fix: Add No clinical approval view + No live capture view for bedside data entry + EntryForm missing allergy, medication, and discharge fields

This commit is contained in:
voltsrage
2026-06-27 16:27:58 +08:00
parent 1c7e7fee7d
commit efd3974d1f
13 changed files with 1184 additions and 12 deletions
@@ -33,6 +33,48 @@
</div>
</fieldset>
<!-- Allergies review (ALLERGY_UPDATE or MIXED) -->
<fieldset v-if="allergyFields.length > 0" class="border border-gray-200 rounded-md p-4">
<legend class="text-sm font-medium text-gray-700 px-2">Allergies</legend>
<div class="space-y-3">
<div v-for="field in allergyFields" :key="field.path">
<div class="flex items-center gap-2">
<input
type="checkbox"
:checked="fieldChecks[field.path]"
@change="toggleCheck(field.path)"
class="w-4 h-4 text-clinical-safe rounded"
/>
<label class="text-xs text-gray-500">{{ field.label }}</label>
</div>
<p class="text-sm mt-2 pl-8 font-medium">
{{ field.value || '(empty)' }}
</p>
</div>
</div>
</fieldset>
<!-- Medications review (MEDICATION_LIST or MIXED) -->
<fieldset v-if="medicationFields.length > 0" class="border border-gray-200 rounded-md p-4">
<legend class="text-sm font-medium text-gray-700 px-2">Medications</legend>
<div class="space-y-3">
<div v-for="field in medicationFields" :key="field.path">
<div class="flex items-center gap-2">
<input
type="checkbox"
:checked="fieldChecks[field.path]"
@change="toggleCheck(field.path)"
class="w-4 h-4 text-clinical-safe rounded"
/>
<label class="text-xs text-gray-500">{{ field.label }}</label>
</div>
<p class="text-sm mt-2 pl-8 font-medium">
{{ field.value || '(empty)' }}
</p>
</div>
</div>
</fieldset>
<!-- Encounter review -->
<fieldset class="border border-gray-200 rounded-md p-4">
<legend class="text-sm font-medium text-gray-700 px-2">Encounter Context</legend>
@@ -172,8 +214,25 @@ interface FieldInfo {
}
const patientFields = ref<FieldInfo[]>([])
const allergyFields = ref<FieldInfo[]>([])
const medicationFields = ref<FieldInfo[]>([])
const encounterFields = ref<FieldInfo[]>([])
const batchType = computed(() => props.batch?.batchType ?? '')
const showAllergies = computed(() => ['ALLERGY_UPDATE', 'MIXED'].includes(batchType.value))
const showMedications = computed(() => ['MEDICATION_LIST', 'MIXED'].includes(batchType.value))
const showEncounterSummary = computed(() => ['ENCOUNTER_SUMMARY', 'MIXED'].includes(batchType.value))
function parseJsonList(json: string | null): string[] {
if (!json) return []
try {
const parsed = JSON.parse(json)
return Array.isArray(parsed) ? parsed : []
} catch {
return []
}
}
watch(
() => batchStore.currentDraft,
(draft) => {
@@ -190,6 +249,50 @@ watch(
{ path: 'patient.bloodType', label: 'Blood Type', value: draft.patient.bloodType ?? '' },
{ path: 'patient.emergencyContact', label: 'Emergency Contact', value: draft.patient.emergencyContact ?? '' },
]
// Build allergy fields
allergyFields.value = []
if (showAllergies.value) {
if (draft.patient.noKnownAllergies) {
allergyFields.value = [
{ path: 'patient.noKnownAllergies', label: 'No Known Allergies', value: 'Yes (NKA)' },
]
} else {
const items = parseJsonList(draft.patient.allergiesJson)
allergyFields.value = items.map((item, i) => ({
path: `patient.allergies[${i}]`,
label: `Allergy ${i + 1}`,
value: item,
}))
if (items.length === 0) {
allergyFields.value = [
{ path: 'patient.allergiesJson', label: 'Allergies', value: '(none entered)' },
]
}
}
}
// Build medication fields
medicationFields.value = []
if (showMedications.value) {
if (draft.patient.noActiveMedications) {
medicationFields.value = [
{ path: 'patient.noActiveMedications', label: 'No Active Medications', value: 'Yes' },
]
} else {
const items = parseJsonList(draft.patient.medicationsJson)
medicationFields.value = items.map((item, i) => ({
path: `patient.medications[${i}]`,
label: `Medication ${i + 1}`,
value: item,
}))
if (items.length === 0) {
medicationFields.value = [
{ path: 'patient.medicationsJson', label: 'Medications', value: '(none entered)' },
]
}
}
}
}
// Build encounter field list
@@ -200,11 +303,19 @@ watch(
{ path: 'encounter.roomBed', label: 'Room / Bed', value: draft.encounter.roomBed ?? '' },
{ path: 'encounter.admissionReason', label: 'Admission Reason', value: draft.encounter.admissionReason ?? '' },
]
if (showEncounterSummary.value) {
encounterFields.value.push(
{ path: 'encounter.status', label: 'Encounter Status', value: draft.encounter.status ?? '' },
{ path: 'encounter.dischargeDiagnosis', label: 'Discharge Diagnosis', value: draft.encounter.dischargeDiagnosis ?? '' },
)
}
}
// Initialize all checks to false
fieldChecks.value = {}
patientFields.value.forEach((f) => { fieldChecks.value[f.path] = false })
allergyFields.value.forEach((f) => { fieldChecks.value[f.path] = false })
medicationFields.value.forEach((f) => { fieldChecks.value[f.path] = false })
encounterFields.value.forEach((f) => { fieldChecks.value[f.path] = false })
observations.value.forEach((_, i) => { fieldChecks.value[`observations[${i}].value`] = false })
},
@@ -212,7 +323,8 @@ watch(
)
const totalFields = computed(
() => patientFields.value.length + encounterFields.value.length + observations.value.length
() => patientFields.value.length + allergyFields.value.length + medicationFields.value.length
+ encounterFields.value.length + observations.value.length
)
const checkedCount = computed(
() => Object.values(fieldChecks.value).filter(Boolean).length