ESH/injury_intimation_form.php
2024-10-23 18:28:06 +05:30

388 lines
13 KiB
PHP

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div id="opd_form_div" style="display:none">
<form id="opd_form" name="opd_form">
<?php
//include autoloader;
include('includes/config/config.php');
include_once("includes/functions.php");
error_reporting(E_ERROR | E_PARSE);
error_log("id:" . $_REQUEST['appointment_idpdf']);
$appoint_id = $_REQUEST['appointment_id_pdf'];
if ($appoint_id == '' || $appoint_id == null) {
$appoint_id = $_REQUEST['appointment_idpdf'];
}
$sql_employee_appointment = "select a.*,p.* from employee_appointment a, patient_master p where a.emp_id=p.id and appointment_id='" . $_REQUEST['appointment_idpdf'] . "'";
error_log("sql injury pres:" . $sql_employee_appointment);
$res_emp_appoint = mysqli_query($conn, $sql_employee_appointment);
$row = mysqli_fetch_array($res_emp_appoint);
@extract($rows_emp_appoint);
$patient_name = $rows_emp_appoint['patient_name'];
$followup_id = $rows_emp_appoint['followup_id'];
if ($followup_id == '' || $followup_id == null) {
$followup_id = 0;
}
//echo $query;
$doc_user_id = ($rows_emp_appoint['doctor_last_attended'] != null || 0 || "") ? $rows_emp_appoint['doctor_last_attended'] : $rows_emp_appoint['modified_by'];
$doc_emp_id = getTableFieldValue('tbl_users', 'emp_id', 'user_id', $doc_user_id, '');
$doc_name = getTableFieldValue('patient_master', 'patient_name', 'id', $doc_emp_id, '');
// $result = mysqli_query($conn, $query);
// $row = mysqli_fetch_array($result);
@extract($row);
$sql_doc_details = "select * from employee_signature where emp_id='$doc_emp_id'";
$result_doc_details = mysqli_query($conn, $sql_doc_details);
$row_doc_details = mysqli_fetch_array($result_doc_details);
$employee_code = $rows_emp_appoint['emp_code'];
$father_name = $rows_emp_appoint['father_name'];
if ($rows_emp_appoint['IsEmergency'] == 1) {
$ans = "Yes";
} else {
$ans = "No";
}
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i:s');
$currentDate = date_format(date_create($date), "d-M-Y h:i:sa ");
$ailment_names = $row['ailments_new'];
$ailment_system_name = $row['ailment_systems_new'];
$injury_part_names = $row['injury_parts_new'];
$health_advices = $row['health_advices_new']; //getCommaSeperatedValuesForInClause("select health_advice_name from health_advice ","health_advice_id",$rows_emp_appoint['health_advices']);
$tests = $rows_emp_appoint['recommended_tests_new']; //getCommaSeperatedValuesForInClause("select section_name from checkup_form_section ","section_id",$rows_emp_appoint['tests']);
$sql_get_sick = "SELECT date_absent,date_absent_to,half_day,approval_date FROM sickness WHERE followup_to_opd = '" . $appoint_id . "' and followup_id = '" . $followup_id . "' ";
error_log("error" . $sql_get_sick);
// echo $sql_get_sick;
error_log("OPD PDF QUERY:" . $sql_get_sick);
$res_det_sick = mysqli_query($conn, $sql_get_sick);
$data_for_sick = mysqli_fetch_array($res_det_sick);
@extract($data_for_sick);
?>
<style>
body {
text-transform: capitalize;
}
.tbl1 {
width: 100%;
}
th {
background-color: #e1e1e1;
font-size: 12px;
font-style: bold;
vertical-align: top;
}
td {
text-align: left;
font-size: 12px;
vertical-align: top;
}
</style>
</head>
<body>
<table border="1" cellspacing="0" width="100%">
<tr>
<th colspan="3" align="center" style="font-size: 20px;background-color: #243557;color: white">Injury
Intimation
Form</th>
</tr>
<tr>
<td width="100%" colspan="3"></td>
</tr>
<tr>
<th colspan="3">Reporting Time in OHC: <?php echo date("G:i a", strtotime($row['appointment_date'])) ?>
<span style="margin-left:250px">Date:
<?php echo date("d/M/Y", strtotime($row['appointment_date'])) ?></span>
</th>
</tr>
<tr>
<td colspan="1">Name Of Patient</td>
<td colspan="2"><?php echo $patient_name; ?></td>
</tr>
<tr>
<td colspan="1">Employee ID <?php echo $row['emp_code'] ?></td>
<td colspan="1">Age of Patient <?php
$from = new DateTime($row['dob']);
$to = new DateTime('today');
echo $from->diff($to)->y; ?></td>
<td colspan="1">Sex <?php if ($row['gender'] == 'M') {
echo 'Male';
} else {
echo 'Female';
} ?></td>
</tr>
<tr>
<td colspan="1">Individual Contact No.</td>
<td colspan="2"><?php echo $row['primary_phone'] ?></td>
</tr>
<tr>
<td colspan="1">Designation and employment status</td>
<td colspan="2">
<?php echo getTableFieldValue('designation', 'designation_name', 'designation_id', $row['designation_id']) ?>
and <?php echo $row['status'] ?></td>
</tr>
<tr>
<td colspan="1">Division/Department/Station</td>
<td colspan="2">
<?php echo getTableFieldValue('bussiness_unit', 'bu_name', 'bu_id', $row['bu_id']) ?>/<?php echo getTableFieldValue('department', 'dept_name', 'dept_id', $row['dept_id']) ?>/<?php echo getTableFieldValue('section', 'section_name', 'section_id', $row['section_id']) ?>
</td>
</tr>
<tr>
<td colspan="1">Name Of Supervisor and Contact no</td>
<td colspan="2">
<?php echo getTableFieldValue('patient_master', 'patient_name', 'id', $row['emp_mgr_code']) ?>
and
<?php echo getTableFieldValue('patient_master', 'primary_phone', 'id', $row['emp_mgr_code']) ?></td>
</tr>
<tr>
<td colspan="1">Reporting Time in OHC[24 Hrs format]</td>
<td colspan="2"><?php echo date("g:i a", strtotime($row['appointment_date'])) ?></td>
</tr>
<tr>
<th align="center" colspan="3">OCCURANCE OF INJURY</th>
</tr>
<tr>
<td colspan="1">Injury Time: <?php echo date("G:i a", strtotime($row['injury_time'])) ?></td>
<td colspan="1">Date: <?php echo date("d/M/Y", strtotime($row['appointment_date'])) ?></td>
<td colspan="1">Shift: <?php echo $row['shift_type'] ?></td>
</tr>
<tr>
<td colspan="1">Activity</td>
<td colspan="2">
<?php if (strcmp($row['activity'], 'R') == 0) {
echo "ROUTINE";
}
if (strcmp($row['activity'], 'NR') == 0) {
echo "NON-ROUTINE";
}
if (strcmp($row['activity'], 'E') == 0) {
echo "EMERGENCY";
} ?>
</td>
</tr>
<tr>
<td colspan="1">PPE</td>
<td colspan="2">
<?php if (strcmp($row['ppe'], 'U') == 0) {
echo 'USED';
}
if (strcmp($row['ppe'], 'NU') == 0) {
echo 'UNUSED';
} else {
echo 'NOT APPLICABLE';
} ?>
</td>
</tr>
<tr>
<td colspan="1">Location of Injury</td>
<td colspan="2"><?php echo $row['incident_location'] ?></td>
</tr>
<?php
$injury_type_names = explode(',', $row['injury_types_new']);
$injury_part_names = explode(',', $row['injury_parts_new']);
// error_log("injury part name: ".print_r($injury_part_names, true)." length: ".count($injury_part_names));
$injury_class_names = explode(',', $row['injury_classes_new']);
?>
<tr>
<td width="50%">Injury Category
</td>
<td width="50%"><?php
foreach ($injury_class_names as $injury_class_name) { ?>
<span><?php echo strtoupper(getTableFieldValue('injury_class', 'inj_class_name', 'inj_class_id', $injury_class_name)); ?>,&nbsp;&nbsp;</span>
<?php }
?>
</td>
<td></td>
</tr>
<tr>
<td width="50%">Injury Type </span>
</td>
<td width="50%"><?php
foreach ($injury_type_names as $injury_type_name) { ?>
<span><?php echo strtoupper(getTableFieldValue('injury_type', 'injury_type_name', 'injury_type_id', $injury_type_name)); ?>,&nbsp;&nbsp;</span>
<?php }
?>
</td>
<td></td>
</tr>
<tr>
<td width="50%">Body part classification</td>
<?php $injury_parts_ids = $row['injury_parts_new'];
$injury_parts_ids_array = array();
$injury_parts_ids_array = explode(",", $injury_parts_ids);
error_log("injury part " . $injury_parts_ids_array);
$injury_part_names = "";
for ($i = 0; $i < count($injury_parts_ids_array); $i++) {
if ($i == 0) {
$injury_part_names = getTableFieldValue('injury_part', 'inj_name', 'inj_id', $injury_parts_ids_array[$i]);
} else {
$injury_part_names = $injury_part_names . "," . getTableFieldValue('injury_part', 'inj_name', 'inj_id', $injury_parts_ids_array[$i]);
}
} ?>
<td width="50%" colspan="2"><?php echo $injury_part_names; ?></td>
</tr>
<tr>
<td width="50%">Injury Mechanism</td>
<td width="50%" colspan="2">
<?php echo getTableFieldValue('injury_mechanism', 'injury_mech_name', 'injury_mech_id', $row['injury_mech']) ?>
</td>
</tr>
<!-- <tr>
<td width="50%" height="3%">Descriprtion of incident</td>
<td width="50%" colspan="2" height="3%"><?php echo $row['remarks_rece'] ?></td>
</tr> -->
<tr>
<td width="50%">Follow Up</td>
<td width="50%" colspan="2"><?php echo date_format(date_create($row['followup']), "d-M-Y") ?></td>
</tr>
<tr>
<td width="50%">Period Of Rest</td>
<td width="50%" colspan="2">
<?php
if(!empty($data_for_sick['date_absent']) )
echo "From " . date_format(date_create($data_for_sick['date_absent']), "d-M-Y") ;
if(!empty($data_for_sick['date_absent_to']) )
echo " To " . date_format(date_create($data_for_sick['date_absent_to']), "d-M-Y") ;?>
</td>
</tr>
<tr>
<td width="50%">Referral</td>
<td width="50%" colspan="2">
<?php echo nl2br(($row['referral'] != '') ? getCommaSeperatedValuesForInClause("select referral_point_name from referral_point ", "referral_point_id ", $row['referral']) : "N/A") ?>
</td>
</tr>
<tr>
<td width="100%" colspan="3" height="8%">
<b><u>OHC Staff Notes:</u></b> <?= $row['remarks_rece'] ?>
</td>
</tr>
<tr style="border-bottom: none;">
<td width="100%" colspan="3" style="border-bottom: none;"><b><u>Treatments:</u></b> </td>
</tr>
<tr style="border-top: none;">
<td width="100%" colspan="3" style="border-top: none;"> <?php include('treatment_view_common.php'); ?></td>
</tr>
<tr>
<td width="100%" colspan="3" height="10%"><b><u>Remark By Medical Officer :</u></b>
<?php echo $row['injury_remarks'] ?><br><br><br><br><span style="margin-left: 550px;"></td>
</tr>
</table>
<table width="100%">
<tr>
<td>
<?php if($row_doc_details['emp_sign']!='' || $row_doc_details['emp_sign']!=null){ ?>
<img src="data:<?php echo $row_doc_details['image_type'] ?>;base64,<?php echo base64_encode($row_doc_details['emp_sign']) ?>"
style="width: 120px; height: 80px;float: right" />
</td>
<?php }?>
</tr>
</table>
</form>
<form id="employeeDetailsFormPdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
</div>
</body>
<script>
formSubmit();
function formSubmit() {
$("#htmlText").val($("#opd_form").html());
document.forms['employeeDetailsFormPdf'].action = "pdf_dynamic.php";
document.forms['employeeDetailsFormPdf'].method = "post";
document.forms['employeeDetailsFormPdf'].submit();
}
</script>