295 lines
12 KiB
PHP
295 lines
12 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
include('includes/functions.php');
|
||
|
|
||
|
header("Content-type:application/octet-stream");
|
||
|
|
||
|
header("Content-type: application/x-msdownload");
|
||
|
header("Content-Disposition: attachment; filename=detention_report_excel.xls");
|
||
|
header("Pragma: no-cache");
|
||
|
header("Expires: 0");
|
||
|
error_reporting(E_ERROR | E_PARSE);
|
||
|
// $month = $_POST['month6'];
|
||
|
// $year = $_POST['year6'];
|
||
|
|
||
|
$date1 = $_REQUEST['date1'];
|
||
|
$date2 = $_REQUEST['date2'];
|
||
|
$date1 = date("Y-m-d", strtotime($date1));
|
||
|
$date2 = date("Y-m-d", strtotime($date2));
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$month_name = date("F", mktime(0, 0, 0, $month, 10));
|
||
|
|
||
|
?>
|
||
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
||
|
<style>
|
||
|
@page {
|
||
|
margin: 15px;
|
||
|
}
|
||
|
|
||
|
.btn {
|
||
|
background-color: #4CAF50;
|
||
|
border-radius: 5%;
|
||
|
/* Green */
|
||
|
border: none;
|
||
|
color: white;
|
||
|
padding: 5px 8px;
|
||
|
text-align: center;
|
||
|
text-decoration: none;
|
||
|
display: inline-block;
|
||
|
font-size: 12px;
|
||
|
margin: 4px 2px;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
@media print {
|
||
|
#printPageButton {
|
||
|
display: none;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<?php include('excel_ohc_header.php') ?>
|
||
|
<table width="100%">
|
||
|
<tr>
|
||
|
|
||
|
<td align="center" style="font-size: 15px"><strong>Detention Report</strong></td>
|
||
|
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="left" style="font-size: 12px"><strong>For Month: <?php echo $month_name; ?></strong></td>
|
||
|
<td align="right" style="font-size: 15px"><button align="center" id="printPageButton" class="btn btn-success"
|
||
|
onClick="window.print();">Print</button></td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
<table border="1" width="100%" cellspacing="0">
|
||
|
<?php
|
||
|
|
||
|
|
||
|
$sqll = "SELECT count(*) as total FROM `detention_master` a LEFT JOIN employee_appointment b on a.opd_id = b.appointment_id left join patient_master c on b.emp_id=c.id WHERE b.appointment_date BETWEEN '$date1' AND '$date2' ORDER BY a.reporting_time ASC";
|
||
|
|
||
|
|
||
|
|
||
|
$result_sqll = mysqli_query($conn, $sqll);
|
||
|
$num_rows = mysqli_num_rows($result_sqll);
|
||
|
$row0 = mysqli_fetch_assoc($result_sqll);
|
||
|
// error_log("total".$row0['total']);
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
<strong>
|
||
|
<tr bgcolor="#eeeeee">
|
||
|
<td align="left" width="2%">Sr.</td>
|
||
|
<td align="left" width="4%">Admit Date</td>
|
||
|
<td align="left" width="4%">Admit Time .</td>
|
||
|
<td align="left" width="4%">Discharge Date</td>
|
||
|
<td align="left" width="4%">Discharge Time </td>
|
||
|
<td align="left" width="3%">Duration</td>
|
||
|
<td align="left" width="2%">Shift</td>
|
||
|
<td align="left" width="5%">Ticket No</td>
|
||
|
<td align="left" width="2%">Ecode / G.Pass</td>
|
||
|
<td align="left" width="10%">Patient Name</td>
|
||
|
<td align="left" width="2%">Age</td>
|
||
|
<td align="left" width="2%">Sex</td>
|
||
|
<td align="left" width="2%">Employeer</td>
|
||
|
<td align="left" width="2%">Division</td>
|
||
|
<td align="left" width="4%">Department</td>
|
||
|
<td align="left" width="2%">Ute</td>
|
||
|
<td align="left" width="2%">Station</td>
|
||
|
<td align="left" width="5%">Mobile</td>
|
||
|
<td align="left" width="2%">Patient Type</td>
|
||
|
<td align="left" width="2%">Disease Type</td>
|
||
|
<td align="left" width="2%"> Reffered By</td>
|
||
|
<td align="left" width="2%">Reffered To</td>
|
||
|
<td align="left" width="10%">Complaints</td>
|
||
|
<td align="left" width="2%">Exam Find</td>
|
||
|
<td align="left" width="2%">Dignosis</td>
|
||
|
<td align="left" width="2%">Body System</td>
|
||
|
<td align="left" width="15%">Treatment</td>
|
||
|
<td align="left" width="2%">Referral</td>
|
||
|
<td align="left" width="2%">Follow Up</td>
|
||
|
<td align="left" width="2%">Detention Status</td>
|
||
|
<td align="left" width="2%">Doctor Consulted</td>
|
||
|
<td align="left" width="2%">Vitals</td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
$count = 1;
|
||
|
$sql = "SELECT DATE_FORMAT(a.reporting_time, '%d-%m-%y') as rep_date,DATE_FORMAT(a.disposal_time, '%d-%m-%y') as dis_date,a.*,c.*, b.* FROM `detention_master` a LEFT JOIN employee_appointment b on a.opd_id = b.appointment_id left join patient_master c on b.emp_id=c.id WHERE b.appointment_date BETWEEN '$date1' AND '$date2' and c.patient_cat_id='$detention_cat'".$is_depend ." ORDER BY a.reporting_time ASC";
|
||
|
error_log('pdf'.$sql);
|
||
|
|
||
|
$result = mysqli_query($conn, $sql);
|
||
|
|
||
|
while ($row1 = mysqli_fetch_array($result)) {
|
||
|
extract($row1);
|
||
|
error_log(getFieldFromTable("ailment_sys_name", "ailment_system", "ailment_sys_id", $row1['ailment_systems_new']));
|
||
|
?>
|
||
|
|
||
|
<tr>
|
||
|
<td><?php echo $count ?></td>
|
||
|
<td><?php echo date_format(date_create($row1['reporting_time']), "d-M-Y "); ?>
|
||
|
</td>
|
||
|
<td><?php echo date_format(date_create($row1['reporting_time']), "g:i A"); ?>
|
||
|
</td>
|
||
|
<td><?php echo date_format(date_create($row1['disposal_time']), "d-M-Y "); ?>
|
||
|
</td>
|
||
|
<td><?php echo date_format(date_create($row1['disposal_time']), "g:i A"); ?>
|
||
|
</td>
|
||
|
|
||
|
<td>
|
||
|
|
||
|
<?php
|
||
|
$time = date_diff(date_create($row1['reporting_time']), date_create($row1['disposal_time']));
|
||
|
|
||
|
|
||
|
if ($time->h == 0) {
|
||
|
echo date_diff(date_create($row1['reporting_time']), date_create($row1['disposal_time']))->i . "min ";
|
||
|
} else {
|
||
|
if ($time->i == 0) {
|
||
|
echo date_diff(date_create($row1['reporting_time']), date_create($row1['disposal_time']))->h . "hr ";
|
||
|
} else {
|
||
|
echo date_diff(date_create($row1['reporting_time']), date_create($row1['disposal_time']))->h . "hr " . date_diff(date_create($row1['reporting_time']), date_create($row1['disposal_time']))->i . "min ";
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
</td>
|
||
|
|
||
|
<td><?php echo $row1['shift_type'] ?></td>
|
||
|
|
||
|
<td><?php echo $row1['ticket_no'] ?></td>
|
||
|
<td><?php echo $row1['emp_code'] ?></td>
|
||
|
<td><?php echo $row1['patient_name'] ?></td>
|
||
|
|
||
|
|
||
|
<td><?php echo datediff($row1['dob']) ?></td>
|
||
|
<td><?php
|
||
|
if ($row1['gender'] == 'M') {
|
||
|
echo "Male";
|
||
|
} else {
|
||
|
echo "Female";
|
||
|
}
|
||
|
|
||
|
?></td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("employer_contractor_name", "employer_contractor", "id", $row1['employer_contractor_id']); ?>
|
||
|
</td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("bu_name", "bussiness_unit", "bu_id", $row1['bu_id']); ?></td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("dept_name", "department", "dept_id", $row1['dept_id']); ?></td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("section_name", "section", "section_id", $row1['section_id']); ?></td>
|
||
|
<td><?php echo getFieldFromTable("sub_section_name", "sub_section", "sub_section_id", $row1['sub_section_id']) ?>
|
||
|
</td>
|
||
|
<td><?php echo $row1['primary_phone'] ?></td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("patient_cat_name", "patient_category", "patient_cat_id", $row1['patient_cat_id']); ?>
|
||
|
</td>
|
||
|
<td><?php echo $row1['disease_type']; ?></td>
|
||
|
|
||
|
<td><?php echo getFieldFromTable("referred_by", "referred_by_master", "id", $row1['referred_by']); ?></td>
|
||
|
<td>
|
||
|
<?php
|
||
|
if ($row1['referred_to'] == "DEPT") {
|
||
|
echo "Department";
|
||
|
} elseif ($row1['referred_to'] == "HR") {
|
||
|
echo "HR";
|
||
|
} elseif ($row1['referred_to'] == "IR") {
|
||
|
echo "IR";
|
||
|
} elseif ($row1['referred_to'] == "HOS") {
|
||
|
echo "Hospital";
|
||
|
}
|
||
|
?></td>
|
||
|
<?php
|
||
|
$complaint_ids = $row1['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];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
<td><?php echo $complaints ?></td>
|
||
|
<?php
|
||
|
$findings_ids = $row1['examination_remarks'];
|
||
|
$findings_ids_array = array();
|
||
|
$findings_ids_array = explode(",", $findings_ids);
|
||
|
$findings = "";
|
||
|
for ($i = 0; $i < count($findings_ids_array); $i++) {
|
||
|
if ($i == 0) {
|
||
|
$findings = getTableFieldValue('examination_findings', 'examination_finding', 'id', $findings_ids_array[$i]);
|
||
|
} else {
|
||
|
$findings = $findings . "," . getTableFieldValue('examination_findings', 'examination_finding', 'id', $findings_ids_array[$i]);
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<td><?php echo $findings ?></td>
|
||
|
|
||
|
<?php
|
||
|
$ailment_names_ids = $row1['ailments_new'];
|
||
|
$ailment_names_ids_array = array();
|
||
|
$ailment_names_ids_array = explode(",", $ailment_names_ids);
|
||
|
$ailment_names = "";
|
||
|
for ($i = 0; $i < count($ailment_names_ids_array); $i++) {
|
||
|
if ($i == 0) {
|
||
|
$ailment_names = getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
|
||
|
} else {
|
||
|
$ailment_names = $ailment_names . "," . getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
<td><?php echo $ailment_names ?></td>
|
||
|
<td><?php echo getFieldFromTable("ailment_sys_name", "ailment_system", "ailment_sys_id", $row1['ailment_systems_new']); ?>
|
||
|
</td>
|
||
|
|
||
|
|
||
|
<td><?php echo getTreatmentText($row1['appointment_id']) ?></td>
|
||
|
<td><?php echo $row1['referral'] ?></td>
|
||
|
<td><?php echo $row1['followup_remarks'] ?></td>
|
||
|
<td><?php if ($row1['is_detention'] == 'Y') {
|
||
|
echo "Discharge";
|
||
|
} else {
|
||
|
echo "Admit";
|
||
|
} ?></td>
|
||
|
<td><?php if ($row1['doctor_attended_flag'] == 'Y') {
|
||
|
echo "Yes";
|
||
|
} else {
|
||
|
echo "No";
|
||
|
} ?></td>
|
||
|
|
||
|
<td><?php echo "SBP:" . $row1['bp_sbp'] . ", DBP:" . $row1['bp_dbp'] . ", FBS:" . $row1['blood_sugar_fbs'] . ", RBS:" . $row1['blood_sugar_rbs'] . ",Temp:" . $row1['temperature'] . ",SPOC2%:" . $row1['spo2_percent'] . ",WEIGHT:" . $row1['weight'] . ",HEIGHT:" . $row1['height'] . ",BMI:" . $row1['bmi'] . ",RESPIARATORY RATE:" . $row1['respiratory_rate'] . ",HEART RATE:" . $row1['heart_rate'] . ",URINE OUTPUT:" . $row1['urine_output'] . ",OXYGEN SUPPLY:" . $row1['oxygen_supply'] . ",AVPU" . $row1['avpu'] . ", MOBILITY:" . $row1['mobility'] . ",TRAMA:" . $row1['trama'] . ", GLASGOW COMA SCALE:" . $row1['glasgow_coma_scale']; ?>
|
||
|
</td>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
<?php
|
||
|
$count++;
|
||
|
}
|
||
|
?>
|
||
|
<tr Height="10px">
|
||
|
<td colspan="8"><b>TOTAL: <?php echo $row0['total'] ?></b></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</body>
|