update Header, Result tambah Sample

This commit is contained in:
mikael-zakaria 2024-12-11 17:54:38 +08:00
parent f2a2ff7650
commit 35f480c341
3 changed files with 92 additions and 41 deletions

View File

@ -3,8 +3,45 @@ namespace App\Controllers;
class PrintResult extends BaseController {
public function otherTests($access, $collection){
public function otherTests($resultData, $data){
// var_dump($data);die();
if($data[0] != null) {
$accessnumber = $data[0]['SP_ACCESSNUMBER'];
$sex = $data[0]['sex'] == 1 ? "Male" : "Female";
$rm_number = $data[0]['PATNUMBER'];
$rm_number = substr($rm_number, -10);
$first_name = $data[0]['FIRSTNAME'];
$last_name = $data[0]['NAME'];
$birth_date = $data[0]['BIRTHDATE'];
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s.u', $birth_date);
if ($dateTime) {
$birth_date = $dateTime->format('d-m-Y');
}
$hostordernumber = $data[0]['HOSTORDERNUMBER'];
$collection_date = $data[0]['COLLECTIONDATE'];
$dateTime = \DateTime::createFromFormat('Y-m-d H:i:s.u', $collection_date);
if ($dateTime) {
$collection_date = $dateTime->format('d-m-Y H:i:s');
}
} else {
$sex ='';
$accessnumber = "";
$rm_number = "";
$first_name = "";
$last_name = "";
$birth_date = "";
$hostordernumber = "";
$collection_date = "";
}
$fullPage="";
$headPage = "
<div id='page'>
@ -17,40 +54,40 @@ class PrintResult extends BaseController {
<tr>
<th class='padmaColor' colspan='6' align='center'>CLINICAL LABORATORY</th>
</tr>
<tr>
<th style='width:12%' align='left'>UHID</th>
<th style='width:18%' align='left'>RM Number</th>
<td style='width:2%'>:</td>
<td style='width:44%'>1BCJJAJSDK</td>
<th style='width:20%' align='left'>Sample ID</th>
<td style='width:35%'>$rm_number</td>
<th style='width:18%' align='left'>Visit Number</th>
<td style='width:2%'>:</td>
<td style='width:20%'>LAB2420076951</td>
<td style='width:35%'>$hostordernumber</td>
</tr>
<tr>
<th align='left'>Name</th>
<th align='left'>First Name</th>
<td>:</td>
<td>Ni Luh Putu Eka Putri Saraswati </td>
<th align='left'>Specimen</th>
<td>$first_name</td>
<th align='left'>Request Number</th>
<td>:</td>
<td>Serum</td>
<td>$accessnumber</td>
</tr>
<tr>
<th align='left'>Age/Gender</th>
<th align='left'>Last Name</th>
<td>:</td>
<td>22 year(s) / Male</td>
<th align='left'>Collection Date/Time</th>
<td>$last_name</td>
<th align='left'>Order Date/Time</th>
<td>:</td>
<td>26-10-2024 / 11:55:04</td>
<td>$collection_date</td>
</tr>
<tr>
<th align='left'>Speciality</th>
<th align='left'>DoB/Gender</th>
<td>:</td>
<td></td>
<td>$birth_date / $sex</td>
<th align='left'>Result Date/Time</th>
<td>:</td>
<td>26-10-2024 / 11:52:04</td>
<td> </td>
</tr>
</table>
@ -63,24 +100,24 @@ class PrintResult extends BaseController {
<tr align='left'>
<th class='padmaColor' style='width:35%'>Parameter</th>
<th class='padmaColor' style='width:14%'>Result</th>
<th class='padmaColor' style='width:14%'>Unit</th>
<th class='padmaColor' style='width:17%'>Normal Range</th>
<th class='padmaColor' style='width:20%'>Notes</th>
<th class='padmaColor' style='width:13%'>Result</th>
<th class='padmaColor' style='width:13%'>Unit</th>
<th class='padmaColor' style='width:20%'>Normal Range</th>
<th class='padmaColor' style='width:20%'>Sample Type</th>
</tr>
";
$resultTest ="";
$items = end($access);
$items = end($resultData);
// Untuk Collection
if ($collection != null) {
if ($data[1] != null) {
$cm_output = [];
$sp_output = [];
foreach ($collection as $item) {
foreach ($data[1] as $item) {
$cm_output[] = "{$item['SHORTTEXT']} " . date('Y-m-d H:i:s', strtotime($item['CM_collection_datetime']));
$sp_output[] = "{$item['SHORTTEXT']} " . date('Y-m-d H:i:s', strtotime($item['SP_reception_datetime']));
}
@ -104,13 +141,13 @@ class PrintResult extends BaseController {
</table>
<br>
<table class='t_center table_collection' >
<tr>
<td><pre>Collection datetime : $collectionText </pre></td>
<td>Collection datetime : $collectionText </td>
</tr>
<tr>
<td><pre>Reception datetime : $receptionText </pre></td>
<td>Reception datetime &nbsp;: $receptionText </td>
</tr>
</table>
";
@ -142,10 +179,10 @@ class PrintResult extends BaseController {
$tempChapEng = "";
$tempChapInd = "";
array_pop($access);
array_pop($resultData);
$i=0;
foreach ($access as $item) {
foreach ($resultData as $item) {
if ($tempChapEng != $item['chap_eng']) {
$tempChapEng = $item['chap_eng'];
@ -157,7 +194,6 @@ class PrintResult extends BaseController {
<tr align='left' class='chapter'>
<td colspan='5'>
<pre><b>".$tempChapEng."</b></pre>
<pre> <small><b>".$tempChapInd."</b></small></pre>
</td>
</tr>
";
@ -165,7 +201,7 @@ class PrintResult extends BaseController {
}
// Melebihi batas Kertas
if($i % 24 == 0) {
if($i % 21 == 0) {
$resultTest .= "</table></div>";
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
$i=0;
@ -193,7 +229,7 @@ class PrintResult extends BaseController {
// Melebihi batas Kertas
if($i % 24 == 0) {
if($i % 21 == 0) {
$resultTest .= "</table></div>";
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
$i=0;
@ -215,6 +251,15 @@ class PrintResult extends BaseController {
public function printResultTest($access) {
$db = \Config\Database::connect();
// Untuk Header
$sql = "select p.PATNUMBER, p.FIRSTNAME, p.NAME, p.BIRTHDATE, sr.HOSTORDERNUMBER, sr.COLLECTIONDATE, sr.SP_ACCESSNUMBER, p.sex
from PATIENTS p
left join SP_REQUESTS sr on p.PATID=sr.PATID
where sr.SP_ACCESSNUMBER='$access'";
$query = $db->query($sql);
$results = $query->getResultArray();
$header = $results[0];
// Untuk Collection
$sql = "select tu.SAMPLETYPE, ds.SHORTTEXT, tu.COLLECTIONDATE as CM_collection_datetime, ct.COLLECTIONDATE as SP_reception_datetime
from SP_TUBES tu
@ -226,6 +271,9 @@ class PrintResult extends BaseController {
$results = $query->getResultArray();
$collection = $results;
$data = [$header, $collection];
// var_dump($data[0]['PATNUMBER']);die();
$sql = "
select dc.CHAPID, dc.FULLTEXT as chap_eng,dc.FULLTEXT as chap_ind,
RESULT=case when cr.RESTYPE in('NM','TX') then cr.RESVALUE when cr.RESTYPE='CE' then tx.FULLTEXT end,
@ -275,13 +323,13 @@ class PrintResult extends BaseController {
$fullPage = "";
if ($data_urine != null && count($data_urine) > 1) {
$fullPage .= $this->otherTests($data_urine, $collection);
$fullPage .= $this->otherTests($data_urine, $data);
}
if ($data_feces != null && count($data_feces) > 1) {
$fullPage .= $this->otherTests($data_feces, $collection);
$fullPage .= $this->otherTests($data_feces, $data);
}
if ($data_others != null && count($data_others) > 1) {
$fullPage .= $this->otherTests($data_others, $collection);
$fullPage .= $this->otherTests($data_others, $data);
}
return view('result_report', ['data' => $fullPage]);

View File

@ -148,7 +148,7 @@ function index() {
stattext = 'Validated';
}
let datarow = "<tr onclick='viewAccess("+accessnumber+")' class='align-middle main_table'" + datafilter +" >" +
'<td>' + colldate + '</td> <td>' + patnumber + '</td> <td>' + accessnumber + '</td> <td>' + patname + '</td> <td>' + hon + '</td> <td>' + tests + '</td>' +
'<td>' + colldate + '</td> <td>' + patnumber + '</td> <td>' + patname + '</td> <td>' + accessnumber + '</td> <td>' + hon + '</td> <td>' + tests + '</td>' +
"<td role='button' class='"+bgcolor+" text-center align-middle'>"+stattext+"</td>" +
"<td role='button' class='text-center align-middle' onclick='resultPdfAccess("+accessnumber+ ",event" +")'> <h4 class='p-0 m-0'><i class='bi bi-filetype-pdf'></i></h4> </td>" +'</tr>';
$("#table-body").append(datarow);

View File

@ -2,7 +2,7 @@
button,hr,input{overflow:visible}progress,sub,sup{vertical-align:baseline}[type=checkbox],[type=radio],legend{box-sizing:border-box;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}details,main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:ButtonText dotted 1px}fieldset{padding:.35em .75em .625em}legend{color:inherit;display:table;max-width:100%;white-space:normal}textarea{overflow:auto}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}[hidden],template{display:none}
/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.7pt; margin:0;}
html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.8pt; margin:0;}
body {
background-color: rgb(17, 16, 16);
@ -30,7 +30,7 @@ body {
#dresult {
margin: 0;
padding: 0;
height: 19.5cm;
height: 18.47cm;
}
.result {
table-layout:fixed;
@ -53,7 +53,8 @@ table {
}
th,td {
padding-left: 1rem;
padding-top: 4px ;
padding-bottom: 2px ;
line-height:1.5;
}
@ -105,8 +106,10 @@ tr.chapter td {
#notes { margin: 5mm 0 0 10mm; }
.table_collection {
font-size: 2em;
.table_collection tr{
/* font-size: 2em; */
/* border:solid 1px black; */
}
#footer {