From cf81c9503b9f0a2c9d37f3413d01517ad3d7af40 Mon Sep 17 00:00:00 2001 From: servdal Date: Fri, 5 Sep 2025 18:16:41 +0700 Subject: [PATCH] Update Cara Baca --- .../app/Http/Controllers/DokterController.php | 19 +- .../Http/Controllers/FrontpageController.php | 2 +- .../Http/Controllers/TemplateController.php | 12 +- htdocs/app/Services/AstmMessageService.php | 203 +++++++++++++----- .../views/dokter/pemeriksaan.blade.php | 37 +++- htdocs/resources/views/dokter/ppds.blade.php | 28 ++- htdocs/resources/views/pendaftaran.blade.php | 165 ++++++++++---- 7 files changed, 337 insertions(+), 129 deletions(-) diff --git a/htdocs/app/Http/Controllers/DokterController.php b/htdocs/app/Http/Controllers/DokterController.php index 64d200d2..77800451 100644 --- a/htdocs/app/Http/Controllers/DokterController.php +++ b/htdocs/app/Http/Controllers/DokterController.php @@ -1136,23 +1136,6 @@ class DokterController extends Controller ]); } } - if(is_array($jsondata) && count($jsondata) > 0){ - foreach ($jsondata as $item){ - RekapAntibiotik::updateOrCreate( - [ - 'orderid' => $orderid, - 'antibiotic' => $item['antibiotic'], - ], - [ - 'resistance' => $item['resistance'], - 'value' => $item['value'], - 'interpretation' => $item['interpretation'], - 'created_at' => $getdataawal->daftar ?? date('Y-m-d H:i:s'), - 'updated_at' => $getdataawal->akhir ?? date('Y-m-d H:i:s'), - ] - ); - } - } } } $gentabel = RekapAntibiotik::where('orderid', $orderid)->get(); @@ -1160,7 +1143,7 @@ class DokterController extends Controller $nomor = 1; $isidata = ''; foreach($gentabel as $rtabel){ - $isidata = $isidata.''; + $isidata = $isidata.''; $nomor++; } $isidata = $isidata.'
NoAntibiotikValueS/I/R
'.$nomor.''.$rtabel->antibiotic.''.$rtabel->value.''.$rtabel->interpretation.'
'.$nomor.''.$rtabel->resistance.''.$rtabel->value.''.$rtabel->interpretation.'
'; diff --git a/htdocs/app/Http/Controllers/FrontpageController.php b/htdocs/app/Http/Controllers/FrontpageController.php index b390c85d..2e2e36c3 100644 --- a/htdocs/app/Http/Controllers/FrontpageController.php +++ b/htdocs/app/Http/Controllers/FrontpageController.php @@ -815,7 +815,7 @@ class FrontpageController extends Controller } } public function registerApi(Request $request) { - Log::info(' Incomming '.json_encode($request->input())); + //Log::info(' Incomming '.json_encode($request->input())); $decodedData = $request->json()->all(); $norm = $decodedData['norm'] ?? null; $nama = $decodedData['nama'] ?? null; diff --git a/htdocs/app/Http/Controllers/TemplateController.php b/htdocs/app/Http/Controllers/TemplateController.php index 932a1eb5..8cf9d689 100644 --- a/htdocs/app/Http/Controllers/TemplateController.php +++ b/htdocs/app/Http/Controllers/TemplateController.php @@ -9,7 +9,7 @@ use App\Jawaban; use App\Subjawaban; use App\SiraB; use App\Organisms; - +use App\Periksa; use Validator; use Picqer\Barcode\BarcodeGeneratorPNG; use Session; @@ -276,8 +276,9 @@ class TemplateController extends Controller return back(); } } else if ($tabel == 'Speciment'){ + $kodelama = ''; if ($id == 'new'){ - $ceksudah = Organisms::where('name', $request->name)->where('category', $request->category)->where('kelompok', $request->kelompok)->count(); + $ceksudah = Organisms::where('name', $request->name)->where('kelompok', $request->kelompok)->count(); if ($ceksudah == 0){ $data = new Organisms; $inputData = $request->except(['id', 'tabel', '_token']); @@ -287,9 +288,11 @@ class TemplateController extends Controller $pesan = $request->name.' ('.$request->category.') Sudah ada, Mohon ubah Data sebelum simpan kembali'; } } else { - $ceksudah = Organisms::where('id', '!=', $id)->where('name', $request->name)->where('category', $request->category)->where('kelompok', $request->kelompok)->count(); + $ceksudah = Organisms::where('id', '!=', $id)->where('name', $request->name)->where('kelompok', $request->kelompok)->count(); if ($ceksudah == 0){ $data = Organisms::find($id); + $kodelama = $data->category; + $kodebaru = $request->category; $inputData = $request->except(['id', 'tabel', '_token']); $data->update($inputData); } else { @@ -297,6 +300,9 @@ class TemplateController extends Controller } } if ($data){ + if ($kodelama != ''){ + Periksa::where('kd_spesimen', $kodelama)->update(['kd_spesimen' => $kodebaru]); + } return response()->json(['icon' => 'success', 'warna' => '#5ba035', 'status' => 'Success', 'message' => 'Saved']); return back(); } else { diff --git a/htdocs/app/Services/AstmMessageService.php b/htdocs/app/Services/AstmMessageService.php index db6a8ae6..3a531089 100644 --- a/htdocs/app/Services/AstmMessageService.php +++ b/htdocs/app/Services/AstmMessageService.php @@ -10,7 +10,7 @@ use Illuminate\Support\Facades\DB; use Exception; use App\DataListiner; use App\Periksa; - +use App\RekapAntibiotik; // Proses untuk Growth and Detection Result function processGrowthDetectionResult($rawData){ // Format: R|1| ^ ^ ^GND_MGIT^430100001234|INST_POSITIVE ^87| ... @@ -148,6 +148,55 @@ class AstmMessageService if (empty($astmData)) { Log::error("ASTM data kosong atau tidak valid."); } + $jsonantibiotik = array( + 'Oxacillin-OX', + 'Cefoxitin-FOX', + 'Benzylpenicillin-P', + 'Ampicillin-AM', + 'Azithromycin-AZM', + 'Erythromycin-ERY', + 'Cefazolin-CZO', + 'Cefepime-FEP', + 'Cefixime-CFM', + 'Cefotaxime-CTX', + 'Cefuroxime-CXM', + 'Ceftazidime-CAZ', + 'Ceftriaxone-CRO', + 'Ceftazidime/Avibactam-CZA', + 'Piperacilin/Tazobactam-TZP', + 'Ampicillin/Sulbactam-SAM', + 'Amoxicillin/Clavulanate-AMC', + 'Cefoperazon/Sulbactam-SCF', + 'Aztreonam-ATM', + 'Ceftaroline-CPT', + 'Ciprofloxacin-CIP', + 'Levofloxacin-LEV', + 'Moxifloxacin-MFX', + 'Clindamycin-CLI', + 'Colistin-CS', + 'Tetracyclin-TCY', + 'Tigecycline-TGC', + 'Gentamicin-GM', + 'Amikacin-AN', + 'Meropenem-MEM', + 'Imipenem-IPM', + 'Doripenem-DOR', + 'Ertapenem-ETP', + 'Minocycline-MNO', + 'Doxycycline-DOX', + 'Spectinomycin-SPT', + 'Tigecycline-TGC', + 'Trimethoprim/Sulfamethoxazole-SXT', + 'Fosfomycin-FOS', + 'Vancomycin-VAN', + 'Linezolid-LNZ', + 'Fluconazole', + 'Voriconazole', + 'Caspofungin', + 'Micafungin', + 'Amphotericin B', + 'Flucytosine' + ); $headerData = []; $patientData = []; $orderData = []; @@ -246,6 +295,9 @@ class AstmMessageService $value = ''; $interpretation = ''; $mulaikirim = 0; + $tanggalmasuk = ''; + $tanggalkeluar = ''; + $resultSample = new ResultSample(); foreach ($mltrData as $index => $field) { if ($field == 'ra'){ @@ -277,60 +329,60 @@ class AstmMessageService $interpretation = substr($field, 2); $mulaikirim++; } else { - $cekbersih = trim($field, '"'); - - if (strpos($cekbersih, 'ci') === 0) { - $accession_number = substr($cekbersih, 2); + $cekbersih = trim($field, '"'); + if (strpos($cekbersih, 'mt') === 0) { + $resultSample->sender_name = substr($cekbersih, 2); } - $field = substr($field, 2); - switch ($index) { - case 0: - $resultSample->sender_name = $alat; - break; - case 1: - $resultSample->version_number = $field; // iiV2 - break; - case 2: - $resultSample->isolate_number = $field; // is000015F278BD - break; - case 4: - $resultSample->patient_id = $field; // pi12009427 - break; - case 5: - $patientNames = explode(',', $field ?? null); - if (count($patientNames) > 0) { - $resultSample->patient_name_last = trim($patientNames[0]); // Last name - } - if (count($patientNames) > 1) { - $resultSample->patient_name_first = trim($patientNames[1]); // First name - } - if (count($patientNames) > 2) { - $resultSample->patient_name_middle = trim($patientNames[2]); // Middle name - } - break; - case 6: - $resultSample->address_street = $field; // plMANINJAU - break; - case 12: - try { - $resultSample->message_datetime = Carbon::parse($field)->format('Y-m-d') ?? null; - }catch (Exception $e) { - $resultSample->message_datetime = date('Y-m-d'); - } - break; - case 13: - try { - $resultSample->test_complete_datetime = Carbon::parse($field)->format('Y-m-d') ?? null; - }catch (Exception $e) { - $resultSample->test_complete_datetime = date('Y-m-d'); - } - break; - case 14: - //$resultSample->accession_number = substr($field, 6); // ci30112024.26859 - break; - case 23: - $resultSample->organism = $field; // o2Staphylococcus haemolyticus - break; + if (strpos($cekbersih, 'ii') === 0) { + $resultSample->version_number = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'rr') === 0) { + $resultSample->isolate_number = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'ci') === 0) { + $accession_number = substr($cekbersih, 2); + $resultSample->accession_number = $accession_number; + } + if (strpos($cekbersih, 'pi') === 0) { + $resultSample->patient_id = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'pn') === 0) { + $patientNames = substr($cekbersih, 2); + $patientNames = explode(',', $patientNames ?? null); + if (count($patientNames) > 0) { + $resultSample->patient_name_first = trim($patientNames[0]); + } + if (count($patientNames) > 1) { + $resultSample->patient_name_last = trim($patientNames[1]); + } + if (count($patientNames) > 2) { + $resultSample->patient_name_middle = trim($patientNames[2]); + } + } + + if (strpos($cekbersih, 'pl') === 0) { + $resultSample->hospital_service = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'p2') === 0) { + $resultSample->hospital_client = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'ss') === 0) { + $resultSample->specimen_type = substr($cekbersih, 2); + } + if (strpos($cekbersih, 'o2') === 0) { + $resultSample->organism = substr($cekbersih, 2); + } + if (strpos($cekbersih, 's1') === 0) { + $tanggalmasuk = substr($cekbersih, 2); + } + if (strpos($cekbersih, 's2') === 0) { + $tanggalmasuk = $tanggalmasuk.' '.substr($cekbersih, 2); + } + if (strpos($cekbersih, 's3') === 0) { + $tanggalkeluar = substr($cekbersih, 2); + } + if (strpos($cekbersih, 's4') === 0) { + $tanggalkeluar = $tanggalkeluar.' '.substr($cekbersih, 2); } } } @@ -341,15 +393,50 @@ class AstmMessageService // Result Record $resultSample->additional_result = json_encode($parsedData['antibiotics']); - - // Menyimpan data yang sudah diparse + if ($tanggalmasuk != ''){ + try { + $resultSample->message_datetime = Carbon::parse($tanggalmasuk)->format('Y-m-d H:i:s') ?? null; + }catch (Exception $e) { + $resultSample->message_datetime = date('Y-m-d H:i:s'); + } + } + if ($tanggalkeluar != ''){ + try { + $resultSample->test_complete_datetime = Carbon::parse($tanggalkeluar)->format('Y-m-d H:i:s') ?? null; + }catch (Exception $e) { + $resultSample->test_complete_datetime = date('Y-m-d H:i:s'); + } + } + $resultSample->save(); if ($accession_number){ - $resultSample->accession_number = $accession_number; // '12345' + $getorderid = Periksa::where('nofoto', $accession_number)->first(); + $orderid = $getorderid->id ?? null; + if ($orderid){ + if(is_array($parsedData['antibiotics']) && count($parsedData['antibiotics']) > 0){ + foreach ($parsedData['antibiotics'] as $item){ + $glassreportname = in_array($item['antibiotic'], $jsonantibiotik); + RekapAntibiotik::updateOrCreate( + [ + 'orderid' => $orderid, + 'antibiotic' => $item['antibiotic'], + ], + [ + 'resistance' => $item['resistance'], + 'value' => $item['value'], + 'interpretation' => $item['interpretation'], + 'glassreportname' => $glassreportname, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + ] + ); + } + } + } Periksa::where('nofoto', $accession_number)->update([ 'status' => 'Data Vitek di Terima', ]); } - $resultSample->save(); + Log::info("Data MTRL Berhasil di Parse dan di simpan ", $resultSample->toArray()); return response()->json(['message' => 'Data berhasil diproses dan disimpan.']); diff --git a/htdocs/resources/views/dokter/pemeriksaan.blade.php b/htdocs/resources/views/dokter/pemeriksaan.blade.php index 35034dcc..8fe32a9b 100644 --- a/htdocs/resources/views/dokter/pemeriksaan.blade.php +++ b/htdocs/resources/views/dokter/pemeriksaan.blade.php @@ -528,7 +528,7 @@ -
+
+
+ + +
+
+ + +
+
+ + +
@@ -2072,6 +2096,7 @@ function openlamanekpertise( jQuery ){ var dlp = document.getElementById('dlp').value; var nofoto = document.getElementById('nofoto').value; + $('#template_jenis').val(dlp); $('#divtemplate').hide(); $('.templatejawaban').hide(); $('.setelahdipilihtemplate').show(); @@ -2315,7 +2340,6 @@ autoheight : true, source : dataAdapter, theme : "energyblue", - selectionmode : 'checkbox', altrows : true, columns: [ { text: 'Expertise', filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () { @@ -2401,6 +2425,7 @@ $("#asalpasien").html(dataRecord.asalpasien); $("#modaliti").val(dataRecord.modality); $("#dlp").val(dataRecord.dlp); + $("#template_jenis").val(dataRecord.dlp); $("#nofoto").val(dataRecord.nofoto); $("#norm").val(dataRecord.noregister); $("#nonama").val(dataRecord.nama); @@ -2686,10 +2711,10 @@ { text: 'Date', datafield: 'daftartgl', width: 80, cellsalign: 'center', align: 'center'}, { text: 'Time', datafield: 'daftarjam', width: 80, cellsalign: 'center', align: 'center'}, { text: 'Comming From', filtertype: 'checkedlist', datafield: 'asalpasien', width: 120, cellsalign: 'left', align: 'center'}, - { text: 'Service', datafield: 'tlsreques', width: 150, cellsalign: 'left', align: 'center'}, - { text: 'Pengirim', filtertype: 'checkedlist', datafield: 'nmexcutor', width: 110, cellsalign: 'left', align: 'center'}, - { text: 'Themeplate', filtertype: 'checkedlist', datafield: 'dlp', width: 75, cellsalign: 'left', align: 'center'}, - { text: 'Jenis', filtertype: 'checkedlist', datafield: 'diagnosa2', width: 75, cellsalign: 'left', align: 'center'}, + { text: 'Service', datafield: 'tlsreques', width: 170, cellsalign: 'left', align: 'center'}, + { text: 'Pengirim', datafield: 'nmexcutor', width: 200, cellsalign: 'left', align: 'center'}, + { text: 'Themeplate', filtertype: 'checkedlist', datafield: 'dlp', width: 100, cellsalign: 'left', align: 'center'}, + { text: 'Jenis', filtertype: 'checkedlist', datafield: 'diagnosa2', width: 120, cellsalign: 'left', align: 'center'}, { text: 'Specimen', filtertype: 'checkedlist', datafield: 'nm_spesimen', width: 230, cellsalign: 'left', align: 'center'}, ] }); diff --git a/htdocs/resources/views/dokter/ppds.blade.php b/htdocs/resources/views/dokter/ppds.blade.php index 31207e58..15f2178b 100644 --- a/htdocs/resources/views/dokter/ppds.blade.php +++ b/htdocs/resources/views/dokter/ppds.blade.php @@ -576,7 +576,7 @@
-
+
+
+ + +
+
+ + +
+
+ + +
@@ -2142,6 +2166,7 @@ function openlamanekpertise( jQuery ){ var dlp = document.getElementById('dlp').value; var nofoto = document.getElementById('nofoto').value; + $('#template_jenis').val(dlp); $('#divtemplate').hide(); $('.templatejawaban').hide(); $('.setelahdipilihtemplate').show(); @@ -2471,6 +2496,7 @@ $("#asalpasien").html(dataRecord.asalpasien); $("#modaliti").val(dataRecord.modality); $("#dlp").val(dataRecord.dlp); + $("#template_jenis").val(dataRecord.dlp); $("#nofoto").val(dataRecord.nofoto); $("#norm").val(dataRecord.noregister); $("#nonama").val(dataRecord.nama); diff --git a/htdocs/resources/views/pendaftaran.blade.php b/htdocs/resources/views/pendaftaran.blade.php index 51910e18..e3e24abb 100644 --- a/htdocs/resources/views/pendaftaran.blade.php +++ b/htdocs/resources/views/pendaftaran.blade.php @@ -511,6 +511,7 @@ { name: 'nmexcutor', type: 'text'}, { name: 'klinisi', type: 'text'}, { name: 'klinis', type: 'text'}, + { name: 'poli', type: 'text'}, { name: 'poli_id', type: 'text'}, { name: 'keterangan', type: 'text'}, { name: 'kesimpulan', type: 'text'}, @@ -690,7 +691,24 @@ $('#modalawal').removeClass('col-lg-12').addClass('col-lg-8'); } }, - + { text: 'Stiker', filterable: false, columntype: 'button', align: 'center', width: 50, cellsrenderer: function () { + return "Print"; + }, buttonclick: function (row) { + editrowjabatan = row; + var offset = $("#gridpemeriksaan").offset(); + var dataRecord = $("#gridpemeriksaan").jqxGrid('getrowdata', editrowjabatan); + var nofoto = dataRecord.nofoto || '000000'; + var asalpasien = dataRecord.asalpasien || 'RSSA'; + var kd_spesimen = dataRecord.kd_spesimen || '00'; + var noregister = dataRecord.noregister || '00000'; + var nama = dataRecord.nama || 'xx'; + var tgllahir = dataRecord.tgllahir || '0000-00-00'; + var reques = dataRecord.poli || '-'; + var daftartgl = dataRecord.daftartgl || '0000-00-00'; + var item = `${asalpasien}<>${kd_spesimen}<>${noregister}<>${nama}<>${tgllahir}<>${reques}<>${daftartgl}`; + jQueryOpenBarCode(item, nofoto); + } + }, { text: 'Ulang', filterable: false, columntype: 'button', align: 'center', width: 50, cellsrenderer: function () { return "Ulang"; }, buttonclick: function (row) { @@ -766,48 +784,111 @@ } } function jQueryOpenBarCode(item, nofoto) { - var itemParts = item.split('<>'); - var itemName = itemParts[0].trim(); - var tahunpendek = itemParts.length > 1 ? itemParts[1].trim() : "xx"; - var nomor = itemParts.length > 2 ? itemParts[2].trim() : "xx"; - var tanggal = itemParts.length > 3 ? itemParts[3].trim() : "0000-00-00"; - var nofoto = itemParts.length > 4 ? itemParts[4].trim() : nofoto; - var noregister = itemParts.length > 5 ? itemParts[5].trim() : "xx"; - var kd_spesimen = itemParts.length > 6 ? itemParts[6].trim() : "xx"; - var nama = itemParts.length > 7 ? itemParts[7].trim() : "xx"; - var itemPartsThn = tanggal.split('-'); - var tahun = itemPartsThn[0].trim(); - var bulan = itemPartsThn.length > 1 ? itemPartsThn[1].trim() : "00"; - var tanggal = itemPartsThn.length > 2 ? itemPartsThn[2].trim() : "00"; - if (itemName == 'Vitek 1' || itemName == 'Vitek 2'){ - var barcodeunik = tanggal+bulan+tahun+'-'+nomor; - } else if (itemName == 'BD Bachtect' || itemName == 'BD MGIT'){ - var barcodeunik = tahunpendek+'-'+nomor; - } else if (itemName == 'abbotm2000' || itemName == 'abbotm2000rt'){ - var barcodeunik = tahun+bulan+tanggal+'-'+nomor; - } else { - var barcodeunik = nofoto; - } - var barcodeContent = `
${kd_spesimen}-${nomor}${nama}
`; - var printWindow = window.open('', '', 'width=600,height=400'); - printWindow.document.write('Print Barcode'); - printWindow.document.write(barcodeContent); - printWindow.document.write('
'); - printWindow.document.write(''); - printWindow.document.close(); - printWindow.onload = function() { - var barcodeElement = printWindow.document.getElementById('barcode'); - if (barcodeElement) { - JsBarcode(barcodeElement, barcodeunik, { - format: "CODE128", - displayValue: true - }); - printWindow.print(); - printWindow.onafterprint = function () { printWindow.close(); }; - } else { - console.error("Element #barcode tidak ditemukan di dalam jendela print."); + var itemParts = item.split('<>'); + var asalpasien = itemParts[0]?.trim() || "xx"; + var kd_spesimen = itemParts[1]?.trim() || "xx"; + var noregister = itemParts[2]?.trim() || "xx"; + var nama = itemParts[3]?.trim() || "xx"; + var tgllahir = itemParts[4]?.trim() || "0000-00-00"; + var reques = itemParts[5]?.trim() || "xx"; + var daftartgl = itemParts[6]?.trim() || "xx"; + + var printWindow = window.open('', '', 'width=1000,height=700,scrollbars=yes,resizable=yes'); + + var style = ` + + `; + + var html = ` + + + Print Barcode + ${style} + + + + + + + + + + + + + + + +
${nofoto} / ${kd_spesimen} / ${asalpasien}
${noregister} / ${nama} / ${tgllahir}
${reques} ( ${daftartgl} )
+ + + `; + + printWindow.document.write(html); + printWindow.document.close(); + + printWindow.onload = function () { + var barcodeElement = printWindow.document.getElementById('barcode'); + if (barcodeElement) { + JsBarcode(barcodeElement, nofoto, { + format: "CODE128", + displayValue: false, + height: 25, + margin: 0 + }); + + // Tunggu render selesai, baru print + setTimeout(() => { + printWindow.focus(); + printWindow.print(); + printWindow.onafterprint = function () { + printWindow.close(); + }; + }, 500); + } else { + console.error("Element #barcode tidak ditemukan di dalam jendela print."); + } + }; } $(window).on('load', function () { openedpage();