<?php
error_reporting(0);
include "../includes/config/config.php";
include "functions.php";
include 'log_entry.php';
    
    $approval_date = $_REQUEST['approval_date'];
    $ticket_no = $_REQUEST['ticketNo'];
	// $medexamdate = $_REQUEST['medical_entry_date'];
	$height = $_REQUEST['height'];
	$weight = $_REQUEST['weight'];
	$bmi = $_REQUEST['bmi'];
	$bp = $_REQUEST['bp'];
	$pulse = $_REQUEST['pulse'];
	$chest = $_REQUEST['chest'];
	$chest_in = $_REQUEST['chest_in'];
	$chest_exp = $_REQUEST['chest_exp'];
	$skin = $_REQUEST['skin'];
	$musculo_skeletal = $_REQUEST['musculo_skeletal'];
	$temp = $_REQUEST['temperature'];
	$spo2 = $_REQUEST['spo2'];
	$cold_n_cough = $_REQUEST['cold_cough'];
	$general_weakness = $_REQUEST['general_weakness'];
	$smell = $_REQUEST['smell'];
	$deformities = $_REQUEST['deformities'];
	$hb = $_REQUEST['hb'];
	$tlc = $_REQUEST['tlc'];
	$dlc_n = $_REQUEST['dlc_n'];
	$dlc_l = $_REQUEST['dlc_l'];
	$dlc_m = $_REQUEST['dlc_m'];
	$dlc_e = $_REQUEST['dlc_e'];
	$dlc_b = $_REQUEST['dlc_b'];
	$esr = $_REQUEST['esr'];
	$blood_sugar_fbs = $_REQUEST['blood_sugar_fbs'];
	$blood_sugar_rbs = $_REQUEST['blood_sugar_rbs'];
	$blood_sugar_ppbs = $_REQUEST['blood_sugar_ppbs'];
	$hiv = $_REQUEST['hiv'];
	$hcv = $_REQUEST['hcv'];
	$hbsag = $_REQUEST['hbsag'];
	$uric_acid = $_REQUEST['uric_acid'];
	$urea = $_REQUEST['s_urea'];
	$creatinine = $_REQUEST['s_creatinine'];
	$sodium = $_REQUEST['sodium'];
	$potassium = $_REQUEST['potassium'];
	$calcium = $_REQUEST['calcium'];
	$phosphate = $_REQUEST['phosphate'];
	$hco3 = $_REQUEST['hco3'];
	$total_bilirubin = $_REQUEST['total_bilirubin'];
	$conj = $_REQUEST['conj'];
	$uniconj = $_REQUEST['uniconj'];
	$sgo2 = $_REQUEST['sgop'];
	$sgpt = $_REQUEST['sgpt'];
	$alk_phosphatase = $_REQUEST['alk_phosphatase'];
	$total_protein = $_REQUEST['total_protein'];
	$albumin = $_REQUEST['albumin'];
	$globulin = $_REQUEST['globulin'];
	$speech = $_REQUEST['speech'];
	$higher_fucntion = $_REQUEST['higher_function'];
	$vertigo = $_REQUEST['vertigo'];
	$reflexes = $_REQUEST['reflexes'];
	$st_line_walking = $_REQUEST['st_line_walking'];
	$vibration_syndrome =  $_REQUEST['vibration_syndrome'];
	$conversational_hearing = $_REQUEST['conversational_hearing'];
	$eac = $_REQUEST['eac'];
	$nose = $_REQUEST['nose'];
	$throat = $_REQUEST['throat'];
	$s1 = $_REQUEST['s1'];
	$any_other_sound = $_REQUEST['any_other_sound'];
	$ecg_finding = $_REQUEST['ecg_findings'];
	$teeth_n_gum = $_REQUEST['teeth_n_gum'];
	$spiro_remarks = $_REQUEST['spiro_remarks'];
	$liver = $_REQUEST['liver'];
	$spleen = $_REQUEST['speen'];
	$tenderness = $_REQUEST['tenderness'];
	$any_other_abnormality = $_REQUEST['any_other_abnormality'];
	$xray_findings = $_REQUEST['xray_findings'];
	$near_with_right_eye = $_REQUEST['near_with_right_eye'];
	$near_without_right = $_REQUEST['near_without_right_eye'];
	$dis_with_right_eye = $_REQUEST['dis_with_right_eye'];
	$dis_without_right_eye = $_REQUEST['dis_without_right_eye'];
	$dis_without_left_eye = $_REQUEST['dis_without_left_eye'];
	$dis_with_left_eye = $_REQUEST['dis_with_left_eye'];
	$near_without_left_eye = $_REQUEST['near_without_left_eye'];
	$near_with_left_eye = $_REQUEST['near_with_left_eye'];
	$color_vision = $_REQUEST['color_vision'];
	$hernia = $_REQUEST['hernia_details'];
	$hydrocele = $_REQUEST['hydrocele_details'];
	$phimosis = $_REQUEST['phimosis'];
	$piles = $_REQUEST['piles'];
	$fistula = $_REQUEST['fistula'];
	$total_cholestrol = $_REQUEST['total_cholestrol'];
	$ldl = $_REQUEST['ldl'];
	$hdl = $_REQUEST['hdl'];
	$vldl = $_REQUEST['vldl'];
	$ln_v = $_REQUEST['ln_v'];
	$ln_axis = $_REQUEST['ln_axis'];
	$ln_dcyl = $_REQUEST['ln_dcyl'];
	$ln_dsph = $_REQUEST['ln_dsph'];
	$rn_v = $_REQUEST['rn_v'];
	$rn_axis = $_REQUEST['rn_axis'];
	$rn_dcyl = $_REQUEST['rn_dcyl'];
	$rn_dsph = $_REQUEST['rn_dsph'];
	$ld_v = $_REQUEST['ld_v'];
	$ld_axis = $_REQUEST['ld_axis'];
	$ld_dcyl = $_REQUEST['ld_dcyl'];
	$ld_dsph = $_REQUEST['ld_dsph'];
	$rd_v = $_REQUEST['rd_v'];
	$rd_axis = $_REQUEST['rd_axis'];
	$rd_dcyl = $_REQUEST['rd_dcyl'];
	$rd_dsph = $_REQUEST['rd_dsph'];
	$lair_250 = $_REQUEST['lair_250'];
	$lair_500 = $_REQUEST['lair_500'];
	$lair_1000 = $_REQUEST['lair_1000'];
	$lair_2000 = $_REQUEST['lair_2000'];
	$lair_4000 = $_REQUEST['lair_4000'];
	$lair_8000 = $_REQUEST['lair_8000'];
	$lbone_250 = $_REQUEST['lbone_250'];
	$lbone_500 = $_REQUEST['lbone_500'];
	$lbone_1000 = $_REQUEST['lbone_1000'];
	$lbone_2000 = $_REQUEST['lbone_2000'];
	$lbone_4000 = $_REQUEST['lbone_4000'];
	$lbone_8000 = $_REQUEST['lbone_8000'];
	$rair_250 = $_REQUEST['rair_250'];
	$rair_500 = $_REQUEST['rair_500'];
	$rair_1000 = $_REQUEST['rair_1000'];
	$rair_2000 = $_REQUEST['rair_2000'];
	$rair_4000 = $_REQUEST['rair_4000'];
	$rair_8000 = $_REQUEST['rair_8000'];
	$rbone_250 = $_REQUEST['rbone_250'];
	$rbone_500 = $_REQUEST['rbone_500'];
	$rbone_1000 = $_REQUEST['rbone_1000'];
	$rbone_2000 = $_REQUEST['rbone_2000'];
	$rbone_4000 = $_REQUEST['rbone_4000'];
	$rbone_8000 = $_REQUEST['rbone_8000'];
	$bn_findings = $_REQUEST['bn_findings'];
	$a = $_REQUEST['a'];
	$cy = $_REQUEST['cy'];
	$i = $_REQUEST['i'];
	$cl = $_REQUEST['cl'];
	$e = $_REQUEST['e'];
	$motor_function = $_REQUEST['motor_function'];
	$any_other_findings = $_REQUEST['other_findings'];
	$triglycerides = $_REQUEST['triglycerides'];

