sheets () ); $insert_counter = 0; $update_counter = 0; $fail_counter = 0; $new_emp_counter = 0; for($i = 0; $i < 1; $i ++) { $Reader->ChangeSheet ( $i ); $j = 0; $max_cols = 0; $crntColIndex = 0; foreach ( $Reader as $Row ) { $crntColIndex = 0; // read row first to read table fields if ($j == 0) { $crntColIndex = 0; $nondb_col = 0; while ( isset ( $Row [$crntColIndex] ) && mysqli_real_escape_string($conn,$Row [$crntColIndex] ) != null && trim ( $Row [$crntColIndex] ) != '' ) { $colVal = mysqli_real_escape_string($conn,$Row [$crntColIndex] ); // if ($colVal != 'NA') { $dbColumnNameList [$crntColIndex] = $Row [$crntColIndex]; } else { // if NA for DB col found... then just record it with NA_Prefix to distinguish and discard later $dbColumnNameList [$crntColIndex] = "NA_" + $nondb_col; $nondb_col ++; } $crntColIndex ++; } // end of while -- reading all columns for first row $j ++; $max_cols = $crntColIndex; error_log ( "db_fields_Array:" . $dbColumnNameList ); // print_r($dbColumnNameList); continue; } // end reading first row db fields if ($j < 3) { // ignore for other header rows $j ++; continue; } if ($Row [0] == '') { // if a blank row is encountered stop reading break; } // read data rows - start $emp_code = ""; $task = ""; $patient_name = ""; $designation = ""; $department = ""; $medical_date = ""; $dbColumnValueList = array (); $histParam = array (); $aadhar_no = ""; $asthama = ""; $diabetes = ""; $tb = ""; $epilepsy = ""; $hbd = ""; $psychiatric = ""; $heart_deases = ""; $typhoid = ""; $major_injury = ""; $smoking = ""; $tobacco = ""; $alcohol = ""; $hiv = ""; $fvc = ""; $waist = ""; $height = ""; $weight = ""; $hip = ""; $nails = ""; $bmi = ""; $pulse = ""; $bp = ""; $s1 = ""; $s2 = ""; $any_other_sound = ""; $ecg_findings = ""; $tmt_findings = ""; $near_with_right_eye = ""; $near_without_right_eye = ""; $dis_with_right_eye = ""; $dis_without_right_eye = ""; $dis_without_left_eye = ""; $dis_with_left_eye = ""; $near_without_left_eye = ""; $near_with_left_eye = ""; $skin = ""; $color_vision = ""; $ident_of_individual_colors=""; $rs = ""; $musculo_skeletal = ""; $cns = ""; $ent = ""; $chest_radiograph = ""; $urine_re_me = ""; $stool_re_me = ""; $fvc_pre = ""; $fvc_post = ""; $fev1_pre = ""; $fev1_post = ""; $fev1_fvc_post = ""; $fev1_fvc_pre = ""; $peak_expiratory_flow_pre = ""; $peak_expiratory_flow_post = ""; $air_cond_left = ""; $air_cond_right = ""; $bone_cond_left = ""; $bone_cond_right = ""; $hb = ""; $tlc = ""; $dlc_n = ""; $dlc_l = ""; $dlc_m = ""; $dlc_e = ""; $platelets = ""; $s_urea = ""; $s_creatinine = ""; $blood_sugar = ""; $esr = ""; $bun = ""; $uric_acid = ""; $acid_phosphatase = ""; $psa = ""; $lipid_profile = ""; $profusion_opacitites = ""; $live_function_test = ""; $thyroid_profile = ""; $dental_exam_report = ""; $mammography = ""; $conversational_hearing = ""; $pap_smear = ""; $any_other = ""; $auroscopy = ""; $throat = ""; $nose = ""; $eac = ""; $liver = ""; $speen = ""; $tenderness = ""; $any_other_abnormality = ""; $appearance = ""; $pus_cells = ""; $rbcs = ""; $epithelial_cells = ""; $other_relevant_findings = ""; $albumin = ""; $sugar = ""; $blood_group = ""; $pallor = ""; $cvs = ""; $ident_of_individual_colors = ""; $physical_status = ""; $abdomen = ""; $opinion_remarks_medical_assistant = ""; $opinion_remarks = ""; $vdrl = ""; $speech = ""; $higher_function = ""; $motor_function = ""; $vertigo = ""; $reflexes = ""; $vibration_syndrome = ""; $ppo = ""; $grade = ""; $type = ""; $hydrocele = ""; $phimosis = ""; $piles = ""; $fistula = ""; $hiv = ""; $fvc = ""; $addiction = ""; $father_name = ""; $identi_mark = ""; $marital_status = ""; $no_of_child = ""; $adopting_family_planning = ""; $typhoid_findings = ""; $urine_findings=""; $lft_findings=""; $xray_findings=""; $sputum_findings=""; $health_index=""; $p=""; $cy=""; $cl=""; $e=""; $a=""; $oe=""; $pr=""; $p_abd=""; $ln_v=""; $ln_axis=""; $ln_dcyl=""; $ln_dsph=""; $rn_v=""; $rn_axis=""; $rn_dcyl=""; $rn_dsph=""; $ld_v=""; $ld_axis=""; $ld_dcyl=""; $ld_dsph=""; $rd_v=""; $rd_axis=""; $rd_dcyl=""; $rd_dsph=""; $blood_sugar_ppbs=""; $blood_sugar_fbs=""; $blood_sugar_rbs=""; $blood_sugar_hb1ac=""; $deformities=""; // print_r($histParam); $arrayHistoryParam = array (); $history_list=""; $sql_hist_param = "select param_id, param_name from history_parameter "; $result_hist_param = mysqli_query($conn,$sql_hist_param ); while ( $row_hist_param = mysqli_fetch_assoc ( $result_hist_param ) ) { $arrayHistoryParam[$row_hist_param['param_name']]=$row_hist_param['param_id']; } error_log ( "max value" . $max_cols ); $crntColIndex = 0; while ( $crntColIndex < $max_cols ) { $colVal = trim ( mysqli_real_escape_string($conn,$Row [$crntColIndex] ) ); $dbColumnValueList [$crntColIndex] = $colVal; // store the column value into valuearray // custom logic, validations and calculations -- start if ($dbColumnNameList [$crntColIndex] == 'emp_code') { $emp_code = $colVal; } else if ($dbColumnNameList [$crntColIndex] == 'task') { $task = $colVal; if ($task == 'Annual Examination') { $task = 'ame_greater_40'; } else if ($task == 'Periodic Examination') { $task = 'ame_less_40'; } else if ($task == 'IME Long') { $task = 'ime_long'; } else if ($task == 'PME') { $task = 'pme'; } else if ($task == 'IME Short') { $task = 'ime_short'; } else { $task = 'ime_long'; } if ($task == "" && $task == NULL) { $response_mssages .= "
Medical Examination Type Missing at row: " . + $j; $fail_counter ++; continue; } } else if ($dbColumnNameList [$crntColIndex] == 'patient_id') { $patient_name = $colVal; if ($patient_name == "" && $patient_name == NULL) { $response_mssages .= "
Patient Name Missing at row: " . + $j; $fail_counter ++; continue; } else if ($dbColumnNameList [$crntColIndex] == 'father_name') { $father_name = $colVal; $dbColumnValueList [$crntColIndex] = $father_name; } } else if ($dbColumnNameList [$crntColIndex] == 'designation') { $designation = $colVal; if ($designation == "" && $designation == NULL) { $response_mssages .= "
Designation Name Missing at row: " . + $j; $fail_counter ++; continue; } } else if ($dbColumnNameList [$crntColIndex] == 'department') { $department = $colVal; if ($department == NULL) { $response_mssages .= "
Department Name Missing at row: " . + $j; $fail_counter ++; continue; } } else if ($dbColumnNameList [$crntColIndex] == 'medical_entry_date') { $medical_date = $colVal; } else if ($dbColumnNameList [$crntColIndex] == 'aadhar_no') { $aadhar_no = $colVal; if ($aadhar_no == "" && $aadhar_no == NULL && minlength == "12" && maxlength == "12") { $response_mssages .= "
Aadhar No Missing at row: " . + $j; $fail_counter ++; continue; } } else if ($dbColumnNameList [$crntColIndex] == 'asthama') { $asthama = $colVal; if (strtolower ( $asthama ) == 'yes') { array_push ( $histParam, "asthama" ); $asthama = 1; $history_list.=$arrayHistoryParam['ASTHMA'].","; } else $asthama = 0; $dbColumnValueList [$crntColIndex] = $asthama; } else if ($dbColumnNameList [$crntColIndex] == 'diabetes') { $diabetes = $colVal; if (strtolower ( $diabetes ) == 'yes'){ $diabetes = 1; $history_list.=$arrayHistoryParam['DIABETES'].","; } else $diabetes = 0; $dbColumnValueList [$crntColIndex] = $diabetes; } else if ($dbColumnNameList [$crntColIndex] == 'tb') { $tb = $colVal; if (strtolower ( $tb ) == 'yes'){ $tb = 1; $history_list.=$arrayHistoryParam['T.B'].","; } else $tb = 0; $dbColumnValueList [$crntColIndex] = $tb; } else if ($dbColumnNameList [$crntColIndex] == 'hbd') { $hbd = $colVal; if (strtolower ( $hbd ) == 'yes'){ $hbd = 1; $history_list.=$arrayHistoryParam['HIGH BLOOD PRESSURE'].","; } else $hbd = 0; $dbColumnValueList [$crntColIndex] = $hbd; } else if ($dbColumnNameList [$crntColIndex] == 'epilepsy') { $epilepsy = $colVal; if (strtolower ( $epilepsy ) == 'yes'){ $epilepsy = 1; $history_list.=$arrayHistoryParam['EPILEPSY'].","; } else $epilepsy = 0; $dbColumnValueList [$crntColIndex] = $epilepsy; } else if ($dbColumnNameList [$crntColIndex] == 'psychiatric') { $psychiatric = $colVal; if (strtolower ( $psychiatric ) == 'yes'){ $psychiatric = 1; $history_list.=$arrayHistoryParam['PSYCHIATRIC ILLNESS'].","; } else $psychiatric = 0; $dbColumnValueList [$crntColIndex] = $psychiatric; } else if ($dbColumnNameList [$crntColIndex] == 'heart_dis') { $heart_deases = $colVal; if (strtolower ( $heart_deases ) == 'yes'){ $heart_deases = 1; $history_list.=$arrayHistoryParam['HEART DISEASE'].","; } else $heart_deases = 0; $dbColumnValueList [$crntColIndex] = $heart_deases; } else if ($dbColumnNameList [$crntColIndex] == 'piles') { $piels = $colVal; if (strtolower ( $piels ) == 'yes'){ $piels = 1; $history_list.=$arrayHistoryParam['PILES/ FISTULA'].","; } else $piels = 0; $dbColumnValueList [$crntColIndex] = $piels; } else if ($dbColumnNameList [$crntColIndex] == 'typhoid ') { $typhoid = $colVal; if (strtolower ( $typhoid ) == 'yes'){ $typhoid = 1; $history_list.=$arrayHistoryParam['TYPHOID'].","; } else $typhoid = 0; $dbColumnValueList [$crntColIndex] = $typhoid; } else if ($dbColumnNameList [$crntColIndex] == 'major_injury') { $major_injury = $colVal; if (strtolower ( $major_injury ) == 'yes'){ $major_injury = 1; $history_list.=$arrayHistoryParam['MAJOR INJURY/FRACTURE/ OPERATION'].","; } else $major_injury = 0; $dbColumnValueList [$crntColIndex] = $major_injury; } else if ($dbColumnNameList [$crntColIndex] == 'smoking') { $smoking = $colVal; if (strtolower ( $smoking ) == 'yes') { $smoking = 1; $addiction = $addiction . "SMOKING"; $history_list.=$arrayHistoryParam['SMOKING'].","; } else $smoking = 0; $dbColumnValueList [$crntColIndex] = $smoking; } else if ($dbColumnNameList [$crntColIndex] == 'tobacco') { $tobacco = $colVal; if (strtolower ( $tobacco ) == 'yes') { $tobacco = 1; if ($addiction != "") { $addiction = $addiction . ",TOBACCO"; } else { $addiction = $addiction . "TOBACCO"; } $history_list.=$arrayHistoryParam['TOBACCO'].","; } else $tobacco = 0; $dbColumnValueList [$crntColIndex] = $tobacco; } else if ($dbColumnNameList [$crntColIndex] == 'alcohol') { $alcohol = $colVal; if (strtolower ( $alcohol ) == 'yes') { $alcohol = 1; if ($addiction != "") { $addiction = $addiction . ",ALCOHOL"; } else { $addiction = $addiction . "ALCOHOL"; } $history_list.=$arrayHistoryParam['ALCOHOL'].","; } else $alcohol = 0; $dbColumnValueList [$crntColIndex] = $alcohol; } else if ($dbColumnNameList [$crntColIndex] == 'dob') { $dob = $colVal; $dbColumnValueList [$crntColIndex] = $dob; } else if ($dbColumnNameList [$crntColIndex] == 'age') { $age = $colVal; error_log ( "dob:" . $dob ); error_log ( "age:" . $age ); if ($dob == '') { $dob = getCalculatedDOBFromAge ( $age ); // $dob=$dob->format('d-m-Y'); error_log ( "calculated dob:" . $dob ); } $dbColumnValueList [$crntColIndex] = $age; } else if ($dbColumnNameList [$crntColIndex] == 'gender') { $gender = $colVal; $dbColumnValueList [$crntColIndex] = $gender; } else if ($dbColumnNameList [$crntColIndex] == 'height') { $height = $colVal; $dbColumnValueList [$crntColIndex] = $height; } else if ($dbColumnNameList [$crntColIndex] == 'weight') { $weight = $colVal; $dbColumnValueList [$crntColIndex] = $weight; } else if ($dbColumnNameList [$crntColIndex] == 'pulse') { $pulse = $colVal; $dbColumnValueList [$crntColIndex] = $pulse; } else if ($dbColumnNameList [$crntColIndex] == 'bp') { $bp = $colVal; $dbColumnValueList [$crntColIndex] = $bp; } else if ($dbColumnNameList [$crntColIndex] == 'nails') { $nails = $colVal; $dbColumnValueList [$crntColIndex] = $nails; error_log ( "naileddddddddd" . $nails ); error_log ( "nailllllled" . $dbColumnValueList [$crntColIndex] ); } else if ($dbColumnNameList [$crntColIndex] == 'bmi') { $bmi = $colVal; $dbColumnValueList [$crntColIndex] = $bmi; } else if ($dbColumnNameList [$crntColIndex] == 'waist') { $waist = $colVal; $dbColumnValueList [$crntColIndex] = $waist; } else if ($dbColumnNameList [$crntColIndex] == 'hip') { $hip = $colVal; $dbColumnValueList [$crntColIndex] = $hip; } else if ($dbColumnNameList [$crntColIndex] == 'sgpt') { $sgpt = $colVal; $dbColumnValueList [$crntColIndex] = $sgpt; } else if ($dbColumnNameList [$crntColIndex] == 'status') { $status = $colVal; $dbColumnValueList [$crntColIndex] = $status; } else if ($dbColumnNameList [$crntColIndex] == 'SpO2') { $SpO2 = $colVal; $dbColumnValueList [$crntColIndex] = $SpO2; } else if ($dbColumnNameList [$crntColIndex] == 'dlc_b') { $dlc_b = $colVal; $dbColumnValueList [$crntColIndex] = $dlc_b; } else if ($dbColumnNameList [$crntColIndex] == 's1') { $s1 = $colVal; $dbColumnValueList [$crntColIndex] = $s1; } else if ($dbColumnNameList [$crntColIndex] == 's2') { $s2 = $colVal; $dbColumnValueList [$crntColIndex] = $s2; } else if ($dbColumnNameList [$crntColIndex] == 'any_other_sound') { $any_other_sound = $colVal; $dbColumnValueList [$crntColIndex] = $any_other_sound; } else if ($dbColumnNameList [$crntColIndex] == 'ecg_findings') { $ecg_findings = $colVal; $dbColumnValueList [$crntColIndex] = $ecg_findings; } else if ($dbColumnNameList [$crntColIndex] == 'tmt_findings') { $tmt_findings = $colVal; $dbColumnValueList [$crntColIndex] = $tmt_findings; } else if ($dbColumnNameList [$crntColIndex] == 'near_without_right_eye') { $near_without_right_eye = $colVal; $dbColumnValueList [$crntColIndex] = $near_without_right_eye; } else if ($dbColumnNameList [$crntColIndex] == 'dis_without_right_eye') { $dis_without_right_eye = $colVal; $dbColumnValueList [$crntColIndex] = $dis_without_right_eye; } else if ($dbColumnNameList [$crntColIndex] == 'dis_without_left_eye') { $dis_without_left_eye = $colVal; $dbColumnValueList [$crntColIndex] = $dis_without_left_eye; } else if ($dbColumnNameList [$crntColIndex] == 'near_without_left_eye') { $near_without_left_eye = $colVal; $dbColumnValueList [$crntColIndex] = $near_without_left_eye; } else if ($dbColumnNameList [$crntColIndex] == 'near_with_right_eye') { $near_with_right_eye = $colVal; $dbColumnValueList [$crntColIndex] = $near_with_right_eye; } else if ($dbColumnNameList [$crntColIndex] == 'dis_with_right_eye') { $dis_with_right_eye = $colVal; $dbColumnValueList [$crntColIndex] = $dis_with_right_eye; } else if ($dbColumnNameList [$crntColIndex] == 'dis_with_left_eye') { $dis_with_left_eye = $colVal; $dbColumnValueList [$crntColIndex] = $dis_with_left_eye; } else if ($dbColumnNameList [$crntColIndex] == 'near_with_left_eye') { $near_with_left_eye = $colVal; $dbColumnValueList [$crntColIndex] = $near_with_left_eye; } else if ($dbColumnNameList [$crntColIndex] == 'skin') { $skin = $colVal; $dbColumnValueList [$crntColIndex] = $skin; } else if ($dbColumnNameList [$crntColIndex] == 'color_vision') { $color_vision = $colVal; $dbColumnValueList [$crntColIndex] = $color_vision; } else if ($dbColumnNameList [$crntColIndex] == 'ident_of_individual_colors') { $ident_of_individual_colors = $colVal; $dbColumnValueList [$crntColIndex] = $ident_of_individual_colors; } else if ($dbColumnNameList [$crntColIndex] == 'rs') { $rs = $colVal; $dbColumnValueList [$crntColIndex] = $rs; } else if ($dbColumnNameList [$crntColIndex] == 'musculo_skeletal') { $musculo_skeletal = $colVal; $dbColumnValueList [$crntColIndex] = $musculo_skeletal; } else if ($dbColumnNameList [$crntColIndex] == 'chest_radiograph') { $chest_radiograph = $colVal; $dbColumnValueList [$crntColIndex] = $chest_radiograph; } else if ($dbColumnNameList [$crntColIndex] == 'stool_re_me') { $stool_re_me = $colVal; $dbColumnValueList [$crntColIndex] = $stool_re_me; } else if ($dbColumnNameList [$crntColIndex] == 'cns') { $cns = $colVal; $dbColumnValueList [$crntColIndex] = $cns; } else if ($dbColumnNameList [$crntColIndex] == 'fvc_pre') { $fvc_pre = $colVal; $dbColumnValueList [$crntColIndex] = $fvc_pre; } else if ($dbColumnNameList [$crntColIndex] == 'fvc_post') { $fvc_post = $colVal; $dbColumnValueList [$crntColIndex] = $fvc_post; } else if ($dbColumnNameList [$crntColIndex] == 'fev1_pre') { $fev1_pre = $colVal; $dbColumnValueList [$crntColIndex] = $fev1_pre; } else if ($dbColumnNameList [$crntColIndex] == 'fev1_post') { $fev1_post = $colVal; $dbColumnValueList [$crntColIndex] = $fev1_post; } else if ($dbColumnNameList [$crntColIndex] == 'fev1_fvc_post') { $fev1_fvc_post = $colVal; $dbColumnValueList [$crntColIndex] = $fev1_fvc_post; } else if ($dbColumnNameList [$crntColIndex] == 'peak_expiratory_flow_pre') { $peak_expiratory_flow_pre = $colVal; $dbColumnValueList [$crntColIndex] = $peak_expiratory_flow_pre; } else if ($dbColumnNameList [$crntColIndex] == 'fev1_fvc_pre') { $fev1_fvc_pre = $colVal; $dbColumnValueList [$crntColIndex] = $fev1_fvc_pre; } else if ($dbColumnNameList [$crntColIndex] == 'peak_expiratory_flow_post') { $peak_expiratory_flow_post = $colVal; $dbColumnValueList [$crntColIndex] = $peak_expiratory_flow_post; } else if ($dbColumnNameList [$crntColIndex] == 'air_cond_left') { $air_cond_left = $colVal; $dbColumnValueList [$crntColIndex] = $air_cond_left; } else if ($dbColumnNameList [$crntColIndex] == 'air_cond_right') { $air_cond_right = $colVal; $dbColumnValueList [$crntColIndex] = $air_cond_right; } else if ($dbColumnNameList [$crntColIndex] == 'bone_cond_left') { $bone_cond_left = $colVal; $dbColumnValueList [$crntColIndex] = $bone_cond_left; } else if ($dbColumnNameList [$crntColIndex] == 'bone_cond_right') { $bone_cond_right = $colVal; $dbColumnValueList [$crntColIndex] = $bone_cond_right; } else if ($dbColumnNameList [$crntColIndex] == 'hb') { $hb = $colVal; $dbColumnValueList [$crntColIndex] = $hb; } else if ($dbColumnNameList [$crntColIndex] == 'tlc') { $tlc = $colVal; $dbColumnValueList [$crntColIndex] = $tlc; } else if ($dbColumnNameList [$crntColIndex] == 'vdrl') { $vdrl = $colVal; $dbColumnValueList [$crntColIndex] = $vdrl; } else if ($dbColumnNameList [$crntColIndex] == 'dlc_n') { $dlc_n = $colVal; $dbColumnValueList [$crntColIndex] = $dlc_n; } else if ($dbColumnNameList [$crntColIndex] == 'dlc_l') { $dlc_l = $colVal; $dbColumnValueList [$crntColIndex] = $dlc_l; } else if ($dbColumnNameList [$crntColIndex] == 'dlc_m') { $dlc_m = $colVal; $dbColumnValueList [$crntColIndex] = $dlc_m; } else if ($dbColumnNameList [$crntColIndex] == 'dlc_e') { $dlc_e = $colVal; $dbColumnValueList [$crntColIndex] = $dlc_e; } else if ($dbColumnNameList [$crntColIndex] == 'platelets') { $platelets = $colVal; $dbColumnValueList [$crntColIndex] = $platelets; } else if ($dbColumnNameList [$crntColIndex] == 's_urea') { $s_urea = $colVal; $dbColumnValueList [$crntColIndex] = $s_urea; } else if ($dbColumnNameList [$crntColIndex] == 's_creatinine') { $s_creatinine = $colVal; $dbColumnValueList [$crntColIndex] = $s_creatinine; } else if ($dbColumnNameList [$crntColIndex] == 's_cholesterol') { $s_cholesterol = $colVal; $dbColumnValueList [$crntColIndex] = $s_cholesterol; } else if ($dbColumnNameList [$crntColIndex] == 'blood_gluose') { $blood_gluose = $colVal; $dbColumnValueList [$crntColIndex] = $blood_gluose; } else if ($dbColumnNameList [$crntColIndex] == 'esr') { $esr = $colVal; $dbColumnValueList [$crntColIndex] = $esr; } else if ($dbColumnNameList [$crntColIndex] == 'bun') { $bun = $colVal; $dbColumnValueList [$crntColIndex] = $bun; } else if ($dbColumnNameList [$crntColIndex] == 'lipid_profile') { $lipid_profile = $colVal; $dbColumnValueList [$crntColIndex] = $lipid_profile; } else if ($dbColumnNameList [$crntColIndex] == 'profusion_opacities') { $profusion_opacitites = $colVal; $dbColumnValueList [$crntColIndex] = $profusion_opacitites; } else if ($dbColumnNameList [$crntColIndex] == 'blood_group') { $blood_group = $colVal; $dbColumnValueList [$crntColIndex] = $blood_group; error_log ( "blooooooood" . $blood_group ); error_log ( "bloooooooodyyyyyy" . $dbColumnValueList [$crntColIndex] ); } else if ($dbColumnNameList [$crntColIndex] == 'hiv') { $hiv = $colVal; $dbColumnValueList [$crntColIndex] = $hiv; } else if ($dbColumnNameList [$crntColIndex] == 'psa') { $psa = $colVal; $dbColumnValueList [$crntColIndex] = $psa; } else if ($dbColumnNameList [$crntColIndex] == 'acid_phosphatase') { $acid_phosphatase = $colVal; $dbColumnValueList [$crntColIndex] = $acid_phosphatase; } else if ($dbColumnNameList [$crntColIndex] == 'uric_acid') { $uric_acid = $colVal; $dbColumnValueList [$crntColIndex] = $uric_acid; } else if ($dbColumnNameList [$crntColIndex] == 'live_function_test') { $live_function_test = $colVal; $dbColumnValueList [$crntColIndex] = $live_function_test; } else if ($dbColumnNameList [$crntColIndex] == 'blood_gluose') { $blood_gluose = $colVal; $dbColumnValueList [$crntColIndex] = $blood_gluose; } else if ($dbColumnNameList [$crntColIndex] == 'dental_exam_report') { $dental_exam_report = $colVal; $dbColumnValueList [$crntColIndex] = $dental_exam_report; } else if ($dbColumnNameList [$crntColIndex] == 'mammography') { $mammography = $colVal; $dbColumnValueList [$crntColIndex] = $mammography; } else if ($dbColumnNameList [$crntColIndex] == 'thyroid_profile') { $thyroid_profile = $colVal; $dbColumnValueList [$crntColIndex] = $thyroid_profile; } else if ($dbColumnNameList [$crntColIndex] == 'pap_smear') { $pap_smear = $colVal; $dbColumnValueList [$crntColIndex] = $pap_smear; } else if ($dbColumnNameList [$crntColIndex] == 'any_other') { $any_other = $colVal; $dbColumnValueList [$crntColIndex] = $any_other; } else if ($dbColumnNameList [$crntColIndex] == 'conversational_hearing') { $conversational_hearing = $colVal; $dbColumnValueList [$crntColIndex] = $conversational_hearing; } else if ($dbColumnNameList [$crntColIndex] == 'auroscopy') { $auroscopy = $colVal; $dbColumnValueList [$crntColIndex] = $auroscopy; } else if ($dbColumnNameList [$crntColIndex] == 'throat') { $throat = $colVal; $dbColumnValueList [$crntColIndex] = $throat; } else if ($dbColumnNameList [$crntColIndex] == 'nose') { $nose = $colVal; $dbColumnValueList [$crntColIndex] = $nose; } else if ($dbColumnNameList [$crntColIndex] == 'heart_sound') { $heart_sound = $colVal; $dbColumnValueList [$crntColIndex] = $heart_sound; } else if ($dbColumnNameList [$crntColIndex] == 'eac') { $eac = $colVal; $dbColumnValueList [$crntColIndex] = $eac; } else if ($dbColumnNameList [$crntColIndex] == 'speen') { $speen = $colVal; $dbColumnValueList [$crntColIndex] = $speen; } else if ($dbColumnNameList [$crntColIndex] == 'tenderness') { $tenderness = $colVal; $dbColumnValueList [$crntColIndex] = $tenderness; } else if ($dbColumnNameList [$crntColIndex] == 'liver') { $liver = $colVal; $dbColumnValueList [$crntColIndex] = $liver; } else if ($dbColumnNameList [$crntColIndex] == 'any_other_abnormality') { $any_other_abnormality = $colVal; $dbColumnValueList [$crntColIndex] = $any_other_abnormality; } else if ($dbColumnNameList [$crntColIndex] == 'appearance') { $appearance = $colVal; $dbColumnValueList [$crntColIndex] = $appearance; } else if ($dbColumnNameList [$crntColIndex] == 'pus_cells') { $pus_cells = $colVal; $dbColumnValueList [$crntColIndex] = $pus_cells; } else if ($dbColumnNameList [$crntColIndex] == 'rbcs') { $rbcs = $colVal; $dbColumnValueList [$crntColIndex] = $rbcs; } else if ($dbColumnNameList [$crntColIndex] == 'epithelial_cells') { $epithelial_cells = $colVal; $dbColumnValueList [$crntColIndex] = $epithelial_cells; } else if ($dbColumnNameList [$crntColIndex] == 'other_relevant_findings') { $other_relevant_findings = $colVal; $dbColumnValueList [$crntColIndex] = $other_relevant_findings; } else if ($dbColumnNameList [$crntColIndex] == 'albumin') { $albumin = $colVal; $dbColumnValueList [$crntColIndex] = $albumin; } else if ($dbColumnNameList [$crntColIndex] == 'sugar') { $sugar = $colVal; $dbColumnValueList [$crntColIndex] = $sugar; } // else if ($dbColumnNameList [$crntColIndex] == 'blood_sugar') { // $blood_sugar = $colVal; // $dbColumnValueList [$crntColIndex] = $blood_sugar; // } else if ($dbColumnNameList [$crntColIndex] == 'ident_of_individual_colors') { $ident_of_individual_colors = $colVal; $dbColumnValueList [$crntColIndex] = $ident_of_individual_colors; } else if ($dbColumnNameList [$crntColIndex] == 'physical_status') { $physical_status = $colVal; $dbColumnValueList [$crntColIndex] = $physical_status; } else if ($dbColumnNameList [$crntColIndex] == 'opinion_remarks_medical_assistant') { $opinion_remarks_medical_assistant = $colVal; $dbColumnValueList [$crntColIndex] = $opinion_remarks_medical_assistant; } else if ($dbColumnNameList [$crntColIndex] == 'opinion_remarks') { $opinion_remarks = $colVal; $dbColumnValueList [$crntColIndex] = $opinion_remarks; } else if ($dbColumnNameList [$crntColIndex] == 'speech') { $speech = $colVal; $dbColumnValueList [$crntColIndex] = $speech; } else if ($dbColumnNameList [$crntColIndex] == 'higher_function') { $higher_function = $colVal; $dbColumnValueList [$crntColIndex] = $higher_function; } else if ($dbColumnNameList [$crntColIndex] == 'motor_function') { $motor_function = $colVal; $dbColumnValueList [$crntColIndex] = $motor_function; } else if ($dbColumnNameList [$crntColIndex] == 'vertigo') { $vertigo = $colVal; $dbColumnValueList [$crntColIndex] = $vertigo; } else if ($dbColumnNameList [$crntColIndex] == 'reflexes') { $reflexes = $colVal; $dbColumnValueList [$crntColIndex] = $reflexes; } else if ($dbColumnNameList [$crntColIndex] == 'vibration_syndrome') { $vibration_syndrome = $colVal; $dbColumnValueList [$crntColIndex] = $vibration_syndrome; } else if ($dbColumnNameList [$crntColIndex] == 'ppo') { $ppo = $colVal; $dbColumnValueList [$crntColIndex] = $ppo; } else if ($dbColumnNameList [$crntColIndex] == 'grade') { $grade = $colVal; $dbColumnValueList [$crntColIndex] = $grade; } else if ($dbColumnNameList [$crntColIndex] == 'type') { $type = $colVal; $dbColumnValueList [$crntColIndex] = $type; } else if ($dbColumnNameList [$crntColIndex] == 'any_other_eye_disease') { $any_other_eye_disease = $colVal; $dbColumnValueList [$crntColIndex] = $any_other_eye_disease; } else if ($dbColumnNameList [$crntColIndex] == 'hernia') { $hernia = $colVal; $dbColumnValueList [$crntColIndex] = $hernia; error_log ( "herniaaaaaa" . $hernia ); error_log ( "herniaaaaa" . $dbColumnValueList [$crntColIndex] ); } else if ($dbColumnNameList [$crntColIndex] == 'hydrocele') { $hydrocele = $colVal; $dbColumnValueList [$crntColIndex] = $hydrocele; } else if ($dbColumnNameList [$crntColIndex] == 'phimosis') { $phimosis = $colVal; $dbColumnValueList [$crntColIndex] = $phimosis; } else if ($dbColumnNameList [$crntColIndex] == 'piles') { $piles = $colVal; $dbColumnValueList [$crntColIndex] = $piles; } else if ($dbColumnNameList [$crntColIndex] == 'fistula') { $fistula = $colVal; $dbColumnValueList [$crntColIndex] = $fistula; } else if ($dbColumnNameList [$crntColIndex] == 'gate') { $gate = $colVal; $dbColumnValueList [$crntColIndex] = $gate; } else if ($dbColumnNameList [$crntColIndex] == 'hair') { $hair = $colVal; $dbColumnValueList [$crntColIndex] = $hair; } else if ($dbColumnNameList [$crntColIndex] == 'lung_exam') { $lung_exam = $colVal; $dbColumnValueList [$crntColIndex] = $lung_exam; } else if ($dbColumnNameList [$crntColIndex] == 'dr_emp_code') { $dr_emp_code = $colVal; $dbColumnValueList [$crntColIndex] = $dr_emp_code; } else if ($dbColumnNameList [$crntColIndex] == 'spectable') { $spectable = $colVal; $dbColumnValueList [$crntColIndex] = $spectable; } else if ($dbColumnNameList [$crntColIndex] == 'primary_phone') { $primary_phone = $colVal; $dbColumnValueList [$crntColIndex] = $primary_phone; } else if ($dbColumnNameList [$crntColIndex] == 'identificaton_mark') { $identi_mark = $colVal; $dbColumnValueList [$crntColIndex] = $identi_mark; } else if ($dbColumnNameList [$crntColIndex] == 'marital') { $marital_status = $colVal; $dbColumnValueList [$crntColIndex] = $marital_status; } else if ($dbColumnNameList [$crntColIndex] == 'no_of_children') { $no_of_child = $colVal; $dbColumnValueList [$crntColIndex] = $no_of_child; } else if ($dbColumnNameList [$crntColIndex] == 'family_planning') { $adopting_family_planning = $colVal; $dbColumnValueList [$crntColIndex] = $adopting_family_planning; } else if ($dbColumnNameList [$crntColIndex] == 'past_present_illness') { $past_present_illness = $colVal; $dbColumnValueList [$crntColIndex] = $past_present_illness; } else if ($dbColumnNameList [$crntColIndex] == 'typhoid_findings') { $typhoid_findings = $colVal; $dbColumnValueList [$crntColIndex] = $typhoid_findings; } else if ($dbColumnNameList [$crntColIndex] == 'urine_findings') { $urine_findings = $colVal; $dbColumnValueList [$crntColIndex] = $urine_findings; } else if ($dbColumnNameList [$crntColIndex] == 'lft_findings') { $lft_findings = $colVal; $dbColumnValueList [$crntColIndex] = $lft_findings; } else if ($dbColumnNameList [$crntColIndex] == 'xray_findings') { $xray_findings = $colVal; $dbColumnValueList [$crntColIndex] = $xray_findings; } else if ($dbColumnNameList [$crntColIndex] == 'sputum_findings') { $sputum_findings = $colVal; $dbColumnValueList [$crntColIndex] = $sputum_findings; } else if ($dbColumnNameList [$crntColIndex] == 'health_index') { $health_index = $colVal; $dbColumnValueList [$crntColIndex] = $health_index; }else if ($dbColumnNameList [$crntColIndex] == 'p') { $p = $colVal; $dbColumnValueList [$crntColIndex] = $p; } else if ($dbColumnNameList [$crntColIndex] == 'cy') { $cy = $colVal; $dbColumnValueList [$crntColIndex] = $cy; } else if ($dbColumnNameList [$crntColIndex] == 'cl') { $cl = $colVal; $dbColumnValueList [$crntColIndex] = $cl; } else if ($dbColumnNameList [$crntColIndex] == 'e') { $e = $colVal; $dbColumnValueList [$crntColIndex] = $e; } else if ($dbColumnNameList [$crntColIndex] == 'a') { $a = $colVal; $dbColumnValueList [$crntColIndex] = $a; } else if ($dbColumnNameList [$crntColIndex] == 'oe') { $oe = $colVal; $dbColumnValueList [$crntColIndex] = $oe; } else if ($dbColumnNameList [$crntColIndex] == 'pr') { $pr = $colVal; $dbColumnValueList [$crntColIndex] = $pr; } else if ($dbColumnNameList [$crntColIndex] == 'p_abd') { $p_abd = $colVal; $dbColumnValueList [$crntColIndex] = $p_abd; } else if ($dbColumnNameList [$crntColIndex] == 'ln_v') { $ln_v = $colVal; $dbColumnValueList [$crntColIndex] = $ln_v; } else if ($dbColumnNameList [$crntColIndex] == 'ln_axis') { $ln_axis = $colVal; $dbColumnValueList [$crntColIndex] = $ln_axis; } else if ($dbColumnNameList [$crntColIndex] == 'ln_dcyl') { $ln_dcyl = $colVal; $dbColumnValueList [$crntColIndex] = $ln_dcyl; } else if ($dbColumnNameList [$crntColIndex] == 'ln_dsph') { $ln_dsph = $colVal; $dbColumnValueList [$crntColIndex] = $ln_dsph; } else if ($dbColumnNameList [$crntColIndex] == 'rn_v') { $rn_v = $colVal; $dbColumnValueList [$crntColIndex] = $rn_v; }else if ($dbColumnNameList [$crntColIndex] == 'rn_axis') { $rn_axis = $colVal; $dbColumnValueList [$crntColIndex] = $rn_axis; } else if ($dbColumnNameList [$crntColIndex] == 'rn_dcyl') { $rn_dcyl = $colVal; $dbColumnValueList [$crntColIndex] = $rn_dcyl; } else if ($dbColumnNameList [$crntColIndex] == 'rn_dsph') { $rn_dsph = $colVal; $dbColumnValueList [$crntColIndex] = $rn_dsph; } else if ($dbColumnNameList [$crntColIndex] == 'ld_v') { $ld_v = $colVal; $dbColumnValueList [$crntColIndex] = $ld_v; } else if ($dbColumnNameList [$crntColIndex] == 'ld_axis') { $ld_axis = $colVal; $dbColumnValueList [$crntColIndex] = $ld_axis; } else if ($dbColumnNameList [$crntColIndex] == 'ld_dcyl') { $ld_dcyl = $colVal; $dbColumnValueList [$crntColIndex] = $ld_dcyl; } else if ($dbColumnNameList [$crntColIndex] == 'ld_dsph') { $ld_dsph = $colVal; $dbColumnValueList [$crntColIndex] = $ld_dsph; } else if ($dbColumnNameList [$crntColIndex] == 'rd_v') { $rd_v = $colVal; $dbColumnValueList [$crntColIndex] = $rd_v; } else if ($dbColumnNameList [$crntColIndex] == 'rd_axis') { $rd_axis = $colVal; $dbColumnValueList [$crntColIndex] = $rd_axis; } else if ($dbColumnNameList [$crntColIndex] == 'rd_dcyl') { $rd_dcyl = $colVal; $dbColumnValueList [$crntColIndex] = $rd_dcyl; } else if ($dbColumnNameList [$crntColIndex] == 'rd_dsph') { $rd_dsph = $colVal; $dbColumnValueList [$crntColIndex] = $rd_dsph; } else if ($dbColumnNameList [$crntColIndex] == 'blood_sugar_ppbs') { $blood_sugar_ppbs = $colVal; $dbColumnValueList [$crntColIndex] = $blood_sugar_ppbs; } else if ($dbColumnNameList [$crntColIndex] == 'blood_sugar_fbs') { $blood_sugar_fbs = $colVal; $dbColumnValueList [$crntColIndex] = $blood_sugar_fbs; } else if ($dbColumnNameList [$crntColIndex] == 'blood_sugar_rbs') { $blood_sugar_rbs = $colVal; $dbColumnValueList [$crntColIndex] = $blood_sugar_rbs; } else if ($dbColumnNameList [$crntColIndex] == 'blood_sugar_hb1ac') { $blood_sugar_hb1ac = $colVal; $dbColumnValueList [$crntColIndex] = $blood_sugar_hb1ac; } else if ($dbColumnNameList [$crntColIndex] == 'deformities') { $deformities = $colVal; $dbColumnValueList [$crntColIndex] = $deformities; } // custom logic, validations and calculations -- End $crntColIndex ++; // continue reading next column value } // end of while -- reading data rows- end $id = ""; print_r ( $histParam [0] ); $paramId = getCommaSeperatedValuesForInClause ( "select param_id from history_parameter", "param_name", $histParam ); error_log ( "param id:::::" . $paramId ); if (! empty ( $emp_code )) { $id = getTableFieldValue ( 'patient_master', 'id', 'aadhar_no', "'" . $aadhar_no . "'" ); // $aadhar_no = getTableFieldValue ( 'patient_master', 'aadhar_no', 'emp_code', "'" .$emp_code . "'" ); $dept_id = getTableFieldValue ( 'department', 'dept_id', 'dept_name', "'" . $department . "'" ); if ($dept_id == null or $dept_id == "") { mysqli_query($conn,"insert into department set dept_name='" . $department . "'" ); $dept_id = getTableFieldValue ( 'department', 'dept_id', 'dept_name', "'" . $department . "'" ); } $designation_id = getTableFieldValue ( 'designation', 'designation_id', 'designation_name', "'" . $designation . "'" ); if ($designation_id == null or $designation_id == "") { mysqli_query($conn,"insert into designation set designation_name='" . $designation . "'" ); $designation_id = getTableFieldValue ( 'designation', 'designation_id', 'designation_name', "'" . $designation . "'" ); } $initquery = ""; $endquery = ""; if (isset ( $id )) { $initquery = "update patient_master set "; $endquery = " where aadhar_no = '" . $aadhar_no . "' "; } else { $initquery = "insert into patient_master set "; $endquery = ""; $new_emp_counter ++; } $query_patient = $initquery . " dob=STR_TO_DATE('" . $dob . "','%d-%m-%Y'),primary_phone ='" . $primary_phone . "',emp_code='" . $emp_code . "',patient_name='" . $patient_name . "',father_name='" . $father_name . "',blood_group='" . $blood_group . "',gender='" . $gender . "',dept_id='" . $dept_id . "',designation_id='" . $designation_id . "',aadhar_no='" . $aadhar_no . "'" . $endquery; // error_log($query_patient); // $result = @mysqli_query($conn,$query_patient); // error_log ("upload medical data".$query_patient); // echo $query_patient; if (! $result = @mysqli_query($conn,$query_patient )) { error_log ( "Exception:" . mysqli_error($conn) ); error_log ( "Failed to Execute Patient Insert/Update Query::: " . $query_patient ); // $response_array['responseText']=mysqli_error($conn); rollback (); exit ( mysqli_error($conn) ); } if ($result) { $response_array ['status'] = 'success'; } else { $response_array ['status'] = 'error'; } } // $blood_group = getTableFieldValue('blood_group', 'id', 'type', "'" . $blood_group . "'"); $id = getTableFieldValue ( 'patient_master', 'id', 'emp_code', "'" . $emp_code . "'" ); error_log ( $id ); $medical_update = "SELECT count(*) count FROM medical_examination where task='" . $task . "' and patient_id='" . $id . "' and medical_entry_date=STR_TO_DATE('" . $medical_date . "','%d-%m-%Y')"; error_log ( "query for medical" . $medical_update ); $result_medical_count = mysqli_query($conn,$medical_update ); $count = 0; if ($row_medical_count = mysqli_fetch_array ( $result_medical_count )) { $count = $row_medical_count ['count']; // echo $count; } // $ailment_array = explode ( ',', $row_medical_count ); error_log ( $count ); if ($count > 0) { $initquery = "update medical_examination set "; $endquery = " where patient_id = '" . $id . "' "; $update_counter ++; } else { $initquery = "insert into medical_examination set "; $endquery = ""; $insert_counter ++; } if ($height != null && $height != '' && $weight != null && $weight != '') { if ($height != 0.0) $bmi = ($weight / ($height / 100 * $height / 100)); } $medical_query = $initquery . " patient_id='" . $id . "',gate='" . $gate . "',hair='" . $hair . "',lung_exam='" . $lung_exam . "',dr_emp_code='" . $dr_emp_code . "',spectable='" . $spectable . "',asthma='" . $asthama . "',diabetes='" . $diabetes . "',tb='" . $tb . "',hbd='" . $hbd . "',epilepsy='" . $epilepsy . "',typhoid='" . $typhoid . "',night_blind='" . $night_blind . "',psychiatric='" . $psychiatric . "',heart_dis='" . $heart_deases . "',major_injury='" . $major_injury . "',height='" . $height . "',weight='" . $weight . "',pulse='" . $pulse . "',bp='" . $bp . "',bmi='" . $bmi . "',waist='" . $waist . "',hip='" . $hip . "',past_present_illness='" . $history_list . "',blood_gluose='" . $blood_gluose . "',heart_sound='" . $heart_sound . "',s_cholesterol='" . $s_cholesterol . "',sgpt='" . $sgpt . "',s1 = '".$s1."',s2 = '".$s2."',SpO2='" . $SpO2 . "',dlc_b='" . $dlc_b . "',any_other_sound='" . $any_other_sound . "',ecg_findings='" . $ecg_findings . "',tmt_findings='" . $tmt_findings . "',near_with_right_eye='" . $near_with_right_eye . "',near_without_right_eye='" . $near_without_right_eye . "',dis_with_right_eye='" . $dis_with_right_eye . "',dis_without_right_eye='" . $dis_without_right_eye . "',dis_without_left_eye='" . $dis_without_left_eye . "',dis_with_left_eye='" . $dis_with_left_eye . "',near_without_left_eye='" . $near_without_left_eye . "',near_with_left_eye='" . $near_with_left_eye . "',nails='" . $nails . "',skin='" . $skin . "',color_vision='" . $color_vision . "',rs='" . $rs . "',musculo_skeletal='" . $musculo_skeletal . "',cns='" . $cns . "',ent='" . $ent . "',chest_radiograph='" . $chest_radiograph . "',phimosis = '".$phimosis."',fistula='".$fistula."',urine_re_me='" . $urine_re_me . "',hernia='" . $hernia . "',hydrocele='" . $hydrocele . "',stool_re_me='" . $stool_re_me . "',fvc_pre='" . $fvc_pre . "',fvc_post='" . $fvc_post . "',fev1_pre='" . $fev1_pre . "',fev1_post='" . $fev1_post . "',fev1_fvc_post='" . $fev1_fvc_post . "',fev1_fvc_pre='" . $fev1_fvc_pre . "',peak_expiratory_flow_pre='" . $peak_expiratory_flow_pre . "',peak_expiratory_flow_post='" . $peak_expiratory_flow_post . "',air_cond_left='" . $air_cond_left . "',air_cond_right='" . $air_cond_right . "',bone_cond_left='" . $bone_cond_left . "',bone_cond_right='" . $bone_cond_right . "',hb='" . $hb . "',tlc='" . $tlc . "',dlc_n='" . $dlc_n . "',dlc_l='" . $dlc_l . "',dlc_m='" . $dlc_m . "',dlc_e='" . $dlc_e . "',platelets='" . $platelets . "',s_urea='" . $s_urea . "',s_creatinine='" . $s_creatinine . "',esr='" . $esr . "',bun='" . $bun . "',uric_acid='" . $uric_acid . "',acid_phosphatase='" . $acid_phosphatase . "',ohc_location_id='" . $ohc_type . "',psa='" . $psa . "',lipid_profile='" . $lipid_profile . "',profusion_opacities='" .$profusion_opacitites. "',live_function_test='" . $live_function_test . "',thyroid_profile='" . $thyroid_profile . "',dental_exam_report='" . $dental_exam_report . "',mammography='" . $mammography . "',conversational_hearing='" . $conversational_hearing . "',pap_smear='" . $pap_smear . "',any_other='" . $any_other . "',auroscopy='" . $auroscopy . "',throat='" . $throat . "',nose='" . $nose . "' ,eac='" . $eac . "',liver='" . $liver . "',speen='" . $speen . "',tenderness='" . $tenderness . "',any_other_abnormality='" . $any_other_abnormality . "',appearance='" . $appearance . "' ,pus_cells='" . $pus_cells . "',rbcs='" . $rbcs . "',epithelial_cells='" . $epithelial_cells . "',other_relevant_findings='" . $other_relevant_findings . "' ,albumin='" . $albumin . "',sugar='" . $sugar . "' ,blood_group='" . $blood_group . "',pallor='" . $pallor . "' ,cvs='" . $cvs . "',ident_of_individual_colors='" . $ident_of_individual_colors . "' ,physical_status='" . $physical_status . "',abdomen='" . $abdomen . "' ,opinion_remarks_medical_assistant='" . $opinion_remarks_medical_assistant . "',opinion_remarks='" . $opinion_remarks . "' ,vdrl='" . $vdrl . "',speech='" . $speech . "' ,higher_function='" . $higher_function . "',motor_function='" . $motor_function . "' ,vertigo='" . $vertigo . "',reflexes='" . $reflexes . "',vibration_syndrome='" . $vibration_syndrome . "',medical_entry_date=STR_TO_DATE('" . $medical_date . "','%d-%m-%Y'),ppo='" . $ppo . "' ,grade='" . $grade . "',type = '".$type."',any_other_eye_disease='" . $any_other_eye_disease . "' ,fvc='" . $fvc . "',task='" . $task . "',hiv='" . $hiv . "' ,smoking='" . $smoking . "',tobacco='" . $tobacco . "' ,alcohol='" . $alcohol . "',forward_status='D',addiction='" . $addiction . "',typhoid_findings='" . $typhoid_findings . "',urine_findings='" . $urine_findings . "',lft_findings='" . $lft_findings . "',xray_findings='" . $xray_findings . "',sputum_findings='" . $sputum_findings . "',health_index='" . $health_index . "', p='" . $p . "',cy='" . $cy . "',cl='" . $cl . "',e='" . $e . "',a='" . $a . "',oe='" . $oe . "',pr='" . $pr . "',p_abd='" . $p_abd . "',ln_v='" . $ln_v . "',ln_axis='" . $ln_axis . "',ln_dcyl='" . $ln_dcyl . "',ln_dsph='" . $ln_dsph . "',rn_v='" . $rn_v . "',rn_axis='" . $rn_axis . "',rn_dcyl='" . $rn_dcyl . "',rn_dsph='" . $rn_dsph . "',ld_v='" . $ld_v . "',ld_axis='" . $ld_axis . "',ld_dcyl='" . $ld_dcyl . "',ld_dsph='" . $ld_dsph . "',rd_v='" . $rd_v . "',rd_axis='" . $rd_axis . "',rd_dcyl='" . $rd_dcyl . "',rd_dsph='" . $rd_dsph . "',blood_sugar_ppbs='" . $blood_sugar_ppbs . "',blood_sugar_fbs='" . $blood_sugar_fbs . "',blood_sugar_rbs='" . $blood_sugar_rbs . "',blood_sugar_hb1ac='" . $blood_sugar_hb1ac . "',deformities='" . $deformities . "'" . $endquery; // echo $medical_query; error_log ( $medical_query ); // echo $medical_query; // $result = @mysqli_query($conn,$medical_query); // error_log ($results); if (! $result = @mysqli_query($conn,$medical_query )) { // echo $query_patient; // $response_array['responseText']=mysqli_error($conn); if (substr ( $medical_query, 0, 6 ) === "insert") { $insert_counter --; } else { $update_counter --; } error_log ( "Exception:" . mysqli_error($conn) ); error_log ( "Failed to Execute the Medical Examination Query::: " . $medical_query ); rollback (); exit ( mysqli_error($conn) ); } // /////////// personal info data insert //////////////////////////////////////////////// $My_Family = " insert into patient_personal_information set identi_mark='" . $identi_mark . "',marital_status='" . $marital_status . "',no_of_child='" . $no_of_child . "',adopting_family_planning='" . $adopting_family_planning . "' "; error_log ( "personal information:: " . $My_Family ); if (! $result11 = @mysqli_query($conn,$My_Family )) { error_log ( "Exception:" . mysqli_error($conn) ); error_log ( "Failed to Execute the Personal info Query::: " . $My_Family ); rollback (); exit ( mysqli_error($conn) ); } } } } commit (); $response_mssages1 = $insert_counter . " " . "Medical Examination records inserted
"; $response_mssages1 .= $update_counter . " " . "Medical Examination records updated
"; $response_mssages1 .= $fail_counter . " " . "Medical Examination records skipped
"; $response_mssages1 .= $new_emp_counter . " " . " New Employee records Found
"; $response_array ['responseText'] = "
" . $response_mssages1 . $response_mssages; echo json_encode ( $response_array ); ?>