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

850 lines
36 KiB
PHP

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
* {
font-family: sans-serif;
}
table,
tr,
td {
border: none !important;
}
.print {
position: absolute;
right: 11%;
}
@media print {
#printPageButton {
display: none;
}
.header {
background-color: #ffeb3b !important;
print-color-adjust: exact;
}
}
/* .tbl1 {
border-collapse: collapse;
} */
/* th {
background-color: #e1e1e1;
font-size: 10px;
font-style: bold;
vertical-align: top;
}
td {
text-align: left;
font-size: 10px;
vertical-align: top;
padding: 8px !important;
} */
/* tr {
border: 1px solid black;
} */
</style>
<?php
// include autoloader;
include('includes/config/config.php');
include('log_entry.php');
include_once("includes/functions.php");
$checkup_id = $_REQUEST['checkup_id'];
$data=array();
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
$query = "select * from ohc_type where ohc_type_id = '" . $_SESSION['current_ohcttype'] . "'";
error_log("query: 27: " . $query);
// echo $query;
$result = mysqli_query($conn, $query);
$row_company = mysqli_fetch_array($result);
@extract($row_company);
//Code for loading the Check up Sections List for the given Checkup page case
$sql_patient = "select * from checkup_form where checkup_id = '$checkup_id'";
$result_p = mysqli_query($conn, $sql_patient);
$row_p = mysqli_fetch_array($result_p);
@extract($row_p);
$queryc = "select * from company_profile ";
$resultc = mysqli_query($conn, $queryc);
$row_company = mysqli_fetch_array($resultc);
@extract($row_company);
$checkup_section_ids = $row_p['checkup_section_ids'];
$param_present = (explode(',', $row_p['checkup_section_ids']));
$param_present = array_unique($param_present);
//for each Section enabled for the checkup case
// print_r($param_present);
foreach ($param_present as $x => $val) {
$sql_param = "select a.*,b.* from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
error_log("//query to load fields for each section@@@@@@@!!!!" . $sql_param);
$result_param = mysqli_query($conn, $sql_param);
$param_name = array();
$param_value = array();
$param_unit ='';
$param_ranges='';
while ($row_param = mysqli_fetch_assoc($result_param)) {
array_push($param_name, $row_param['parameter_name']);
if(empty(getFieldFromTable('parameter_value_name', 'checkup_parameter_value', 'parameter_value_id', $row_param['checkup_form_value'])) && empty(getCommaSeperatedValuesForInClause("select parameter_value_name from checkup_parameter_value", 'parameter_value_id', $row_param['checkup_form_value'])) && empty($row_param['checkup_form_value'])){
$param_unit='';
}else{
$param_unit= getFieldFromTable('unit_name', 'checkup_parameter_unit_master', 'unit_id', $row_param['unit']);
}
if ($row_param['input_type'] == 'select') {
array_push($param_value, getFieldFromTable('parameter_value_name', 'checkup_parameter_value', 'parameter_value_id', $row_param['checkup_form_value']).' &nbsp;'.$param_unit);
} else if ($row_param['input_type'] == 'multiselect') {
array_push($param_value, getCommaSeperatedValuesForInClause("select parameter_value_name from checkup_parameter_value", 'parameter_value_id', $row_param['checkup_form_value']).' '.$param_unit);
} else {
array_push($param_value, $row_param['checkup_form_value'].' '.$param_unit);
}
}
$sql_group_ids = "select count(distinct(a.group_id)) as field_value from checkup_parameter a left join checkup_form_key_value b on a.column_name = b.checkup_form_key where checkup_form_id = '$checkup_id' and checkup_form_section_id = '$val' order by column_order";
$result_grp = mysqli_query($conn, $sql_group_ids);
$row_grp = mysqli_fetch_assoc($result_grp);
$total_group_ids = $row_grp['field_value'];
//echo 'hellooooooooooooooooooo';
error_log("total group ids:" . $total_group_ids);
$group_ids = array();
for ($i = 1; $i <= $total_group_ids; $i++) {
$group_id = "select count(group_id) from checkup_parameter where group_id = '$i' and enabled!='N' and checkup_form_section_id = '$val'";
error_log("group id len query:" . $group_id);
$result_group_id = mysqli_query($conn, $group_id);
$row_group_id = mysqli_fetch_array($result_group_id);
array_push($group_ids, $row_group_id['0']);
}
$max_len = max($group_ids);
// echo $max_len;
// print_r($group_ids);
$k = 0;
for ($i = 0; $i < $total_group_ids; $i++) {
$value = $group_ids[$i];
$value2 = $max_len - $value;
while ($value != 0) {
$para=array(
$param_name[$k]=>$param_value[$k],
);
array_push($data,$para);
$k++;
$value--;
} while ($value2 != 0) { $value2--;}}}
function chekFromItem($arr, $keyToSearch) {
foreach($arr as $key=>$para){
foreach($para as $name=>$value)
{
if($name==$keyToSearch) return $value;
}
}}
error_log("data".print_r($data,true));
?>
</head>
<body>
<form name="checkup_form_employee" id="checkup_form_employee" method="POST">
<div class="row" style="display:flex">
<div id="preexam_form_div" style="width:50%;outline-style: solid;margin-right: 10px; ">
<table width="100%" class='header' style="background-color:#ffeb3b;">
<tr>
<!-- <?php if( !empty($row_company['company_logo']) || $row_company['company_logo'] !=null || $row_company['company_logo'] !="" ){ ?>
<td width="20%"><img
src="data:<?php echo $row_company['image_type'] ?>;base64,<?php echo base64_encode($row_company['company_logo']) ?>"
style="width: 150px; height: 60px; margin: 0px; padding: 0px;background-color: #ffff0080;">
</td> <?php } ?> -->
<td width="60%" align="center">
<div style="margin-left: 20px;">
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">
<?php echo $row_company['company_name'] ?>
</strong><br />
<strong
style="margin-left: 50px ;font-size: 15px; text-align: center;"><?php echo $row_company['address'] ?>
</strong><br />
<strong style="margin-left:50px;color:green; font-size: 15px;">ANNUAL MEDICAL CHECK UP
HEALTH
CARD </strong>
</div>
</td>
<!-- <?php if (isset($row_company['right_com_logo']) && $row_company['right_com_logo'] != null) { ?>
<td width="20%" align="right"><img
src="data:<?php echo $row_company['right_image_type'] ?>;base64,<?php echo base64_encode($row_company['right_com_logo']) ?>"
style="width: 150px; height: 60px; margin:0px; padding: 0px;">
</td>
<?php } ?> -->
</tr>
</table>
<hr>
<input type="hidden" id="checkup_section_ids" name="checkup_section_ids[]">
<div class="mainPanel">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading" id="panel-heading1">
</div>
<div class="panel-body">
<div class="row">
<?php
// $emp_id ='5504';
$sql_employee = "select * from patient_master where id=(select emp_id from checkup_form where checkup_id='$checkup_id' )";
$result = mysqli_query($conn, $sql_employee);
//$checkup_id = $_REQUEST['flex_checkup_id'];
// $sql_checkup = "select * from checkup_form where checkup_id='$checkup_id'";
//echo $sql_checkup;
$checkup_result = mysqli_query($conn, $sql_employee);
$row_checkup = mysqli_fetch_assoc($checkup_result);
while ($row_employee = mysqli_fetch_assoc($result)) {
$patient = $row_employee['patient_name'];
$gender = $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE';
$age = "";
if (!empty($row_employee['dob'])) {
$dob = $row_employee['dob'];
$age = (date('Y') - date('Y', strtotime($dob)));
}
?>
<table border="0" width="100%" style="font-size:12px">
<tr>
<td width="25%" style="color:red;">
<strong><?php echo $patient?></strong>
</td>
<td width="25%">
<b style="color:red;">EMPLOYEE ID:</b>
<?php echo $row_employee['emp_code'] ?>
</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td width="25%">
<b style="color:red;"> Date:</b>
<?php echo date_format(date_create($row_p['checkup_date']), "d-M-Y") ?>
</td>
<td width="25%">
<b style="color:red;">AMC No.</b>
<?php echo $row_p['ticket_no'] ?>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">GENDER:</b>
<?php echo $row_employee['gender'] == 'm' || $row_employee['gender'] == 'M' ? 'MALE' : 'FEMALE' ?>
</td>
<td width="25%">
<b style="color:red;">DOJ:</b>
<?php if($row_employee['doj']!='' || $row_employee['doj']!=null) echo date_format(date_create($row_employee['doj']), "d-M-Y") ?>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">DOB:</b>
<?= !empty($row_employee['dob']) ? date_format(date_create($row_employee['dob']), "d-M-Y") : '' ?>
</td>
<td width="25%">
<b style="color:red;">Age</b>
<?php echo $age ?>
</td>
</tr>
<tr>
<tr>
<td width="25%">
<b style="color:red;">DESIGNATION:</b>
<?php echo getFieldFromTable('designation_name', 'designation', 'designation_id', $row_employee['designation_id']) ?>
</td>
<td width="25%">
<b style="color:red;">MOBILE NO.:</b>
<?php echo $row_employee['primary_phone'] ?>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">DEPARTMENT:</b>
<?php echo getFieldFromTable('dept_name', 'department', 'dept_id', $row_employee['dept_id']) ?>
</td>
<td width="25%">
<b style="color:red;">DIVISION:</b>
<?php echo getTableFieldValue('bussiness_unit', 'bu_name', 'bu_id', $row_employee['bu_id'], ''); ?>
</td>
</tr>
<td width="25%">
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">HEIGHT:</b>
<?php echo chekFromItem($data,"Height") ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b style="color:red;">WEIGHT:</b>
<?php echo chekFromItem($data,"Weight")?>
</td>
<td width="25%">
<b style="color:red;">BMI:</b>
<?php echo chekFromItem($data,"BMI")?>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">IDENTIFICATION M.:</b>
<?php echo $row_employee['identity'] ?>
</td>
<td width="25%">
<b style="color:red;">B.group:</b>
<?php echo $row_employee['blood_group'] ?>
</td>
</tr>
</table>
<?php } ?>
<table border="5" width="100%" style="font-size:12px;outline-style: solid;">
<tr>
<td align="center" style="outline-style: solid;">
<b style="color:red;">ETE TEST</b>
</td>
<td align="center" style="outline-style: solid;">
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b>RT.EYE</b>
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b>LT.EYE</b>
</td>
</tr>
<tr>
<td align="center" width="25%" style="outline-style: solid;">
<b style="color:red;">SPECTS </b>
</td>
<td align="center" width="25%" style="outline-style: solid;">
<b>DIST</b>
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b><?php echo chekFromItem($data,"DISTANT VISION RT EYE")?></b>
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b><?php echo chekFromItem($data,"DISTANT VISION LT EYE")?></b>
</td>
</tr>
<tr>
<td align="center" width="25%" style="outline-style: solid;">
<b style="color:red;">WITHOUT GLASS</b>
</td>
<td align="center" width="25%" style="outline-style: solid;">
<b>NEAR</b>
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b><?php echo chekFromItem($data,"NEAR VISION RT EYE")?></b>
</td>
<td width="25%" align="center" style="outline-style: solid;">
<b><?php echo chekFromItem($data,"NEAR VISION LT EYE")?></b>
</td>
</tr>
<tr>
<td align="center" style="outline-style: solid;">
<b style="color:red;">COLOR VISION BY ISHIHARA CHART</b>
</td>
<td align="center" style="outline-style: solid;">
</td>
<td width="25%" colspan="2" align="center" style="outline-style: solid;">
<b><?php echo chekFromItem($data,"COLOUR VISION ISHIHARA CHART")?></b>
</td>
</tr>
</table>
<table border="0" width="100%" style="font-size:12px">
<tr>
<td width="25%">
<b style="color:red;">PULSE</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Pulse")?></b>
</td>
<!-- <td width="25%" colspan="2" align="center">
<b style="color:red;">P/O/L/I/C/C</b>
</td> -->
<td width="25%">
<b style="color:red;">BP</b>
<b><?php echo chekFromItem($data,"Systolic BP")."/".chekFromItem($data,"DIASTOLIC BP")?></b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;"> SYS EXAM</b>
</td>
<td width="25%">
<b>NAD</b>
</td>
<td width="25%" colspan="2" align="center">
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">PAST H/O:</b>
</td>
<td width="25%" colspan="4">
<b><?php echo "CAD: ".chekFromItem($data,"CAD").", "?><?php echo "HYPERTENSION: ".chekFromItem($data,"Hypertension").", "?><?php echo "DIABETES: ".chekFromItem($data,"Diabetes")?></b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">MEDICATION H/O:</b>
</td>
<td width="25%" colspan="4">
<b>PRESENT
MEDICATION:<?=" ".chekFromItem($data,"PRESENT MEDICATION IF ANY")?></b>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="preexam_form_div" style="width:50%;outline-style: solid;margin-right: 10px; ">
<table border="0" width="100%" style="font-size:12px">
<tr>
<td width="25%">
<b style="color:red;">HB:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Haemoglobin")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">M: 13-18 F:12-16</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">RBS:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"RBS")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(70-140)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">HBA1C:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"HBA1C")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(4.0-6.5)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">FBS:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"FBS")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(70-110)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">TOTAL CHOLESTEROL:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Total Cholesterol")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 200)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM TRIGLYCERIDES:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Serum Triglyceride")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 150)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM HDL:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"SERUM HDL")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(> 40)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM LDL:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Serum LDL")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 100)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM VLDL:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Serum VLDL")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 30)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM BILIRUBIN TOTAL:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Serum Bilirubin Total")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(0.5-1.2)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SERUM CREATININE:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Serum Creatinine")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(M:0.6-1.4 F:0.5-1.2)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SGPT:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"SGPT")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 40)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">SGOT:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"SGOT ")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">(< 40)</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">BUN:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"BUN")?></b>
</td>
<td width="25%" colspan="2" align="center">
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">URINE SUGAR:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"Sugar")?></b>
</td>
<td width="25%" colspan="2" align="center">
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">AUDIO:</b>
</td>
<td width="25%">
<b><?php if(chekFromItem($data,"Audiometry RT Ear")!=null || chekFromItem($data,"Audiometry RT Ear")!=''){ echo " R: ".chekFromItem($data,"Audiometry RT Ear");}?><?php if(chekFromItem($data,"Audiometry LT Ear")!=null || chekFromItem($data,"Audiometry LT Ear")!=''){echo " L: ".chekFromItem($data,"Audiometry LT Ear");}?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">-</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">PFT:</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"SPIROMETRY (PFT)")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">-</b>
</td>
</tr>
<tr>
<td width="25%">
<b style="color:red;">X RAY CHEST (PA VIEW)</b>
</td>
<td width="25%">
<b><?php echo chekFromItem($data,"X Ray Chest (PA View)")?></b>
</td>
<td width="25%" colspan="2" align="center">
<b style="color:#0000ff8a;">- </b>
</td>
</tr>
</table>
<hr>
<table width="100%" class='header' style="background-color:#ffeb3b;height:150px">
<tr>
<td width="60%" align="center" style="color:BLUE;">
<div style="margin-left: 20px;">
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">
<?php echo getTableFieldValue("patient_master","patient_name",'id',$row_p['doc_attend']) ?>
</strong><br />
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">CHIF MEDICAL
OFFICER</strong><br />
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">OCCUPATIONAL
HEALTH CENTRE</strong><br />
<strong
style="margin-left: 50px ;font-size: 15px; text-align: center;"><?php echo $row_company['address'] ?>
</strong><br />
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">
CONTACT NO. 9099093222,9099061549,02876-
</strong><br />
<strong style="margin-left: 50px ;font-size: 15px; text-align: center;">
265302/3/4
</strong><br />
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<form id="employeeDetailsFormPdf" action="" method="POST">
<input type="hidden" name="htmlText" id="htmlText" />
</form>
<button id="printPageButton" class="btn btn-success print" onClick="window.print();">Print</button>
</body>
<script>
// $("td").each(function() {
// if (this.innerText === '') {
// this.closest('tr').remove();
// }
// });
</script>