ESH/api2/patient_count.php

117 lines
3.7 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php
error_reporting(0);
include "../includes/config/config.php";
include "functions.php";
include 'log_entry.php';
$patientsList_array =array();
$patient_array = array();
// $patient_array_opd = array();
// $patient_array_injury = array();
// $patient_array_sickness = array();
// $patient_array_medical = array();
$count_opd = "SELECT count(appointment_id) as count_opd FROM employee_appointment WHERE attended_status = 'DRP' and appointment_type= 'O'";
error_log("COUNT OPD::" .$count_opd);
$fetch_patients = mysqli_query($conn,$count_opd ) or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_opd'] = $row_patients['count_opd'];
// array_push($patient_array,$patient_array_opd);
}
$fetch_patients = mysqli_query($conn, "SELECT count(appointment_id) as count_injury FROM employee_appointment WHERE attended_status = 'DRP' and appointment_type= 'I'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_injury'] = $row_patients['count_injury'];
// array_push($patient_array,$patient_array_injury);
}
$fetch_patients = mysqli_query($conn, "SELECT count(checkup_id) as count_medical FROM checkup_form WHERE current_status !='DRA'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_medical'] = $row_patients['count_medical'];
// array_push($patient_array,$patient_array_medical);
}
$fetch_patients = mysqli_query($conn, "SELECT count(sickness_id) as count_sickness FROM sickness WHERE attended_status = 'DRP'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_sickness'] = $row_patients['count_sickness'];
// array_push($patient_array,$patient_array_sickness);
}
$count_opd = "SELECT count(appointment_id) as count_opd FROM employee_appointment WHERE attended_status = 'DRA' and appointment_type= 'O'";
error_log("COUNT OPD::" .$count_opd);
$fetch_patients = mysqli_query($conn,$count_opd ) or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_opd_approved'] = $row_patients['count_opd'];
// array_push($patient_array,$patient_array_opd);
}
$fetch_patients = mysqli_query($conn, "SELECT count(appointment_id) as count_injury FROM employee_appointment WHERE attended_status = 'DRA' and appointment_type= 'I'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_injury_approved'] = $row_patients['count_injury'];
// array_push($patient_array,$patient_array_injury);
}
$fetch_patients = mysqli_query($conn, "SELECT count(checkup_id) as count_medical FROM checkup_form WHERE current_status ='DRA'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_medical_approved'] = $row_patients['count_medical'];
// array_push($patient_array,$patient_array_medical);
}
$fetch_patients = mysqli_query($conn, "SELECT count(sickness_id) as count_sickness FROM sickness WHERE attended_status = 'DRA'") or die(mysqli_error($conn));
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
$patientsList_array['count_sickness_approved'] = $row_patients['count_sickness'];
// array_push($patient_array,$patient_array_sickness);
}
array_push($patient_array,$patientsList_array);
$jsonData = json_encode($patient_array, JSON_PRETTY_PRINT);
echo $jsonData;
?>