edit manual checkin
This commit is contained in:
@@ -236,15 +236,15 @@
|
||||
</div>
|
||||
<div class="status-text">
|
||||
<h3 class="status-title">Input Manual</h3>
|
||||
<p class="status-subtitle">Masukkan nomor Antrean Code atau Barcode Pasien</p>
|
||||
<p class="status-subtitle">Masukkan nomor Antrean atau Barcode Pasien</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-form @submit.prevent="checkInManual" ref="manualForm">
|
||||
<v-text-field
|
||||
v-model="manualInput"
|
||||
label="Nomor Antrean Code / Barcode Pasien"
|
||||
placeholder="Contoh: 26011301220"
|
||||
label="Nomor Antrean / Barcode Pasien"
|
||||
placeholder="Contoh: RA020 atau 26011500001"
|
||||
prepend-inner-icon="mdi-account-card-details"
|
||||
variant="outlined"
|
||||
:color="primaryColor"
|
||||
@@ -2576,30 +2576,39 @@ const checkInManual = async () => {
|
||||
|
||||
const cleanInput = String(searchBarcode).trim();
|
||||
const cleanInputUpper = cleanInput.toUpperCase();
|
||||
const originalInput = inputValue.toUpperCase().trim();
|
||||
|
||||
console.log('🔍 checkInManual called with:', inputValue);
|
||||
console.log('🔍 Extracted barcode/patientId:', searchBarcode);
|
||||
console.log('🔍 Cleaned input:', cleanInput);
|
||||
console.log('🔍 Original input:', originalInput);
|
||||
console.log('📊 Total patients in store:', queueStore.allPatients.length);
|
||||
|
||||
// IMPORTANT: Hanya cari dengan EXACT barcode match untuk menghindari false positive
|
||||
// Format barcode: YYMMDD + 5 digit (contoh: 26011500001)
|
||||
// Jangan gunakan fallback ke noAntrian atau no karena bisa menyebabkan false positive
|
||||
// Contoh masalah: RA020 dengan barcode 26011500001 terdeteksi sebagai RA002 dengan barcode 26011500198
|
||||
// Cari pasien dengan dua metode:
|
||||
// 1. EXACT barcode match (prioritas tertinggi) - format: YYMMDD + 5 digit (contoh: 26011500001)
|
||||
// 2. EXACT nomor antrean match - format: RA020, F-RA001, EA013, dll
|
||||
// Menggunakan matchNoAntrian helper untuk memastikan kode + angka match dengan benar
|
||||
const foundPatient = queueStore.allPatients.find(p => {
|
||||
if (!p) return false;
|
||||
|
||||
// Normalize barcode untuk comparison (remove whitespace, case-insensitive)
|
||||
const patientBarcode = String(p.barcode || '').trim();
|
||||
|
||||
// EXACT barcode match (case-insensitive, whitespace-insensitive)
|
||||
// Ini adalah satu-satunya cara yang aman untuk match pasien
|
||||
// 1. EXACT barcode match (case-insensitive, whitespace-insensitive) - PRIORITAS TERTINGGI
|
||||
if (patientBarcode === cleanInput ||
|
||||
patientBarcode.toLowerCase() === cleanInput.toLowerCase()) {
|
||||
console.log('✅ Found by exact barcode match:', patientBarcode, '===', cleanInput);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2. EXACT nomor antrean match (untuk manual input)
|
||||
// Menggunakan matchNoAntrian helper untuk memastikan kode + angka match dengan benar
|
||||
// Ini mencegah false positive seperti RA020 terdeteksi sebagai RA002
|
||||
if (p.noAntrian && matchNoAntrian(originalInput, p.noAntrian)) {
|
||||
console.log('✅ Found by exact nomor antrean match:', p.noAntrian, '===', originalInput);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -2607,7 +2616,7 @@ const checkInManual = async () => {
|
||||
// Tiket belum di-generate (tidak ada di queueStore)
|
||||
console.error('❌ Patient not found. Input:', inputValue);
|
||||
console.error('🔍 Extracted barcode/patientId:', searchBarcode);
|
||||
console.error('📋 Available barcodes (first 10):', queueStore.allPatients.slice(0, 10).map(p => ({
|
||||
console.error('📋 Available patients (first 10):', queueStore.allPatients.slice(0, 10).map(p => ({
|
||||
no: p.no,
|
||||
barcode: p.barcode,
|
||||
noAntrian: p.noAntrian?.split(' |')[0]
|
||||
@@ -2626,11 +2635,11 @@ const checkInManual = async () => {
|
||||
kodeKlinik: null
|
||||
});
|
||||
|
||||
const errorMsg = `❌ Tiket Belum Di-generate!\n\nInput: ${inputValue}\nBarcode/Patient ID: ${searchBarcode}\n\nTiket belum terdaftar di sistem. Pastikan tiket sudah di-generate terlebih dahulu.`;
|
||||
const errorMsg = `❌ Tiket Tidak Ditemukan!\n\nInput: ${inputValue}\n\nTiket dengan nomor antrean atau barcode tersebut tidak ditemukan di sistem.\n\nPastikan:\n- Nomor antrean atau barcode sudah benar\n- Tiket sudah di-generate terlebih dahulu\n- Format input: RA020, F-RA001, atau 26011500001`;
|
||||
infoMessage.value = errorMsg;
|
||||
infoAction.value = 'checkin';
|
||||
infoDialog.value = true;
|
||||
showSnackbar('Error', 'Tiket belum terdaftar di sistem. Pastikan tiket sudah di-generate.', 'error', 'mdi-alert-circle');
|
||||
showSnackbar('Error', 'Tiket tidak ditemukan. Pastikan nomor antrean atau barcode sudah benar.', 'error', 'mdi-alert-circle');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2643,13 +2652,24 @@ const checkInManual = async () => {
|
||||
|
||||
// IMPORTANT: Refresh data pasien dari queueStore untuk mendapatkan status REAL-TIME
|
||||
// Jangan gunakan foundPatient.status karena mungkin sudah stale
|
||||
// Cari ulang pasien dari queueStore dengan EXACT barcode match
|
||||
// Cari ulang pasien dari queueStore dengan EXACT match (barcode atau nomor antrean)
|
||||
const freshPatient = queueStore.allPatients.find(p => {
|
||||
if (!p) return false;
|
||||
|
||||
// Match by barcode
|
||||
const patientBarcode = String(p.barcode || '').trim();
|
||||
// Hanya exact barcode match untuk menghindari false positive
|
||||
return patientBarcode === foundPatient.barcode ||
|
||||
patientBarcode === searchBarcode ||
|
||||
patientBarcode === cleanInput;
|
||||
if (patientBarcode === foundPatient.barcode ||
|
||||
patientBarcode === searchBarcode ||
|
||||
patientBarcode === cleanInput) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Match by nomor antrean (jika input adalah nomor antrean)
|
||||
if (p.noAntrian && p.no === foundPatient.no) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!freshPatient) {
|
||||
|
||||
Reference in New Issue
Block a user