360 lines
9.7 KiB
PHP
360 lines
9.7 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
|
||
|
include('includes/auth/auth.php');
|
||
|
|
||
|
include('includes/functions.php');
|
||
|
|
||
|
include('access.php');
|
||
|
|
||
|
include('log_entry.php');
|
||
|
|
||
|
// error_reporting(E_ERROR | E_PARSE);
|
||
|
|
||
|
?>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$emp_id = $_REQUEST['emp_id'];;
|
||
|
|
||
|
// echo $emp_id;
|
||
|
|
||
|
// Connect to mysqli database
|
||
|
|
||
|
$page = 1; // The current page
|
||
|
|
||
|
$sortname = 'appointment_date'; // Sort column
|
||
|
|
||
|
$sortorder = 'desc'; // Sort order
|
||
|
|
||
|
$qtype = ''; // Search column
|
||
|
|
||
|
$query = ''; // Search string
|
||
|
|
||
|
// Get posted data
|
||
|
|
||
|
if (isset($_POST['page'])) {
|
||
|
|
||
|
$page = mysqli_real_escape_string($conn, $_POST['page']);
|
||
|
}
|
||
|
|
||
|
if (isset($_POST['sortname'])) {
|
||
|
|
||
|
$sortname = mysqli_real_escape_string($conn, $_POST['sortname']);
|
||
|
}
|
||
|
|
||
|
if (isset($_POST['sortorder'])) {
|
||
|
|
||
|
$sortorder = mysqli_real_escape_string($conn, $_POST['sortorder']);
|
||
|
}
|
||
|
|
||
|
if (isset($_POST['qtype'])) {
|
||
|
|
||
|
$qtype = mysqli_real_escape_string($conn, $_POST['qtype']);
|
||
|
}
|
||
|
|
||
|
if (isset($_POST['query'])) {
|
||
|
|
||
|
$query = mysqli_real_escape_string($conn, $_POST['query']);
|
||
|
}
|
||
|
|
||
|
if (isset($_POST['rp'])) {
|
||
|
|
||
|
$rp = mysqli_real_escape_string($conn, $_POST['rp']);
|
||
|
}
|
||
|
|
||
|
// Setup sort and search SQL using posted data
|
||
|
|
||
|
$sortSql = "order by $sortname $sortorder";
|
||
|
|
||
|
|
||
|
if ($qtype == 'emp_code') {
|
||
|
$emp_id = getFieldFromTable('id', 'patient_master', 'emp_code', trim($query));
|
||
|
$searchSql = ($qtype != '' && $query != '' && trim($query) != '') ? " and ep.emp_id = '" . $emp_id . "' " : '';
|
||
|
} else {
|
||
|
$searchSql = ($qtype != '' && $query != '') ? " and upper($qtype) like upper('%$query%')" : '';
|
||
|
}
|
||
|
|
||
|
|
||
|
// Get total count of records
|
||
|
|
||
|
// echo 'shu'.$p;
|
||
|
|
||
|
$sql = "select count(*)from employee_appointment ep inner join patient_master e on e.id=ep.emp_id where ((doctor_attended_flag='N' and attended_status='DRP') or (doctor_attended_flag='Y' and attended_status='MDP')) and ep.appointment_type='I' and ep.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' $searchSql";
|
||
|
|
||
|
// echo $sql;
|
||
|
error_log("query: 90: " . $sql);
|
||
|
|
||
|
$result = mysqli_query($conn, $sql);
|
||
|
|
||
|
$row = mysqli_fetch_array($result);
|
||
|
|
||
|
$total = $row[0];
|
||
|
|
||
|
// Setup paging
|
||
|
|
||
|
if (!isset($rp)) {
|
||
|
|
||
|
$rp = 10;
|
||
|
}
|
||
|
|
||
|
$pageStart = ($page - 1) * $rp;
|
||
|
|
||
|
$limitSql = "limit $pageStart, $rp";
|
||
|
|
||
|
// Return JSON data
|
||
|
|
||
|
$data = array();
|
||
|
|
||
|
$data['page'] = $page;
|
||
|
|
||
|
$data['total'] = $total;
|
||
|
|
||
|
$data['rows'] = array();
|
||
|
|
||
|
$sql_employee_appointment = "select patient_name,emp_code ,ep.modified_by,e.id,appointment_id,ticket_no,token_no, appointment_date,bp_sbp,bp_dbp,blood_sugar_fbs,blood_sugar_rbs,blood_sugar_ppbs,temperature,spo2_percent,remarks_rece ,complaints,examination_remarks,ailment_ids,hospital_treatment, referral,followup,remarks,IsEmergency ,appointment_type,injury_types
|
||
|
|
||
|
from employee_appointment ep inner join patient_master e on e.id=ep.emp_id where ((doctor_attended_flag='N' and attended_status='DRP') or (doctor_attended_flag='Y' and attended_status='MDP')) and ep.appointment_type='I' and ep.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ";
|
||
|
|
||
|
// echo $sql_employee_appointment;
|
||
|
|
||
|
$sql_export = $sql_employee_appointment;
|
||
|
|
||
|
$sql_employee_appointment .= " $searchSql $sortSql $limitSql ";
|
||
|
|
||
|
$sql_export .= " $searchSql $sortSql ";
|
||
|
|
||
|
error_log("sql employee_appointment: 143: " . $sql_employee_appointment);
|
||
|
$results_employee_appointment = mysqli_query($conn, $sql_employee_appointment);
|
||
|
|
||
|
// echo $sql_employee_appointment;
|
||
|
|
||
|
$count = ($page - 1) * $rp + 1;
|
||
|
|
||
|
// echo $sql_ailment;
|
||
|
|
||
|
// echo $access_level;
|
||
|
|
||
|
while ($row_employee_appointment = mysqli_fetch_assoc($results_employee_appointment)) {
|
||
|
|
||
|
extract($row_employee_appointment);
|
||
|
|
||
|
$appointment_type = $row_employee_appointment['appointment_type'];
|
||
|
|
||
|
$emp_id = $row_employee_appointment['id'];
|
||
|
|
||
|
$complaints = getCommaSeperatedValuesForInClause("select complaint from complaints ", "complaint_id", $row_employee_appointment['complaints']);
|
||
|
|
||
|
if ($appointment_type == 'O') {
|
||
|
|
||
|
$diagnosis = getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_employee_appointment['ailment_ids']);
|
||
|
} else if ($appointment_type == 'I') {
|
||
|
|
||
|
$diagnosis = getCommaSeperatedValuesForInClause("select injury_type_name from injury_type", "injury_type_id", $row_employee_appointment['injury_types']);
|
||
|
}
|
||
|
|
||
|
$appointment_type = $row_employee_appointment['appointment_type'];
|
||
|
|
||
|
$employee_appointment = $row_employee_appointment['appointment_id'];
|
||
|
|
||
|
$emp_id = $row_employee_appointment['emp_id'];
|
||
|
|
||
|
// echo $ailment_id;
|
||
|
|
||
|
$view_link = "";
|
||
|
|
||
|
$edit_link = "";
|
||
|
|
||
|
$delete_link = "";
|
||
|
|
||
|
$approve_link = "";
|
||
|
|
||
|
$links = "";
|
||
|
|
||
|
$space = " ";
|
||
|
|
||
|
// echo "shubham";
|
||
|
|
||
|
// if ($appointment_type == 'O') {
|
||
|
|
||
|
// $view_link = "<a href=\"view_opd.php?appointmentId=" . $appointment_id . "&flex_opd_id=" . $emp_id . "&returnPage=pending_medical_disbursement_list.php?view=view\" class=\"green\" ><i class=\"ace-icon fa fa-search-plus bigger-130\"></i></a>";
|
||
|
|
||
|
// $view_link .= $space;
|
||
|
// } else if ($appointment_type == 'I') {
|
||
|
|
||
|
// $view_link = "<a href=\"#\" class=\"grey\"view_injury.php?appointmentId=" . $appointment_id . "&flex_opd_id=" . $emp_id . "&returnPage=pending_medical_disbursement_list.php?view=view\" class=\"green\" ><i class=\"ace-icon fa fa-eye bigger-130\"></i></a>";
|
||
|
|
||
|
// $view_link .= $space;
|
||
|
// }
|
||
|
|
||
|
// if ($appointment_type == 'O') {
|
||
|
|
||
|
// $edit_link = "<a href=\"edit_opd.php?appointmentId=" . $appointment_id . "&flex_opd_id=" . $emp_id . "&returnPage=pending_medical_disbursement_list.php?view=edit\" class=\"blue\" ><i class=\"menu-icon fa fa-pencil-square-o\"></i></a>";
|
||
|
|
||
|
// $edit_link .= $space;
|
||
|
// } else if ($appointment_type == 'I') {
|
||
|
|
||
|
|
||
|
$view_link = $space . "<a id='appointment_id_" . $appointment_id . "' href=\"#\"class=\"grey\" onclick=\"open_employee_appointment('" . $appointment_id . "','" . $appointment_type . "','" . $emp_id . "','V');\"><i class=\"ace-icon fa fa-eye\" style=\"font-size: 15px;\"></i></a>";
|
||
|
|
||
|
$edit_link = $space . "<a href=\"#\" class=\"blue\" onclick=\"open_employee_appointment('" . $appointment_id . "','" . $appointment_type . "','" . $emp_id . "','E');\"><i class=\"ace-icon fa fa-edit\" style=\"font-size: 15px;\"></i></a>";
|
||
|
|
||
|
$followup_links = "";
|
||
|
$query_followup = "select * from followup_details where appointment_id='" . $row_employee_appointment['appointment_id'] . "' and ((doctor_attended_flag='N' and attended_status='DRP') or (doctor_attended_flag='Y' and attended_status='MDP') or (doctor_attended_flag='Y' and attended_status='DRP')) and appointment_type='I' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ";
|
||
|
error_log("Patient_Search_followup:" . $query_followup);
|
||
|
if (!$result_followup = @mysqli_query($conn, $query_followup)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
if (mysqli_num_rows($result_followup) > 0) {
|
||
|
while ($row_followup = mysqli_fetch_assoc($result_followup)) {
|
||
|
|
||
|
if (isAccessible($_SESSION['RoleId'], $menu_key, 'W')) {
|
||
|
$followup_links .= "<a href=\"#\" class=\"green\" onclick=\"open_employee_appointment('" . $appointment_id . "','" . $appointment_type . "','" . $emp_id . "','F','" . $row_followup['followup_id'] . "');\">" . $row_followup["ticket_no"] . "</a>";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// $edit_link .= $space;
|
||
|
// }
|
||
|
|
||
|
// if ($appointment_type == 'O') {
|
||
|
|
||
|
// $approve_link = "<a onclick=\"open_approval();\" class=\"blue\" ><i class=\"glyphicon glyphicon-paperclip\"></i></a>";
|
||
|
|
||
|
// $approve_link .= $space;
|
||
|
// } else if ($appointment_type == 'I') {
|
||
|
|
||
|
|
||
|
|
||
|
// $approve_link .= $space;
|
||
|
// }
|
||
|
|
||
|
// $convert_link="<a href=\"#\" class=\"blue\" onclick=\"convertToOPD();\"><i class=\"glyphicon glyphicon-edit\"></i></a>";
|
||
|
|
||
|
|
||
|
// $delete_link="<a href=\"#\" class=\"blue\" onclick=\"delete_employee_appointment_history('".$appointment_id."');\"><i class=\"ace-icon fa fa-trash-o bigger-130\"></i></a>";
|
||
|
|
||
|
// echo $hasReadAccess =isAccessible($_SESSION['RoleId'],$menu_key,'R');
|
||
|
|
||
|
// echo $hasWriteAccess = isAccessible($_SESSION['RoleId'],$menu_key,'W');
|
||
|
|
||
|
// echo $hasReadAccess;
|
||
|
|
||
|
// echo $hasWriteAccess;
|
||
|
|
||
|
if (!isAccessible($_SESSION['RoleId'], $menu_key, 'R')) {
|
||
|
|
||
|
$view_link = "";
|
||
|
}
|
||
|
|
||
|
if (!isAccessible($_SESSION['RoleId'], $menu_key, 'W')) {
|
||
|
|
||
|
$edit_link = "";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$links = $edit_link;
|
||
|
|
||
|
$isEmergency = "";
|
||
|
|
||
|
|
||
|
|
||
|
if ($row_employee_appointment['IsEmergency'] == 1) {
|
||
|
|
||
|
$isEmergency = "<span class=' lighter red'>Yes</i></span>";
|
||
|
} else {
|
||
|
|
||
|
$isEmergency = "<span class='green'>No</i></span>";
|
||
|
}
|
||
|
|
||
|
$doctor_attended_flag = "";
|
||
|
|
||
|
if ($row_employee_appointment['doctor_attended_flag'] == 'Y') {
|
||
|
|
||
|
$doctor_attended_flag = "<span class=' lighter red'>Yes</i></span>";
|
||
|
} else {
|
||
|
|
||
|
$doctor_attended_flag = "<span class='green'>No</i></span>";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
$check_results = "SBP:" . $row_employee_appointment['bp_sbp'] . ", DBP:" . $row_employee_appointment['bp_dbp'] . ", FBS:" . $row_employee_appointment['blood_sugar_fbs'] . ", RBS:" . $row_employee_appointment['blood_sugar_rbs'] . ", PPBS:" . $row_employee_appointment['blood_sugar_ppbs'] . ", TEMP:" . $row_employee_appointment['temperature'] . ", SpO2:" . $row_employee_appointment['spo2_percent'];;
|
||
|
|
||
|
// echo $row_employee_appointment['bp_sbp'];
|
||
|
|
||
|
$data['rows'][] = array(
|
||
|
|
||
|
'id' => $row_employee_appointment['appointment_id'],
|
||
|
|
||
|
'cell' => array(
|
||
|
|
||
|
$links,
|
||
|
|
||
|
$count++,
|
||
|
|
||
|
date_format(date_create($row_employee_appointment['appointment_date']), "d-M-Y H:i A"),
|
||
|
$followup_links,
|
||
|
$row_employee_appointment['ticket_no'],
|
||
|
|
||
|
|
||
|
$row_employee_appointment['emp_code'],
|
||
|
|
||
|
$row_employee_appointment['patient_name'],
|
||
|
|
||
|
$isEmergency,
|
||
|
|
||
|
|
||
|
$doctor_attended_flag,
|
||
|
|
||
|
$complaints,
|
||
|
|
||
|
|
||
|
$check_results,
|
||
|
|
||
|
$row_employee_appointment['remarks_rece'],
|
||
|
|
||
|
|
||
|
|
||
|
)
|
||
|
|
||
|
);
|
||
|
}
|
||
|
|
||
|
$data['rows'][] = array(
|
||
|
|
||
|
'id' => $row['filterkey'],
|
||
|
|
||
|
'cell' => array(
|
||
|
'',
|
||
|
"<input type=hidden name='filterkey' id='filterkey' value=\"" . base64_encode($sql_export) . "\">",
|
||
|
"<input type=hidden name=paramlist id=paramlist value=\"" . base64_encode($paramlist) . "\">",
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
'',
|
||
|
''
|
||
|
)
|
||
|
);
|
||
|
|
||
|
error_log("data: " . print_r($data, true));
|
||
|
|
||
|
echo json_encode($data);
|
||
|
|
||
|
?>
|