$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=0 and (datediff(CURRENT_DATE,doj)/365)<2 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_0_to_2=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=0 and (datediff(CURRENT_DATE,doj)/365)<2 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=2 and (datediff(CURRENT_DATE,doj)/365)<5 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_2_to_5=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=2 and (datediff(CURRENT_DATE,doj)/365)<5 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=5 and (datediff(CURRENT_DATE,doj)/365)<10 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_5_to_10=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=5 and (datediff(CURRENT_DATE,doj)/365)<10 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=10 and (datediff(CURRENT_DATE,doj)/365)<15 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_10_to_15=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=10 and (datediff(CURRENT_DATE,doj)/365)<15 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=15 and (datediff(CURRENT_DATE,doj)/365)<20 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_15_to_20=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=15 and (datediff(CURRENT_DATE,doj)/365)<20 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=20 and (datediff(CURRENT_DATE,doj)/365)<25 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_20_to_25=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=20 and (datediff(CURRENT_DATE,doj)/365)<25 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=25 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_greater_than_equal_to_25=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=25 and status='Active' $qry_filter$qry_dob) $qry_date1$qry_date GROUP by emp_id";
$qry_date1.=" and year(checkup_date) ='".$year2."'";
$qry_dob.="and year(doj) <= '".$year2."'";
}
//for 0 to 2
$total=0;
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=0 and (datediff(CURRENT_DATE,doj)/365)<2 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_0_to_2=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=0 and (datediff(CURRENT_DATE,doj)/365)<2 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=2 and (datediff(CURRENT_DATE,doj)/365)<5 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_2_to_5=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=2 and (datediff(CURRENT_DATE,doj)/365)<5 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=5 and (datediff(CURRENT_DATE,doj)/365)<10 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_5_to_10=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=5 and (datediff(CURRENT_DATE,doj)/365)<10 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=10 and (datediff(CURRENT_DATE,doj)/365)<15 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_10_to_15=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=10 and (datediff(CURRENT_DATE,doj)/365)<15 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=15 and (datediff(CURRENT_DATE,doj)/365)<20 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_15_to_20=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=15 and (datediff(CURRENT_DATE,doj)/365)<20 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=20 and (datediff(CURRENT_DATE,doj)/365)<25 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_20_to_25=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=20 and (datediff(CURRENT_DATE,doj)/365)<25 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";
$pat_query="SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=25 and status='Active' $qry_filter$qry_dob";
$pat_result=mysqli_query($conn,$pat_query);
if(mysqli_num_rows($pat_result)){
$total=mysqli_num_rows($pat_result);
}else{
$total=0;
}
$per_for_greater_than_equal_to_25=[];
$count_health_index="SELECT max(checkup_id),health_index from checkup_form where emp_id in (SELECT id FROM patient_master where (datediff(CURRENT_DATE,doj)/365)>=25 and status='Active' $qry_filter$qry_dob) $qry_date1 GROUP by emp_id";