$pat_query="SELECT count(*) as total FROM patient_master where status='Active' $qry_filter$qry_doj";
$pat_result=mysqli_query($conn,$pat_query);
$pat_num_row=mysqli_fetch_assoc($pat_result);
error_log("total:".$pat_num_row['total']);
$percentage_for_less_10=0;
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter$qry_doj ORDER by id asc) and health_index<10 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter$qry_doj ORDER by id asc) and health_index>=10 and health_index<15 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter$qry_doj ORDER by id asc) and health_index>=15 and health_index<20 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter$qry_doj ORDER by id asc) and health_index>=20 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$qry_date.=" and year(medical_entry_date) ='".$year2."'";
$qry_filter.=" and year(doj) <='".$year2."'";
}
$pat_query="SELECT count(*) as total FROM patient_master where status='Active' $qry_filter";
$pat_result=mysqli_query($conn,$pat_query);
$pat_num_row=mysqli_fetch_assoc($pat_result);
$data['total_count']=$pat_num_row['total'];
$percentage_emp_per_health_index=0;
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter ORDER by id asc) and health_index<10 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter ORDER by id asc) and health_index>=10 and health_index<15 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter ORDER by id asc) and health_index>=15 and health_index<20 $qry_date GROUP BY patient_id ORDER BY patient_id asc";
$count_health_index="select max(medical_exam_id),health_index,patient_id from medical_examination where patient_id in (SELECT id FROM `patient_master` where status='Active' $qry_filter ORDER by id asc) and health_index>=20 $qry_date GROUP BY patient_id ORDER BY patient_id asc";