fix: Optional OCR-Assisted Draft Pre-Fill

This commit is contained in:
voltsrage
2026-06-28 01:48:15 +08:00
parent c160c5f912
commit c26ef22670
16 changed files with 186 additions and 69 deletions
@@ -349,8 +349,8 @@ watch(
noKnownAllergies: draft.patient.noKnownAllergies ?? false,
noActiveMedications: draft.patient.noActiveMedications ?? false,
})
allergies.value = parseJsonList(draft.patient.allergiesJson)
medications.value = parseJsonList(draft.patient.medicationsJson)
allergies.value = draft.patient.allergies ?? []
medications.value = draft.patient.medications ?? []
}
if (draft.encounter) {
Object.assign(encounter, {
@@ -380,7 +380,7 @@ async function saveAllergies() {
try {
await batchStore.saveDraftPatient(props.batchId, {
...patient,
allergiesJson: JSON.stringify(allergies.value.filter(a => a.trim())),
allergies: allergies.value.filter(a => a.trim()),
})
toast.success('Allergies saved')
} catch (e: unknown) {
@@ -410,7 +410,7 @@ async function saveMedications() {
try {
await batchStore.saveDraftPatient(props.batchId, {
...patient,
medicationsJson: JSON.stringify(medications.value.filter(m => m.trim())),
medications: medications.value.filter(m => m.trim()),
})
toast.success('Medications saved')
} catch (e: unknown) {
@@ -431,8 +431,8 @@ async function savePatient() {
try {
await batchStore.saveDraftPatient(props.batchId, {
...patient,
allergiesJson: patient.noKnownAllergies ? null : JSON.stringify(allergies.value.filter(a => a.trim())),
medicationsJson: patient.noActiveMedications ? null : JSON.stringify(medications.value.filter(m => m.trim())),
allergies: patient.noKnownAllergies ? null : allergies.value.filter(a => a.trim()),
medications: patient.noActiveMedications ? null : medications.value.filter(m => m.trim()),
})
toast.success('Patient demographics saved')
} catch (e: unknown) {