From 35f480c3413c8d21a6277debd57b5b1bb29982c4 Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Wed, 11 Dec 2024 17:54:38 +0800 Subject: [PATCH] update Header, Result tambah Sample --- app/Controllers/PrintResult.php | 118 ++++++++++++++++++++++---------- app/Views/admin/dashboard.php | 2 +- public/assets/css/pdf.css | 13 ++-- 3 files changed, 92 insertions(+), 41 deletions(-) diff --git a/app/Controllers/PrintResult.php b/app/Controllers/PrintResult.php index 02193cc..998ddcd 100644 --- a/app/Controllers/PrintResult.php +++ b/app/Controllers/PrintResult.php @@ -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 = "
@@ -17,40 +54,40 @@ class PrintResult extends BaseController { CLINICAL LABORATORY - + - UHID + RM Number : - 1BCJJAJSDK - Sample ID + $rm_number + Visit Number : - LAB2420076951 + $hostordernumber - Name + First Name : - Ni Luh Putu Eka Putri Saraswati - Specimen + $first_name + Request Number : - Serum + $accessnumber - Age/Gender + Last Name : - 22 year(s) / Male - Collection Date/Time + $last_name + Order Date/Time : - 26-10-2024 / 11:55:04 + $collection_date - Speciality + DoB/Gender : - + $birth_date / $sex Result Date/Time : - 26-10-2024 / 11:52:04 + @@ -63,24 +100,24 @@ class PrintResult extends BaseController { Parameter - Result - Unit - Normal Range - Notes + Result + Unit + Normal Range + Sample Type "; $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 {
- + - + - +
Collection datetime : $collectionText 
Collection datetime : $collectionText
Reception datetime  : $receptionText 
Reception datetime  : $receptionText
"; @@ -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 {
".$tempChapEng."
-
 ".$tempChapInd."
"; @@ -165,7 +201,7 @@ class PrintResult extends BaseController { } // Melebihi batas Kertas - if($i % 24 == 0) { + if($i % 21 == 0) { $resultTest .= "
"; $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 .= ""; $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]); diff --git a/app/Views/admin/dashboard.php b/app/Views/admin/dashboard.php index d4d50f1..beb7e42 100644 --- a/app/Views/admin/dashboard.php +++ b/app/Views/admin/dashboard.php @@ -148,7 +148,7 @@ function index() { stattext = 'Validated'; } let datarow = "" + - '' + colldate + ' ' + patnumber + ' ' + accessnumber + ' ' + patname + ' ' + hon + ' ' + tests + '' + + '' + colldate + ' ' + patnumber + ' ' + patname + ' ' + accessnumber + ' ' + hon + ' ' + tests + '' + ""+stattext+"" + "

" +''; $("#table-body").append(datarow); diff --git a/public/assets/css/pdf.css b/public/assets/css/pdf.css index 62338ac..6215f30 100644 --- a/public/assets/css/pdf.css +++ b/public/assets/css/pdf.css @@ -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 {