275 lines
11 KiB
PHP
275 lines
11 KiB
PHP
|
<style>
|
||
|
#myInput {
|
||
|
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="myInput" name="patient_name" onkeyup="myFunction()" onBlur="checkPatient()" autocomplete="off" style= "text-transform:uppercase;" onChange="hideResultTable();" placeholder="Patient Name" title="Enter Patient Name">
|
||
|
<div id="searchResultDiv" class="dropdown-content">
|
||
|
<table id="myTable" class="table table-bordered table-hover">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th style="width: 25%;">Name</th>
|
||
|
<th style="width: 25%;">Father Name</th>
|
||
|
<th style="width: 25%;">Emp Code</th>
|
||
|
<th style="width: 25%;">Phone</th>
|
||
|
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
|
||
|
<?php
|
||
|
$query = "select id, patient_name, father_name, emp_code, primary_phone from patient_master order by patient_name ";
|
||
|
// echo $query;
|
||
|
if (! $result = @mysqli_query($conn,$query)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
} else {
|
||
|
while ($row = @mysqli_fetch_array($result)) {
|
||
|
@extract($row);
|
||
|
|
||
|
?>
|
||
|
<tr onClick="selectRow(<?php echo $row['id']?>)" >
|
||
|
<td><?php echo $row['patient_name']?></td>
|
||
|
<td><?php echo $row['father_name']?></td>
|
||
|
<td><?php echo $row['emp_code']?></td>
|
||
|
<td><?php echo $row['primary_phone']?></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){
|
||
|
$("#patient_id").val(data.id)
|
||
|
$("#flex_opd_id").val(data.id)
|
||
|
<?php if($_REQUEST['task']=='visitor_opd' || $_REQUEST['task']=='ime_long' || $_REQUEST['task']=='ime_short'){?>
|
||
|
|
||
|
$("#update_button").show();
|
||
|
$("#save_button").hide();
|
||
|
$("#father_name").val(data.father_name);
|
||
|
|
||
|
$("#myInput").val(data.patient_name);
|
||
|
if(data.patient_cat_id==1){
|
||
|
$("#employee_div").show();
|
||
|
}else{
|
||
|
$("#employee_div").hide();
|
||
|
}
|
||
|
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);
|
||
|
// $("#emp_sub_cat").val(data.emp_sub_cat_id);
|
||
|
$("#employer_contractor_id").val(data.employer_contractor_id);
|
||
|
$("#emp_designation").val(data.designation_id)
|
||
|
$("#blood_group").val(data.blood_group);
|
||
|
// $("#emp_cat").val(data.emp_cat_id);
|
||
|
$("#has_first_aid").val(data.is_first_aid);
|
||
|
$("#phone_no").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);
|
||
|
$("#dob").val(myDateFormater(data.dob))
|
||
|
$('#employer_contractor_id').select2();
|
||
|
$('#emp_designation').select2();
|
||
|
|
||
|
checkPatient();
|
||
|
|
||
|
|
||
|
/*$('#father_name').attr("readonly", "readonly");
|
||
|
$('#pin_code').attr("readonly", "readonly");
|
||
|
$('#state').attr("readonly", "readonly");
|
||
|
$('#district').attr("readonly", "readonly");
|
||
|
$('#tehsil').attr("readonly", "readonly");
|
||
|
$('#ps').attr("readonly", "readonly");
|
||
|
$('#village').attr("readonly", "readonly");
|
||
|
$('#aadhar_no').attr("readonly", "readonly");
|
||
|
$('#phone_no').attr("readonly", "readonly");
|
||
|
$('#has_first_aid').attr("readonly", "readonly");
|
||
|
$('#blood_group').attr("readonly", "readonly");
|
||
|
$('#emp_designation').attr("readonly", "readonly");
|
||
|
$('#employer_contractor_id').attr("readonly", "readonly");
|
||
|
$('#dept').attr("readonly", "readonly");
|
||
|
$('#emp_cadre').attr("readonly", "readonly");
|
||
|
$('#patient_category').attr("readonly", "readonly");
|
||
|
$('#gender').attr("readonly", "readonly");
|
||
|
$('#post').attr("readonly", "readonly");
|
||
|
$('#status').attr("readonly", "readonly");
|
||
|
$('#ohc_type_id').attr("readonly", "readonly");*/
|
||
|
|
||
|
("#emp_designation").select2();
|
||
|
<?php }?>
|
||
|
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'
|
||
|
var patient_content='';
|
||
|
patient_content+='<div class="col-xs-12 col-sm-9">'
|
||
|
patient_content+='<div class="space-20"></div>'
|
||
|
patient_content+='<div class="profile-user-info profile-user-info-striped">'
|
||
|
patient_content+='<div class="profile-info-row">'
|
||
|
patient_content+='<div class="profile-info-name">PATIENT NAME</div>'
|
||
|
patient_content+='<div class="profile-info-value">'
|
||
|
patient_content+='<span>'+data.patient_name+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">FATHER NAME</div>'
|
||
|
patient_content+='<div class="profile-info-value"><span>'+data.father_name+'</span>'
|
||
|
patient_content+='</div></div><div class="profile-info-row"><div class="profile-info-name">Gender</div>'
|
||
|
patient_content+='<div class="profile-info-value"><span>'+gender+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">CODE/G.PASS NO</div><div class="profile-info-value">'
|
||
|
patient_content+='<span>'+data.emp_code+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">Age</div>'
|
||
|
patient_content+='<div class="profile-info-value"><span>'+calcAge(data.dob)+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Joining Date</div>'
|
||
|
patient_content+='<div class="profile-info-value">'+data.doj+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">PATIENT CATEGORY</div>'
|
||
|
patient_content+='<div class="profile-info-value"><span>'+data.patient_cat_name+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Department</div><div class="profile-info-value"><span>'+data.dept_name+'</span></div></div>'
|
||
|
patient_content+=' <div class="profile-info-row"><div class="profile-info-name">DESIGNATION</div><div class="profile-info-value"> <span>'+data.designation_name+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">EMPLOYEE CADRE</div><div class="profile-info-value"><span>'+data.emp_cadre+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">EMPLOYER/CONTRACTOR</div>'
|
||
|
patient_content+='<div class="profile-info-value"><span>'+data.employer_contractor_name+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Is First Aider </div><div class="profile-info-value"><span><?php echo ($is_first_aid==1) ? "Yes": "No" ?></span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">PHONE NUMBER</div><div class="profile-info-value"><span>'+data.primary_phone+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Aadhar No</div><div class="profile-info-value"><span>'+data.aadhar_no+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">RESIDING VILLAGE</div><div class="profile-info-value"><span>'+data.village+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">POST</div><div class="profile-info-value"><span>'+data.post+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">PS</div><div class="profile-info-value"><span>'+data.ps+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Tehsil</div><div class="profile-info-value"><span>'+data.tehsil+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">District</div><div class="profile-info-value"><span>'+data.district+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">State</div><div class="profile-info-value"><span>'+data.state+'</span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">Pin Code</div><div class="profile-info-value"><span>'+data.pin_code+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name"></div><div class="profile-info-value"><span></span></div></div>'
|
||
|
patient_content+='<div class="profile-info-row"><div class="profile-info-name">OHC Location</div><div class="profile-info-value"><span>'+data.ohc_type_name+'</span></div>'
|
||
|
patient_content+='<div class="profile-info-name">Status</div><div class="profile-info-value"><span>'+status+'</span></div></div></div></div>'
|
||
|
$("#patient_info").html(patient_content);
|
||
|
|
||
|
},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("myInput");
|
||
|
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";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
$( 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();
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|