update serum dibawah note

This commit is contained in:
mikael-zakaria 2024-12-09 20:53:46 +08:00
parent 5efe2b1218
commit 1598e01c89

View File

@ -3,7 +3,7 @@ namespace App\Controllers;
class PrintResult extends BaseController { class PrintResult extends BaseController {
public function otherTests($access){ public function otherTests($access, $collection){
$fullPage=""; $fullPage="";
$headPage = " $headPage = "
@ -73,8 +73,22 @@ class PrintResult extends BaseController {
$resultTest =""; $resultTest ="";
$item = end($access); $items = end($access);
// Untuk Collection
if ($collection != null) {
$cm_output = [];
$sp_output = [];
foreach ($collection 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']));
}
$collectionText = implode(' | ', $cm_output) . "\n";
$receptionText = implode(' | ', $sp_output) . "\n";
}
$resultNoteandSpecimen = " $resultNoteandSpecimen = "
<br> <br>
@ -84,7 +98,7 @@ class PrintResult extends BaseController {
</tr> </tr>
<tr> <tr>
<td> <td>
".$item['RESVALUE']." ".$items['RESVALUE']."
</td> </td>
</tr> </tr>
</table> </table>
@ -93,10 +107,10 @@ class PrintResult extends BaseController {
<table class='t_center table_collection' > <table class='t_center table_collection' >
<tr> <tr>
<td><pre>Collection datetime : - </pre></td> <td><pre>Collection datetime : $collectionText </pre></td>
</tr> </tr>
<tr> <tr>
<td><pre>Reception datetime : - </pre></td> <td><pre>Reception datetime : $receptionText </pre></td>
</tr> </tr>
</table> </table>
"; ";
@ -200,6 +214,18 @@ class PrintResult extends BaseController {
public function printResultTest($access) { public function printResultTest($access) {
$db = \Config\Database::connect(); $db = \Config\Database::connect();
// Untuk Collection
$sql = "select tu.SAMPLETYPE, ds.SHORTTEXT, tu.COLLECTIONDATE as CM_collection_datetime, ct.COLLECTIONDATE as SP_reception_datetime
from SP_TUBES tu
left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE= tu.SAMPLETYPE
left join cmod.dbo.CM_TUBES ct on ct.SAMPLETYPE=tu.SAMPLETYPE and ct.ACCESSNUMBER=tu.SP_ACCESSNUMBER
where tu.SP_ACCESSNUMBER='$access'
";
$query = $db->query($sql);
$results = $query->getResultArray();
$collection = $results;
$sql = " $sql = "
select dc.CHAPID, dc.FULLTEXT as chap_eng,dc.FULLTEXT as chap_ind, 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, RESULT=case when cr.RESTYPE in('NM','TX') then cr.RESVALUE when cr.RESTYPE='CE' then tx.FULLTEXT end,
@ -224,7 +250,6 @@ class PrintResult extends BaseController {
$query = $db->query($sql); $query = $db->query($sql);
$results = $query->getResultArray(); $results = $query->getResultArray();
$data_urine = array_filter($results, function($item) { $data_urine = array_filter($results, function($item) {
$chapterid = $item["CHAPID"]; $chapterid = $item["CHAPID"];
$tesscode = $item['TESTCODE']; $tesscode = $item['TESTCODE'];
@ -250,13 +275,13 @@ class PrintResult extends BaseController {
$fullPage = ""; $fullPage = "";
if ($data_urine != null && count($data_urine) > 1) { if ($data_urine != null && count($data_urine) > 1) {
$fullPage .= $this->otherTests($data_urine); $fullPage .= $this->otherTests($data_urine, $collection);
} }
if ($data_feces != null && count($data_feces) > 1) { if ($data_feces != null && count($data_feces) > 1) {
$fullPage .= $this->otherTests($data_feces); $fullPage .= $this->otherTests($data_feces, $collection);
} }
if ($data_others != null && count($data_others) > 1) { if ($data_others != null && count($data_others) > 1) {
$fullPage .= $this->otherTests($data_others); $fullPage .= $this->otherTests($data_others, $collection);
} }
return view('result_report', ['data' => $fullPage]); return view('result_report', ['data' => $fullPage]);