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

652 lines
23 KiB
PHP

<link rel="stylesheet"
href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
<link rel="stylesheet"
href="assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
<link rel="stylesheet"
href="adminlte/bower_components/bootstrap/less/type.less" />
<script src="assets/js/jquery-ui.custom.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/chosen.jquery.min.js"></script>
<script src="assets/js/spinbox.min.js"></script>
<script src="assets/js/bootstrap-datepicker.min.js"></script>
<script src="assets/js/bootstrap-timepicker.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script src="assets/js/buttons.flash.min.js"></script>
<script src="assets/js/buttons.html5.min.js"></script>
<script src="assets/js/buttons.print.min.js"></script>
<script src="assets/js/buttons.colVis.min.js"></script>
<script src="assets/js/dataTables.select.min.js"></script>
<script src="assets/js/moment.min.js"></script>
<script src="assets/js/daterangepicker.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script src="assets/js/jquery.knob.min.js"></script>
<script src="assets/js/autosize.min.js"></script>
<script src="assets/js/jquery.inputlimiter.min.js"></script>
<script src="assets/js/jquery.maskedinput.min.js"></script>
<script src="assets/js/bootstrap-tag.min.js"></script>
<script src="assets/js/ace-elements.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".glyphicon").css("top","");
});
function open_treatments(appointment_id){
$('#modal-add-consultation').modal("show");
}
</script>
<?php
include ('includes/config/config.php');
$rolecode = $_SESSION['RoleCode'];
//echo $rolecode;
if (isset($_REQUEST['appointmentId'])) {
$sql = "select * from employee_appointment where appointment_id='" . $_REQUEST['appointmentId'] . "'";
//echo "query:".$sql;
$appointment_id=$_REQUEST['appointmentId'];
//echo $appointment_id;
$result = mysqli_query($conn,$sql);
$num_rows = @mysqli_num_rows($result);
$row = null;
// echo fhfh;
if ($num_rows > 0) {
$row = @mysqli_fetch_array($result);
}
}
?>
<script>
var rolecode='<?php echo $_SESSION ['RoleCode']?>';
</script>
<form id="opd_form" method="post">
<div class="widget-box box box-success" id="opd_form_pdf"
style="margin-left: 5px; margin-right: 50px; width: 99%">
<div class="widget-header" data-action="fullscreen">
<h5 class="widget-title">Patient OPD - <?php echo $patient_name?></h5>
<div class="widget-toolbar" style="float: right">
<div class="clearfix">
<div class="pull-right tableTools-container">
<div class="dt-buttons btn-overlap btn-group ">
<a href="<?php echo $_REQUEST['returnPage'].'&backButon=back'?>"
class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold save_button"
style="float: left;">Back</a> <a
class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold save_button"
id="forwardButton" tabindex="0" aria-controls="dynamic-table"
data-original-title="" title=""><span><i
class="fa fa-floppy-o bigger-110 green"></i> <span
class="hidden">Save</span></span></a> <a
class="dt-button buttons-print btn btn-white btn-primary btn-bold"
onclick="exporttopdf();" tabindex="0"
aria-controls="dynamic-table" data-original-title="" title=""><span><i
class="fa fa-print bigger-110 grey"></i> <span class="hidden">Print</span></span></a>
<a
class="dt-button buttons-print btn btn-white btn-primary btn-bold"
data-action="fullscreen" tabindex="0"
aria-controls="dynamic-table" data-original-title="" title=""><span><i
class="fa fa fa-expand bigger-110 grey"></i> <span
class="hidden">Maximize</span></span></a> <input type="hidden"
name="attendedStatus" id="attendedStatus"
<?php if ($rolecode == 'DOC'){ ?>
value="<?php echo $__STATUS_DOCTOR_ATTENDED?>" <?php }?>
<?php if ($rolecode == 'DIS'){ ?>
value="<?php echo $__STATUS_PHARMACY_ATTENDED?>" <?php }?>
<?php if ($rolecode == 'LAB'){ ?>
value="<?php echo $__STATUS_MEDICAL_ATTENDED?>" <?php }?>/> <input
type="hidden" name="doctor_last_attended"
id="doctor_last_attended" <?php if ($rolecode == 'DOC'){ ?>
value="<?php echo $_SESSION['user_id']?>" <?php }else {?>
value="<?php echo $row['doctor_last_attended']?>" <?php }?> />
</div>
</div>
</div>
</div>
</div>
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-10 table-responsive">
<div class="widget-box box box-warning">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-sm-3">
<label class="control-label" for="appoint"><strong
style="font-size: 11px">Ticket No</strong></label> <input
id="ticket_no" type="hidden" style="height: 30px"
class="form-control" name="ticket_no"
value="<?php echo $row['ticket_no'];?>" /> <input
id="appoint" type="hidden" style="height: 30px"
class="form-control" name="appoint"
value="<?php echo $_REQUEST['appointmentId']?>"/>
<div class="input-group">
<?php echo $row['ticket_no'];?>
</div>
</div>
<div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px">Token No</strong></label>
<div class="input-group">
<?php echo $row['token_no']?>
</div>
</div>
<div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px">Visit Date</strong></label>
<div class="input-group">
<span><?php echo date_format(date_create($row['appointment_date']),"d-M-Y h:i:sa ")?> </span>
</div>
</div>
<div class=" col-sm-3">
<label class="control-label" for="followup_to_opd"><strong
style="font-size: 11px">Followup to(if Applicable)</strong></label>
<div class="input-group">
<?php echo getFieldFromTable("CONCAT(ticket_no,' ',DATE_FORMAT(appointment_date,'%d-%b-%Y %l:%i %p '))",'employee_appointment','appointment_id',$row['followup_to_opd'])?>
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-4">
<label class="control-label" for="injury_time"><strong
style="font-size: 11px">Injury Time</strong></label>
<div class="input-group">
<span><?php echo date_format(date_create($row['injury_time']),"d-M-Y h:i:sa ")?> </span></div>
</div>
<div class="col-sm-8">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Incident Location</strong></label>
<div class="input-group">
<?php echo nl2br($row['incident_location'])?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-4">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Injury Description</strong></label>
<div class="input-group"><?php echo nl2br($row['complaints'])?></div>
</div>
<div class="col-sm-4">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Remarks/Follow-up Investigation Details</strong></label>
<div class="input-group"><?php echo nl2br($row['remarks_rece'])?></div>
</div>
<div class="col-sm-4">
<label class="control-label"><strong
style="font-size: 11px">On Examination Findings</strong></label>
<div class="input-group"><?php echo nl2br($row['examination_remarks'])?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Injury</strong></label>
<table
class="table table-bordered table-hover simple-table">
<thead>
<tr class="active">
<th><strong style="font-size: 11px">Type</strong></th>
<th><strong style="font-size: 11px">Part</strong></th>
<th><strong style="font-size: 11px">Classification</strong></th>
</tr>
</thead>
<tbody>
<?php
$injury_type_ids=$row['injury_types_new'];
$injury_type_ids_array=array();
$injury_type_ids_array= explode(",",$injury_type_ids);
$injury_type_names="";
for($i=0;$i<count($injury_type_ids_array);$i++){
if($i==0){
$injury_type_names=getTableFieldValue('injury_type','injury_type_name','injury_type_id',$injury_type_ids_array[$i]);
}else{
$injury_type_names=$injury_type_names.",".getTableFieldValue('injury_type','injury_type_name','injury_type_id',$injury_type_ids_array[$i]);
}
}
$injury_class_ids=$row['injury_classes_new'];
$injury_class_ids_array=array();
$injury_class_ids_array= explode(",",$injury_class_ids);
$injury_class_names="";
for($i=0;$i<count($injury_class_ids_array);$i++){
if($i==0){
$injury_class_names=getTableFieldValue('injury_class','inj_class_name','inj_class_id',$injury_class_ids_array[$i]);
}else{
$injury_class_names=$injury_class_names.",".getTableFieldValue('injury_class','inj_class_name','inj_class_id',$injury_class_ids_array[$i]);
}
}
$injury_parts_ids=$row['injury_parts_new'];
$injury_parts_ids_array=array();
$injury_parts_ids_array= explode(",",$injury_parts_ids);
$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]);
}
}
?>
<tr>
<td class="col-sm-4"><?php echo $injury_type_names; ?></td>
<td class="col-sm-4"><?php echo $injury_part_names ?></td>
<td class="col-sm-4"><?php echo $injury_class_names?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="remarks"><strong
style="font-size: 11px">Procedures Done(if Any)</strong></label>
<div class="input-group"><?php echo nl2br($row['injury_procedure'])?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<?php $appointment_id=$_REQUEST['appointmentId'] ; ?>
<?php include('treatment_view_common.php'); ?>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<label class="control-label" for="referral"><strong
style="font-size: 11px">Additional Recommendations(If Any)</strong></label>
<?php echo nl2br($row['external_treatments'])?>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-6">
<label class="control-label" for="referral"><strong
style="font-size: 11px">Referral</strong></label>
<div class="input-group"><?php echo nl2br(($row['referral']!='')?$row['referral']:"N/A")?></div>
</div>
<div class="col-sm-6">
<label class="control-label" for="followup"><strong
style="font-size: 11px">Follow-up</strong></label>
<div class="input-group"><?php echo nl2br(($row['followup']!='')?$row['followup']:"N/A")?></div>
</div>
</div>
<?php if($row['recommended_tests_new']!="" && $row['recommended_tests_new']!=null){?>
<div class="row">
<div class="col-sm-12 table-responsive">
</br>
<label class="control-label" for="additional_advices"><strong
style="font-size: 11px">Doctor Recommended Tests :</strong></label>
</div>
<div class="col-sm-12 table-responsive">
<input type="hidden" name="recommended_tests_new" value="<?php echo $row['recommended_tests_new']?>">
<div class="row">
<?php $test_array=explode(",",$row['recommended_tests_new']);
for($i=0;$i<count($test_array);$i++){?>
<?php if($i%2==0){?>
</div>
<div class="row">
<?php }?>
<div class="col-sm-6 table-responsive">
<?php echo $i+1;?>&nbsp;<?php echo $test_array[$i] ?>
<?php $test_map_array=getKeyValueMapWithWhere('doctor_recommended_test','test_name','test_result','appointment_id',$_REQUEST['appointmentId']);?>
<textarea name="test_<?php echo $i?>" rows="4" cols="4"
id="test_<?php echo $i?>"
placeholder="<?php echo $test_array[$i]?> Test Result"
class="autosize-transition form-control"
style="overflow: hidden; overflow-wrap: break-word;"><?php echo $test_map_array[$test_array[$i]]?></textarea>
</div>
<?php }
?>
</div>
</div>
</div>
<?php }?>
</div>
<!-- /.col-xs-12 -->
</div>
<!--row end-->
</div>
<!--end of widget-main-->
</div>
<!--end of widget-body-->
</div>
<!--end of widget-box-->
</div>
<div class="col-xs-2 table-responsive">
<div class="widget-box box box-danger">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="form-field-select-1"><strong
style="font-size: 11px">Emergency?</strong></label>
: <?php if($row['IsEmergency']==0){echo "No";}else {echo "Yes";}?>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div>
<div class="col-sm-3">SBP:<?php echo $row['bp_sbp']?></div>
<div class="col-sm-3">DBP:<?php echo $row['bp_dbp']?></div>
<div class="col-sm-6">Heart Rate:<?php echo $row['heart_rate']?></div>
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div>
<div class="col-sm-3">FBS:<?php echo $row['blood_sugar_fbs']?></div>
<div class="col-sm-3">RBS:<?php echo $row['blood_sugar_rbs']?></div>
<div class="col-sm-3">PPBS:<?php echo $row['blood_sugar_ppbs']?></div>
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div>
<div class="col-sm-6">Temp:<?php echo $row['temperature']?></div>
<div class="col-sm-6">SPOC2%:<?php echo $row['spo2_percent']?></div>
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="injury_part"><strong
style="font-size: 11px">Affected Body Parts</strong></label>
<div class="input-group"> <?php echo $row['injury_parts_new']?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="health_advice_name"><strong
style="font-size: 11px">Health Advices</strong></label>
<div class="input-group"><?php echo nl2br($row['health_advices_new'])?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="additional_advices"><strong
style="font-size: 11px">Additional Precautions</strong></label>
<div class="input-group"><?php echo nl2br($row['remarks'])?></div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<label class="control-label" for="followup_remarks"><strong
style="font-size: 11px">Follow-Up Remarks(If Any)</strong></label>
<div class="input-group"><?php echo $row['followup_remarks']?></div>
</div>
</div>
<div class="space-6"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<?php include 'support_opd_document.php'?>
<?php include 'image_popup_opd.php'?>
<form id="pdfform" target="_blank">
<input type="hidden" id="appointment_id_pdf"
value="<?php echo $row['appointment_id']?>" name="appointment_id_pdf">
</form>
<script>
function delete_opd_document(delete_id){
$("#medical_doc_id").on("click", ".glyphicon-trash", function (event) {
$('#medical_doc_'+delete_id).remove();
});
$.ajax({
url:"delete_opd_document.php",
data:{delete_id:delete_id},
method:"POST",
success:function(data){
BootstrapDialog.alert('Document Deleted Successfully ');
//getMedicalDocData();
},
error:function(data){
BootstrapDialog.alert('Error In deleting Upload Document');
}
});
}
function exporttopdf(){
document.forms['pdfform'].action="opd_form_pdf.php";
document.forms['pdfform'].method="post";
document.forms['pdfform'].submit();
}
function save_pft_doc(){
$.ajax({
url : 'save_test_result.php',
type : "POST",
data : $("#opd_form").serialize(),
success : function(data) {
//var data = $.parseJSON(data);
//alert(data);
BootstrapDialog.alert('Details Saved Successfully.');
//loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id']?>');
//return;
//window.location.reload();
},
error : function(data) {
BootstrapDialog.alert('Error Saving Details');
//return;
}
});
}
function validate_update(formId, appointment_id){
var appointment_date = $('#appointment_date'+appointment_id).val();
if(appointment_date == ''){
BootstrapDialog.alert('Please Enter Appointment Date.!!!');
return false;
}
var complaints = $('#complaints'+appointment_id).val();
if(complaints == ''){
BootstrapDialog.alert('Please Enter Complaints.!!!');
return false;
}
update_appointment(formId, appointment_id);
}
function update_appointment(formId, appointment_id){
$("#save_button").hide();
$.ajax({
url : 'save_test_result.php',
type : "POST",
data : $("#"+formId).serialize(),
success : function(data) {
//BootstrapDialog.alert('Details Updated Successfully.');
//window.location = 'employee_appointment_form.php?appointmentId='+appointmentId+' ';
//
BootstrapDialog.show({
message: 'Details Updated Successfully.',
buttons: [ {
label: 'OK',
action: function(dialogItself){
dialogItself.close();
//window.location.reload();
}
}]
});
//window.location.reload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Updating Details');
return;
}
});
//window.location.reload();
}
jQuery(function($) {
$("#forwardButton").on("click", function(){
<?php if ($rolecode == 'LAB') { ?>
BootstrapDialog.show({
title: 'Forward',
message: '<select class="form-control" id="forward_status" style="margin-left:100px;width:60%">'
+'<option value="MDP">Forward To Doctor</option>',
buttons: [{
label: 'OK',
action: function() {
$("#attendedStatus").val($("#forward_status").val());
save_pft_doc('opd_form','<?php echo $row['appointment_id']?>')
$(".close").click();
}
}]
});
<?php }else{ ?>
$("#attendedStatus").val('CLS');
save_pft_doc('opd_form','<?php echo $row['appointment_id']?>')
<?php }?>
});
});
</script>