Perbaikan Label(RM, VN, Colldate) dan Hasil Result

This commit is contained in:
mikael-zakaria 2024-12-17 08:42:59 +08:00
parent a184263214
commit 736ea4d356
2 changed files with 33 additions and 27 deletions

View File

@ -3,7 +3,7 @@ namespace App\Controllers;
class PrintLabel extends BaseController {
public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ) {
public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
// Printer Posteck
$sampleLabel ="N
OD
@ -14,19 +14,19 @@ D10
A4,3,0,2,1,1,N,\"$title.$name\"
A4,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"\"
A4,75,0,2,1,1,N,\"Chapter\"
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\"
A195,110,0,2,1,1,N,\"SAM# $barcode\"
A4,140,0,2,1,1,N,\"RM : $uhid\"
A4,160,0,2,1,1,N,\"VN : $bv\"
A195,156,0,2,1,1,N,\"$collection_date\"
P1
";
return $sampleLabel;
}
public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ) {
public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
$sampleLabel ="N
OD
q400
@ -36,12 +36,12 @@ D10
A4,3,0,2,1,1,N,\"$title.$name\"
A4,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"\"
A4,75,0,2,1,1,N,\"Chapter\"
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\"
A195,110,0,2,1,1,N,\"SAM# $barcode\"
A4,140,0,2,1,1,N,\"RM : $uhid\"
A4,160,0,2,1,1,N,\"VN : $bv\"
A195,156,0,2,1,1,N,\"$collection_date\"
P1
";
@ -71,16 +71,16 @@ P1
$networkPath = "";
$db = \Config\Database::connect();
$sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX,
DATEDIFF(YEAR, BirthDate, GETDATE()) -
CASE WHEN MONTH(BirthDate) > MONTH(GETDATE()) OR (MONTH(BirthDate) = MONTH(GETDATE()) AND DAY(BirthDate) > DAY(GETDATE())) THEN 1
ELSE 0 END AS AGE,
ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as BARCODE, getdate() as COLLDATE
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.SAMPCODE = '$sampletype'";
$sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX,
DATEDIFF(YEAR, BirthDate, GETDATE()) -
CASE WHEN MONTH(BirthDate) > MONTH(GETDATE()) OR (MONTH(BirthDate) = MONTH(GETDATE()) AND DAY(BirthDate) > DAY(GETDATE())) THEN 1
ELSE 0 END AS AGE,
ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as BARCODE, sr.COLLECTIONDATE
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.SAMPCODE = '$sampletype'";
$query = $db->query($sql);
$results = $query->getResultArray();
@ -94,15 +94,21 @@ where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'";
$sample = $item['FULLTEXT'];
$barcode = $item['BARCODE'];
$age = $item['AGE'];
$colldate = $item['COLLDATE'];
$collectiondate = $item['COLLECTIONDATE'];
$date = \DateTime::createFromFormat('Y-m-d H:i:s.v', $collectiondate);
if ($date) {
$collectiondate = $date->format('d/m/Y H:i');
} else {
$collectiondate = "";
}
// Ruang Analis Printer POSTEK C168/200s
if ($role === 'admin' || $role === 'user') {
$printer = $this->printerLab();
$label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv );
$label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate);
} else if ($role === 'sampling') {
$printer = $this->printerSampling();
$label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv );
$label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate);
} else {
// Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling
return $this->response->setJSON([
@ -133,7 +139,7 @@ where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'";
// Hapus Koneksi
//exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var);
return $this->response->setJSON( [
'message' => "Print Berhasil",
'message' => "Print Berhasil!" ,
'status' => true,
]);
}

View File

@ -169,7 +169,7 @@ class PrintResult extends BaseController {
<td align='right'>dr. I Komang Parwata Sp.PK</td>
</tr>
<tr>
<td>Mrs. Gst Ayu Riska Mastari</td>
<td>Mrs. Gusti Ayu Riska Mastari</td>
<td align='right'>Reg. No: 570/SIPDS/0001/I/DPMPTSP/2023</td>
</tr>
</table>