70 lines
3.2 KiB
PHP
70 lines
3.2 KiB
PHP
<?php
|
|
error_reporting(0);
|
|
include "../includes/config/config.php";
|
|
include "functions.php";
|
|
include 'log_entry.php';
|
|
$patientsList_array =array();
|
|
$patient_array = array();
|
|
$medicine_array = array();
|
|
$medicine_array_ext = array();
|
|
$page = $limit = $search="";
|
|
|
|
$page = $_REQUEST['_page'];
|
|
$limit = $_REQUEST['_limit'];
|
|
$search = $_REQUEST['_search'];
|
|
|
|
|
|
$sql_opd = "SELECT b.patient_name,b.emp_code,b.father_name,b.gender,b.employer_contractor_id,b.dept_id,b.dob,a.* FROM sickness a left join patient_master b on b.id = a.emp_id WHERE a.attended_status = 'DRA'";
|
|
if (!empty($limit)) {
|
|
$sql_opd .= "ORDER BY a.sickness_id DESC LIMIT $page , $limit";
|
|
}
|
|
|
|
if (!empty($search)) {
|
|
$sql_opd .= "and ( b.patient_name like '%$search%' or b.emp_code like '%$search%')";
|
|
}
|
|
|
|
error_log("OPD::" .$sql_opd);
|
|
$fetch_patients = mysqli_query($conn, $sql_opd) or die(mysqli_error($conn));
|
|
while ($row_patients = mysqli_fetch_assoc($fetch_patients)) {
|
|
$age = isset($row_patients['dob']) ? date_diff(date_create($row_patients['dob']), date_create('today'))->y : "Not Available";
|
|
$patient_array['appointment_id'] = (int)$row_patients['appointment_id'];
|
|
if ($row_patients['IsEmergency'] == 1) {
|
|
|
|
$patient_array['ans'] = "Yes";
|
|
} else {
|
|
|
|
$patient_array['ans'] = "No";
|
|
}
|
|
$patient_array['employer_contractor'] = getTableFieldValue('employer_contractor', 'employer_contractor_name', 'id', $row_patients['employer_contractor_id'], '');
|
|
$patient_array['dept'] = getTableFieldValue('department', 'dept_name', 'dept_id', $row_patients['dept_id'], '');
|
|
$patient_array['patient_name'] = $row_patients['patient_name'];
|
|
$patient_array['emp_code'] = $row_patients['emp_code'];
|
|
$patient_array['father_name'] = $row_patients['father_name'];
|
|
$patient_array['gender'] = $row_patients['gender'] == 'M' ? "Male" : "Female";
|
|
$patient_array['ticket_no'] = $row_patients['ticket_no'];
|
|
$patient_array['dob'] = (string)$age;
|
|
$patient_array['sickness_name'] = $row_patients['sickness_name'];
|
|
$patient_array['des'] = $row_patients['des'];
|
|
$patient_array['sickness_date'] = date_format(date_create($row_patients['sickness_date']), "d-M-Y h:i:s A");
|
|
$patient_array['sickness_time'] = date_format(date_create($row_patients['sickness_date']), "h:i:s A");
|
|
$patient_array['approval_date'] = date_format(date_create($row_patients['approval_date']), "d-M-Y h:i:sa");
|
|
$patient_array['date_absent'] = date_format(date_create($row_patients['date_absent']), "d-M-Y h:i:sa");
|
|
$patient_array['date_absent_to'] = date_format(date_create($row_patients['date_absent_to']), "d-M-Y h:i:sa");
|
|
$patient_array['date_return'] = date_format(date_create($row_patients['date_return']), "d-M-Y h:i:sa");
|
|
$patient_array['fitness_status'] = $row_patients['fitness_status'];
|
|
$patient_array['ailment_system'] = $row_patients['ailment_system'];
|
|
$patient_array['ailment_name'] = $row_patients['ailment_name'];
|
|
$patient_array['agency'] = $row_patients['agency'];
|
|
|
|
|
|
array_push($patientsList_array,$patient_array);
|
|
}
|
|
|
|
|
|
|
|
$jsonData = json_encode($patientsList_array, JSON_PRETTY_PRINT);
|
|
|
|
|
|
echo $jsonData;
|
|
|
|
?>
|