diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index d347798..232a10c 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -93,5 +93,5 @@ $routes->group('fo', ['filter' => 'role:fo'], static function ($routes) {
// Printers
$routes->get('prints/single_sample/(:any)/(:any)', 'PrinterController::printSingleSampleBarcode/$1/$2');
-$routes->get('prints/all_sample', 'PrinterController::printAllSampleBarcode');
+$routes->get('prints/all_sample/(:any)', 'PrinterController::printAllSampleBarcode/$1');
$routes->get('prints/result_test/(:any)', 'PrinterController::printResultTest/$1');
\ No newline at end of file
diff --git a/app/Controllers/PrinterController.php b/app/Controllers/PrinterController.php
index 6c81023..e9f141b 100644
--- a/app/Controllers/PrinterController.php
+++ b/app/Controllers/PrinterController.php
@@ -25,6 +25,26 @@ class PrinterController extends BaseController {
$role = session()->get('userrole');
$networkPath = "";
+ $db = \Config\Database::connect();
+ $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, p.BIRTHDATE, st.SAMPLETYPE, ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as barcode
+ from SP_TUBES st
+ left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER
+ left join PATIENTS p on p.PATID=sr.PATID
+ left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE
+ where st.SP_ACCESSNUMBER='$access' AND ds.FULLTEXT = '$sample'";
+
+ $query = $db->query($sql);
+ $results = $query->getResultArray();
+ $item = $results[0];
+
+ $uhid = substr($item['UHID'], -10);
+ $bv = $item['BV'];
+ $sex = $item['SEX'] == 1 ? "M" : "F";
+ $title = $item['SEX'] == 1 ? "Mr" : "Mrs";
+ $name = $item['NAME'];
+ $sample = $item['FULLTEXT'];
+ $barcode = $item['barcode'];
+
// Ruang Analis Printer POSTEK C168/200s
if ($role === 'admin' || $role === 'user') {
@@ -40,15 +60,15 @@ q400
Q200,10+0
I8,A,001
D10
-A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\"
-A4,25,0,2,1,1,N,\"M 29Y\"
-A4,55,0,2,1,1,N,\"SAMPLE\"
+A4,3,0,2,1,1,N,\"$title.$name\"
+A4,25,0,2,1,1,N,\"$sex USIA\"
+A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"Chapter\"
-B149,35,0,1,3,8,70,N,\"24020840\"
-A199,110,0,2,1,1,N,\"LAB 24020840\"
-A4,140,0,2,1,1,N,\"UH : 1B094943\"
-A4,160,0,2,1,1,N,\"BV : BV035725\"
-A195,156,0,2,1,1,N,\"$filename\"
+B149,35,0,1,3,8,70,N,\"$barcode\"
+A199,110,0,2,1,1,N,\"LAB $barcode\"
+A4,140,0,2,1,1,N,\"UH : $uhid\"
+A4,160,0,2,1,1,N,\"BV : $bv\"
+A195,156,0,2,1,1,N,\"Tgl Coll\"
P1
";
@@ -68,15 +88,15 @@ q400
Q185,10+0
I8,A,001
D10
-A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\"
-A4,25,0,2,1,1,N,\"M 29Y\"
-A4,55,0,2,1,1,N,\"SAMPLE\"
+A4,3,0,2,1,1,N,\"$title.$name\"
+A4,25,0,2,1,1,N,\"$sex USIA\"
+A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"Chapter\"
-B149,35,0,1,3,8,70,N,\"24020840\"
-A199,110,0,2,1,1,N,\"LAB 24020840\"
-A4,140,0,2,1,1,N,\"UH : 1B094943\"
-A4,160,0,2,1,1,N,\"BV : BV035725\"
-A195,156,0,2,1,1,N,\"03/12/2024 07:10\"
+B149,35,0,1,3,8,70,N,\"$barcode\"
+A199,110,0,2,1,1,N,\"LAB $barcode\"
+A4,140,0,2,1,1,N,\"UH : $uhid\"
+A4,160,0,2,1,1,N,\"BV : $bv\"
+A195,156,0,2,1,1,N,\"Tgl Coll\"
P1
";
@@ -115,13 +135,22 @@ P1
}
}
- public function printAllSampleBarcode() {
+ public function printAllSampleBarcode($access) {
- $data = 3;
-
$role = session()->get('userrole');
$networkPath = "";
+ $db = \Config\Database::connect();
+ $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, p.BIRTHDATE, st.SAMPLETYPE, ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as barcode
+ from SP_TUBES st
+ left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER
+ left join PATIENTS p on p.PATID=sr.PATID
+ left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE
+ where st.SP_ACCESSNUMBER='$access'";
+
+ $query = $db->query($sql);
+ $results = $query->getResultArray();
+
// Ruang Analis Printer POSTEK
if ($role === 'admin' || $role === 'user') {
@@ -130,12 +159,22 @@ P1
$pathNetworkFolder = 'L:/Sampling_Labels/';
$letterPath = 'L:';
- for ($i=0; $i<$data; $i++) {
+ // for ($i=0; $i<$data; $i++) {
+ foreach($results as $item) {
+
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
+ $uhid = substr($item['UHID'], -10);
+ $bv = $item['BV'];
+ $sex = $item['SEX'] == 1 ? "M" : "F";
+ $title = $item['SEX'] == 1 ? "Mr" : "Mrs";
+ $name = $item['NAME'];
+ $sample = $item['FULLTEXT'];
+ $barcode = $item['barcode'];
+
// Printer Posteck
$sampleLable ="N
OD
@@ -143,15 +182,15 @@ q400
Q200,10+0
I8,A,001
D10
-A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\"
-A4,25,0,2,1,1,N,\"M 29Y\"
-A4,55,0,2,1,1,N,\"SAMPLE\"
+A4,3,0,2,1,1,N,\"$title.$name\"
+A4,25,0,2,1,1,N,\"$sex USIA\"
+A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"Chapter\"
-B149,35,0,1,3,8,70,N,\"24020840\"
-A199,110,0,2,1,1,N,\"LAB 24020840\"
-A4,140,0,2,1,1,N,\"UH : 1B094943\"
-A4,160,0,2,1,1,N,\"BV : BV035725\"
-A195,156,0,2,1,1,N,\"$filename\"
+B149,35,0,1,3,8,70,N,\"$barcode\"
+A199,110,0,2,1,1,N,\"LAB $barcode\"
+A4,140,0,2,1,1,N,\"UH : $uhid\"
+A4,160,0,2,1,1,N,\"BV : $bv\"
+A195,156,0,2,1,1,N,\"Tgl Coll\"
P1
";
@@ -178,12 +217,20 @@ P1
$pathNetworkFolder = 'S:/Sampling_Labels/';
$letterPath = 'S:';
- for ($i=0; $i<$data; $i++) {
-
+ foreach($results as $item) {
+
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
+ $uhid = substr($item['UHID'], -10);
+ $bv = $item['BV'];
+ $sex = $item['SEX'] == 1 ? "M" : "F";
+ $title = $item['SEX'] == 1 ? "Mr" : "Mrs";
+ $name = $item['NAME'];
+ $sample = $item['FULLTEXT'];
+ $barcode = $item['barcode'];
+
// Printer Zebra
$sampleLable ="N
OD
@@ -191,15 +238,15 @@ q400
Q185,10+0
I8,A,001
D10
-A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\"
-A4,25,0,2,1,1,N,\"M 29Y\"
-A4,55,0,2,1,1,N,\"SAMPLE\"
+A4,3,0,2,1,1,N,\"$title.$name\"
+A4,25,0,2,1,1,N,\"$sex USIA\"
+A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"Chapter\"
-B149,35,0,1,3,8,70,N,\"24020840\"
-A199,110,0,2,1,1,N,\"LAB 24020840\"
-A4,140,0,2,1,1,N,\"UH : 1B094943\"
-A4,160,0,2,1,1,N,\"BV : BV035725\"
-A195,156,0,2,1,1,N,\"03/12/2024 07:10\"
+B149,35,0,1,3,8,70,N,\"$barcode\"
+A199,110,0,2,1,1,N,\"LAB $barcode\"
+A4,140,0,2,1,1,N,\"UH : $uhid\"
+A4,160,0,2,1,1,N,\"BV : $bv\"
+A195,156,0,2,1,1,N,\"Tgl Coll\"
P1
";
@@ -239,7 +286,8 @@ P1
}
- public function otherTests($request){
+ public function otherTests($access){
+
$fullPage="";
$headPage = "
@@ -297,16 +345,19 @@ P1
- | Parameter |
- Result |
- Unit |
+ Parameter |
+ Result |
+ Unit |
Normal Range |
- Notes |
+ Notes |
";
$resultTest ="";
+
+ $item = end($access);
+
$resultNoteandSpecimen = "
@@ -316,7 +367,7 @@ P1
|
- Hasil pemeriksaan sedikit di luar rentang normal. Disarankan untuk memantau kondisi ini dan melakukan pemeriksaan ulang jika diperlukan.
+ ".$item['RESVALUE']."
|
@@ -325,10 +376,10 @@ P1
- Collection datetime : EDTA,SERUM 13-11-2024 10.00 |
+ Collection datetime : - |
- Reception datetime : EDTA,SERUM 13-11-2024 12.00 |
+ Reception datetime : - |
";
@@ -355,55 +406,66 @@ P1
";
$lastDiv="";
-
+
+
+ $tempChapEng = "";
+ $tempChapInd = "";
+
+ array_pop($access);
+
$i=0;
- foreach ($request as $chapter) {
-
- $i++;
- // Untuk Chapter
- $resultTest .= "
-
-
- ".$chapter['chapter_eng']."
- ".$chapter['chapter_ind']."
- |
-
- ";
-
- // Melebihi batas Kertas
- if($i % 22 == 0) {
- $resultTest .= "";
- $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
- $i=0;
- $resultTest = "";
- }
-
- foreach($chapter["tests"] as $test) {
- $i++;
- $resultTest .= "
-
-
-
- ".$test["test_eng"]."
- ".$test["test_ind"]."
- |
- " . $test["result"] . " |
- " . $test["unit"] . " |
- " . $test["range"] . " |
- " . $test["notes"] . " |
-
- ";
-
- // Melebihi batas Kertas
- if($i % 22 == 0) {
- $resultTest .= "";
- $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
- $i=0;
- $resultTest = "";
- }
- }
+ 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++;
+ $resultTest .= "
+
+
+ ".$item["test_eng"]."
+ ".$item["test_ind"]."
+ |
+ " . $item["RESVALUE"] . " |
+ " . $item["UNIT"] . " |
+ " . $item["REFRANGE"] . " |
+ " . " " . " |
+
+ ";
+
+
+ // Melebihi batas Kertas
+ if($i % 24 == 0) {
+ $resultTest .= "";
+ $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
+ $i=0;
+ $resultTest = "";
+ }
}
+
$resultTest .= "
".$resultNoteandSpecimen."
@@ -415,933 +477,49 @@ P1
}
public function printResultTest($access) {
-
- $data_mentah = [
- [
- "chapter_eng" => "IMUNOLOGY 4 PANEL",
- "chapter_ind" => "IMUNOLOGI 4 PANEL",
- "tests" => [
- [
- "test_eng" => "HBsAg",
- "test_ind" => "HBsAg",
- "result" => "Non-Reactive",
- "unit" => "mL/g",
- "range" => "Non-Reactive",
- "notes" => "Baik dan Tidak Berbahaya"
- ],
- [
- "test_eng" => "Anti-TP Test",
- "test_ind" => "Tes Anti-TP",
- "result" => "Non-Reactive",
- "unit" => "",
- "range" => "",
- "notes" => "Baik dan Tidak Berbahaya"
- ]
- ]
- ],
- [
- "chapter_eng" => "CARDIOLOGY 2 PANEL",
- "chapter_ind" => "KARDIOLOGI 2 PANEL",
- "tests" => [
- [
- "test_eng" => "Troponin I",
- "test_ind" => "Troponin I",
- "result" => "0.03",
- "unit" => "ng/mL",
- "range" => "< 0.04",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "CK-MB",
- "test_ind" => "CK-MB",
- "result" => "5.0",
- "unit" => "ng/mL",
- "range" => "0 - 5",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "DIABETES 3 PANEL",
- "chapter_ind" => "DIABETES 3 PANEL",
- "tests" => [
- [
- "test_eng" => "Fasting Blood Glucose",
- "test_ind" => "Gula Darah Puasa",
- "result" => "95",
- "unit" => "mg/dL",
- "range" => "70 - 99",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "HbA1c",
- "test_ind" => "HbA1c",
- "result" => "5.6%",
- "unit" => "%",
- "range" => "< 5.7%",
- "notes" => "Tidak ada indikasi diabetes"
- ],
- [
- "test_eng" => "Random Blood Glucose",
- "test_ind" => "Gula Darah Sewaktu",
- "result" => "130",
- "unit" => "mg/dL",
- "range" => "70 - 140",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "LIVER FUNCTION PANEL",
- "chapter_ind" => "PANEL FUNGSI HATI",
- "tests" => [
- [
- "test_eng" => "ALT (SGPT)",
- "test_ind" => "ALT (SGPT)",
- "result" => "25",
- "unit" => "U/L",
- "range" => "0 - 35",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "AST (SGOT)",
- "test_ind" => "AST (SGOT)",
- "result" => "20",
- "unit" => "U/L",
- "range" => "0 - 35",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "RENAL FUNCTION PANEL",
- "chapter_ind" => "PANEL FUNGSI GINJAL",
- "tests" => [
- [
- "test_eng" => "Creatinine",
- "test_ind" => "Kreatinin",
- "result" => "1.0",
- "unit" => "mg/dL",
- "range" => "0.7 - 1.3",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "Urea",
- "test_ind" => "Ureum",
- "result" => "35",
- "unit" => "mg/dL",
- "range" => "15 - 40",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "FECES",
- "chapter_ind" => "PANEL FESES",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Consistency",
- "test_ind" => "Konsistensi",
- "result" => "Soft",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Konsistensi lunak, tidak cair atau keras"
- ],
- [
- "test_eng" => "Occult Blood",
- "test_ind" => "Darah Tersembunyi",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ditemukan darah tersembunyi"
- ],
- [
- "test_eng" => "Parasites",
- "test_ind" => "Parasit",
- "result" => "None",
- "unit" => "",
- "range" => "None",
- "notes" => "Tidak ditemukan parasit"
- ]
- ]
- ],
- [
- "chapter_eng" => "URINE",
- "chapter_ind" => "PANEL URIN",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Yellow",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna kuning normal"
- ],
- [
- "test_eng" => "Clarity",
- "test_ind" => "Kejernihan",
- "result" => "Clear",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Jernih tanpa sedimen"
- ],
- [
- "test_eng" => "pH",
- "test_ind" => "pH",
- "result" => "6.0",
- "unit" => "",
- "range" => "4.5 - 8.0",
- "notes" => "pH dalam rentang normal"
- ],
- [
- "test_eng" => "Protein",
- "test_ind" => "Protein",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada protein dalam urin"
- ],
- [
- "test_eng" => "Glucose",
- "test_ind" => "Glukosa",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada glukosa dalam urin"
- ]
- ]
- ],
- [
- "chapter_eng" => "IMUNOLOGY 4 PANEL",
- "chapter_ind" => "IMUNOLOGI 4 PANEL",
- "tests" => [
- [
- "test_eng" => "HBsAg",
- "test_ind" => "HBsAg",
- "result" => "Non-Reactive",
- "unit" => "mL/g",
- "range" => "Non-Reactive",
- "notes" => "Baik dan Tidak Berbahaya"
- ],
- [
- "test_eng" => "Anti-TP Test",
- "test_ind" => "Tes Anti-TP",
- "result" => "Non-Reactive",
- "unit" => "",
- "range" => "",
- "notes" => "Baik dan Tidak Berbahaya"
- ]
- ]
- ],
- [
- "chapter_eng" => "CARDIOLOGY 2 PANEL",
- "chapter_ind" => "KARDIOLOGI 2 PANEL",
- "tests" => [
- [
- "test_eng" => "Troponin I",
- "test_ind" => "Troponin I",
- "result" => "0.03",
- "unit" => "ng/mL",
- "range" => "< 0.04",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "CK-MB",
- "test_ind" => "CK-MB",
- "result" => "5.0",
- "unit" => "ng/mL",
- "range" => "0 - 5",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "DIABETES 3 PANEL",
- "chapter_ind" => "DIABETES 3 PANEL",
- "tests" => [
- [
- "test_eng" => "Fasting Blood Glucose",
- "test_ind" => "Gula Darah Puasa",
- "result" => "95",
- "unit" => "mg/dL",
- "range" => "70 - 99",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "HbA1c",
- "test_ind" => "HbA1c",
- "result" => "5.6%",
- "unit" => "%",
- "range" => "< 5.7%",
- "notes" => "Tidak ada indikasi diabetes"
- ],
- [
- "test_eng" => "Random Blood Glucose",
- "test_ind" => "Gula Darah Sewaktu",
- "result" => "130",
- "unit" => "mg/dL",
- "range" => "70 - 140",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "LIVER FUNCTION PANEL",
- "chapter_ind" => "PANEL FUNGSI HATI",
- "tests" => [
- [
- "test_eng" => "ALT (SGPT)",
- "test_ind" => "ALT (SGPT)",
- "result" => "25",
- "unit" => "U/L",
- "range" => "0 - 35",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "AST (SGOT)",
- "test_ind" => "AST (SGOT)",
- "result" => "20",
- "unit" => "U/L",
- "range" => "0 - 35",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "RENAL FUNCTION PANEL",
- "chapter_ind" => "PANEL FUNGSI GINJAL",
- "tests" => [
- [
- "test_eng" => "Creatinine",
- "test_ind" => "Kreatinin",
- "result" => "1.0",
- "unit" => "mg/dL",
- "range" => "0.7 - 1.3",
- "notes" => "Normal"
- ],
- [
- "test_eng" => "Urea",
- "test_ind" => "Ureum",
- "result" => "35",
- "unit" => "mg/dL",
- "range" => "15 - 40",
- "notes" => "Normal"
- ]
- ]
- ],
- [
- "chapter_eng" => "FECES",
- "chapter_ind" => "PANEL FESES",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Consistency",
- "test_ind" => "Konsistensi",
- "result" => "Soft",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Konsistensi lunak, tidak cair atau keras"
- ],
- [
- "test_eng" => "Occult Blood",
- "test_ind" => "Darah Tersembunyi",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ditemukan darah tersembunyi"
- ],
- [
- "test_eng" => "Parasites",
- "test_ind" => "Parasit",
- "result" => "None",
- "unit" => "",
- "range" => "None",
- "notes" => "Tidak ditemukan parasit"
- ]
- ]
- ],
- [
- "chapter_eng" => "URINE",
- "chapter_ind" => "PANEL URIN",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Yellow",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna kuning normal"
- ],
- [
- "test_eng" => "Clarity",
- "test_ind" => "Kejernihan",
- "result" => "Clear",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Jernih tanpa sedimen"
- ],
- [
- "test_eng" => "pH",
- "test_ind" => "pH",
- "result" => "6.0",
- "unit" => "",
- "range" => "4.5 - 8.0",
- "notes" => "pH dalam rentang normal"
- ],
- [
- "test_eng" => "Protein",
- "test_ind" => "Protein",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada protein dalam urin"
- ],
- [
- "test_eng" => "Glucose",
- "test_ind" => "Glukosa",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada glukosa dalam urin"
- ]
- ]
- ],
- [
- "chapter_eng" => "FECES",
- "chapter_ind" => "PANEL FESES",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Consistency",
- "test_ind" => "Konsistensi",
- "result" => "Soft",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Konsistensi lunak, tidak cair atau keras"
- ],
- [
- "test_eng" => "Occult Blood",
- "test_ind" => "Darah Tersembunyi",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ditemukan darah tersembunyi"
- ],
- [
- "test_eng" => "Parasites",
- "test_ind" => "Parasit",
- "result" => "None",
- "unit" => "",
- "range" => "None",
- "notes" => "Tidak ditemukan parasit"
- ]
- ]
- ],
- [
- "chapter_eng" => "URINE",
- "chapter_ind" => "PANEL URIN",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Yellow",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna kuning normal"
- ],
- [
- "test_eng" => "Clarity",
- "test_ind" => "Kejernihan",
- "result" => "Clear",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Jernih tanpa sedimen"
- ],
- [
- "test_eng" => "pH",
- "test_ind" => "pH",
- "result" => "6.0",
- "unit" => "",
- "range" => "4.5 - 8.0",
- "notes" => "pH dalam rentang normal"
- ],
- [
- "test_eng" => "Protein",
- "test_ind" => "Protein",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada protein dalam urin"
- ],
- [
- "test_eng" => "Glucose",
- "test_ind" => "Glukosa",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada glukosa dalam urin"
- ]
- ]
- ],
- [
- "chapter_eng" => "FECES",
- "chapter_ind" => "PANEL FESES",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Consistency",
- "test_ind" => "Konsistensi",
- "result" => "Soft",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Konsistensi lunak, tidak cair atau keras"
- ],
- [
- "test_eng" => "Occult Blood",
- "test_ind" => "Darah Tersembunyi",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ditemukan darah tersembunyi"
- ],
- [
- "test_eng" => "Parasites",
- "test_ind" => "Parasit",
- "result" => "None",
- "unit" => "",
- "range" => "None",
- "notes" => "Tidak ditemukan parasit"
- ]
- ]
- ],
- [
- "chapter_eng" => "URINE",
- "chapter_ind" => "PANEL URIN",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Yellow",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna kuning normal"
- ],
- [
- "test_eng" => "Clarity",
- "test_ind" => "Kejernihan",
- "result" => "Clear",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Jernih tanpa sedimen"
- ],
- [
- "test_eng" => "pH",
- "test_ind" => "pH",
- "result" => "6.0",
- "unit" => "",
- "range" => "4.5 - 8.0",
- "notes" => "pH dalam rentang normal"
- ],
- [
- "test_eng" => "Protein",
- "test_ind" => "Protein",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada protein dalam urin"
- ],
- [
- "test_eng" => "Glucose",
- "test_ind" => "Glukosa",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada glukosa dalam urin"
- ]
- ]
- ],
- [
- "chapter_eng" => "FECES",
- "chapter_ind" => "PANEL FESES",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Brown",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna normal tanpa indikasi penyakit"
- ],
- [
- "test_eng" => "Consistency",
- "test_ind" => "Konsistensi",
- "result" => "Soft",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Konsistensi lunak, tidak cair atau keras"
- ],
- [
- "test_eng" => "Occult Blood",
- "test_ind" => "Darah Tersembunyi",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ditemukan darah tersembunyi"
- ],
- [
- "test_eng" => "Parasites",
- "test_ind" => "Parasit",
- "result" => "None",
- "unit" => "",
- "range" => "None",
- "notes" => "Tidak ditemukan parasit"
- ]
- ]
- ],
- [
- "chapter_eng" => "URINE",
- "chapter_ind" => "PANEL URIN",
- "tests" => [
- [
- "test_eng" => "Color",
- "test_ind" => "Warna",
- "result" => "Yellow",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Warna kuning normal"
- ],
- [
- "test_eng" => "Clarity",
- "test_ind" => "Kejernihan",
- "result" => "Clear",
- "unit" => "",
- "range" => "Normal",
- "notes" => "Jernih tanpa sedimen"
- ],
- [
- "test_eng" => "pH",
- "test_ind" => "pH",
- "result" => "6.0",
- "unit" => "",
- "range" => "4.5 - 8.0",
- "notes" => "pH dalam rentang normal"
- ],
- [
- "test_eng" => "Protein",
- "test_ind" => "Protein",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada protein dalam urin"
- ],
- [
- "test_eng" => "Glucose",
- "test_ind" => "Glukosa",
- "result" => "Negative",
- "unit" => "",
- "range" => "Negative",
- "notes" => "Tidak ada glukosa dalam urin"
- ]
- ]
- ],
- ];
+ $db = \Config\Database::connect();
+ $sql = "select dc.CHAPID, dc.FULLTEXT as chap_eng,dc.FULLTEXT as chap_ind, 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_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 t.TESTORDER";
- // Seleksi data yang mengandung "URINE"
- $data_urine = array_filter($data_mentah, function($item) {
- $chapter = strtolower($item["chapter_eng"]);
- return stripos($chapter, "urine") !== false;
+ $query = $db->query($sql);
+ $results = $query->getResultArray();
+
+
+ $data_urine = array_filter($results, function($item) {
+ $chapterid = $item["CHAPID"];
+ // Memfilter data dengan CHAPID 3, 61, atau 62
+ return $chapterid == 3 || $chapterid == 61 || $chapterid == 62;
});
// Seleksi data yang mengandung "FESES"
- $data_feces = array_filter($data_mentah, function($item) {
- $chapter = strtolower($item["chapter_eng"]);
- return stripos($chapter, "feces") !== false;
+ $data_feces = array_filter($results, function($item) {
+ $chapterid = $item["CHAPID"];
+ // Memfilter data yang 4
+ return $chapterid == 4;
});
-
- // Seleksi data yang tidak mengandung kata "urine" atau "feces"
- $data_others = array_filter($data_mentah, function($item) {
- $chapter = strtolower($item["chapter_eng"]);
- return stripos($chapter, "urine") === false && strpos($chapter, "feces") === false;
+ // Seleksi data yang tidak mengandung "urine" dan "feces"
+ $data_others = array_filter($results, function($item) {
+ $chapterid = $item["CHAPID"];
+ // Memfilter data yang bukan 61 atau 3
+ return $chapterid !== 3 && $chapterid !== 4 && $chapterid !== 61 && $chapterid !== 62;
});
$fullPage = "";
- if ($data_urine !== null) {
+ if ($data_urine != null) {
$fullPage .= $this->otherTests($data_urine);
}
- if ($data_feces !== null) {
+ if ($data_feces != null) {
$fullPage .= $this->otherTests($data_feces);
}
- if ($data_others !== null) {
+ if ($data_others != null) {
$fullPage .= $this->otherTests($data_others);
}
diff --git a/app/Views/admin/dashboard.php b/app/Views/admin/dashboard.php
index 69d63ba..325589b 100644
--- a/app/Views/admin/dashboard.php
+++ b/app/Views/admin/dashboard.php
@@ -57,6 +57,7 @@
= $this->section('script') ?>