diff --git a/htdocs/app/Http/Controllers/DokterController.php b/htdocs/app/Http/Controllers/DokterController.php
index 94ee4bb7..c07f8257 100644
--- a/htdocs/app/Http/Controllers/DokterController.php
+++ b/htdocs/app/Http/Controllers/DokterController.php
@@ -2266,8 +2266,8 @@ class DokterController extends Controller
$arrnofoto = explode('-', $nofoto);
$nofoto = $arrnofoto[0];
if ($statuse != 'Selesai'){
- if ($statuse == 'Dikerjakan awal'){
- Periksa::where('id', $id)->where('status', 'Dikerjakan awal')->update([
+ if ($statuse == 'Pemeriksaan awal'){
+ Periksa::where('id', $id)->where('status', 'Pemeriksaan awal')->update([
'status' => 'Pemeriksaan Sampel',
'excutor' => $idpemeriksa,
]);
@@ -2275,7 +2275,7 @@ class DokterController extends Controller
return back();
} else {
Periksa::where('id', $id)->whereNull('status')->update([
- 'status' => 'Dikerjakan awal',
+ 'status' => 'Pemeriksaan awal',
'excutor' => $idpemeriksa,
]);
return response()->json(['icon' => 'success', 'warna' => '#5ba035', 'status' => 'Success', 'message' => 'Status Updated']);
diff --git a/htdocs/app/Http/Controllers/ListController.php b/htdocs/app/Http/Controllers/ListController.php
index 0855998b..f30c12fa 100644
--- a/htdocs/app/Http/Controllers/ListController.php
+++ b/htdocs/app/Http/Controllers/ListController.php
@@ -286,7 +286,7 @@ class ListController extends Controller
WHEN status LIKE '%Decliend%' THEN 'Decliend'
WHEN status LIKE '%Selesai%' THEN 'Selesai'
WHEN status LIKE '%Arsip%' THEN 'Arsip'
- WHEN status LIKE '%Dikerjakan awal%' THEN 'Dikerjakan awal'
+ WHEN status LIKE '%Pemeriksaan awal%' THEN 'Pemeriksaan awal'
WHEN status LIKE '%Data Vitek di Terima%' THEN 'Data Vitek di Terima'
ELSE CONCAT('', status::text, '')
END AS tlsstatus"),
@@ -300,7 +300,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', nofoto::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', nofoto::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', nofoto::text, '')
ELSE CONCAT('', nofoto::text, '')
END AS tlsnofoto"),
@@ -314,7 +314,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', noregister::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', noregister::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', noregister::text, '')
ELSE CONCAT('', noregister::text, '')
END AS tlsnoregister"),
@@ -328,7 +328,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', nmpasien::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', nmpasien::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', nmpasien::text, '')
ELSE CONCAT('', nmpasien::text, '')
END AS tlsnama"),
@@ -342,7 +342,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', reques::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', reques::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', reques::text, '')
ELSE CONCAT('', reques::text, '')
END AS tlsreques")
@@ -621,7 +621,7 @@ class ListController extends Controller
WHEN status LIKE '%Decliend%' THEN 'Decliend'
WHEN status LIKE '%Selesai%' THEN 'Selesai'
WHEN status LIKE '%Arsip%' THEN 'Arsip'
- WHEN status LIKE '%Dikerjakan awal%' THEN 'Dikerjakan awal'
+ WHEN status LIKE '%Pemeriksaan awal%' THEN 'Pemeriksaan awal'
WHEN status LIKE '%Data Vitek di Terima%' THEN 'Data Vitek di Terima'
ELSE CONCAT('', status::text, '')
END AS tlsstatus"),
@@ -635,7 +635,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', nofoto::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', nofoto::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', nofoto::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', nofoto::text, '')
ELSE CONCAT('', nofoto::text, '')
END AS tlsnofoto"),
@@ -649,7 +649,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', noregister::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', noregister::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', noregister::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', noregister::text, '')
ELSE CONCAT('', noregister::text, '')
END AS tlsnoregister"),
@@ -663,7 +663,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', nmpasien::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', nmpasien::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', nmpasien::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', nmpasien::text, '')
ELSE CONCAT('', nmpasien::text, '')
END AS tlsnama"),
@@ -677,7 +677,7 @@ class ListController extends Controller
WHEN status LIKE '%Expertise%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Decliend%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Selesai%' THEN CONCAT('', reques::text, '')
- WHEN status LIKE '%Dikerjakan awal%' THEN CONCAT('', reques::text, '')
+ WHEN status LIKE '%Pemeriksaan awal%' THEN CONCAT('', reques::text, '')
WHEN status LIKE '%Arsip%' THEN CONCAT('', reques::text, '')
ELSE CONCAT('', reques::text, '')
END AS tlsreques")
diff --git a/listener/app.py b/listener/app.py
index 765c3636..29f4d712 100644
--- a/listener/app.py
+++ b/listener/app.py
@@ -213,31 +213,32 @@ def get_pending_orders(ip_addr):
def send_all_orders(conn, ip_addr, hl7_msg, msg_id):
orders = get_pending_orders(ip_addr)
session = SessionLocal()
+ try:
+ if not orders:
+ print(f"[GENEXPERT] Tidak ada order pending untuk {ip_addr}")
+ rsp = (
+ f"MSH|^~\\&|LIS|LAB|GeneXpert|Cepheid|{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}||RSP^Z03|{msg_id}|P|2.5\r"
+ f"MSA|AA|{msg_id}\r"
+ f"QAK|NF|{msg_id}\r"
+ )
+ conn.sendall(f"\x0b{rsp}\x1c\r".encode('utf-8'))
+ return
- if not orders:
- print(f"[GENEXPERT] Tidak ada order pending untuk {ip_addr}")
- rsp = (
- f"MSH|^~\\&|LIS|LAB|GeneXpert|Cepheid|{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}||RSP^Z03|{msg_id}|P|2.5\r"
- f"MSA|AA|{msg_id}\r"
- f"QAK|NF|{msg_id}\r"
- )
- conn.sendall(f"\x0b{rsp}\x1c\r".encode('utf-8'))
- return
+ print(f"[GENEXPERT] Mengirim {len(orders)} order ke {ip_addr}")
- print(f"[GENEXPERT] Mengirim {len(orders)} order ke {ip_addr}")
+ for order in orders:
+ rsp = create_hl7_dsr_response(order, msg_id, "")
+ print(f"[GENEXPERT] Order ditemukan untuk {ip_addr}")
+
+ mllp = f"\x0b{rsp}\x1c\r"
+ conn.sendall(mllp.encode('utf-8'))
+ flag = get_flag_by_device(ip_addr)
+ setattr(order, flag, True)
+ session.add(order)
- for order in orders:
- rsp = create_hl7_dsr_response(order, msg_id, "")
- print(f"[GENEXPERT] Order ditemukan untuk {ip_addr}")
-
- mllp = f"\x0b{rsp}\x1c\r"
- conn.sendall(mllp.encode('utf-8'))
- flag = get_flag_by_device(ip_addr)
- setattr(order, flag, True)
- session.add(order)
-
- session.commit()
- session.close()
+ session.commit()
+ finally:
+ session.close()
def extract_msg_control_id(hl7_message):
try:
@@ -448,8 +449,19 @@ def parse_hl7_result(conn, msg_id, hl7_message, device_name="GeneXpert"):
# 4. Validasi Data Penting
if not sample_id:
- logging.warning("[HL7 Parser] ORU diterima tanpa accession/sample_id. Data diabaikan.")
- print("[HL7 Parser] ORU diterima tanpa accession/sample_id. Data diabaikan.")
+ source_ip = ""
+ try:
+ source_ip = str(conn.getpeername()[0]).strip()
+ except Exception:
+ source_ip = str(device_name).replace("GeneXpert-", "").replace(",", " ").strip()
+
+ if source_ip:
+ logging.info(f"[HL7 Parser] ORU tanpa sample_id dari {source_ip}. Anggap sebagai request order.")
+ print(f"[HL7 Parser] ORU tanpa sample_id dari {source_ip}. Anggap sebagai request order.")
+ send_all_orders(conn, source_ip, clean_hl7, msg_id)
+ else:
+ logging.warning("[HL7 Parser] ORU tanpa sample_id diterima, tetapi IP sumber tidak dapat diidentifikasi.")
+ print("[HL7 Parser] ORU tanpa sample_id diterima, tetapi IP sumber tidak dapat diidentifikasi.")
return
mapped_no_id = sample_id