feat: implement patient data integration with SIMRS API and add modular queue management components

This commit is contained in:
Fanrouver
2026-07-13 14:40:05 +07:00
parent fec58f14b5
commit d1b6629ac8
16 changed files with 868 additions and 82 deletions

No files matched your search

+15 -4
View File
@@ -2782,6 +2782,7 @@ const fetchPatientsForLoket = async (loketId: string | number, force: boolean =
shift: shift,
klinik: clinic.name || clinic,
kodeKlinik: clinic.kode || null, // Essential for filtering
idKlinik: clinic.id || null, // Essential for Eksekutif loket matching
fastTrack: isFastTrack ? "YA" : "TIDAK",
pembayaran: paymentType,
noRM: `RM-${barcode.slice(-6)}`,
@@ -2804,12 +2805,17 @@ const fetchPatientsForLoket = async (loketId: string | number, force: boolean =
// Auto-assign Loket ID if not provided, based on Clinic Mapping
// fulfill requirement: "adjust based on loket id depending on creation"
if (!newPatient.loketId && newPatient.kodeKlinik) {
if (!newPatient.loketId && (newPatient.kodeKlinik || newPatient.idKlinik)) {
const allLokets = loketStore.lokets || [];
if (isEksekutif) {
const targetLoket = allLokets.find(l =>
l.pelayanan && Array.isArray(l.pelayanan) &&
(l.pelayanan.includes(newPatient.kodeKlinik) || l.pelayanan.includes(newPatient.kodeKlinik?.split('-')[0])) &&
(
l.pelayanan.includes(newPatient.kodeKlinik) ||
l.pelayanan.includes(newPatient.kodeKlinik?.split('-')[0]) ||
l.pelayanan.includes(newPatient.idKlinik) ||
l.pelayanan.includes(String(newPatient.idKlinik))
) &&
(l.id >= 1000 || l.tipeLoket === 'EKSEKUTIF')
);
@@ -2818,12 +2824,17 @@ const fetchPatientsForLoket = async (loketId: string | number, force: boolean =
if (!newPatient.loket) newPatient.loket = targetLoket.namaLoket;
console.log(`✅ Auto-assigned Eksekutif Ticket ${newPatient.noAntrian} to Loket ${targetLoket.id} (${targetLoket.namaLoket})`);
} else {
console.warn(`⚠️ Warning: No Eksekutif Loket found for clinic ${newPatient.kodeKlinik}. Ticket will not be routed to any loket.`);
console.warn(`⚠️ Warning: No Eksekutif Loket found for clinic ID ${newPatient.idKlinik} or Code ${newPatient.kodeKlinik}. Ticket will not be routed to any loket.`);
}
} else {
const targetLoket = allLokets.find(l =>
l.pelayanan && Array.isArray(l.pelayanan) &&
(l.pelayanan.includes(newPatient.kodeKlinik) || l.pelayanan.includes(newPatient.kodeKlinik?.split('-')[0]))
(
l.pelayanan.includes(newPatient.kodeKlinik) ||
l.pelayanan.includes(newPatient.kodeKlinik?.split('-')[0]) ||
l.pelayanan.includes(newPatient.idKlinik) ||
l.pelayanan.includes(String(newPatient.idKlinik))
)
);
if (targetLoket) {