218 lines
5.2 KiB
PHP
218 lines
5.2 KiB
PHP
|
<?php include('includes/config/config.php');
|
||
|
include('log_entry.php');
|
||
|
error_reporting(E_ERROR | E_PARSE);
|
||
|
$ohc_location = $_REQUEST['ohc_location'];
|
||
|
$patient_category = $_REQUEST['patient_category'];
|
||
|
$dept = $_REQUEST['dept'];
|
||
|
error_log("ffhdjfkhervh".$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 checkup_date >=str_to_date('".$start_date."','%d-%m-%Y') ";
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
if(isset($end_date) && $end_date!=''){
|
||
|
//$qry_date.=" and checkup_date <='".$end_date."' ";
|
||
|
//s $qry_date.=" and checkup_date <=str_to_date('".$end_date."','%d-%m-%Y') ";
|
||
|
}*/
|
||
|
|
||
|
|
||
|
|
||
|
// $query="SELECT year(doj) as yr FROM patient_master";
|
||
|
// if (!$result = @mysqli_query($conn,$query)) {
|
||
|
// exit(mysqli_error($conn));
|
||
|
// }
|
||
|
// if(mysqli_num_rows($result) > 0) {
|
||
|
// while ($row = @mysqli_fetch_array($result)) {
|
||
|
// if($row['yr'] == '2016'){
|
||
|
// $yr1 = $row['inj_class_id'];
|
||
|
// }elseif($row['inj_class_name'] == 'LTI'){
|
||
|
// $lti_id = $row['inj_class_id'];
|
||
|
// }elseif($row['inj_class_name'] == 'HOSPITALIZATION'){
|
||
|
// $hos_id = $row['inj_class_id'];
|
||
|
// }elseif($row['inj_class_name'] == 'MINOR'){
|
||
|
// $min_id = $row['inj_class_id'];
|
||
|
// }
|
||
|
// }
|
||
|
// } else {
|
||
|
// echo '0';
|
||
|
// }
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$y1 = date("Y",strtotime("-5 year"));
|
||
|
|
||
|
$y2 = date("Y",strtotime("-4 year"));
|
||
|
|
||
|
$y3 = date("Y",strtotime("-3 year"));
|
||
|
|
||
|
$y4 = date("Y",strtotime("-2 year"));
|
||
|
|
||
|
$y5 = date("Y",strtotime("-1 year"));
|
||
|
|
||
|
|
||
|
|
||
|
$year = array($y1,$y2,$y3,$y4,$y5);
|
||
|
|
||
|
$data = array();
|
||
|
|
||
|
for($i=0;$i<sizeof($year);$i++){
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=18 and YEAR(CURDATE())-year(dob)<=25 and year(doj) like '".$year[$i]."'";
|
||
|
error_log("fdhkdjhf".$query);
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['age_18_25'][$year[$i]] = $row;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=26 and YEAR(CURDATE())-year(dob)<=30 $qry_date and year(doj) like '".$year[$i]."'";
|
||
|
|
||
|
error_log("fdhkdjhf".$query);
|
||
|
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['age_26_30'][$year[$i]] = $row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=31 and YEAR(CURDATE())-year(dob)<=40 $qry_date and year(doj) like '".$year[$i]."'";
|
||
|
|
||
|
error_log("fdhkdjhf".$query);
|
||
|
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['age_31_40'][$year[$i]] = $row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=41 and YEAR(CURDATE())-year(dob)<=50 $qry_date and year(doj) like '".$year[$i]."'";
|
||
|
|
||
|
error_log("fdhkdjhf".$query);
|
||
|
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['age_41_50'][$year[$i]] = $row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>50 and year(doj) like '".$year[$i]."'";
|
||
|
|
||
|
error_log("fdhkdjhf".$query);
|
||
|
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['age_more50'][$year[$i]] = $row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
$query="SELECT count(*) as total FROM patient_master ";
|
||
|
$qry_bu=preg_replace('/and/', 'where', $qry_bu, 1);
|
||
|
//echo $query.$qry_bu;
|
||
|
if (!$result = @mysqli_query($conn,$query.$qry_bu)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||
|
$data['total_count'] = $row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
echo json_encode($data);
|
||
|
?>
|