ESH/save_medical_examination_form.php
2024-10-23 18:28:06 +05:30

76 lines
7.6 KiB
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
include ('includes/config/config.php');
include ('includes/functions.php');
$medical_exam_id = $_POST ['medical_exam_id'];
include ('log_entry.php');
begin();
if (! empty ( $medical_exam_id )) {
// update case
$initquery = " update medical_examination ";
$endquery = " where medical_exam_id = '".$medical_exam_id. "'";
$data['$medical_exam_id']=$medical_exam_id;
} else {
$initquery = "insert into medical_examination ";
$endquery="";
}
$ime_no = $_POST['ime_no'];
$pme_no = $_POST['pme_no'];
if($_POST['conduction_type'] == 'AIR CONDUCTION'){
$bone_cond_left = NULL;
$bone_cond_right = NULL;
$air_cond_left = $_POST['air_cond_left'];
$air_cond_right = $_POST['air_cond_right'];
}
if($_POST['conduction_type'] == 'BONE CONDUCTION'){
$air_cond_left = NULL;
$air_cond_right = NULL;
$bone_cond_left = $_POST['bone_cond_left'];
$bone_cond_right = $_POST['bone_cond_right'];
}
// if($_SESSION['RoleCode'] == 'LAB'){
// $med_asst = " medical_attend='".$_SESSION['user_id']."',sign_medical_ass='".$_POST['signature_medical_assistant']."',
// }
$query=$initquery." set ime_no = '$ime_no',pme_no = '$pme_no', waist='".strtoupper($_POST['waist'])."',height='".$_POST['height']."',weight='".$_POST['weight']."',hip='".strtoupper($_POST['hip'])."',nails='".strtoupper($_POST['nails'])."',any_other_eye_disease='".strtoupper($_POST['any_other_eye_disease'])."',
bmi='".$_POST['bmi']."',pulse='".strtoupper($_POST['pulse'])."',bp='".strtoupper($_POST['bp'])."',near_with_right_eye='".strtoupper($_POST['near_with_right_eye'])."',hiv='".strtoupper($_POST['hiv'])."',hbsag='".strtoupper($_POST['hbsag'])."',opinion_mo='".strtoupper($_POST['opinion_mo'])."',
near_without_right_eye='".strtoupper($_POST['near_without_right_eye'])."',dis_with_right_eye='".strtoupper($_POST['dis_with_right_eye'])."',abdomen='".strtoupper($_POST['abdomen'])."',fvc='".strtoupper($_POST['fvc'])."',peak_expiratory_flow='".strtoupper($_POST['peak_expiratory_flow'])."', fev1_fvc='".strtoupper($_POST['fev1_fvc'])."',fev1='".strtoupper($_POST['fev1'])."',
dis_without_right_eye='".strtoupper($_POST['dis_without_right_eye'])."',dis_without_left_eye='".strtoupper($_POST['dis_without_left_eye'])."',dis_with_left_eye='".strtoupper($_POST['dis_with_left_eye'])."',dlc_l='".strtoupper($_POST['dlc_l'])."',dlc_m='".strtoupper($_POST['dlc_m'])."',dlc_e='".strtoupper($_POST['dlc_e'])."',
near_without_left_eye='".strtoupper($_POST['near_without_left_eye'])."',near_with_left_eye='".strtoupper($_POST['near_with_left_eye'])."',skin='".strtoupper($_POST['skin'])."',color_vision='".strtoupper($_POST['color_vision'])."',rs='".strtoupper($_POST['rs'])."',
musculo_skeletal='".strtoupper($_POST['musculo_skeletal'])."',cns='".strtoupper($_POST['cns'])."',ent='".strtoupper($_POST['ent'])."',chest_radiograph='".strtoupper($_POST['chest_radiograph'])."',urine_re_me='".strtoupper($_POST['urine_re_me'])."',stool_re_me='".strtoupper($_POST['stool_re_me'])."',conduction_type='".strtoupper($_POST['conduction_type'])."',air_cond_left='$air_cond_left',air_cond_right = '$air_cond_right',bone_cond_right='$bone_cond_right',bone_cond_left='$bone_cond_left',
fev1_fvc_pre='".strtoupper($_POST['fev1_fvc_pre'])."',profusion_opacities='".strtoupper($_POST['profusion_opacities'])."',
fvc_pre='".strtoupper($_POST['fvc_pre'])."' ,fvc_post='".strtoupper($_POST['fvc_post'])."',fev1_pre='".strtoupper($_POST['fev1_pre'])."',fev1_post='".strtoupper($_POST['fev1_post'])."',fev1_fvc_post='".strtoupper($_POST['fev1_fvc_post'])."',blood_group='".strtoupper($_POST['blood_group'])."',
peak_expiratory_flow_pre='".strtoupper($_POST['peak_expiratory_flow_pre'])."',peak_expiratory_flow_post='".strtoupper($_POST['peak_expiratory_flow_post'])."',pallor='".strtoupper($_POST['pallor'])."',cvs='".strtoupper($_POST['cvs'])."',ident_of_individual_colors='".strtoupper($_POST['ident_of_individual_colors'])."',physical_status='".strtoupper($_POST['physical_status'])."',opinion_remarks_medical_assistant='".strtoupper($_POST['opinion_remarks_medical_assistant'])."'
,hb='".strtoupper($_POST['hb'])."',s1='".strtoupper($_POST['s1'])."',s2='".strtoupper($_POST['s2'])."',any_other_sound='".strtoupper($_POST['any_other_sound'])."',ecg_findings='".strtoupper($_POST['ecg_findings'])."',tmt_findings='".strtoupper($_POST['tmt_findings'])."',
blood_sugar='".strtoupper($_POST['blood_sugar'])."',s_creatinine='".strtoupper($_POST['s_creatinine'])."',s_urea='".strtoupper($_POST['s_urea'])."',platelets='".strtoupper($_POST['platelets'])."',dlc_n='".strtoupper($_POST['dlc_n'])."',tlc='".strtoupper($_POST['tlc'])."',vdrl='".strtoupper($_POST['vdrl'])."',
lipid_profile='".strtoupper($_POST['lipid_profile'])."',psa='".strtoupper($_POST['psa'])."',acid_phosphatase='".strtoupper($_POST['acid_phosphatase'])."',uric_acid='".strtoupper($_POST['uric_acid'])."',bun='".strtoupper($_POST['bun'])."',esr='".strtoupper($_POST['esr'])."',speech='".strtoupper($_POST['speech'])."' ,higher_function='".strtoupper($_POST['higher_function'])."', motor_function='".strtoupper($_POST['motor_function'])."', vertigo='".strtoupper($_POST['vertigo'])."', reflexes='".strtoupper($_POST['reflexes'])."', vibration_syndrome='".strtoupper($_POST['vibration_syndrome'])."' ,hernia_details='".strtoupper($_POST['hernia_details'])."', hydrocele='".strtoupper($_POST['hydrocele'])."', phimosis='".strtoupper($_POST['phimosis'])."', piles_details='".strtoupper($_POST['piles_details'])."', fistula='".strtoupper($_POST['fistula'])."', grade='".strtoupper($_POST['grade'])."', type='".strtoupper($_POST['type'])."',
live_function_test='".strtoupper($_POST['live_function_test'])."',thyroid_profile='".strtoupper($_POST['thyroid_profile'])."',dental_exam_report='".strtoupper($_POST['dental_exam_report'])."',mammography='".strtoupper($_POST['mammography'])."',pap_smear='".strtoupper($_POST['pap_smear'])."',any_other='".strtoupper($_POST['any_other'])."',
opinion_remarks='".strtoupper($_POST['opinion_remarks'])."',throat='".strtoupper($_POST['throat'])."',nose='".strtoupper($_POST['nose'])."',eac='".strtoupper($_POST['eac'])."',auroscopy='".strtoupper($_POST['auroscopy'])."',conversational_hearing='".strtoupper($_POST['conversational_hearing'])."',medical_attend='".$_SESSION['user_id']."',sign_medical_ass='".$_POST['signature_medical_assistant']."',sign_medical_officer='".$_POST['sign_medical_officer']."',
liver='".strtoupper($_POST['liver'])."',speen='".strtoupper($_POST['speen'])."',tenderness='".strtoupper($_POST['tenderness'])."',any_other_abnormality='".strtoupper($_POST['any_other_abnormality'])."' ,appearance='".strtoupper($_POST['appearance'])."',pus_cells='".strtoupper($_POST['pus_cells'])."',rbcs='".strtoupper($_POST['rbcs'])."' ,epithelial_cells='".strtoupper($_POST['epithelial_cells'])."',other_relevant_findings='".strtoupper($_POST['other_relevant_findings'])."',albumin='".strtoupper($_POST['albumin'])."',sugar='".strtoupper($_POST['sugar'])."', next_due_date=STR_TO_DATE('" . $_POST ['due_date'] . "','%d/%m/%Y'), approval_date=STR_TO_DATE('" . $_POST ['approval_date'] . "','%d/%m/%Y') ".$endquery;
error_log("queeeeeryyyyyy".$query);
if (! $result = @mysqli_query($conn,$query )) {
error_log("Failed to insert medical examination:: error:".mysqli_error($conn).", query:".$query);
rollback();
exit ( mysqli_error($conn) );
} else {
if (empty ( $medical_exam_id )) {
$medical_exam_id = @mysqli_insert_id ();
}
$data ['status'] = 200;
$data ['message'] = "success";
if (! empty ( $_POST['hiddenHighlighter'] ) ) {
saveHighlightedParams($medical_exam_id , $_POST['hiddenHighlighter'] );
}
error_log($query);
}
$data ['medical_exam_id'] = $medical_exam_id;
echo json_encode ( $data );
commit();
?>