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

658 lines
28 KiB
PHP

<?php include('techsyn_header.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'); ?>
<?php
error_reporting(E_ERROR | E_PARSE);
$id = ($_REQUEST['flex_opd_id'] != '' && $_REQUEST['flex_opd_id'] != null) ? $_POST['flex_opd_id'] : $_REQUEST['emp_id_history'];
//echo $id;
$query = "select * from patient_master where id = '" . $id . "' ";
//echo $query;
if (!$result = @mysqli_query($conn, $query)) {
exit(mysqli_error($conn));
} else {
$row = @mysqli_fetch_array($result);
@extract($row);
}
?>
<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">Preventive Check-up</li>
</ul>
</div>
<div class="row" id="sickness_form_id">
<div class="col-xs-12">
<div class="widget-box">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div style="margin:5px;">
<div class="tabbable">
<ul class="nav nav-tabs" id="myTab">
<li class="active">
<a data-toggle="tab" href="#appointment" aria-expanded="false">
<?php
$checkup_type_dd = getFieldFromTable('checkup_type_id','checkup_form','checkup_id',$_REQUEST['flex_checkup_id']);
echo getFieldFromTable('checkup_type_name','checkup_type','checkup_type_id',$checkup_type_dd);
?>
<!-- <span class="badge badge-success">+</span> -->
</a>
</li>
<!-- <li><a href='#' class="blue" onclick="open_dashboard(<?= $row['id'] ?>)"><i class="ace-icon fa fa-user bigger-130"></i><?= $patient_name ?>'s Profile</a>
</li> -->
<!-- <li class=""><a data-toggle="tab" href="#history1" aria-expanded="false"> <input type="hidden" id="emp_id" name="emp_id" value="<?php echo ($_REQUEST['flex_opd_id'] != '' && $_REQUEST['flex_opd_id'] != null) ? $_POST['flex_opd_id'] : $_REQUEST['emp_id_history']; ?>">
History <span class="badge badge-danger" id="history_record"><?php
$history_count = getTableFieldValue('checkup_form', 'count(*)', 'emp_id', ($_REQUEST['flex_opd_id'] != '' && $_REQUEST['flex_opd_id'] != null) ? $_POST['flex_opd_id'] : $_REQUEST['emp_id_history']);
if ($history_count == '' || $history_count == null)
$history_count = 0;
echo $history_count;
?></span>
</a></li> -->
</ul>
<div class="tab-content">
<div id="appointment" class="tab-pane fade in active ">
<?php if ($_REQUEST['toPage'] == 'V') {
include('checkup_form_view.php');
} else {
include('checkup_form_submit.php');
}
?>
</div>
<div id="history1" class="tab-pane fade">
<?php //include('history_checkup.php'); ?>
</div>
</div>
</div>
<!--end tab table-->
</div>
<!--end of inner row-->
</div>
<!--end of widget-main -->
</div>
<!--end of inner widgetbody-->
</div>
<!--end of inner widgetbox-->
</div>
<!--end of xs-->
</div>
<!--end of inner widgetbody-->
</div>
</div>
<!--end of outer col-xs-12">-->
</div>
<!--end of outer row-->
</div>
<form name="f1" method="post" id="flex_opd_id_medical" action="">
<div id="flex1" style="width: 100%"></div>
<input type="hidden" name="flex_opd_id" id="flex_opd_id" />
</form>
<script>
function open_dashboard(emp_id) {
// alert(emp_id)
if (emp_id != null && emp_id != '') {
$("#flex_opd_id").val(emp_id);
$("#flex_opd_id_medical").attr('target', '_blank');
$("#flex_opd_id_medical").attr('method', 'POST');
$("#flex_opd_id_medical").attr('action', 'emp_dashboard.php');
$("#flex_opd_id_medical").submit();
}
}
function save() {
//alert(" gfgdgdg");
// console.log($("#checkup_form_employee").serialize());
get_section_id();
$.ajax({
url: 'save_checkup_form.php',
type: "POST",
data: $("#checkup_form_employee").serialize(),
success: function(data) {
var checkId = JSON.parse(data);
if ($("#checkup_id").val() == "") {
var history_record = $("#history_record").text();
$('#history_record').text(parseInt(history_record) + 1);
}
$("#checkup_id").val(checkId);
$("#flex1").flexReload();
BootstrapDialog.alert('Surveillance Results Saved Successfully.');
// if (($("#attendedStatus").val() == 'DRA') && ($("#checkup_form_type_code").val() ==
// "PRE_EMP_MEDICAL_EXAMINATIONS_HAZARDOUS")) {
// open_form_generation(checkId, "form_33");
// } else if (($("#attendedStatus").val() == 'DRA') && ($("#checkup_form_type_code").val() ==
// "MINE_WORKER_MEDICAL_EXAMINATIONS")) {
// open_form_generation(checkId, "form_O");
// }
// console.log($("#attendedStatus").val());
<?php if ($_SESSION['RoleCode'] == $__ROLE_DOCTOR) { ?>
window.location.replace("approved_medical_examination.php");
<?php } else if ($_SESSION['RoleCode'] == $__ROLE_MEDICALROOM) { ?>
window.location.replace("pending_medical_examination_list.php");
<?php } else if ($_SESSION['RoleCode'] == $__ROLE_LAB) { ?>
window.location.replace("pending_lab_test_reception.php");
<?php }else if ($_SESSION['RoleCode'] == 'RCP') { ?>
window.location.replace("pending_medical_examination_list.php");
<?php } ?>
//return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Surveillance Results');
return;
}
});
// $('.close').click();
}
// to generate form automatically start
// 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) {
// }
// });
// // generateFormPdf()
// } 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) {
// }
// });
// // generateFormPdfO()
// }
// }
// var function_calling_count = 0;
// function_calling_count_o = 0;
// function open_form_generation(checkup_id, form_generation_type) {
// $("#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);
// $.ajax({
// 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 year = dob.getFullYear();
// // var year1 = getFullYear();
// 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_genaration').modal({
// keyboard: true
// });
// //$('#form_genaration').modal("show");
// form_generation_for_pdf("form_33");
// } else {
// var content = "";
// if (function_calling_count_o > 0) {
// // $("table[id='header_table'] > tbody > tr:first-child").remove();
// $('#table_body_form_o>tbody> tr:first').remove();
// //$("#doc_no").html();
// $('#form_header>tbody> tr:last').remove();
// }
// 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);
// //$("#doc_no_o").html(data.document_no);
// function_calling_count_o++;
// $("#profile-picture1").html(imageContent);
// $('#form_genaration_0').modal({
// keyboard: true
// });
// //$('#form_genaration_0').modal("show");
// form_generation_for_pdf("form_O");
// }
// }
// },
// error: function(data) {
// BootstrapDialog.alert(" Error In Saving Foward Status ");
// }
// });
// }
// end here
function loadPage() {
if ($("#attendedStatus").val() == 'MDA' || $("#attendedStatus").val() == 'RCA' || $("#attendedStatus").val() ==
'DRA') {
$('div.modal-header > div > div.bootstrap-dialog-close-button > button').click();
return;
}
<?php if ($_SESSION['RoleCode'] == 'DOC') {
echo "location.replace('medical_examination_list.php');";
} else if ($_SESSION['RoleCode'] == $__ROLE_MEDICALROOM) {
echo "location.replace('pending_medical_examination_list.php');";
} else if ($_SESSION['RoleCode'] == $__ROLE_LAB) {
echo "location.replace('pending_lab_test_reception.php');";
}
?>
}
/* $('#checkdown_date').datepicker({
autoclose:true,
format: 'dd/mm/yyyy',
}).next().on(ace.click_event, function(){
$(this).prev().focus();
});*/
function myDateFormaterTime(myDate) {
$('#checkdown_date').datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(myDate),
});
}
function loadUploadedDocDynamic(emp_id,checkup_id,section_id) {
console.log(emp_id + " "+ checkup_id + " "+ section_id);
$.ajax({
type: 'POST',
url: 'populate_document_section.php',
data:{
empId : emp_id ,
checkupId : checkup_id,
sectionId:section_id
},
dataType: 'json',
success: function (data) {
var tableBody = $('#supportDoc' + section_id + ' table tbody');
tableBody.empty(); // Clear existing rows
$.each(data, function (index, document) {
var docName = document.medical_doc_desc ? document.medical_doc_desc : document.medical_doc_name;
var docType = document.medical_doc_type === 'application/pdf' ? 'images/pdf.png' : 'images/image_icon.png';
var row = '<tr id="medical_doc_' + document.id + '">';
row += '<td>' + docName + '</td>';
row += '<td><a href="data:' + document.medical_doc_type + ';base64,' + document.medical_doc + '" download="' + document.medical_doc_name + '"><img src="' + docType + '" width="35" height="35"></a></td>';
<?php
$hasExecuteAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'E');
if ($hasExecuteAccess) {
?>
row += '<td align="center" style="width: 20%">';
row += '<a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" onclick="delete_checkup_section_document(' + document.id + ')" title="Delete"><span class="glyphicon glyphicon-trash"></span></a>';
row += '</td>';
<?php } ?>
row += '</tr>';
tableBody.append(row);
});
},
error: function (data) {
console.error('Error loading uploaded documents:', data);
}
});
}
var highlightedFields =
"<?php echo getFieldFromTable("highlighted_fields", "medical_examination_highlighted", "medical_exam_id", $_REQUEST['flex_checkup_id']) ?>"
$(document).ready(function() {
function getHighlightData() {
let checkup_id = '<?= $_REQUEST['flex_checkup_id'] ?>';
return new Promise((resolve, reject) => {
$.ajax({
type: 'post',
url: 'get_highlight_data.php',
data: {
checkup_id: checkup_id
},
success: function(data) {
try {
data = JSON.parse(data);
resolve(data);
} catch (Error) {
reject(Error);
}
},
error: function(data) {
reject(data);
}
});
});
}
getHighlightData().then((data) => {
// console.log(data);
for (let key in data) {
// console.log(key);
if (data.hasOwnProperty(key)) {
let value = data[key];
if (value !== "") {
// console.log("id: " + key);
document.getElementById(`${key}`).style.color = value;
$("#" + key).css("border", "1px solid " + value);
$("#color_" + key).val(value);
} else {
$("#" + key).css("border", "");
document.getElementById(`${key}`).style.color = "black";
}
}
}
}).catch((error) => {
console.log(error);
});
});
</script>
<script type="text/javascript">
var js_array_enabledSections = [<?php echo '"' . implode('","', $enabledSections) . '"' ?>];
js_array_enabledSections.forEach(showHeaderSection);
</script>
<?php
$header_visible = getFieldFromTable('sec_choice', 'checkup_type', 'checkup_type_id', $checkup_type_id);
error_log("key value : " . $header_visible);
if ($header_visible == "No") {
?>
<script>
document.getElementById("checkup_section_header").style.display = "none";
</script>
<?php
}
?>
<?php //include_once('form/form_o.php'); ?>
<?php //include_once('form/form_33.php'); ?>
<?php include('techsyn_footer.php'); ?>