CLINICAL LABORATORY
UHID : 1BCJJAJSDK Sample ID : LAB2420076951
Name : Ni Luh Putu Eka Putri Saraswati Specimen : Serum
Age/Gender : 22 year(s) / Male Collection Date/Time : 26-10-2024 / 11:55:04
Speciality : Result Date/Time : 26-10-2024 / 11:52:04

"; $resultTest =""; $item = end($access); $resultNoteandSpecimen = "
Parameter Result Unit Normal Range Notes
Notes
".$item['RESVALUE']."

Collection datetime : - 
Reception datetime  : - 
"; $footerPage = " "; $lastDiv="
"; $tempChapEng = ""; $tempChapInd = ""; array_pop($access); $i=0; foreach ($access as $item) { if ($tempChapEng != $item['chap_eng']) { $tempChapEng = $item['chap_eng']; $tempChapInd = $item['chap_ind']; $i++; // Untuk Chapter $resultTest .= "
".$tempChapEng."
 ".$tempChapInd."
"; } // Melebihi batas Kertas if($i % 24 == 0) { $resultTest .= ""; $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; $i=0; $resultTest = ""; } $i++; if ($item['RESTYPE'] == "CE"){ $resvalue = $item['RESULT']; } else { $resvalue = $item['RESVALUE']; } $resultTest .= "
 ".$item["test_eng"]."
  ".$item["test_ind"]."
" . $resvalue . " " . $item["UNIT"] . " " . $item["REFRANGE"] . " " . " " . " "; // Melebihi batas Kertas if($i % 24 == 0) { $resultTest .= ""; $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; $i=0; $resultTest = ""; } } $resultTest .= " ".$resultNoteandSpecimen." "; $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; return $fullPage; } public function printResultTest($access) { $db = \Config\Database::connect(); $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, cr.*, cdt.TEXT1 as test_eng, cdt.TEXT2 as test_ind from cmod.dbo.CM_RESULTS cr left join REQUESTS r on r.ACCESSNUMBER=cr.ACCESSNUMBER left join cmod.dbo.CM_DICT_TESTS cdt on cr.TESTCODE=cdt.TESTCODE left join DICT_TESTS dt on dt.TESTCODE=cr.TESTCODE and dt.ENDVALIDDATE is null left join TESTS t on t.REQUESTID = r.REQUESTID and t.TESTID=dt.TESTID left join DICT_TEXTS tx on tx.TEXTID=t.CODEDRESULTID left join DICT_CHAPTERS dc on dc.CHAPID=dt.CHAPID and dc.ENDVALIDDATE is null left join cmod.dbo.CM_DICT_CHAPTERS cdc on cdc.CHAPCODE=dc.CHAPCODE where cr.ACCESSNUMBER='$access' ORDER BY CASE WHEN cr.TESTCODE = 'NOTE' THEN 1 ELSE 0 END, t.TESTORDER; "; $query = $db->query($sql); $results = $query->getResultArray(); $data_urine = array_filter($results, function($item) { $chapterid = $item["CHAPID"]; $tesscode = $item['TESTCODE']; // Memfilter data dengan CHAPID 3, 61, atau 62 return $chapterid == 3 || $chapterid == 61 || $chapterid == 62 || $tesscode == 'NOTE'; }); // Seleksi data yang mengandung "FESES" $data_feces = array_filter($results, function($item) { $chapterid = $item["CHAPID"]; $tesscode = $item['TESTCODE']; // Memfilter data yang 4 return $chapterid == 4 || $tesscode == 'NOTE'; }); // Seleksi data yang tidak mengandung "urine" dan "feces" $data_others = array_filter($results, function($item) { $chapterid = $item["CHAPID"]; $tesscode = $item['TESTCODE']; // Memfilter data yang bukan 61 atau 3 return $chapterid !== 3 && $chapterid !== 4 && $chapterid !== 61 && $chapterid !== 62 || $tesscode == 'NOTE'; }); $fullPage = ""; if ($data_urine != null && count($data_urine) > 1) { $fullPage .= $this->otherTests($data_urine); } if ($data_feces != null && count($data_feces) > 1) { $fullPage .= $this->otherTests($data_feces); } if ($data_others != null && count($data_others) > 1) { $fullPage .= $this->otherTests($data_others); } return view('result_report', ['data' => $fullPage]); } }