Update Cara Baca

This commit is contained in:
servdal
2025-09-05 18:16:41 +07:00
parent ab65bfb585
commit cf81c9503b
7 changed files with 337 additions and 129 deletions
@@ -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 = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="65%"><strong>Antibiotik</strong></td><td width="15%"><strong>Value</strong></td><td width="15%"><strong>S/I/R</strong></td></tr>';
foreach($gentabel as $rtabel){
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->antibiotic.'</td<td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->resistance.'</td><td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
$nomor++;
}
$isidata = $isidata.'</table>';
@@ -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;
@@ -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 {
+145 -58
View File
@@ -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.']);
@@ -528,7 +528,7 @@
</div>
</div>
</div>
<div class="form-group col-lg-12">
<div class="form-group col-lg-3">
<label for="id_pemeriksaantl" class="col-form-label">Pemeriksaan Tambahan Lainnya</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaantl" name="id_pemeriksaantl">
<option value="">Pilih Salah Satu</option>
@@ -539,6 +539,30 @@
@endif
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaanhemolisa" class="col-form-label">Hemolisa</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaanhemolisa" name="id_pemeriksaanhemolisa">
<option value="">Pilih Salah Satu</option>
<option value="&#646; hemolisa">&#646; hemolisa</option>
<option value="&#946; hemolisa">&#946; hemolisa</option>
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaankatalase" class="col-form-label">Tes Katalase</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaankatalase" name="id_pemeriksaankatalase">
<option value="">Pilih Salah Satu</option>
<option value="Katalase +">Katalase +</option>
<option value="Katalase -">Katalase -</option>
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaankabulase" class="col-form-label">Tes Kabulase</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaankabulase" name="id_pemeriksaankabulase">
<option value="">Pilih Salah Satu</option>
<option value="Kabulase +">Kabulase +</option>
<option value="Kabulase -">Kabulase -</option>
</select>
</div>
<div class="form-group col-lg-12">
<label class="col-form-label">Kirby bauer :</label>
<div class="form-row">
@@ -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'},
]
});
+27 -1
View File
@@ -576,7 +576,7 @@
</div>
</div>
</div>
<div class="form-group col-lg-12">
<div class="form-group col-lg-3">
<label for="id_pemeriksaantl" class="col-form-label">Pemeriksaan Tambahan Lainnya</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaantl" name="id_pemeriksaantl">
<option value="">Pilih Salah Satu</option>
@@ -587,6 +587,30 @@
@endif
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaanhemolisa" class="col-form-label">Hemolisa</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaanhemolisa" name="id_pemeriksaanhemolisa">
<option value="">Pilih Salah Satu</option>
<option value="&#646; hemolisa">&#646; hemolisa</option>
<option value="&#946; hemolisa">&#946; hemolisa</option>
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaankatalase" class="col-form-label">Tes Katalase</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaankatalase" name="id_pemeriksaankatalase">
<option value="">Pilih Salah Satu</option>
<option value="Katalase +">Katalase +</option>
<option value="Katalase -">Katalase -</option>
</select>
</div>
<div class="form-group col-lg-3">
<label for="id_pemeriksaankabulase" class="col-form-label">Tes Kabulase</label>
<select class="form-control ekspertiseseletc" id="id_pemeriksaankabulase" name="id_pemeriksaankabulase">
<option value="">Pilih Salah Satu</option>
<option value="Kabulase +">Kabulase +</option>
<option value="Kabulase -">Kabulase -</option>
</select>
</div>
<div class="form-group col-lg-12">
<label class="col-form-label">Kirby bauer :</label>
<div class="form-row">
@@ -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);
+123 -42
View File
@@ -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 = `<table><tr><td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${kd_spesimen}-${nomor}</td><td align="right" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">${nama}</td></tr><tr><td colspan="2">`;
var printWindow = window.open('', '', 'width=600,height=400');
printWindow.document.write('<html><head><title>Print Barcode</title></head><body>');
printWindow.document.write(barcodeContent);
printWindow.document.write('<svg id="barcode"></svg></td></tr></table>');
printWindow.document.write('</body></html>');
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 = `
<style>
@page {
size: 5.5cm 4cm landscape;
margin: 0;
}
};
@media print {
body {
width: 5.5cm;
height: 4cm;
margin: 0;
top: 0mm;
padding: 0mm;
font-family: Tahoma, Arial, sans-serif;
}
}
body {
width: 5.5cm;
height: 4cm;
margin: 0;
padding: 0mm;
font-family: Tahoma, Arial, sans-serif;
}
table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
svg {
width: 70%;
height: 35px;
}
td {
padding: 0;
margin: 0;
font-size: 8pt;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
`;
var html = `
<html>
<head>
<title>Print Barcode</title>
${style}
</head>
<body>
<table>
<tr>
<td>${nofoto} / ${kd_spesimen} / ${asalpasien}</td>
</tr>
<tr>
<td><svg id="barcode"></svg></td>
</tr>
<tr>
<td>${noregister} / ${nama} / ${tgllahir}</td>
</tr>
<tr>
<td>${reques} ( ${daftartgl} )</td>
</tr>
</table>
</body>
</html>
`;
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();