438 lines
15 KiB
PHP
438 lines
15 KiB
PHP
<style>
|
|
#patient_name {
|
|
background-image: url('images/searchicon.png');
|
|
/* Add a search icon to input */
|
|
background-position: 5px 7px;
|
|
/* Position the search icon */
|
|
background-repeat: no-repeat;
|
|
/* Do not repeat the icon image */
|
|
width: 100%;
|
|
/* Full-width */
|
|
font-size: 14px;
|
|
/* Increase font-size */
|
|
padding: 8px 15px 10px 30px;
|
|
/* Add some padding */
|
|
border: 1px solid #ddd;
|
|
/* Add a grey border */
|
|
}
|
|
|
|
|
|
#searchResultDiv {
|
|
overflow: scroll;
|
|
display: none;
|
|
position: absolute;
|
|
background-color: #fff;
|
|
width: 100%;
|
|
overflow: auto;
|
|
border: 1px solid #ddd;
|
|
z-index: 111;
|
|
}
|
|
|
|
#mgrListDiv {
|
|
overflow: scroll;
|
|
display: none;
|
|
position: absolute;
|
|
background-color: #fff;
|
|
width: 100%;
|
|
margin-top: 30px;
|
|
overflow: auto;
|
|
border: 1px solid #ddd;
|
|
z-index: 111;
|
|
}
|
|
|
|
#primary_patientListDiv {
|
|
overflow: scroll;
|
|
display: none;
|
|
position: absolute;
|
|
background-color: #fff;
|
|
width: 100%;
|
|
margin-top: 30px;
|
|
overflow: auto;
|
|
border: 1px solid #ddd;
|
|
z-index: 111;
|
|
}
|
|
</style>
|
|
<div class="dropdown">
|
|
<input type="text" id="patient_name" name="patient_name" autocomplete="off" style="text-transform:uppercase;" onChange=' $("#myTable").toggle("show"); $("#searchResultDiv").toggle("show");' placeholder="Patient Name" title="Enter Patient Name">
|
|
<input type="hidden" id="patient_id" name="patient_id">
|
|
<div id="searchResultDiv" class="dropdown-content">
|
|
<table id="myTable" class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 30%;">Patient Name</th>
|
|
<th style="width: 10%;">Emp Code</th>
|
|
<th style="width: 20%;">Father Name</th>
|
|
<th style="width: 10%;">Phone</th>
|
|
<!-- <th style="width: 10%;">Base OHC</th> -->
|
|
<th style="width: 30%;">Email</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
//$(document).ready(function() {
|
|
var src = 'select_patient_list.php';
|
|
|
|
|
|
$(function() {
|
|
function log(message) {
|
|
$("<div>").text(message).prependTo("#log");
|
|
$("#log").scrollTop(0);
|
|
}
|
|
|
|
$("#primary_patient").autocomplete({
|
|
source: function(request, response) {
|
|
$.ajax({
|
|
url: src,
|
|
dataType: "json",
|
|
data: {
|
|
"searchParam": request.term
|
|
},
|
|
success: function(data) {
|
|
$("#primary_patientListTable tbody tr").remove();
|
|
var table = $("#primary_patientListTable");
|
|
|
|
if (data.length != 0) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
item = data[i];
|
|
table.append("<tr onClick=\"setPrimaryPatient(" + item.id +
|
|
",'" + item.patient_name + "(" + item.emp_code +
|
|
")')\"><td>" + item.patient_name + "</td></tr>");
|
|
}
|
|
|
|
}
|
|
$("#primary_patientTable").show();
|
|
$("#primary_patientListDiv").show();
|
|
}
|
|
});
|
|
},
|
|
minLength: 3,
|
|
delay: 300,
|
|
select: function(event, ui) {
|
|
log(ui.item ?
|
|
"Selected: " + ui.item.label :
|
|
"Nothing selected, input was " + this.value);
|
|
},
|
|
open: function() {
|
|
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
|
|
},
|
|
close: function() {
|
|
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
|
|
}
|
|
});
|
|
});
|
|
|
|
$(function() {
|
|
function log(message) {
|
|
$("<div>").text(message).prependTo("#log");
|
|
$("#log").scrollTop(0);
|
|
}
|
|
|
|
$("#emp_mgr").autocomplete({
|
|
source: function(request, response) {
|
|
$.ajax({
|
|
url: src,
|
|
dataType: "json",
|
|
data: {
|
|
"searchParam": request.term
|
|
},
|
|
success: function(data) {
|
|
$("#mgrListTable tbody tr").remove();
|
|
var table = $("#mgrListTable");
|
|
|
|
if (data.length != 0) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
item = data[i];
|
|
table.append("<tr onClick=\"setSuperVisor(" + item.id +
|
|
",'" + item.patient_name + "(" + item.emp_code +
|
|
")')\"><td>" + item.patient_name + "</td></tr>");
|
|
}
|
|
|
|
}
|
|
$("#mgrListTable").show();
|
|
$("#mgrListDiv").show();
|
|
}
|
|
});
|
|
},
|
|
minLength: 3,
|
|
delay: 300,
|
|
select: function(event, ui) {
|
|
log(ui.item ?
|
|
"Selected: " + ui.item.label :
|
|
"Nothing selected, input was " + this.value);
|
|
},
|
|
open: function() {
|
|
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
|
|
},
|
|
close: function() {
|
|
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#patient_name").autocomplete({
|
|
source: function(request, response) {
|
|
$.ajax({
|
|
url: src,
|
|
dataType: "json",
|
|
data: {
|
|
"searchParam": request.term,
|
|
"strict_search": "Y",
|
|
},
|
|
success: function(data) {
|
|
$("#myTable tbody tr").remove();
|
|
var table = $("#myTable");
|
|
|
|
if (data.length != 0) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
item = data[i];
|
|
table.append("<tr onClick=\"selectRow(" + item.id + ",'" + item
|
|
.emp_code + "')\"><td>" + item.patient_name + "</td><td>" + item.emp_code + "</td><td>" + item
|
|
.father_name + "</td><td>" + item.primary_phone + "</td><td>" +
|
|
item.offiial_email_id + "</td></tr>");
|
|
}
|
|
|
|
}
|
|
$("#myTable").show();
|
|
$("#searchResultDiv").show();
|
|
$("#dependent_list").hide();
|
|
}
|
|
});
|
|
},
|
|
minLength: 1,
|
|
delay: 300,
|
|
select: function(event, ui) {
|
|
log(ui.item ?
|
|
"Selected: " + ui.item.label :
|
|
"Nothing selected, input was " + this.value);
|
|
},
|
|
open: function() {
|
|
$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
|
|
},
|
|
close: function() {
|
|
$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
|
|
}
|
|
});
|
|
|
|
function setPrimaryPatient(emp_id, emp_code) {
|
|
$("#primary_patientListTable").hide();
|
|
$("#primary_patientListDiv").hide();
|
|
$("#primary_patient").val('');
|
|
$("#primary_patient_name").val(emp_code);
|
|
$("#primary_patient_id").val(emp_id);
|
|
}
|
|
|
|
function setSuperVisor(mgr_emp_id, emp_code) {
|
|
$("#mgrListTable").hide();
|
|
$("#mgrListDiv").hide();
|
|
$("#emp_mgr").val('');
|
|
$("#emp_mgr_name").val(emp_code);
|
|
$("#manager_emp_id").val(mgr_emp_id);
|
|
}
|
|
|
|
function selectRow(patient_id) {
|
|
|
|
var pre_emp_cat_id =
|
|
'<?= getTableFieldValue('patient_category', 'patient_cat_id', 'patient_cat_name', 'Pre Employment') ?>'
|
|
|
|
|
|
console.log("category " + pre_emp_cat_id);
|
|
$("#myTable").hide();
|
|
$("#searchResultDiv").hide();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'select_patient.php',
|
|
data: {
|
|
'key_val': patient_id,
|
|
key: 'id'
|
|
},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
|
|
if (data.emp_image_type == null || data.emp_image_type == '') {
|
|
|
|
$("#avatar").attr("src", "images/male-profile.png");
|
|
} else {
|
|
$("#avatar").attr("src", "data:" + data.emp_image_type + ";base64," + data.emp_photo);
|
|
}
|
|
|
|
|
|
|
|
if (data.image_type == null || data.image_type == '') {
|
|
$("#avatar2").attr("src", "images/no_image.png");
|
|
} else {
|
|
$("#avatar2").attr("src", "data:" + data.image_type + ";base64," + data.emp_sign);
|
|
}
|
|
|
|
$("#emp_cadre").val(data.emp_cadre);
|
|
$("#patient_id").val(data.id)
|
|
$("#flex_opd_id").val(data.id)
|
|
$("#update_button").show();
|
|
// $("#save_button").hide();
|
|
$("#father_name").val(data.father_name);
|
|
$("#patient_name").val(data.patient_name);
|
|
$("#is_ohc_staff").val(data.is_ohc_staff);
|
|
|
|
$("#emp_code").val(data.emp_code);
|
|
if (data.patient_cat_id == 1 || data.patient_cat_id == 3) {
|
|
|
|
$("#bussiness_unit").val(data.bu_id);
|
|
$("#dept").val(data.dept_id);
|
|
$("#bussiness_unit").select2();
|
|
$("#dept").select2();
|
|
$("#section").val(data.section_id);
|
|
$("#section").select2();
|
|
$("#sub_section").val(data.sub_section_id);
|
|
$("#sub_section").select2();
|
|
$("#primary_phone").val(data.primary_phone);
|
|
$("#aadhar_no").val(data.aadhar_no);
|
|
|
|
|
|
} else {
|
|
|
|
$("#bussiness_unit1").val(data.bu_id);
|
|
$("#dept1").val(data.dept_id);
|
|
$("#section1").val(data.section_id);
|
|
$("#sub_section1").val(data.sub_section_id);
|
|
$("#primary_phone1").val(data.primary_phone);
|
|
$("#aadhar_no1").val(data.aadhar_no);
|
|
if (data.patient_cat_id == '<?= $pre_emp_cat_id ?>') {
|
|
$("#temp_emp_code").val(data.emp_code);
|
|
}
|
|
}
|
|
|
|
if (data.emp_cat_id == 2 || data.emp_cat_id == pre_emp_cat_id) {
|
|
$("#emp_sub_category_div").show();
|
|
} else {
|
|
$("#emp_sub_category_div").hide();
|
|
}
|
|
// $("#gender").val(data.gender);
|
|
|
|
|
|
$('input:radio[id=gender][value=' + data.gender + ']').prop('checked', true);
|
|
|
|
|
|
$("#patient_category").val(data.patient_cat_id);
|
|
$("#temp_emp_code").val(data.emp_code);
|
|
|
|
$("#emp_cadre").val(data.emp_cadre);
|
|
$("#dept").val(data.dept_id);
|
|
$("#dept").select2();
|
|
$("#employer_contractor_id").val(data.employer_contractor_id);
|
|
|
|
$("#manager_emp_id").val(data.emp_mgr_code);
|
|
$("#emp_mgr_name").val(getFieldValue("concat(patient_name,'(',emp_code,')')", 'patient_master',
|
|
'id', data.emp_mgr_code, 'emp_mgr_name'));
|
|
$("#emp_designation").val(data.designation_id)
|
|
$("#blood_group").val(data.blood_group);
|
|
$("#blood_group").select2();
|
|
$("#dep_loc").val(data.deployment_location);
|
|
$("#dep_loc").select2();
|
|
|
|
$("#plant_id").val(data.plant_id);
|
|
$("#plant_id").select2();
|
|
|
|
|
|
$("#has_first_aid").val(data.is_first_aid);
|
|
$("#primary_phone").val(data.primary_phone);
|
|
$("#aadhar_no").val(data.aadhar_no);
|
|
$("#village").val(data.village);
|
|
$("#post").val(data.post);
|
|
$("#ps").val(data.ps);
|
|
$("#tehsil").val(data.tehsil);
|
|
$("#district").val(data.district);
|
|
$("#state").val(data.state);
|
|
$("#pin_code").val(data.pin_code);
|
|
$("#primary_patient_id").val(data.primary_patient_id);
|
|
$("#primary_patient_name").val(getFieldValue("concat(patient_name,'(',emp_code,')')",
|
|
'patient_master', 'id', data.primary_patient_id, 'primary_patient_name'));
|
|
|
|
$("#relation_type").val(data.relation_type);
|
|
$("#dob").val(myDateFormater(data.dob));
|
|
|
|
if (data.dob != '1970-01-01' && data.dob != null && data.dob != undefined && data.dob != '0000-00-00' && data.dob != '01/01/1970') {
|
|
const dobDate = new Date(data.dob);
|
|
const currentDate = new Date();
|
|
|
|
let CalAge = currentDate.getFullYear() - dobDate.getFullYear();
|
|
|
|
if (
|
|
currentDate.getMonth() < dobDate.getMonth() ||
|
|
(currentDate.getMonth() === dobDate.getMonth() &&
|
|
currentDate.getDate() < dobDate.getDate())
|
|
) {
|
|
CalAge--;
|
|
}
|
|
|
|
$("#emp_age").val(CalAge);
|
|
}
|
|
|
|
|
|
$('#employer_contractor_id').select2();
|
|
//$("#manager_emp_id").select2();
|
|
$('#emp_designation').select2();
|
|
//$("#primary_patient_id").select2();
|
|
checkPatient();
|
|
showOrHideForDiv(data.patient_cat_id);
|
|
var gender = "";
|
|
if (data.gender == 'M')
|
|
gender = "Male"
|
|
else if (data.gender == 'F')
|
|
gender = "Female"
|
|
else
|
|
gender = "Others"
|
|
if (data.status == '1')
|
|
status = 'Active'
|
|
else
|
|
status = 'Inactive';
|
|
|
|
$("#dependent_icon").show();
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error In Fetching Patient Record');
|
|
}
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
function hideResultTable() {
|
|
$("#myTable").toggle("show");
|
|
$("#searchResultDiv").toggle("show");
|
|
|
|
|
|
}
|
|
|
|
function calcAge(dateString) {
|
|
var birthday = +new Date(dateString);
|
|
return ~~((Date.now() - birthday) / (31557600000));
|
|
}
|
|
|
|
$(document).on('click', function(e) {
|
|
if ($(e.target).closest(window.element).length === 0) {
|
|
$(window.element).hide();
|
|
$("#myTable").hide();
|
|
$("#searchResultDiv").hide();
|
|
}
|
|
});
|
|
|
|
|
|
|
|
$(document).on('keydown', function(e) {
|
|
if (e.keyCode === 27) { // ES
|
|
$(elem).hide();
|
|
$("#myTable").hide();
|
|
$("#searchResultDiv").hide();
|
|
}
|
|
if ($("#patient_name").val() == '') {
|
|
checkPatient();
|
|
}
|
|
});
|
|
</script> |