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

659 lines
24 KiB
PHP

<?php include('techsyn_header.php');
include('log_entry.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try{ace.settings.loadState('main-container')}catch(e){}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="#">Home</a>
</li>
<li class="active"><a href="task_list.php">Covid Monitoring</a></li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div class="box box-primary center"
style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; " >
<form id="task_form" method="post">
<!-- box-body-->
<div class="box-body">
<div class="row" >
<div class="col-sm-12" style="margin-top: 15px;">
<table id="myTable" class="table table-bordered order-list" >
<thead>
<tr>
<th style=" width: 7%; ">History</th>
<th style=" width: 7%; ">Patient Name</th>
<th style=" width: 6%; ">Covid Contact Type</th>
<th style=" width: 6%; ">Staying</th>
<th style=" width: 6%; ">Covid test Result</th>
<th style=" width: 10%; ">Health Porblems</th>
</tr>
</thead>
<?php
$row=null;
if(isset($_REQUEST['flex_id'])){
$sql="select * from covid_monitoring where id='".$_REQUEST['flex_id']."'";
$result = @mysqli_query($conn,$sql);
$num_rows=@mysqli_num_rows($result);
$row=@mysqli_fetch_array($result);
}
do{
?>
<tbody>
<tr id="main-form">
<td >
<i class="ace-icon fa fa-file-pdf-o bigger-150" style="cursor: pointer; color:red;" data-toggle="modal" data-target="#covidHistoryModal" onclick="open_covid_history()"></i>
</td>
<td >
<select class="form-control select2" name="patient_id" id="patient_id" >
<option value="">Choose any name</option>
<?php $sql_emp_1="SELECT id, CONCAT(patient_name, '-', emp_code) AS emp_details FROM patient_master order by patient_name";?><?php echo generate_options($sql_emp_1,'','id','emp_details','id', $id); ?>
</select><!-- <input type="hidden" name="patient_id" id="patient_id" /> -->
<input type="hidden" name="flex_patient_id" id="flex_patient_id" />
</td>
<td >
<input type="hidden" name="covid_monitoring_id" id="covid_monitoring_id" class="covid_monitoring_id">
<select style="width: 100%; height: 34px;" name="covid_contact_type" class="form-control" id="covid_contact_type">
<option value="">Choose any one</option>
<?php echo generateOption('covid_contact_type_master','type_name','id','$row[covid_contact_id]',''); ?>
</select>
</td>
<td >
<select style="width: 100%; height: 34px;" name="covid_patient_staying" class="form-control" id="covid_patient_staying">
<option value="">Choose any one</option>
<?php echo generateOption('covid_patient_staying','name','id',$row['id'],''); ?>
</select>
</td>
<td >
<select style="width: 100%; height: 34px;" name="test_result" id="test_result" class="form-control">
<option value="">Choose any one</option>
<?php echo generateOption('covid_test_result_master','result_name','id','',''); ?>
</select>
</td>
<td >
<input type="text" name="health_problem" value="<?php echo $row['health_problem']?>" id="health_problem" class="form-control"/>
</td>
</tr>
</table>
<table width="100%" id="myTable1" class="table table-bordered order-list" >
<thead>
<tr>
<th width="30%">Travel History</th>
<th width="10%">SPO2 Basis</th>
<th width="10%">Sample Given Date</th>
<th width="10%">Tested Positive on</th>
<th width="10%">Admission on</th>
<th width="10%">Discharge on</th>
<th width="30%">Remarks</th>
</tr>
</thead><tr>
<td >
<input type="text" name="travel_history" value="<?php echo $row['travel_history']?>" id="travel_history" class="form-control"/>
</td>
<td >
<select style="width: 100%; height: 34px;" name="spo2_basis" id="spo2_basis" class="form-control">
<option value="">Choose any one</option>
<option value="Mild">Mild</option>
<option value="Moderate">Moderate</option>
<option value="Asymptomatic">Asymptomatic</option>
</select>
</td>
<td >
<input type="date" name="sample_date" value="<?php echo $row['sample_date']?>" id="sample_date" class="form-control"/>
</td>
<td >
<input type="datetime-local" name="positive_on" value="<?php echo $row['tested_positive_on']?>" id="positive_on" class="form-control"/>
</td>
<td >
<input type="datetime-local" name="admission_on" value="<?php echo $row['admission_on']?>" id="admission_on" class="form-control"/>
</td>
<td >
<input type="datetime-local" name="discharge_on" value="<?php echo $row['discharge_on']?>" id="discharge_on" class="form-control"/>
</td>
<td >
<input type="text" name="remarks" value="<?php echo $row['remarks']?>" id="remarks" class="form-control"/>
</td>
</tr>
<?php
}while($row=@mysqli_fetch_array($result))//end of while
?>
</tbody>
<tfoot>
<tr>
</tr>
</tfoot>
</table>
<table class="table table-bordered order-list" >
<tr>
<thead>
<th rowspan="2" colspan="2">Home quarantine</th>
<th rowspan="2" colspan="2">Protocol Rest Duration</th>
<th rowspan="2">Resumed duties from</th>
</thead>
</tr>
<tr>
<thead>
<th>From Date</th>
<th>To date</th>
<th>From date</th>
<th>To date</th>
</thead>
</tr>
<tbody>
<tr>
<td><input type="date" name="hq_fromdate" id="hq_fromdate" class="form-control" value="<?php echo $row['hq_fromdate']?>"></td>
<td><input type="date" name="hq_todate" id="hq_todate" class="form-control" value="<?php echo $row['hq_todate']?>"></td>
<td><input type="date" name="prest_fromdate" id="prest_fromdate" class="form-control" value="<?php echo $row['prest_fromdate']?>"></td>
<td><input type="date" name="prest_todate" id="prest_todate" class="form-control" value="<?php echo $row['prest_todate']?>"></td>
<td >
<input type="date" name="resume_duties_from" value="<?php echo $row['resume_duties_from']?>" id="resume_duties_from" class="form-control"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- End box-body-->
<!--box-footer-->
<div class="box-footer" style="text-align: center;">
<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
New
</button>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
<button class="btn btn-info save_button" id="save_button" type="button" onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Save
</button>
</div>
<!--End box-footer-->
</form>
</div>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try{ace.settings.loadState('main-container')}catch(e){}
</script>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<!-- End of breadcrumb -->
<div class="page-content" style="margin-top: -47px">
<div id="flexigridDiv" class="table-responsive">
<form name="f1" method="post" id="flex_appointment_form" action="pbio_medical_waste_generation_excel.php">
<div id="flex1" style="width:100%">
<input type="hidden" name="flex_ambulance_id" id="flex_ambulance_id"/>
</div>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_actions" id="pdf_actions" value="covid_monitoring_pdf.php"/>
<input type="hidden" name="excel_actions" id="excel_actions" value="bio_medical_waste_generation_excel.php"/>
<input type="hidden" name="pdf_action" id="pdf_action" value="biowaste_pdf.php"/>
<input type="hidden" name="excel_action" id="excel_action" value="excel_ambulance.php"/>
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<div class="modal fade" id="covidHistoryModal" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Covid History</h4>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style=" width: 13%; ">Patient Name</th>
<th style=" width: 13%; ">Covid Contact Type</th>
<th style=" width: 6%; ">Staying</th>
<th style=" width: 13%; ">Covid test Result</th>
<th style=" width: 7%; ">SPO2 Basis</th>
<th style=" width: 15%; ">Remarks</th>
<th style=" width: 12%; ">Resumed Duties From</th>
<th style=" width: 10%; ">Tested Positive on</th>
<th style=" width: 15%; ">Discharge on</th>
</tr>
</thead>
<tbody id="modal_data">
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
var w=screen.width*.90;
var h =0;
h =(window.innerHeight-($("#navbar").height()+$(".breadcrumbs").height()))*.75;
$("#flex1").flexigrid({
url: 'covid_monitoring_script.php',
dataType: 'json',
colModel : [
{display: '', name : 'link', width : w*.05, sortable : false, align: 'left'},
{display: 'Sr', name : 'count', width : w*.02, sortable : false, align: 'left'},
{display: 'Date Added', name : 'date_added', width : w*.06, sortable : true, align: 'left'},
{display: 'Patient Name', name : 'patient_name', width : w*.08, sortable : true, align: 'left'},
//{display: 'Age', name : 'age', width : w*.03, sortable : true, align: 'left'},
{display: 'Sex', name : 'gender', width : w*.03, sortable : true, align: 'left'},
{display: 'Emp Code', name : 'emp_id', width : w*.04, sortable : true, align: 'left'},
{display: 'Dept.', name : 'dept_name', width : w*.06, sortable : true, align: 'left'},
{display: 'Contact Type', name : 'type_name', width : w*.06, sortable : true, align: 'left'},
{display: 'Staying In', name : 'name', width : w*.05, sortable : true, align: 'left'},
{display: 'Mobile No.', name : 'personal_phone', width : w*.07, sortable : true, align: 'left'},
{display: 'SPO2 Basis', name : 'spo2_basis', width : w*.07, sortable : true, align: 'left'},
{display: 'Remarks.', name : 'remarks', width : w*.08, sortable : true, align: 'left'},
{display: 'Covid Test Result', name : 'result_name', width : w*.08, sortable : true, align: 'left'},
{display: 'Resumed Duties From', name : 'resumed_duties_from', width : w*.10, sortable : true, align: 'left'},
{display: 'Tested Positive on', name : 'tested_positive_on', width : w*.08, sortable : true, align: 'left'},
{display: 'Discharge on', name : 'discharge_on', width : w*.09, sortable : true, align: 'left'}
],
buttons : [
{name: 'PDF', bclass: 'print', onpress : pdf},
{separator: true},
{name: 'Excel', bclass: 'print_excel', onpress : excel},
{separator: true}
],
searchitems : [
{display: 'Patient Name', name : 'patient_name'},
{display: 'EMP Code', name : 'emp_id'},
{display: 'Gender', name : 'gender'},
{display: 'Contact Type', name : 'type_name',isdefault: true},
{display: 'Department', name : 'dept_name',isdefault: true},
{display: 'Staying In', name : 'name',isdefault: true},
{display: 'Covid Test', name : 'result_name',isdefault: true},
{display: 'SPO2 Basis', name : 'spo2_basis',isdefault: true},
{display: 'Mobile no.', name : 'personal_phone',isdefault: true},
// {display: 'Resumed Duties on', name : 'resumed_duties_from',isdefault: true},
// {display: 'Tested Positive on', name : 'tested_positive_on',isdefault: true},
// {display: 'Discharge on', name : 'discharge_on',isdefault: true},
// {display: 'Date Added', name : 'date_added',isdefault: true},
{display: 'Remarks', name : 'remarks',isdefault: true},
],
// sortname: "id",
// sortname: "patient_name",
sortname: "emp_id",
// sortname: "dept_name",
// sortname: "spo2_basis",
// sortname: "result_name",
//sortname: "resumed_duties_from",
// sortname: "tested_positive_on",
// sortname: "discharge_on",
sortorder: "asc",
usepager: true,//pagination
//title:"Employee OPD",
useRp: true,
rp: 50,//records per page
showTableToggleBtn: false,//toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
// }
function delete_covid_monitoring(id){
$.ajax({
url : 'delete_covid_monitoring.php',
data:{id:id},
type : 'POST',
dataType:'json',
success : function(data) {
if(data=='SUCCESS') {
BootstrapDialog.alert('Covid Monitoring Deleted Successfully!');
$("#flex1").flexReload();
return;
}
},
error : function(data) {
BootstrapDialog.alert('Error: Covid Monitoring Not Deleted!');
return;
}
});
}
function show_save_button(){
$("#save_button").show();
$("#covid_monitoring_id").val("");
//$("#patient_id").val("");
$("#covid_contact_type").val("");
$("#covid_patient_staying").val("");
$("#spo2_basis").val("");
$("#remarks").val("");
$("#test_result").val("");
$("#resume_duties_from").val("");
$("#covid_monitoring_id").val("");
$("#patient_id").val(null).trigger("change");
}
function open_covid_monitoring(id,access){
if(access=='V'){
$("#save_button").hide()
}else if(access=='E')
$("#save_button").show()
$.ajax({
url : 'select_covid_monitoring.php',
data:{id:id},
type : 'POST',
dataType:'json',
success : function(data) {
$("#patient_id").val(data.emp_id);
$("#covid_contact_type").val(data.covid_contact_id);
$("#covid_patient_staying").val(data.staying_id);
$("#spo2_basis").val(data.spo2_basis);
$("#remarks").val(data.remarks);
$("#test_result").val(data.covid_test_result_id);
$("#rat_test_result").val(data.rat_result);
$("#resume_duties_from").val(data.resumed_duties_from);
positive_on_dt = datetime_formate(data.tested_positive_on);
discharge_on_dt = datetime_formate(data.discharge_on);
admission_on = datetime_formate(data.admission_on);
$("#positive_on").val(positive_on_dt);
$("#discharge_on").val(discharge_on_dt);
$('#hq_fromdate').val(data.hq_fromdate);
$('#hq_todate').val(data.hq_todate);
$('#prest_fromdate').val(data.prest_fromdate);
$('#prest_todate').val(data.prest_todate);
$('#sample_date').val(data.sample_date);
$('#travel_history').val(data.travel_history);
$('#health_problem').val(data.health_problems);
$('#admission_on').val(admission_on);
// console.log('tested positive on '+data.tested_positive_on);
// console.log('tested positive on '+data.discharge_on);
$("#covid_monitoring_id").val(data.id);
$(".select2").select2();
},
error : function(data) {
BootstrapDialog.alert('Error Populating Covid Patient');
return;
}
});
}
function open_covid_history(){
var id = $("#patient_id").val();
$.ajax({
url : 'open_covid_history.php',
data:{id:id},
type : 'POST',
dataType:'json',
success : function(data) {
$("#modal_data").empty();
content = "";
if(data.length>0){
for(var i=0;i<data.length;i++){
content += "<tr><td>"+data[i].patient_name+"</td><td>"+data[i].type_name+"</td><td>"+data[i].name+"</td><td>"+data[i].result_name+"</td><td>"+data[i].spo2_basis+"</td><td>"+data[i].remarks+"</td><td>"+data[i].resumed_duties_from+"</td><td>"+data[i].tested_positive_on+"</td><td>"+data[i].discharge_on+"</td></tr>"
}
}
$("#modal_data").append(content);
},
});
}
function datetime_formate(dt){
dt = dt.split(' ');
dt = dt[0]+"T"+dt[1];
return dt;
}
function pdf(){
window.open('covid_monitoring_pdf.php','Covid Monitoring');
}
function excel(){
window.open('covid_monitoring_excel.php','Covid Monitoring');
}
$("#new_button").on("click", function() {
$("covid_monitoring_id").val("");
});
</script>
<?php include('techsyn_footer.php'); ?>
</div>
<!-- End of page-content -->
</div>
</div>
</div>
<script>
function validate(){
var patient_id = $('#patient_id').val();
if(patient_id == ''){
BootstrapDialog.alert('Please Select Patient Name.!!!');
return false;
}
var covid_contact_type = $('#covid_contact_type').val();
if(covid_contact_type == ''){
BootstrapDialog.alert('Please Select Contact Type.!!!');
return false;
}
// var covid_patient_staying = $('#covid_patient_staying').val();
// if(covid_patient_staying == ''){
// BootstrapDialog.alert('Please Select Patient Staying.!!!');
// return false;
// }
// var remarks = $('#remarks').val();
// if(remarks == ''){
// BootstrapDialog.alert('Please Enter Remarks.!!!');
// return false;
// }
// var test_result = $('#test_result').val();
// if(test_result == ''){
// BootstrapDialog.alert('Please Select Test Result.!!!');
// return false;
// }
var spo2_basis = $('#spo2_basis').val();
if(spo2_basis == ''){
BootstrapDialog.alert('Please Select SPO2 level.!!!');
return false;
}
save();
}
</script>
<style>
#modal-add-ailment{
overflow-y:scroll;
}
</style>
<?php include('techsyn_footer.php'); ?>
<script type="text/javascript">
function save(){
$.ajax({
url : 'save_covid_monitoring.php ',
type : "POST",
data : $("#task_form").serialize(),
success : function(data) {
// alert(data);
BootstrapDialog.alert('Covid Monitoring Saved Successfully.');
$("#flex1").flexReload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Covid Monitoring!');
return;
}
});
$('.close').click();
// location.href="procurement_list.php";
}
$('.date-picker').datepicker({
autoclose:true,
format:'dd/mm/yyyy'
}).next().on(ace.click_event,function(){
$(this).prev().focus();
});
</script>
<!-- bootstrap & fontawesome -->
<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" />
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
<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>