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

744 lines
20 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<style>
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
/* Semi-transparent black background */
z-index: 9999;
/* Set a high z-index to ensure it's displayed on top */
}
</style>
<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');
error_reporting(E_ERROR | E_PARSE);
?>
<!--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="">Patient Visit</li>
<li class="active">Pending Medical Examination</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<form name="f1" method="post" action="" id="flex_form_checkup">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_checkup_id" id="flex_checkup_id" />
<input type="hidden" name="emp_id_history" id="emp_id_history" />
<input type="hidden" name="checkup_type_id_db" id="checkup_type_id_db" />
<input type="hidden" name="toPage" id="toPage" />
</form>
<form name="flex_medical_form" method="post" action="" id="flex_medical_form">
<input type="hidden" name="medical_exam_id" id="medical_exam_id" />
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="flex_medical_form" id="flex_medical_form" />
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_pending_medical_examination.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_pending_medical_examination.php" />
</form>
<div id="flex1" style="width:100%">
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'medical_examination_list_script.php',
dataType: 'json',
colModel: [{
display: 'Select',
name: 'checkbox',
width: w * .07,
sortable: false,
align: 'left'
}, {
display: 'Sr',
name: 'count',
width: w * .04,
sortable: false,
align: 'center'
},
{
display: 'Actions',
name: '',
width: w * .09,
sortable: false,
align: 'center'
},
{
display: 'Examination Date',
name: 'medical_entry_date',
width: w * .1,
sortable: true,
align: 'center'
},
// {display: 'Examination Type', name: 'task', width: w*.2, sortable: true, align: 'center'},
{
display: 'Ticket No',
name: 'ticket_no',
width: w * .1,
sortable: true,
align: 'center'
},
{
display: 'Patient Name',
name: 'patient_name',
width: w * .1,
sortable: true,
align: 'center'
},
{
display: 'EMP Code',
name: 'emp_code',
width: w * .1,
sortable: true,
align: 'center'
},
{
display: 'Checkup Name',
name: 'checkup_type_id',
width: 300,
sortable: true,
align: 'center'
},
{
display: 'Reporting OHC',
name: 'ohc_type_id',
width: w * .08,
sortable: true,
align: 'center'
},
{
display: 'Patient Category',
name: 'patient_cat_id',
width: w * .1,
sortable: true,
align: 'center'
},
{
display: 'Aadhar No. ',
name: 'aadhar_no',
width: 150,
sortable: true,
align: 'center'
},
{
display: 'Primary No.',
name: 'primary_phone',
width: 150,
sortable: true,
align: 'center'
},
{
display: 'Test Status',
name: 'test_status',
width: w * .07,
sortable: true,
align: 'center'
},
// {
// display: 'Medical examination',
// name: 'current_status',
// width: w * .1,
// sortable: true,
// align: 'center'
// },
],
buttons: [{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
},
{
separator: true
},
{
name: 'Download Template',
bclass: 'print_excel',
onpress: download_template
},
{
separator: true
},
{
name: 'Upload Excel',
bclass: 'print_excel',
onpress: upload_excel
},
{
separator: true
},
{
name: 'Download Excel',
bclass: 'print_excel',
onpress: download_excel
},
{
separator: true
},
{
name: 'Bulk Approve',
bclass: 'print_excel',
onpress: bulk_approve
},
],
searchitems: [{
display: 'EMP code',
name: 'emp_code',
isdefault: true
},
{
display: 'Patient Name',
name: 'patient_name',
isdefault: true
},
{
display: 'Phone No',
name: 'primary_phone',
isdefault: true
},
{
display: 'Aadhar Card',
name: 'aadhar_no',
isdefault: true
},
{
display: 'Examination Date(DD/MM/YYYY)',
name: 'medical_entry_date',
isdefault: true
},
{
display: 'Examination Date Range(DD/MM/YYYY)-(DD/MM/YYYY)',
name: 'medical_entry_date_between',
isdefault: true
},
// {
// display: 'Examination Type(annual/pre_employment)',
// name: 'task',
// isdefault: true
// },
{
display: 'Patient Category',
name: 'patient_cat_name'
}
],
sortname: "a.last_modified",
sortorder: "desc",
usepager: true, //pagination
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function showOverlay() {
var overlay = document.createElement('div');
overlay.className = 'overlay';
document.body.appendChild(overlay);
}
function hideOverlay() {
var overlay = document.querySelector('.overlay');
if (overlay) {
overlay.parentNode.removeChild(overlay);
}
}
let checkArr = {};
let checkboxArr = [];
function generateForm(checkArr) {
return new Promise((resolve, reject) => {
console.log(checkArr);
Object.entries(checkArr).forEach(([key, value]) => {
if (value == "PRE_EMP_MEDICAL_EXAMINATIONS_HAZARDOUS") {
open_form_generation(key, "form_33");
} else if (value == "MINE_WORKER_MEDICAL_EXAMINATIONS") {
open_form_generation(key, "form_O");
} else if (value == "ANNUAL_MEDICAL_EXAMINATION_HAZARDOUS" || value == "PERIODIC_MEDICAL_EXAMINATIONS_HAZARDOUS") {
open_form_generation(key, "form_32");
}
// console.log("running");
// console.log(key + " " + value);
});
resolve();
});
}
function form_generation_for_pdf(form_type) {
// alert(form_type);
var form_generate_type = "";
var content = "";
var form_data_array = [];
if (form_type == 'form_33') {
form_generate_type = 'Form 33';
$('#form_33 p').each(function(index) {
if (index <= 22)
form_data_array[index] = ($(this).text())
});
} else if (form_type == 'form_O') {
$('#form_0_pdf p').each(function(index) {
if (index <= 16)
form_data_array[index] = ($(this).text())
});
form_generate_type = 'Form O';
}
console.log(form_data_array);
if (form_type == 'form_33') {
$.ajax({
url: 'save_form_generation_type.php',
type: 'POST',
data: {
form_type: $("#form_type").val(),
checkup_id: $("#checkup_id").val(),
form_data_array: form_data_array
},
success: function(data) {}
});
} else {
$.ajax({
url: 'save_form_generation_type.php',
type: 'POST',
data: {
form_type: $("#form_type_O").val(),
checkup_id: $("#checkup_id_O").val(),
form_data_array: form_data_array
},
success: function(data) {}
});
}
}
var function_calling_count = 0;
function_calling_count_o = 0;
function open_form_generation(checkup_id, form_generation_type) {
console.log("inside open form generation function checkup id is" + checkup_id);
$("#valid_date").html("");
$("#checkup_id").val(checkup_id);
$("#form_type").val(form_generation_type);
$("#checkup_id_O").val(checkup_id);
$("#form_type_O").val(form_generation_type);
console.log($("#checkup_id").val(checkup_id));
console.log("inside open form generation function checkup id is" + checkup_id);
$.ajax({
async: false,
url: 'get_medical_examination_patient_details.php',
type: 'POST',
data: {
checkup_id: checkup_id
},
success: function(data) {
var data = $.parseJSON(data);
if (data != null) {
var gender = "";
var gender_call = "";
var gender_call_2 = "";
// alert(data.gender);
if (data.gender == 'Female') {
gender = 'Female';
gender_call = "She";
gender_call_2 = "her";
} else if (data.gender == 'Male') {
gender = 'Male';
gender_call = "He";
gender_call_2 = "his"
} else {
gender = 'Others';
gender_call = "He/She";
gender_call_2 = "his/her";
}
var dob = data.dob;
var dt = new Date();
var year = dt.getFullYear();
console.log(dob, year);
var age = year - dob;
if (form_generation_type == 'form_33') {
var content = "";
if (function_calling_count > 0) {
$("table[id='header_table'] > tbody > tr:first-child").remove();
$('#table_body > tbody > tr:first').remove();
//$("#doc_no").html();
}
// $("#doc_no").html(data.document_no);
$("#header_table> tbody > tr:first").before("<tr><td >SL NO <b>" + data.serial_no +
" </b></td><td align=\"right\">Date <b style=\"font-weight:600\">" + data.approval_date + "</b> </td></tr>")
content +=
"<tr><td><p contenteditable=\"true\">1. Serial number in the register of adult workers: <b>" +
data.serial_no + "</b> </p><br>";
content += "<p contenteditable=\"true\">2. Name of person examined: <b style=\"font-weight:600\">" + data
.patient_name + "</b> </p><br>";
content += "<p contenteditable=\"true\">3. Father`s Name: <b style=\"font-weight:600\">" + data.father_name + "</b></p><br>";
content += "<p contenteditable=\"true\">4. Sex: <b style=\"font-weight:600\">" + data.gender + "</b></p><br>";
content += "<p contenteditable=\"true\">5. Residence: <b style=\"font-weight:600\">" + data.village + " ," + data
.post + "," + data.ps + "</b></p><br>";
content += "<p contenteditable=\"true\">6. Date of birth, if available: <b style=\"font-weight:600\">" + data.birth + "</b></p><br>";
content +=
"<p contenteditable=\"true\">7. Name & address of the factory: GUJARAT HEAVY CHEMICAL LTD.,SUTRAPADA, ANURAG NAGAR,GUJARAT </p><br>";
content +=
"<p contenteditable=\"true\">8. The worker is employed/proposed:</p>";
content +=
"<p contenteditable=\"true\">&nbsp;&nbsp;&nbsp;&nbsp;a) Hazardous process:<b style=\"font-weight:600\">" + data.hazardous_process + "</b></p>";
content +=
"<p contenteditable=\"true\">&nbsp;&nbsp;&nbsp;&nbsp;b) Dangerous operation:<b style=\"font-weight:600\">" + data.dangerous_operation + "</b></p><br>";
content += "<p contenteditable=\"true\">I certify that I have personally examined the above named person whose identification marks are ……… " + data.identi_mark + "……..and who is desirous of being employed in above mentioned process/operation and that his/her,age, as can be ascertained from my examination, is ……… " + age + "……years.</p><br>"
content += "<p contenteditable=\"true\"> In my opinion he/she is fit for employment in the Said manufacturing process/operation.</p><br>";
let doc_finding = "";
if (data.fit_status == 'ufit') {
doc_finding = data.doc_finding;
}
content += "<p contenteditable=\"true\">In my opinion he/she is unfit for employment in the said manufacturing process/operation for the reason ………" + doc_finding + "…………He/She is referred for further examination to the Certifying Surgeon.</p><br>"
content += "<p contenteditable=\"true\"> The serial number of previous certificate is …………………………….................</p></td></tr><br>"
var imageContent = "";
var stampContent = "";
imageContent = "<img class=\"editable img-responsive\" id=\"avatar\" src=\"data:" +
data.image_type + ";base64," + data.emp_sign +
"\" style=\"display: block; width: 180px; height: 25px;\" />"
function_calling_count++;
$('#header_table tr').eq(4).after(content);
$("#profile-picture").html(imageContent);
form_generation_for_pdf("form_33");
} else if (form_generation_type == 'form_O') {
var content = "";
if (function_calling_count_o > 0) {
// $("table[id='header_table'] > tbody > tr:first-child").remove();
$('#table_body_form_o>tbody> tr>td').remove();
//$("#doc_no").html();
}
content += "<tr><td colspan=\"2\" align=\"left\"><p contenteditable=\"true\">Certificate No: ................</p></td></tr>";
content += " <tr><td><p contenteditable=\"true\"> Certified that Shri/Smt.* " + data
.patient_name + " "
content += " employed as ...." + data.designation +
" .... in..................Mine, Form B No. .................. has been examined "
content += " for an initial/periodical medical examination.He/she* appears to be " +
getAge(new Date(data.dob)) + " years of age."
content +=
"The findings of the examining authority are given in the attached sheet. It is considered that Shri/Smt.* ...." + data
.patient_name + "..... </p></td></tr>"
// if (data.fit_status == 'fit') {
content += "<tr><td><p contenteditable=\"true\">(a)* is medically fit for any employment in mines</p></td></tr>"
let finding = "";
if (data.fit_status == 'ufit') {
finding = data.doc_finding;
console.log(finding);
}
content += "<tr><td><p contenteditable=\"true\">(b)* is suffering from.......... " + finding + " ...................and medically unfit for</p></td></tr>"
content += "<tr><td><p contenteditable=\"true\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(i) any employment in mines; or</p></td></tr>"
content += "<tr><td><p contenteditable=\"true\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ii)any employment below ground; or</p></td></tr>"
content += "<tr><td><p contenteditable=\"true\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(iii) any employment or work.............................. </p></td></tr>"
finding = "";
let checkup_names = "";
if (data.fit_status == 'tfit') {
finding = data.doc_finding;
checkup_names = data.checkup_test_names;
}
content += "<tr><td><p contenteditable=\"true\">(c)* is suffering from...... <b>" + finding + "</b> .............. he/she should get this disability* cured/controlled and should be again examined within a period of....................month.He/She will appear for re-examination with the result of test of ..... <b>" + checkup_names + "</b> ............and the opinion of............Specialist from................. . He/She may be permitted/not* permitted to carry on his duties during this period.</p></td></tr>"
$('#table_body_form_o> tbody > tr:first').before(content);
var imageContent = "";
imageContent = "<img class=\"editable img-responsive\" id=\"avatar\" src=\"data:" +
data.image_type + ";base64," + data.emp_sign +
"\" style=\"display: block; width: 180px; height: 25px;\" />"
$("#doctor_name_id").html("Doctor Name : " + data.doctor_name);
$("#qualification_id").html("Qualification : " + data.qualification);
$("#registration_no_id").html("Registration No : " + data.registration_no);
function_calling_count_o++;
$("#profile-picture1").html(imageContent);
form_generation_for_pdf("form_O");
} else {
$.ajax({
async: false,
url: 'save_form_32.php',
type: 'post',
data: {
checkup_id: checkup_id
},
success: function(data) {
}
})
}
}
},
error: function(data) {}
});
}
function bulk_approve() {
BootstrapDialog.alert("Please wait auto approving process will take some time do not press anywhere else");
showOverlay();
checkArr = {};
checkboxArr = [];
console.log("getting here in bulk approve");
document.querySelectorAll('.checkbox').forEach((component) => {
if (component.checked) {
checkboxArr.push(component.getAttribute('value'));
let key = component.getAttribute('value');
checkArr[key] = component.getAttribute('data-checkup-code');
}
});
console.log(checkboxArr + ' ' + checkArr);
if (checkboxArr.length == 0) {
BootstrapDialog.alert("Select some checkboxes to approve");
return false;
}
generateForm(checkArr).then(() => {
$.ajax({
type: 'post',
url: 'bulk_doc_approval.php',
data: {
checkupIds: checkboxArr
},
success: function(data) {
if (data == 400) {
BootstrapDialog.alert("Something went wrong while approval");
} else if (data == 200) {
BootstrapDialog.alert("Approval Done");
$("#flex1").flexReload();
hideOverlay();
}
},
error: function(data) {
BootstrapDialog.alert("Something went wrong while approval");
}
})
})
.catch((Error) => {
BootstrapDialog.alert("Something went wrong " + Error);
hideOverlay();
});
}
$(document).ready(function() {
<?php if ($_SESSION['RoleCode'] == 'DOC') { ?>
document.body.getElementsByTagName('th')[0].innerHTML = '<div style="text-align: left; width: 69.552px;"><input type="checkbox" name="selectAll" id="selectAll" onchange></div>'
let element = document.getElementById("selectAll");
element.addEventListener('click', (event) => {
const isChecked = event.target.checked;
document.querySelectorAll('.checkbox').forEach((component) => {
component.checked = isChecked;
});
});
<?php } ?>
<?php if ($_SESSION['RoleCode'] != 'DOC') { ?> document.body.getElementsByClassName('fbutton')[5].style.display='none'; <?php } ?>
});
function pdf() {
window.open('ajax_pdf.php', 'OPD-Injury List');
}
function excel() {
window.open('ajax_excel.php', 'OPD-Injury List');
}
function upload_excel() {
window.location = 'upload_excel_medical.php';
}
function download_template() {
window.location = 'templates/Medical Examination Template.xlsx';
}
function download_excel() {
window.location = 'download_excel_medical.php';
}
function open_checkup(checkupId, empId, action, checkup_type_id) {
//window.location = 'checkup.php?checkup_id='+checkupId+'';
console.log(checkupId + ':' + empId + ' ; ' + action + ' : ' + checkup_type_id);
if (checkupId != null && checkupId != '') {
$("#flex_checkup_id").val(checkupId);
$("#checkup_type_id_db").val(checkup_type_id);
$("#emp_id_history").val(empId);
$("#toPage").val(action);
$("#flex_form_checkup").attr('method', 'POST');
$("#flex_form_checkup").attr('action', 'checkup_from_before.php');
$("#flex_form_checkup").submit();
}
}
function open_medical_examination_form(medical_exam_id, patient_id, task) {
if (medical_exam_id != null && medical_exam_id != '' && patient_id != null && patient_id != '') {
$("#medical_exam_id").val(medical_exam_id);
$("#flex_medical_form").attr('method', 'POST');
if (task == 'pme') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_pme.php');
} else if (task == 'ime_short') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_ime_short_term.php');
} else if (task == 'annual') {
$("#flex_medical_form").attr('action', 'add_initial_medical_examination_longterm.php');
} else if (task == 'semi_annual') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters_ame_below_40.php');
}
if (task == 'ime_long' || task == 'pre_employment') {
$("#flex_medical_form").attr('action', 'add_patient_physical_parameters.php');
}
$("#flex_medical_form").submit();
}
}
</script>
<?php include_once('form/form_o.php'); ?>
<?php include_once('form/form_33.php'); ?>
<?php include('techsyn_footer.php'); ?>