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

524 lines
17 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FOOD HANDLER MEDICAL EXAMINATION CARD</title>
</head>
<style>
.table1, .table2, .table4 th, td {
border: none;
border-collapse: collapse;
}
td, p {
/*padding: 4px;*/
font-size: small;
}
.table3 {
border: 1px solid;
border-collapse: collapse
}
.table3 td, .eye_sight td {
border: 1px solid;
border-collapse: collapse
}
.photo {
border: 1px black solid;
width: 80px;
height: 100px;
}
u {
text-underline-offset: 1px;
}
.eye_sight {
border: 1px solid black;
padding: 0;
border-collapse: collapse;
width: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
/* tr , td {
border: 1px solid black;
padding: 0;
border-collapse: collapse;
} */
div {
width: 80%;
height: 80%;
border: solid 0px;
/* position: left; */
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.btn {
background-color: #4CAF50;
border-radius: 5%; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
@media print {
#printPageButton {
display: none;
}
}
</style>
<?php
include ('includes/config/config.php');
include_once ("includes/functions.php");
$queryc = "select * from company_profile ";
// echo $query;
$resultc = mysqli_query($conn,$queryc);
$row_company = mysqli_fetch_array($resultc);
@extract($row_company);
$sql_patient_physical_parameters="select a.*,b.*,c.*,a.height,a.weight,a.waist,a.bp,e.file_name, e.emp_sign as sign, e.qualification,e.registration_no,e.emp_id as sign_id, f.company_name, f.company_logo, f.image_type,address from company_profile f, medical_examination a inner join patient_master b on b.id=a.patient_id left join designation c on b.designation_id=c.designation_id left join tbl_users d on d.user_id=a.approved_by left join employee_signature e on d.emp_id=e.emp_id where a.medical_exam_id='".$_REQUEST['medical_exam_id']."' ";
// echo $sql_patient_physical_parameters;
$result_patient_physical_parameters= mysqli_query($conn,$sql_patient_physical_parameters);
$row_patient_physical_parameters= mysqli_fetch_assoc($result_patient_physical_parameters);
@extract($row_patient_physical_parameters);
error_log($row_patient_physical_parameters['patient_name']);
error_log($row_patient_physical_parameters['pohc_no']);
error_log("sagar Height".$row_patient_physical_parameters['height']);
// error_log($row_patient_physical_parameters['approving_doc_sign_img']);
// error_log($row_patient_physical_parameters['doc_sign_image_type']);
$doc_emp_id = getFieldfromTable('emp_id', 'tbl_users', 'user_id', $sign_medical_officer);
// error_log($doc_emp_id);
$doctor_name = getFieldfromTable('patient_name', 'patient_master', 'id', $doc_emp_id);
$design = getFieldfromTable('designation_name','designation','designation_id',$row_patient_physical_parameters['designation_id']);
$contractor = getFieldfromTable('employer_contractor_name','employer_contractor','id',$row_patient_physical_parameters['employer_contractor_id']);
$queryf = "select * from medical_examination where medical_exam_id='" . $_REQUEST['medical_exam_id'] . "' ";
// echo $query;
$resultf = mysqli_query($conn,$queryf);
$rowf = mysqli_fetch_array($resultf);
@extract($rowf);
$sql_past_occupational_history = " select * from past_occupational_history where medical_exam_id='" . $_REQUEST['medical_exam_id'] . "' ";
$result_past_occupational_history = mysqli_query($conn,$sql_past_occupational_history);
$row_past_occupational_history = mysqli_fetch_assoc($result_past_occupational_history);
@extract($row_past_occupational_history);
$sql_patient_personal_info = " select * from patient_personal_information where medical_exam_id='" . $_REQUEST['medical_exam_id'] . "' ";
$result_patient_personal_info = mysqli_query($conn,$sql_patient_personal_info);
$row_patient_personal_info = mysqli_fetch_assoc($result_patient_personal_info);
@extract($row_patient_personal_info);
$date_of_exam = strtoupper(date_format(date_create($row_patient_personal_info['date_of_exam']), "d-M-Y "));
?>
<body>
<div align="right">
<button align="center" id="printPageButton" class="btn btn-success"
onClick="window.print();">Print</button>
</div>
<table cellspacing="0" width="100%">
<tr>
<td width="10%"><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;"></td>
<td width="70%">
<div>
<strong style="margin-left: 25px; font-size: 20px"><?php echo $row_company['company_name']?></strong>
<!-- <strong style="margin-left: 100px">MEDICAL DEPARTMENT</strong>
<b style="margin-left: 60px"><?php echo $row_company['address']?></b>
<strong style="margin-left: 60px;">PREVENTION IS BETTER THAN CURE</strong> -->
</div>
</td>
<td width="20%" align="right"><strong>OHC Mob.</strong><?php echo $row_company['primary_phone']?><br>
<strong>MO Mob:</strong><?php echo $row_company['fax']?><br> <b
style="font-size: 14px">Email:</b><span style="font-size: 14px"><?php echo strtolower($row_company['primary_email'])?></span>
</td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="2"><strong style="margin-left: 100px">MEDICAL DEPARTMENT</strong></td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="2"><b style="margin-left: 90px"><?php echo $row_company['address']?></b></td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="2"><strong
style="margin-left: 140px; text-decoration: underline;">FOOD HANDLER
EXAMINATION</strong></td>
</tr>
</table>
<br>
<table style="width: 100%">
<tr>
<td align="left">Form No. :<?php echo $row_patient_physical_parameters['pohc_no']?></td>
<td colspan="10" align="right"><strong>Date:<?php echo date("d-M-Y",strtotime($row_patient_physical_parameters['medical_entry_date']))?></td>
</tr>
</tr>
<td colspan="6"><strong>Name:</strong>...........<?php echo $row_patient_physical_parameters['patient_name']?>..............</td>
<td colspan="3"><strong>Age:</strong>&nbsp; &nbsp; <?php
$from = new DateTime($dob);
$to = new DateTime('today');
echo $from->diff($to)->y;?></td>
<td colspan="2"><strong>Sex:</strong> <?php if($gender=='M')
echo " Male";
elseif ($gender=='F')
echo " Female";?></td>
</div>
</tr>
<tr>
<td colspan="6"><strong>Father's Name:</strong>......<?php echo $row_patient_physical_parameters['father_name']?>............</td>
<td colspan="6"><strong>Blood Group</strong>.....<?php echo $row_patient_physical_parameters['blood_group']?>.......</td>
</tr>
<tr>
<td colspan="6"><strong>EmpID:</strong>......<?php echo $row_patient_physical_parameters['emp_code']?>............</td>
<td colspan="6"><strong>Designation:</strong>........<?php echo $design?>............</td>
</tr>
<tr>
<td colspan="6"><strong>Company/ Contractor Name:</strong>......<?php echo $contractor?>............</td>
</tr>
<tr>
<td colspan="6"><strong>Emai ID:</strong>&nbsp; &nbsp; <?php echo $row_patient_physical_parameters['email_id']?></td>
<td colspan="6"><strong>MOBILE NO:</strong>&nbsp; &nbsp; <?php echo $row_patient_physical_parameters['primary_phone']?></td>
</tr>
<tr>
<td colspan="6"><strong>PERMANENT ADDRESS:</strong>&nbsp; &nbsp; <?php echo $row_patient_physical_parameters['village']?>,<?php echo $row_patient_physical_parameters['post']?>,<?php echo $row_patient_physical_parameters['ps']?>,<?php echo $row_patient_physical_parameters['tehsil']?>,<?php echo $row_patient_physical_parameters['district']?>,<?php echo $row_patient_physical_parameters['state']?>,<?php echo $row_patient_physical_parameters['pincode']?> </td>
</tr>
</table>
<center>
<h4>
<u>MEDICAL REPORT</u>
</h4>
<p>
<u>(To be filled by the M.O.)</u>
</p>
</center>
<?php
$sql_section = "select * from history_parameter where param_id not in (13) order by param_id asc";
$result_section = mysqli_query($conn,$sql_section);
$row_section = mysqli_fetch_assoc($result_section);
function check_illness($illness_id)
{
$new_sqll = "SELECT past_present_illness FROM MEDICAL_EXAMINATION WHERE medical_exam_id = '" . $_REQUEST['medical_exam_id'] . "'";
$resultl = mysqli_query($conn,$new_sqll);
if (mysqli_num_rows($resultl) > 0) {
$rowl = @mysqli_fetch_array($resultl);
$param_present = (explode(', ', $rowl[0]));
}
$flag = 0;
if (mysqli_num_rows($resultl) > 0) {
foreach ($param_present as $x => $val) {
if ($val == $illness_id) {
echo '<span style="font-family:ZapfDingbats">√</span>';
$flag ++;
break;
}
}
} else {
echo '';
}
if ($flag == 0) {
echo 'X';
}
}
?>
<table class="table2" style="width: 90%">
<td>
<h3>
<u>Past and Present Ailment: </u>
</h3>
</td>
</tr>
<tr>
<td ><strong> Asthma:</strong>&nbsp; &nbsp;<?php check_illness('1'); ?> </td>
<td ><strong>Diabetes Mellitus:</strong>&nbsp; &nbsp;<?php check_illness('2'); ?> </td>
<td ><strong>TB:</strong>&nbsp; &nbsp; <?php check_illness('3'); ?></td>
</tr>
<tr>
<td><strong>Hypertension:</strong>&nbsp; &nbsp; <?php check_illness('4'); ?></td>
<td><strong>Jaundice:</strong>&nbsp; &nbsp; <?php check_illness('6'); ?></td>
<td><strong>Epilepsy:</strong>&nbsp; &nbsp; <?php check_illness('5'); ?></td>
</tr>
<tr>
<td><strong>Psychiatric Illness:</strong>&nbsp; &nbsp; <?php check_illness('7'); ?></td>
<td><strong>Hernia/Hydrocele:</strong>&nbsp; &nbsp; <?php check_illness('8'); ?></td>
<td><strong>Heart Disease:</strong>&nbsp; &nbsp; <?php check_illness('9'); ?></td>
</tr>
<tr>
<td><strong>Piles/Fistula:</strong>&nbsp; &nbsp; <?php check_illness('10'); ?></td>
<td><strong>Night Blindness:</strong>&nbsp; &nbsp; <?php check_illness('11'); ?></td>
<td><strong>Typhoid:</strong>&nbsp; &nbsp; <?php check_illness('12'); ?></td>
</tr>
<tr>
<td><strong>Major Injury/Fracture/Operation:</strong>&nbsp; &nbsp; <?php check_illness('13'); ?></td>
<td><strong>Spondylosis:</strong>&nbsp; &nbsp; <?php check_illness('15'); ?></td>
<td><strong>Leprosy:</strong>&nbsp; &nbsp; <?php check_illness('16'); ?></td>
</tr>
<tr>
<td><strong>Thyroid:</strong>&nbsp; &nbsp; <?php check_illness('17'); ?></td>
<td><strong>Vertigo:</strong>&nbsp; &nbsp; <?php check_illness('18'); ?></td>
<td><strong>STD:</strong>&nbsp; &nbsp; <?php check_illness('19'); ?></td>
</tr>
<tr>
<td><strong>Any other disease:</strong>&nbsp; &nbsp; <?php check_illness('20'); ?></td>
</tr>
</table>
<table class="table2" style="width: 100%">
<tr>
<td colspan="8">
<h3>
<u>CLINICAL OBSERVATIONS/FINDINGS:</u>
</h3>
</td>
</tr>
<table class="table table3" border="1" cellspacing="0" style="width: 80%" >
<tr>
<td ><strong style="font-weight: 800" >A</strong></td>
<td ><strong style="font-weight: 800" >CY</strong> </td>
<td ><strong style="font-weight: 800">I</strong> </td>
<td><strong style="font-weight: 800" >CL</strong> </td>
<td><strong style="font-weight: 800">OE</strong> </td>
</tr>
<tr>
<tr>
<td>
<?php echo $row_patient_physical_parameters['a']?>
</td>
<td>
<?php echo $row_patient_physical_parameters['cy']?>
</td>
<td>
<?php echo $row_patient_physical_parameters['i']?>
</td>
<td>
<?php echo $row_patient_physical_parameters['cl']?>
</td>
<td>
<?php echo $row_patient_physical_parameters['e']?>
</td>
</tr>
</tr>
</table>
<br>
<br>
<table class="table2" style="width: 80%">
<tr>
<td><strong>Height</strong> <?php echo $row_patient_physical_parameters['height']?> cms</td>
<td><strong>Weight</strong> <?php echo $row_patient_physical_parameters['weight']?> kgs</td>
<td><strong>BMI</strong> <?php echo $row_patient_physical_parameters['bmi']?>...</td>
<tr>
<tr><td><strong>Built & Nutrition</strong>..<?php echo $row_patient_physical_parameters['bn_findings']?>....</td>
<td><strong>BP:</strong>..<?php echo $row_patient_physical_parameters['bp']?>...mm hg</td>
<td><strong>Pulse:</strong>...<?php echo $row_patient_physical_parameters['pulse']?>..../m</td>
</tr>
<tr><td><strong>P/A</strong>...<?php echo $row_patient_physical_parameters['pa']?>...</td>
<td><strong>Skin</strong>...<?php echo $row_patient_physical_parameters['skin']?>...</td>
<td><strong>Chest:</strong>...<?php echo $row_patient_physical_parameters['chest']?>...</td>
</tr>
<tr><td><strong>Chest Inspiration:</strong>...<?php echo $row_patient_physical_parameters['chest_in']?>...</td>
<td><strong>Chest Expiration:</strong>...<?php echo $row_patient_physical_parameters['chest_exp']?>...</td>
<td><strong>CVS:</strong>...<?php echo $row_patient_physical_parameters['cvs']?>...</td>
</tr>
<tr>
<td><strong>CNS:</strong>...<?php echo $row_patient_physical_parameters['cns']?>...</td>
<td><strong>Musculo Skeletal:</strong> <?php echo $row_patient_physical_parameters['musculo_skeletal']?></td>
<td><strong>P/Abd:</strong>&nbsp; &nbsp;<?php echo $row_patient_physical_parameters['p_abd']?></td>
</tr>
<tr>
<td><strong>Dress:</strong>&nbsp; &nbsp;<?php echo $row_patient_physical_parameters['dress']?></td>
<td><strong>Nail:</strong>&nbsp; &nbsp;<?php echo $row_patient_physical_parameters['nails']?></td>
<td><strong>Hair:</strong>&nbsp; &nbsp;<?php echo $row_patient_physical_parameters['hair']?></td>
</tr>
<?php
$sql_adv = "select health_advices,health_risks from medical_examination where medical_exam_id = '".$_REQUEST['medical_exam_id']."'";
$result_adv = mysqli_query($conn,$sql_adv);
$row_adv = mysqli_fetch_array($result_adv);
$health_advices_ids = $row_adv['health_advices'];
error_log("ADVICES:".$row_adv['health_advices']);
$health_advices_ids_array = array();
$health_advices_ids_array = explode(",", $health_advices_ids);
$health_advices = "";
for ($i = 0; $i < count($health_advices_ids_array); $i ++) {
if ($i == 0) {
$health_advices = getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $health_advices_ids_array[$i]);
} else {
$health_advices = $health_advices . "," . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $health_advices_ids_array[$i]);
}
}
error_log("HEALTH ADVICES:".$health_advices);
$health_risks_ids = $row_adv['health_risks'];
$health_risks_ids_array = array();
$health_risks_ids_array = explode(",", $health_risks_ids);
$health_risks = "";
for ($i = 0; $i < count($health_risks_ids_array); $i ++) {
if ($i == 0) {
$health_risks = getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $health_risks_ids_array[$i]);
} else {
$health_risks = $health_risks . "," . getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $health_risks_ids_array[$i]);
}
}
?>
<tr>
<td colspan="8"><strong>Other Diseases if any: <?php echo $health_risks?> </strong>&nbsp; &nbsp;</td>
</tr>
<tr>
<td colspan="8"><strong>Treatment and Advice: <?php echo $health_advices?> </strong>&nbsp; &nbsp;</td>
</tr>
<tr>
<td style="border: none !important;"><b style="font-weight: 1200;">Remarks </b><?php echo $row_patient_physical_parameters['remarks']?></td>
</tr>
</tr><td>
This is to certify that Mr/ Ms <?php echo $row_patient_physical_parameters['patient_name']?>has been examined and he / she is found to be medically <?php echo $row_patient_physical_parameters['physical_status']?> for duty.</tr>
<tr>
</table>
<br>
<br>
</table>
<table width="100%">
<tr>
<td colspan="4">Signature:<img
src="data:<?php echo $row_patient_physical_parameters['doc_sign_image_type']?>;base64,<?php echo base64_encode( $row_patient_physical_parameters['approving_doc_sign_img'])?>"
style="width: 200px; height: 61px;" /></td>
<?php if($row_patient_physical_parameters['approved_by'] == "" || $row_patient_physical_parameters['approved_by'] == null){?>
<td>Date:<?php echo date("d-M-Y",strtotime($row_patient_physical_parameters['medical_entry_date']))?></td>
<?php } else {?>
<td>Date:<?php echo date("d-M-Y",strtotime($row_patient_physical_parameters['approval_date']))?></td>
<?php }?>
</tr>
<tr>
<td>Factory Medical Officer</td>
</tr>
<tr>
<td>Form No:TML/F/MED/01</td>
</tr>
<tr>
<td>Rev: 03</td>
</tr>
</table>
</body>
</html>
<script>
$(document).ready(function(){
window.print();
});
</script>