2024-10-16 19:08:33 +05:30
< ? php
include ( 'includes/config/config.php' );
include ( 'log_entry.php' );
error_reporting ( E_ERROR | E_PARSE );
$ohc_location = $_REQUEST [ 'ohc_location' ];
$patient_category = $_REQUEST [ 'patient_category' ];
$dept = $_REQUEST [ 'dept' ];
$emp_designation = $_REQUEST [ 'emp_designation' ];
$emp_cadre = $_REQUEST [ 'emp_cadre' ];
$employer_contractor = $_REQUEST [ 'employer_contractor' ];
$gender = $_REQUEST [ 'gender' ];
$start_date = $_REQUEST [ 'startDate' ];
$end_date = $_REQUEST [ 'endDate' ];
// $qry_bu ="";
// $qry_date="";
// if(isset($ohc_location) && $ohc_location!=''){
// $qry_bu.=" and ohc_location_id ='".$ohc_location."' ";
// }
// if(isset($patient_category) && $patient_category!=''){
// $qry_bu.=" and emp_cat_id ='".$patient_category."' ";
// }
// if(isset($dept) && $dept!=''){
// $qry_bu.=" and dept_id ='".$dept."' ";
// }
// if(isset($emp_designation) && $emp_designation!=''){
// $qry_bu.=" and designation_id ='".$emp_designation."' ";
// }
// if(isset($emp_cadre) && $emp_cadre!=''){
// $qry_bu.=" and emp_cadre ='".$emp_cadre."' ";
// }
// if(isset($employer_contractor) && $employer_contractor!=''){
// $qry_bu.=" and employer_contractor_id ='".$employer_contractor."' ";
// }
// if(isset($gender) && $gender!=''){
// $qry_bu.=" and gender ='".$gender."' ";
// }
// if(isset($start_date) && $start_date!=''){
// //$qry_date.=" and checkup_date >='".$start_date."' ";
// $qry_date.=" and medical_entry_date >=str_to_date('".$start_date."','%d-%m-%Y') ";
// }
// if(isset($end_date) && $end_date!=''){
// //$qry_date.=" and checkup_date <='".$end_date."' ";
// $qry_date.=" and medical_entry_date <=str_to_date('".$end_date."','%d-%m-%Y') ";
// }
// $i=0;
// $weight =array(1,2,3,4,5,-1,-2,-3,-4,-5,0);
$increase_weight_upto1 = 0 ;
$increase_weight_upto1_to_2 = 0 ;
$increase_weight_upto2_to_3 = 0 ;
$increase_weight_upto3_to_4 = 0 ;
$increase_weight_upto4_to_5 = 0 ;
$increase_weight_upto5plus = 0 ;
$decrease_weight_upto1 = 0 ;
$decrease_weight_upto1_to_2 = 0 ;
$decrease_weight_upto2_to_3 = 0 ;
$decrease_weight_upto3_to_4 = 0 ;
$decrease_weight_upto4_to_5 = 0 ;
$decrease_weight_upto5plus = 0 ;
$weight_no_change = 0 ;
$query = " select md1.weight as wt1, md2.weight as wt2,(md1.patient_id) , (md1.weight-md2.weight )wt_diff from (select patient_id, weight,bmi from medical_examination where year(medical_entry_date) like '2021') md1,(select patient_id, weight,bmi from medical_examination where year(medical_entry_date) like '2020') md2 where md1.patient_id=md2.patient_id " ;
if ( ! $result = @ mysqli_query ( $conn , $query )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:08:33 +05:30
}
while ( $row = mysqli_fetch_array ( $result )){
if ( $row [ 'wt_diff' ] > 0 && $row [ 'wt_diff' ] <= 1 ){
$increase_weight_upto1 ++ ;
}
if ( $row [ 'wt_diff' ] > 1 && $row [ 'wt_diff' ] <= 2 ){
$increase_weight_upto1_to_2 ++ ;
}
if ( $row [ 'wt_diff' ] > 2 && $row [ 'wt_diff' ] <= 3 ){
$increase_weight_upto2_to_3 ++ ;
}
if ( $row [ 'wt_diff' ] > 3 && $row [ 'wt_diff' ] <= 4 ){
$increase_weight_upto3_to_4 ++ ;
}
if ( $row [ 'wt_diff' ] > 4 && $row [ 'wt_diff' ] <= 5 ){
$increase_weight_upto4_to_5 ++ ;
}
if ( $row [ 'wt_diff' ] >= 5 ){
$increase_weight_upto5plus ++ ;
}
if ( $row [ 'wt_diff' ] < 0 && $row [ 'wt_diff' ] >= - 1 ){
$decrease_weight_upto1 ++ ;
}
if ( $row [ 'wt_diff' ] < - 1 && $row [ 'wt_diff' ] >= - 2 ){
$decrease_weight_upto1_to_2 ++ ;
}
if ( $row [ 'wt_diff' ] < - 2 && $row [ 'wt_diff' ] >= - 3 ){
$decrease_weight_upto2_to_3 ++ ;
}
if ( $row [ 'wt_diff' ] < - 3 && $row [ 'wt_diff' ] >= - 4 ){
$decrease_weight_upto3_to_4 ++ ;
}
if ( $row [ 'wt_diff' ] < - 4 && $row [ 'wt_diff' ] >= - 5 ){
$decrease_weight_upto4_to_5 ++ ;
}
if ( $row [ 'wt_diff' ] <= - 5 ){
$decrease_weight_upto5plus ++ ;
}
if ( $row [ 'wt_diff' ] == 0 ){
$weight_no_change ++ ;
}
}
// $data['increase_weight_upto1'] = $increase_weight_upto1;
// $data['increase_weight_upto1_to_2'] = $increase_weight_upto1_to_2;
// $data['increase_weight_upto2_to_3'] = $increase_weight_upto2_to_3;
// $data['increase_weight_upto3_to_4'] = $increase_weight_upto3_to_4;
// $data['increase_weight_upto4_to_5'] = $increase_weight_upto4_to_5;
// $data['increase_weight_upto5plus'] = $increase_weight_upto5plus;
// $data['decrease_weight_upto1'] = $decrease_weight_upto1;
// $data['decrease_weight_upto1_to_2'] = $decrease_weight_upto1_to_2;
// $data['decrease_weight_upto2_to_3'] = $decrease_weight_upto2_to_3;
// $data['decrease_weight_upto3_to_4'] = $decrease_weight_upto3_to_4;
// $data['decrease_weight_upto4_to_5'] = $decrease_weight_upto4_to_5;
// $data['weight_no_change'] = $weight_no_change;
$array1 = array ( 1 , $increase_weight_upto1 , 1 * $increase_weight_upto1 );
$data [] = $array1 ;
$array2 = array ( 2 , $increase_weight_upto1_to_2 , 2 * $increase_weight_upto1_to_2 );
$data [] = $array2 ;
$array3 = array ( 3 , $increase_weight_upto2_to_3 , 3 * $increase_weight_upto2_to_3 );
$data [] = $array3 ;
$array4 = array ( 4 , $increase_weight_upto3_to_4 , 4 * $increase_weight_upto3_to_4 );
$data [] = $array4 ;
// $array1 = array(1,$increase_weight_upto4_to_5,1*$increase_weight_upto1);
// $data[]=$array1;
$array5 = array ( 5 , $increase_weight_upto5plus , 5 * $increase_weight_upto5plus );
$data [] = $array5 ;
$array6 = array ( - 1 , $decrease_weight_upto1 , - 1 * $decrease_weight_upto1 );
$data [] = $array6 ;
$array7 = array ( - 2 , $decrease_weight_upto1_to_2 , - 2 * $decrease_weight_upto1_to_2 );
$data [] = $array7 ;
$array8 = array ( - 3 , $decrease_weight_upto2_to_3 , - 3 * $decrease_weight_upto2_to_3 );
$data [] = $array8 ;
$array9 = array ( - 4 , $decrease_weight_upto3_to_4 , - 4 * $decrease_weight_upto3_to_4 );
$data [] = $array9 ;
$array10 = array ( - 5 , $decrease_weight_upto4_to_5 , - 5 * $decrease_weight_upto4_to_5 );
$data [] = $array10 ;
$array11 = array ( 0 , $weight_no_change , 0 * $weight_no_change );
$data [] = $array11 ;
echo json_encode ( $data );
?>