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

78 lines
3.4 KiB
PHP

<?php include('pdf_header.php');
include('includes/config/config.php');
// include('pop_up_top.php');
?>
<table width="100%">
<tr>
<div style="font-size:12px">
<td width="25%" align="left"> Run Date :
<?php echo date("d-M-Y"); ?>
</td>
<td width="50%" align="center" style="font-size:30px"><strong>Prescription List</strong></td>
<td width="25%" align="left"> User :
<?php echo $username ?>
</td>
</tr>
</table>
<table border="1">
<?php
$sql = base64_decode($filterkey);
//echo $sql;
$result = mysqli_query($conn, $sql);
?><tr>
<th width=25%>Sr </th>
<th width=25%>Chronic Illness</th>
<th width=25%>Patient Name</th>
<th width="25%">Emp Code</th>
<th width="25%">Diagnosis Date</th>
<th width=25%>Medicine</th>
<th width=25%>Frequency</th>
<th width=25%>Timing</th>
<th width=25%>Admin.route</th>
<th width=25%>Duration</th>
</tr><?php
$count = 1;
while ($rowOfEmployee = mysqli_fetch_array($result)) {
$exist_sql = "select b.diagnosis_date from problem_response a inner join problem_response_details b on a.rid = b.rid where a.pid=(select pid from problem_master where pcode='ABT') and a.patient_id = '" . $rowOfEmployee['emp_id'] . "' and b.rvalue = '" . $rowOfEmployee['diseases'] . "'";
error_log("problem response checking sql " . $exist_sql);
$result_sql = mysqli_query($conn, $exist_sql);
$row_res = mysqli_fetch_assoc($result_sql);
if ($row_res['diagnosis_date'] != null && $row_res['diagnosis_date'] != '' && $row_res['diagnosis_date'] != '1970-01-01' && $row_res['diagnosis_date'] != '0000-00-00') {
$date = DateTime::createFromFormat('Y-m-d', $row_res['diagnosis_date']);
// Format the date in "d/m/Y" format
$newDateFormat = $date->format('d/m/Y');
$diagnosis_date = $newDateFormat;
} else {
$diagnosis_date = "Not Present";
}
?><tr>
<td><?php echo $count ?></td>
<td><?php echo getTableFieldValue('abnormality', 'abnormality_name', 'abnormality_id', $rowOfEmployee['diseases']) ?></td>
<td><?php echo getTableFieldValue('patient_master', 'patient_name', 'id', $rowOfEmployee['emp_id']) ?></td>
<td><?php echo getTableFieldValue('patient_master', 'emp_code', 'id', $rowOfEmployee['emp_id']) ?></td>
<td><?php echo $diagnosis_date; ?></td>
<td><?php echo getTableFieldValue('tbl_items', 'item_name', 'item_id', $rowOfEmployee['medicine_name']) ?></td>
<td><?php echo getTableFieldValue('medicine_frequency', 'medicine_frequency', 'frequency_id', $rowOfEmployee['medicine_frequency']) ?>
</td>
<td><?php echo getTableFieldValue('medicine_timings', 'medicine_timing', 'timing_id', $rowOfEmployee['medicine_timing']) ?>
</td>
<td><?php echo getTableFieldValue('dosage_category', 'dosage_category', 'dosage_category_id', $rowOfEmployee['admin_route']) ?>
</td>
<td><?php echo $rowOfEmployee['duration'] ?></td>
</tr><?php
$count++;
}
?>
</table>
<?php
include('pdf_footer.php');
?>