351 lines
11 KiB
PHP
351 lines
11 KiB
PHP
<?php
|
|
include('includes/config/config.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 (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['key'] ='0-2';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
|
|
}
|
|
}
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
/* 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(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='2-5';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
}
|
|
}
|
|
//echo $query;
|
|
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date ";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
/* 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(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
// echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='5-10';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
|
|
}
|
|
}
|
|
//echo $query;
|
|
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=10 and YEAR(CURDATE())-year(doj)<15 ".$qry_bu;
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='10-15';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
}
|
|
}
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=15 and YEAR(CURDATE())-year(doj)<20 ".$qry_bu;
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='15-20';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
}
|
|
}
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>=20 and YEAR(CURDATE())-year(doj)<25 ".$qry_bu;
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='20-25';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
}
|
|
}
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$query1="select id FROM patient_master where YEAR(CURDATE())-year(doj)>25".$qry_bu;
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left is not null AND air_cond_left!='') AND (air_cond_right is not null AND air_cond_right!='') AND (bone_cond_left is not null AND bone_cond_left!='') AND (bone_cond_right is not null AND bone_cond_right!='') and patient_id in ($query1) $qry_date";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$record[$i]['key'] ='>25';
|
|
$record[$i]['total'] =$row['total'];
|
|
|
|
}
|
|
}
|
|
$query="SELECT count(*) as total from medical_examination where (air_cond_left='abnormal' or air_cond_right='abnormal' or bone_cond_left='abnormal' or bone_cond_right='abnormal' ) and patient_id in ($query1) $qry_date";
|
|
//echo $query;
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
|
|
if(mysqli_num_rows($result) > 0) {
|
|
if ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
$record[$i]['is_abnormal_audiometry']=$row['total'];
|
|
|
|
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo json_encode($record);
|
|
?>
|