update post API klinik dan loket di queuestore
This commit is contained in:
+35
-7
@@ -146,6 +146,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
klinik: service.healthcare_service_name || clinic.name,
|
||||
kodeKlinik: kodeKlinik,
|
||||
klinikId: clinic.id,
|
||||
healthcareServiceId: service.id, // Store the healthcare service ID
|
||||
ruang: service.sub_healthcare_service_name || '',
|
||||
nomorRuang: roomId ? String(roomId) : String(clinic.id),
|
||||
pembayaran: service.payment_type_name || visit.payment_type_name || '',
|
||||
@@ -1978,7 +1979,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
syncApiPatientStatus(allPatients.value[patientIndex], "di-loket");
|
||||
message = `Pasien ${patientCode} diaktifkan kembali dan masuk ke tabel Di Loket`;
|
||||
|
||||
// POST to external API to revert status to di-loket
|
||||
// POST to external API to revert status to sedang diproses (status 8)
|
||||
try {
|
||||
fetch('http://10.10.150.131:8089/api/v1/tiket/update', {
|
||||
method: 'POST',
|
||||
@@ -1987,14 +1988,14 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
},
|
||||
body: JSON.stringify({
|
||||
barcode: patient.barcode || "",
|
||||
statuspasien: "2", // Status code for "di-loket"
|
||||
statuspasien2: "2",
|
||||
idklinikstatus: "1",
|
||||
idklinikstatus2: "1"
|
||||
statuspasien: "8", // Status code for "sedang diproses" when reactivating
|
||||
statuspasien2: "8",
|
||||
idklinikstatus: "2",
|
||||
idklinikstatus2: "2"
|
||||
})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
console.log(`✅ [queueStore] Successfully activated patient ${patient.barcode}`);
|
||||
console.log(`✅ [queueStore] Successfully activated patient ${patient.barcode} to sedang diproses`);
|
||||
} else {
|
||||
console.error(`⚠️ [queueStore] Failed to activate patient ${patient.barcode}:`, response.status);
|
||||
}
|
||||
@@ -2037,6 +2038,33 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
allPatients.value[patientIndex] = updatedPatient;
|
||||
// Set currentProcessingPatient with isolated key
|
||||
currentProcessingPatient.value[storageKey] = updatedPatient;
|
||||
|
||||
// POST to external API when patient is being processed (sedang diproses)
|
||||
try {
|
||||
fetch('http://10.10.150.131:8089/api/v1/tiket/update', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
barcode: patient.barcode || "",
|
||||
statuspasien: "8", // Status code for "sedang diproses"
|
||||
statuspasien2: "8",
|
||||
idklinikstatus: "2",
|
||||
idklinikstatus2: "2"
|
||||
})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
console.log(`✅ [queueStore] Successfully updated patient ${patient.barcode} to sedang diproses`);
|
||||
} else {
|
||||
console.error(`⚠️ [queueStore] Failed to update patient ${patient.barcode} to sedang diproses:`, response.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(`❌ [queueStore] Error updating patient ${patient.barcode} to sedang diproses:`, error);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`❌ [queueStore] Error initiating status update for patient ${patient.barcode}:`, error);
|
||||
}
|
||||
} else {
|
||||
// Untuk adminType selain loket, update status jika perlu
|
||||
if (shouldUpdateStatus) {
|
||||
@@ -2578,7 +2606,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
try {
|
||||
const apiUrl = 'http://10.10.150.100:8084/api/v1/visit/status/finish';
|
||||
const requestBody = {
|
||||
patient_visit_healthcare_service_id: patient.klinikId || patient.idKlinik,
|
||||
patient_visit_healthcare_service_id: patient.healthcareServiceId,
|
||||
visit_code: patient.barcode || patient.visitCode,
|
||||
visit_status_id: [19]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user