";
// $view_link = $space . "";
$dashboard_link=$space . "";
}
if (isAccessible($_SESSION['RoleId'], $menu_key, 'W')) {
$edit_link = $space . "";
}
if (isAccessible($_SESSION['RoleId'], $menu_key, 'E') && $treatment_text == '' && $row_employee_appointment['doctor_attended_flag'] != 'Y') {
$delete_link = $space . "";
}
$detention_status = '';
if( $row_employee_appointment['is_discharge']=='Y'){
$detention_status = "Discharge";
}
else{
$detention_status = "Admitted";
}
if($row_employee_appointment['doctor_attended_flag'] != 'Y'){
$pdf_link="";
}
$links = $view_link . $edit_link . $delete_link . $pdf_link . $dashboard_link;
// $doctor_attended_flag = "No";
// if ($row_employee_appointment['doctor_attended_flag'] == 'Y') {
// $doctor_attended_flag = "Yes";
// } else {
// $doctor_attended_flag = "No";
// }
if ($row_employee_appointment['is_detention']=='Y' || $row_employee_appointment['is_detention']=='N') {
$doctor_attended_flag = "YES";
}else{
$doctor_attended_flag = "NO";
}
$complaint_ids = $row_employee_appointment['complaints'];
$complaint_ids_array = array();
$complaint_ids_array = explode(",", $complaint_ids);
$complaints = "";
for ($i = 0; $i < count($complaint_ids_array); $i++) {
if ($i == 0) {
if (is_numeric($complaint_ids_array[$i])) {
$complaints = getTableFieldValue('complaints', 'complaint', 'complaint_id', $complaint_ids_array[$i]);
} else {
$complaints = $complaint_ids_array[$i];
}
} else {
if (is_numeric($complaint_ids_array[$i])) {
$complaints = $complaints . "," . getTableFieldValue('complaints', 'complaint', 'complaint_id', $complaint_ids_array[$i]);
} else {
$complaints = $complaints . "," . $complaint_ids_array[$i];
}
}
}
$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'] . ",Temp:" . $row_employee_appointment['temperature'] . ",SPOC2%:" . $row_employee_appointment['spo2_percent'];
$data['rows'][] = array(
'id' => $row_employee_appointment['appointment_id'],
'cell' => array(
$count ++,
$links,
date_format(date_create($row_employee_appointment['appointment_date']), "d-M-Y H:i "),
$row_employee_appointment['ticket_no'],
$row_employee_appointment['emp_code'],
$row_employee_appointment['patient_name'],
$doctor_attended_flag,
$detention_status,
$complaints,
getTableFieldValue("examination_findings","examination_finding","id",$row_employee_appointment['examination_remarks']),
$diagnosis,
$treatment_text,
$row_employee_appointment['referral'],
$row_employee_appointment['followup'],
$check_results
)
);
}
$data['rows'][] = array(
'id' => $row['filterkey'],
'cell' => array('', "", "", '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
);
echo json_encode($data);
?>