if (!empty($ticket_no)) {
	$sql = "UPDATE medical_examination SET height = '".$height."',weight = '".$weight."',bmi = '".$bmi."',bp = '".$bp."',pulse = '".$pulse."',chest = '".$chest."',chest_in = '".$chest_in."',chest_exp = '".$chest_exp."',skin = '".$skin."',musculo_skeletal = '".$musculo_skeletal."',temp = '".$temperature."',spo2 = '".$spo2."',cold_cough = '".$cold_cough."',general_weakness = '".$general_weakness."',smell = '".$smell."',deformities = '".$deformities."',hb = '".$hb."',tlc = '".$tlc."',dlc_n = '".$dlc_n."',dlc_l = '".$dlc_l."',dlc_m = '".$dlc_m."',dlc_e = '".$dlc_e."',dlc_b = '".$dlc_b."',esr = '".$esr."',blood_sugar_fbs = '".$blood_sugar_fbs."',blood_sugar_rbs = '".$blood_sugar_rbs."',blood_sugar_ppbs = '".$blood_sugar_ppbs."',hiv = '".$hiv."',hcv = '".$hcv."',hbsag = '".$hbsag."',uric_acid = '".$uric_acid."',s_urea = '".$s_urea."',s_creatinine = '".$s_creatinine."',sodium = '".$sodium."',potassium = '".$potassium."',calcium = '".$calcium."',phosphates = '".$phosphate."',hco3 = '".$hco3."',total_bilirubin = '".$total_bilirubin."',conj = '".$conj."',uniconj = '".$uniconj."',sgop = '".$sgop."',sgpt = '".$sgpt."',alk_phosphatase = '".$alk_phosphatase."',total_protein = '".$total_protein."',albumin = '".$albumin."',globulin = '".$globulin."',speech = '".$speech."',higher_function = '".$higher_function."',vertigo = '".$vertigo."',reflexes = '".$reflexes."',st_line_walking = '".$st_line_walking."',vibration_syndrome =  '".$vibration_syndrome."',conversational_hearing = '".$conversational_hearing."',eac = '".$eac."',nose = '".$nose."',throat = '".$throat."',s1 = '".$s1."',any_other_sound = '".$any_other_sound."',ecg_findings = '".$ecg_findings."',teeth_gum = '".$teeth_n_gum."',spirometry_remarks = '".$spiro_remarks."',liver = '".$liver."',speen = '".$speen."',tenderness = '".$tenderness."',any_other_abnormality = '".$any_other_abnormality."',xray_findings = '".$xray_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."',color_vision = '".$color_vision."',hernia_details = '".$hernia_details."',hydrocele = '".$hydrocele_details."',phimosis = '".$phimosis."',piles = '".$piles."',fistula = '".$fistula."',total_cholestrol = '".$total_cholestrol."',ldl = '".$ldl."',hdl = '".$hdl."',vldl = '".$vldl."',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."',lair_250 = '".$lair_250."',lair_500 = '".$lair_500."',lair_1000 = '".$lair_1000."',lair_2000 = '".$lair_2000."',lair_4000 = '".$lair_4000."',lair_8000 = '".$lair_8000."',lbone_250 = '".$lbone_250."',lbone_500 = '".$lbone_500."',lbone_1000 = '".$lbone_1000."',lbone_2000 = '".$lbone_2000."',lbone_4000 = '".$lbone_4000."',lbone_8000 = '".$lbone_8000."',rair_250 = '".$rair_250."',rair_500 = '".$rair_500."',rair_1000 = '".$rair_1000."',rair_2000 = '".$rair_2000."',rair_4000 = '".$rair_4000."',rair_8000 = '".$rair_8000."',rbone_250 = '".$rbone_250."',rbone_500 = '".$rbone_500."',rbone_1000 = '".$rbone_1000."',rbone_2000 = '".$rbone_2000."',rbone_4000 = '".$rbone_4000."',rbone_8000 = '".$rbone_8000."',bn_findings = '".$bn_findings."',a = '".$a."',cy = '".$cy."',i = '".$i."',cl = '".$cl."',e = '".$e."',motor_function = '".$motor_function."',other_relevant_findings = '".$other_findings."',triglycerides = '".$triglycerides."',approval_date='".$approval_date."',forward_status='A'  WHERE peme_no = '".$ticket_no."'";

$query = mysqli_query($conn , $sql); 
error_log("MEDICAL UPDATE QUERY::" .$sql);
if (!$query) {
	echo 1;
} else {
	echo 0;
}
} 

?>