$qry_bu.=" and b.employer_contractor_id ='".$employer_contractor."' ";
}
if(isset($gender)&&$gender!=''){
$qry_bu.=" and b.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;
$record=array();
// $query="select count(a.id) as total, f.dept_name from covid_monitoring a left join patient_master b on a.emp_id = b.id left join covid_patient_staying c on a.staying_id = c.id left join covid_test_result_master d on a.covid_test_result_id = d.id left join covid_contact_type_master e on a.covid_contact_id = e.id left join department f on b.dept_id = f.dept_id group BY f.dept_name ";
$query="select count(a.id) as total, f.dept_name from covid_monitoring a left join patient_master b on a.emp_id = b.id left join covid_patient_staying c on a.staying_id = c.id left join covid_test_result_master d on a.covid_test_result_id = d.id left join covid_contact_type_master e on a.covid_contact_id = e.id left join department f on b.dept_id = f.dept_id where d.id = '2' $qry_bu group BY f.dept_name ";
$query="SELECT count(*) as total_active from covid_monitoring where id in (select a.id from covid_monitoring a left join patient_master b on a.emp_id = b.id left join covid_test_result_master d on a.covid_test_result_id = d.id left join department f on b.dept_id = f.dept_id where d.id='2' $qry_bu group BY f.dept_name )";