361 lines
11 KiB
PHP
361 lines
11 KiB
PHP
<?php
|
|
// include('pdf_header.php');
|
|
include ('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
header('Content-Type: application/force-download');
|
|
header('Content-disposition: attachment; filename=excel_emp_report_list.xls');
|
|
?>
|
|
<body>
|
|
<table border="1" width="100%">
|
|
<?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;
|
|
$record =array();
|
|
|
|
/* starting from 18 to 25 */
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=0 and YEAR(CURDATE())-year(doj)<2 ".$qry_bu;
|
|
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?>
|
|
<tr>
|
|
|
|
<td colspan="2" align="center"><strong>DURATION OF SERVICE DIABETES REPORT</strong></td>
|
|
<tr>
|
|
<td align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
|
|
|
|
<td align="left"> User : <?php echo $username ?></td>
|
|
</tr>
|
|
<tr>
|
|
<?php if(isset($start_date) && isset($end_date)){?>
|
|
<td colspan="2" ><strong>Filters Applied-</strong> <u>Range:</u><?php echo $start_date;?> to <?php echo $end_date ;?>, <u>EMPLOYER/CONTRACTOR:</u><?php if($employer_contractor==''){echo "ALL";} else?><?php echo getTableFieldValue(' employer_contractor','employer_contractor_name','id',$employer_contractor);?>, <u>Gender:</u><?php if($gender==''){echo "ALL";} else?><?php echo $gender;?>,
|
|
<u>OHC Location:</u><?php if($ohc_location==''){echo "ALL";} else?><?php echo getTableFieldValue('ohc_type','ohc_type_name','ohc_type_id',$ohc_location);?>, <u>Patient Category:</u><?php if($patient_category==''){echo "ALL";} else?><?php echo getTableFieldValue('patient_category','patient_cat_name','patient_cat_id',$patient_category);?>, <u>Department:</u><?php if($dept==''){echo "ALL";} else?><?php echo getTableFieldValue('department','dept_name','dept_id',$dept); ?>,
|
|
<u>Designation:</u><?php if($emp_designation==''){echo"ALL";} else?><?php echo getTableFieldValue(' designation','designation_name','designation_id',$emp_designation);?>, <u>Employee Cadre:</u><?php if($emp_cadre==''){echo "ALL";} else?><?php echo getTableFieldValue(' emp_cadre','emp_cadre','emp_cadre_id',$emp_cadre); ?>
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
<?php }?>
|
|
</tr>
|
|
<strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(0-2)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
|
|
|
|
/* ending from 18 to 25 */
|
|
|
|
|
|
|
|
|
|
/* starting from 26 to 30 */
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=2 and YEAR(CURDATE())-year(doj)<5 ".$qry_bu;
|
|
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
|
|
|
|
//echo $query;
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(2-5)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
|
|
/* ending from 26 to 30 */
|
|
|
|
|
|
/* starting from 31 to 40 */
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=5 and YEAR(CURDATE())-year(doj)<10 ".$qry_bu;
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
// echo $query;
|
|
|
|
//echo $query;
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(5-10)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=10 and YEAR(CURDATE())-year(doj)<15 ".$qry_bu;
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(10-15)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=15 and YEAR(CURDATE())-year(doj)<20 ".$qry_bu;
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(15-20)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=20 and YEAR(CURDATE())-year(doj)<25 ".$qry_bu;
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(20-25)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
<?php
|
|
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>25".$qry_bu;
|
|
$query="SELECT count(DISTINCT(patient_id)) as total from medical_examination where patient_id in ($query1) $qry_date";
|
|
|
|
|
|
$query="SELECT patient_master.patient_name,GROUP_CONCAT(DISTINCT past_present_illness SEPARATOR ',') as illness from medical_examination INNER JOIN patient_master ON medical_examination.patient_id = patient_master.id where patient_id in ($query1) $qry_date group by patient_id Having Find_In_Set(2,illness)>0";
|
|
//echo $query;
|
|
|
|
$result = mysqli_query($conn,$query);
|
|
|
|
//echo $query;
|
|
?><strong><tr bgcolor="#eeeeee">
|
|
<td align="center" width="10%">Duration of service(>25)</td>
|
|
|
|
<td align="center" width="15%" >Patient Name</td>
|
|
|
|
|
|
</strong></tr>
|
|
|
|
<?php
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
while ($rowOfEmployee = mysqli_fetch_array($result)) {
|
|
|
|
?>
|
|
<tr>
|
|
<td></td>
|
|
<td align="left" width="15%"><?php echo $rowOfEmployee['patient_name']?></td>
|
|
|
|
</tr><?php
|
|
|
|
}
|
|
?>
|
|
</table>
|
|
</body>
|