update
This commit is contained in:
@@ -1310,7 +1310,7 @@ class FrontpageController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function registerApi(Request $request) {
|
public function registerApi(Request $request) {
|
||||||
//Log::info(' Incomming '.json_encode($request->input()));
|
Log::info(' Incomming '.json_encode($request->input()));
|
||||||
$decodedData = $request->json()->all();
|
$decodedData = $request->json()->all();
|
||||||
$norm = $decodedData['norm'] ?? null;
|
$norm = $decodedData['norm'] ?? null;
|
||||||
$nama = $decodedData['nama'] ?? null;
|
$nama = $decodedData['nama'] ?? null;
|
||||||
@@ -1325,41 +1325,33 @@ class FrontpageController extends Controller
|
|||||||
$bpjs = $decodedData['nobpjs'] ?? '0';
|
$bpjs = $decodedData['nobpjs'] ?? '0';
|
||||||
$drpeminta = $decodedData['drpeminta'] ?? null;
|
$drpeminta = $decodedData['drpeminta'] ?? null;
|
||||||
$tlsasal = $decodedData['asalpasien'] ?? null;
|
$tlsasal = $decodedData['asalpasien'] ?? null;
|
||||||
//$rekues = $decodedData['layanan'] ?? null;
|
$diagnosa = $decodedData['diagnosa'] ?? null;
|
||||||
$statusbayar = $decodedData['statusbayar'] ?? null;
|
$statusbayar = $decodedData['statusbayar'] ?? null;
|
||||||
$notransaksi = $decodedData['notransaksi'] ?? null;
|
$notransaksi = $decodedData['nomor_lab'] ?? null;
|
||||||
$insurance = $decodedData['asuransi'] ?? 'UMM';
|
$insurance = $decodedData['jenispembayaran'] ?? 'UMM';
|
||||||
$klinis = $decodedData['klinis'] ?? null;
|
$klinis = $decodedData['klinis'] ?? null;
|
||||||
$klinisi = $decodedData['klinisi'] ?? $drpeminta;
|
$klinisi = $decodedData['klinisi'] ?? $drpeminta;
|
||||||
$rekues = $decodedData['kode'] ?? null;
|
$rekues = $decodedData['jenispemeriksaan'] ?? null;
|
||||||
$nm_spesimen = $decodedData['spesimen'] ?? null;
|
$nm_spesimen = $decodedData['spesimen'] ?? null;
|
||||||
|
$kd_spesimen = $decodedData['kodespesimen'] ?? null;
|
||||||
$pengambilan = $decodedData['pengambilan'] ?? null;
|
$pengambilan = $decodedData['pengambilan'] ?? null;
|
||||||
$nmrs = $decodedData['namarspengirim'] ?? 'RSSA Malang';
|
$nmrs = $decodedData['keteranganrujukan'] ?? 'RSSA Malang';
|
||||||
|
$tanggalregis = $decodedData['tanggalregis'] ?? date('Y-m-d');
|
||||||
|
$tanggalsampel = $decodedData['tanggalsampel'] ?? date('Y-m-d');
|
||||||
$telpon = str_replace('_', '', $nohap);
|
$telpon = str_replace('_', '', $nohap);
|
||||||
//$rekues = str_replace('_', ' ', $rekues);
|
|
||||||
$tlsasal = str_replace('_', ' ', $tlsasal);
|
$tlsasal = str_replace('_', ' ', $tlsasal);
|
||||||
$klinisi = str_replace('_', ' ', $klinisi);
|
$klinisi = str_replace('_', ' ', $klinisi);
|
||||||
$nama = str_replace('_', ' ', $nama);
|
$nama = str_replace('_', ' ', $nama);
|
||||||
$alamat = str_replace('_', ' ', $alamat);
|
$alamat = str_replace('_', ' ', $alamat);
|
||||||
$kd_spesimen = '';
|
|
||||||
$getkodespesimen= Organisms::where('name', $nm_spesimen)->where('kelompok', 'listkodespesimen')->first();
|
$getkodespesimen= Organisms::where('name', $nm_spesimen)->where('kelompok', 'listkodespesimen')->first();
|
||||||
if (isset($getkodespesimen->category)){
|
if (isset($getkodespesimen->category)){
|
||||||
$kd_spesimen= $getkodespesimen->category;
|
$kd_spesimen= $getkodespesimen->category;
|
||||||
} else {
|
} else {
|
||||||
$cekdulu = explode(' ', $nm_spesimen);
|
|
||||||
if (isset($cekdulu[1])){
|
|
||||||
$kd_spesimen = str_replace('.', '', $cekdulu[0]);
|
|
||||||
} else {
|
|
||||||
foreach ($cekdulu as $kata) {
|
|
||||||
$kd_spesimen .= substr($kata, 0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Organisms::create([
|
Organisms::create([
|
||||||
'name' => $nm_spesimen,
|
'name' => $nm_spesimen,
|
||||||
'category' => $kd_spesimen,
|
'category' => $kd_spesimen,
|
||||||
'kelompok' => 'listkodespesimen'
|
'kelompok' => 'listkodespesimen'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
$iddokter = '';
|
$iddokter = '';
|
||||||
$ruangan = 1;
|
$ruangan = 1;
|
||||||
@@ -1437,12 +1429,12 @@ class FrontpageController extends Controller
|
|||||||
$check = Poli::where('subpoli', $rekues)->first();
|
$check = Poli::where('subpoli', $rekues)->first();
|
||||||
if (isset($check->id)){
|
if (isset($check->id)){
|
||||||
$poli_id = $check->id;
|
$poli_id = $check->id;
|
||||||
$kd_spesimen= $check->subsubpoli;
|
|
||||||
$nm_spesimen= $check->modaliti;
|
|
||||||
} else {
|
} else {
|
||||||
$poli_id = Poli::insertGetId([
|
$poli_id = Poli::insertGetId([
|
||||||
'poli' => 'Mikrobiologi',
|
'poli' => 'Mikrobiologi',
|
||||||
'subpoli' => $rekues,
|
'subpoli' => $rekues,
|
||||||
|
'subsubpoli' => $kd_spesimen,
|
||||||
|
'modaliti' => $nm_spesimen,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$nofoto = date('y').'-'.sprintf("% 06s", $noloket);
|
$nofoto = date('y').'-'.sprintf("% 06s", $noloket);
|
||||||
@@ -1492,6 +1484,10 @@ class FrontpageController extends Controller
|
|||||||
'asuransi' => $insurance,
|
'asuransi' => $insurance,
|
||||||
'urgensi' => $urgensi,
|
'urgensi' => $urgensi,
|
||||||
'daftar' => $mulai,
|
'daftar' => $mulai,
|
||||||
|
'diagnosa' => $diagnosa,
|
||||||
|
'pengambilan' => $pengambilan,
|
||||||
|
'tanggalregis' => $tanggalregis,
|
||||||
|
'tanggalsampel' => $tanggalsampel,
|
||||||
'pendaftar' => $clientIpNumeric,
|
'pendaftar' => $clientIpNumeric,
|
||||||
'nmpendaftar' => $clientIp,
|
'nmpendaftar' => $clientIp,
|
||||||
'orderid' => $notransaksi,
|
'orderid' => $notransaksi,
|
||||||
@@ -1501,7 +1497,7 @@ class FrontpageController extends Controller
|
|||||||
if (in_array($poli_id, $daftaridtcm)){
|
if (in_array($poli_id, $daftaridtcm)){
|
||||||
$genexpert = false;
|
$genexpert = false;
|
||||||
} else {
|
} else {
|
||||||
$genexpert = 1;
|
$genexpert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Paslab::updateOrCreate(
|
Paslab::updateOrCreate(
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('periksa', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('periksa', 'tanggalregis')) {
|
||||||
|
$table->date('tanggalregis')->nullable()->after('tgladendum');
|
||||||
|
}
|
||||||
|
if (!Schema::hasColumn('periksa', 'tanggalsampel')) {
|
||||||
|
$table->date('tanggalsampel')->nullable()->after('tanggalregis');
|
||||||
|
}
|
||||||
|
if (!Schema::hasColumn('periksa', 'pengambilan')) {
|
||||||
|
$table->string('pengambilan', 255)->nullable()->after('diagnosa2');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('periksa', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('periksa', 'tanggalregis')) {
|
||||||
|
$table->dropColumn('tanggalregis');
|
||||||
|
}
|
||||||
|
if (Schema::hasColumn('periksa', 'tanggalsampel')) {
|
||||||
|
$table->dropColumn('tanggalsampel');
|
||||||
|
}
|
||||||
|
if (Schema::hasColumn('periksa', 'pengambilan')) {
|
||||||
|
$table->dropColumn('pengambilan');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+15
-19
@@ -450,29 +450,14 @@ def create_genexpert_rsp_z02_response(orders, incoming_hl7, ip_addr=None):
|
|||||||
print(f"[GENEXPERT] Payload order dilewati rnoreg={sample_id} karena assay kosong.")
|
print(f"[GENEXPERT] Payload order dilewati rnoreg={sample_id} karena assay kosong.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
first_name, last_name = split_patient_name(order.nama)
|
|
||||||
patient_name = sanitize_astm_field(f"{last_name}^{first_name}", uppercase=True, max_len=80, allow_component_sep=True)
|
|
||||||
dob = format_hl7_date(getattr(order, "tgllahir", None))
|
|
||||||
sex = map_hl7_sex(getattr(order, "rjenis", ""))
|
|
||||||
address = sanitize_astm_field(getattr(order, "alamat", ""), max_len=120)
|
|
||||||
room = sanitize_astm_field(getattr(order, "ruangan", ""), uppercase=True, max_len=80)
|
|
||||||
doctor = sanitize_astm_field(getattr(order, "namadok", ""), max_len=80)
|
|
||||||
requested_test_name = sanitize_astm_field(getattr(order, "tes", ""), max_len=120)
|
|
||||||
specimen_type = sanitize_astm_field(
|
|
||||||
getattr(order, "nm_spesimen", "") or getattr(order, "kd_spesimen", "") or "ORH",
|
|
||||||
uppercase=True,
|
|
||||||
max_len=40
|
|
||||||
)
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f"[GENEXPERT-DEBUG] Build RSP rnoreg={sample_id}, ip={ip_addr}, "
|
f"[GENEXPERT-DEBUG] Build RSP rnoreg={sample_id}, ip={ip_addr}, "
|
||||||
f"patient_id={patient_id}, assay_code={assay_code}, assay_source={assay_source}, "
|
f"patient_id={patient_id}, assay_code={assay_code}, assay_source={assay_source}, "
|
||||||
f"capability_match={capability_match}, patient_name='{patient_name}', dob='{dob}', "
|
f"capability_match={capability_match}, query_name='{query_name}', query_tag='{query_tag}', "
|
||||||
f"sex='{sex}', room='{room}', doctor='{doctor}', specimen_type='{specimen_type}', "
|
"profile='minimal-rsp-z02'"
|
||||||
f"requested_test_name='{requested_test_name}', query_name='{query_name}', query_tag='{query_tag}'"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
segments.append(f"PID|{patient_idx}||{patient_id}||{patient_name}||{dob}|{sex}|||{address}")
|
segments.append(f"PID|{patient_idx}||{patient_id}")
|
||||||
segments.append(f"ORC|NW|1|||||||{order_ts}")
|
segments.append(f"ORC|NW|1|||||||{order_ts}")
|
||||||
segments.append(f"OBR|1|||{assay_code}|||||||A")
|
segments.append(f"OBR|1|||{assay_code}|||||||A")
|
||||||
segments.append("TQ1|||||||||R")
|
segments.append("TQ1|||||||||R")
|
||||||
@@ -627,7 +612,7 @@ def debug_genexpert_order_message(hl7_message, ip_addr=None):
|
|||||||
print(
|
print(
|
||||||
f"[GENEXPERT-ORDER-DEBUG] ip={ip_addr}, seg=PID, patient_id='{current_pid}', "
|
f"[GENEXPERT-ORDER-DEBUG] ip={ip_addr}, seg=PID, patient_id='{current_pid}', "
|
||||||
f"patient_name='{current_patient_name}', dob='{dob}', sex='{sex}', "
|
f"patient_name='{current_patient_name}', dob='{dob}', sex='{sex}', "
|
||||||
f"address='{address}', raw='{segment}'"
|
f"address='{address}', mode='minimal', raw='{segment}'"
|
||||||
)
|
)
|
||||||
elif seg_type == "ORC":
|
elif seg_type == "ORC":
|
||||||
order_index = fields[2] if len(fields) > 2 else ""
|
order_index = fields[2] if len(fields) > 2 else ""
|
||||||
@@ -2105,6 +2090,8 @@ def handle_genexpert_client(conn, addr):
|
|||||||
log_genexpert_handshake(addr[0], "ETX-RX", detail=f"bytes={len(data)}")
|
log_genexpert_handshake(addr[0], "ETX-RX", detail=f"bytes={len(data)}")
|
||||||
if b"\x04" in data:
|
if b"\x04" in data:
|
||||||
log_genexpert_handshake(addr[0], "EOT-RX", detail=f"bytes={len(data)}")
|
log_genexpert_handshake(addr[0], "EOT-RX", detail=f"bytes={len(data)}")
|
||||||
|
if b"\x15" in data:
|
||||||
|
log_genexpert_handshake(addr[0], "NAK-RX", detail=f"bytes={len(data)}")
|
||||||
|
|
||||||
# --- 1. HANDLE HANDSHAKE (ENQ) ---
|
# --- 1. HANDLE HANDSHAKE (ENQ) ---
|
||||||
# Jika alat kirim ENQ (\x05/♣), langsung balas ACK (\x06)
|
# Jika alat kirim ENQ (\x05/♣), langsung balas ACK (\x06)
|
||||||
@@ -2115,6 +2102,10 @@ def handle_genexpert_client(conn, addr):
|
|||||||
log_genexpert_handshake(addr[0], "ACK-TX", detail="reason=enq")
|
log_genexpert_handshake(addr[0], "ACK-TX", detail="reason=enq")
|
||||||
# Hapus ENQ dari buffer agar tidak mengganggu
|
# Hapus ENQ dari buffer agar tidak mengganggu
|
||||||
buffer = buffer.replace(b'\x05', b'')
|
buffer = buffer.replace(b'\x05', b'')
|
||||||
|
|
||||||
|
if b'\x15' in buffer:
|
||||||
|
log_genexpert_handshake(addr[0], "NAK-BUFFER-CLEAR", detail=f"buffer_len={len(buffer)}")
|
||||||
|
buffer = buffer.replace(b'\x15', b'')
|
||||||
|
|
||||||
# --- 2. CEK APAKAH PESAN SUDAH LENGKAP? ---
|
# --- 2. CEK APAKAH PESAN SUDAH LENGKAP? ---
|
||||||
# Kita cari tanda akhir pesan umum:
|
# Kita cari tanda akhir pesan umum:
|
||||||
@@ -2141,6 +2132,11 @@ def handle_genexpert_client(conn, addr):
|
|||||||
|
|
||||||
# --- 3. PROSES JIKA LENGKAP ---
|
# --- 3. PROSES JIKA LENGKAP ---
|
||||||
if msg_complete:
|
if msg_complete:
|
||||||
|
if end_marker_pos == 0 and buffer[:1] == b'\x04':
|
||||||
|
log_genexpert_handshake(addr[0], "EOT-CLEAR", detail="standalone-eot")
|
||||||
|
buffer = buffer[1:].lstrip(b'\r').lstrip(b'\n')
|
||||||
|
continue
|
||||||
|
|
||||||
# Ambil pesan dari awal sampai marker
|
# Ambil pesan dari awal sampai marker
|
||||||
# (Gunakan slice sampai end_marker_pos+1 agar karakter penutup ikut terambil/dibuang)
|
# (Gunakan slice sampai end_marker_pos+1 agar karakter penutup ikut terambil/dibuang)
|
||||||
if end_marker_pos == -1: end_marker_pos = len(buffer)
|
if end_marker_pos == -1: end_marker_pos = len(buffer)
|
||||||
|
|||||||
Reference in New Issue
Block a user