feat: implement SEP search functionality and enhance history management

This commit is contained in:
riefive
2025-11-28 14:48:29 +07:00
parent a2e8f04304
commit e9ed2a3715
8 changed files with 108 additions and 39 deletions
@@ -3,12 +3,14 @@
import { Button } from '~/components/pub/ui/button'
import AppEncounterEntryForm from '~/components/app/encounter/entry-form.vue'
import AppViewPatient from '~/components/app/patient/view-patient.vue'
import AppViewHistory from '~/components/app/sep/view-history.vue'
// Helpers
import { refDebounced } from '@vueuse/core'
// Handlers
import { useEncounterEntry } from '~/handlers/encounter-entry.handler'
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
const props = defineProps<{
id: number
@@ -53,6 +55,7 @@ const {
getValidateSepNumber,
handleFetchDoctors,
} = useEncounterEntry(props)
const { recSepId, openHistory, histories, getMonitoringHistoryMappers } = useIntegrationSepEntry()
const debouncedSepNumber = refDebounced(sepNumber, 500)
@@ -102,6 +105,13 @@ async function handleEvent(menu: string, value?: any) {
if (memberText.length > 5) {
await getValidateMember(memberText)
}
} else if (menu === 'search-sep') {
const memberText = String(value?.cardNumber || '').trim()
if (memberText.length < 5) return
getMonitoringHistoryMappers(memberText).then(() => {
openHistory.value = true
})
return
} else if (menu === 'save') {
await handleSaveEncounter(value)
} else if (menu === 'cancel') {
@@ -110,6 +120,7 @@ async function handleEvent(menu: string, value?: any) {
}
provide('rec_select_id', recSelectId)
provide('rec_sep_id', recSepId)
provide('table_data_loader', isLoading)
watch(debouncedSepNumber, async (newValue) => {
@@ -179,6 +190,11 @@ onMounted(async () => {
"
@save="handleSavePatient"
/>
<AppViewHistory
v-model:open="openHistory"
:is-action="true"
:histories="histories"
/>
<!-- Footer Actions -->
<div class="mt-6 flex justify-end gap-2 border-t border-t-slate-300 pt-4">
<Button
+1 -1
View File
@@ -8,7 +8,7 @@ import AppViewHistory from '~/components/app/sep/view-history.vue'
import AppViewLetter from '~/components/app/sep/view-letter.vue'
// Handler
import useIntegrationSepEntry from '~/handlers/integration-sep-entry.handler'
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
const {
histories,