279 lines
9.5 KiB
PHP
279 lines
9.5 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 */
|
|
}
|
|
|
|
.dropdown {
|
|
position: relative;
|
|
width: 100%;
|
|
display: inline-block;
|
|
}
|
|
|
|
.dropdown-content {
|
|
display: none;
|
|
position: absolute;
|
|
margin-top: -12px;
|
|
width: 100%;
|
|
overflow: auto;
|
|
border: 1px solid #ddd;
|
|
z-index: 1;
|
|
}
|
|
|
|
#searchResultDiv {
|
|
overflow: scroll;
|
|
display: none;
|
|
position: absolute;
|
|
background-color: #fff;
|
|
width: 100%;
|
|
overflow: auto;
|
|
border: 1px solid #ddd;
|
|
z-index: 1;
|
|
}
|
|
</style>
|
|
<div class="dropdown">
|
|
<input type="text" id="patient_name" name="patient_name" onkeyup="myFunction()" onchange="checkPatient()"
|
|
autocomplete="off" style="text-transform:uppercase;" onChange="hideResultTable();" placeholder="Beneficiary Name"
|
|
title="Enter Beneficiary Name">
|
|
<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: 15%;">Father Name</th>
|
|
<th style="width: 10%;">Phone</th>
|
|
<!-- <th style="width: 10%;">Base OHC</th> -->
|
|
<th style="width: 20%;">Employer/Contractor</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
$ohc_type_id = "ohc_type_id = " . $_SESSION['current_ohcttype'];
|
|
if($_SESSION['RoleCode'] == 'VTIA' || $_SESSION['RoleCode'] == 'VTIC' || $_SESSION['RoleCode'] == 'TP12'){
|
|
$beneficiary_type = 'VTI';
|
|
}else{
|
|
$beneficiary_type = 'CSR';
|
|
}
|
|
$query = "select id, patient_name, father_name, emp_code, primary_phone,employer_contractor_id from patient_master where $ohc_type_id and beneficiary_type = '$beneficiary_type' order by patient_name ";
|
|
error_log("search query" . $query);
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
error_log("error pulling patient info:".mysqli_error($conn)."search query" . $query);
|
|
exit(mysqli_error($conn));
|
|
} else {
|
|
while ($row = @mysqli_fetch_array($result)) {
|
|
@extract($row);
|
|
|
|
?>
|
|
<tr onClick="selectRow(<?php echo $row['id'] ?>)">
|
|
|
|
<td style="font-family: verdana;"><?php echo $row['emp_code'] ?> -
|
|
<?php echo $row['patient_name'] ?></td>
|
|
<td style="font-family: verdana;"><?php echo $row['father_name'] ?></td>
|
|
<td style="font-family: verdana;"><?php echo $row['primary_phone'] ?></td>
|
|
<!-- <td style="font-family: verdana;"><?php echo getFieldFromTable("ohc_type_name", "ohc_type", "ohc_type_id", $row['ohc_type_id']) ?></td> -->
|
|
<td style="font-family: verdana;">
|
|
<?php echo getFieldFromTable("employer_contractor_name", "employer_contractor", "id", $row['employer_contractor_id']) ?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function selectRow(patient_id) {
|
|
|
|
$("#myTable").hide();
|
|
$("#searchResultDiv").hide();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'select_patient.php',
|
|
data: {
|
|
'key_val': patient_id,
|
|
key: 'id'
|
|
},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
|
|
$("#avatar").attr("src", "data:" + data.emp_image_type + ";base64," + data.emp_photo);
|
|
$("#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);
|
|
$("#village").val(data.village);
|
|
$("#district").val(data.district);
|
|
$("#tehsil").val(data.tehsil);
|
|
$("#dob").val(data.dob);
|
|
$("#trainees_no").val(data.primary_phone);
|
|
$("#perents_no").val(data.secondary_contact_no);
|
|
$("#education").val(data.education);
|
|
$("#reference_from").val(data.reference_from);
|
|
$("#enquiry_id").val(data.id);
|
|
$("#patient_name").val(data.patient_name);
|
|
$("#program").val(data.subject);
|
|
|
|
|
|
|
|
|
|
$("#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);
|
|
if (data.patient_cat_id == 1 || data.patient_cat_id == 3) {
|
|
$("#employee_div").show();
|
|
$("#non_employee_div").hide();
|
|
$("#bussiness_unit").val(data.bu_id);
|
|
$("#dept").val(data.dept_id);
|
|
$("#section").val(data.section_id);
|
|
$("#sub_section").val(data.sub_section_id);
|
|
$("#primary_phone").val(data.primary_phone);
|
|
$("#aadhar_no").val(data.aadhar_no);
|
|
|
|
|
|
} else {
|
|
$("#employee_div").hide();
|
|
$("#non_employee_div").show();
|
|
$("#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.emp_cat_id == 2) {
|
|
$("#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);
|
|
$("#emp_code").val(data.emp_code);
|
|
|
|
$("#emp_cadre").val(data.emp_cadre);
|
|
$("#dept").val(data.dept_id);
|
|
$("#employer_contractor_id").val(data.employer_contractor_id);
|
|
$("#manager_emp_id").val(data.emp_mgr_code);
|
|
$("#emp_designation").val(data.designation_id)
|
|
$("#blood_group").val(data.blood_group);
|
|
$("#dep_loc").val(data.deployment_location);
|
|
|
|
$("#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);
|
|
$("#relation_type").val(data.relation_type);
|
|
$("#dob").val(myDateFormater(data.dob))
|
|
$('#employer_contractor_id').select2();
|
|
$("#manager_emp_id").select2();
|
|
$('#emp_designation').select2();
|
|
$("#primary_patient_id").select2();
|
|
checkPatient();
|
|
|
|
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));
|
|
}
|
|
|
|
function myFunction() {
|
|
var input, filter, table, tr, td, i, txtValue;
|
|
input = document.getElementById("patient_name");
|
|
filter = input.value.toUpperCase();
|
|
table = document.getElementById("myTable");
|
|
$("#myTable").show();
|
|
$("#searchResultDiv").show();
|
|
tr = table.getElementsByTagName("tr");
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[0];
|
|
if (td) {
|
|
txtValue = td.textContent || td.innerText;
|
|
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
tr[i].style.display = "";
|
|
} else {
|
|
tr[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
$("#dependent_list").hide();
|
|
}
|
|
$(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>
|