From 3a2ad11a0e52c3c7b14d17e31b6c3bc4850121b1 Mon Sep 17 00:00:00 2001 From: riefive Date: Mon, 24 Nov 2025 14:47:00 +0700 Subject: [PATCH] feat: enhance encounter process with user data logging and component integration --- .../content/encounter/process-next.vue | 6 +++--- app/handlers/encounter-init.handler.ts | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/components/content/encounter/process-next.vue b/app/components/content/encounter/process-next.vue index 29d87541..e5bf9733 100644 --- a/app/components/content/encounter/process-next.vue +++ b/app/components/content/encounter/process-next.vue @@ -40,12 +40,12 @@ const id = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0 const data = ref(null) const isShowPatient = computed(() => data.value && data.value?.patient?.person) -console.log(user) - if (activePosition.value === 'none') { // if user position is none, redirect to home page router.push('/') } +console.log(JSON.stringify(user, null, 4)) + // Dummy rows for ProtocolList (matches keys expected by list-cfg.protocol) const protocolRows = [ { @@ -82,7 +82,7 @@ function handleClick(type: string) { } function initMenus() { - menus.value = getMenuItems(id, props, user, activePosition.value, { + menus.value = getMenuItems(id, props, user, { status: data.value, medicalAssessment: data.value, medicalAssessmentRehab: data.value, diff --git a/app/handlers/encounter-init.handler.ts b/app/handlers/encounter-init.handler.ts index 5e0cee10..6f4aa1fe 100644 --- a/app/handlers/encounter-init.handler.ts +++ b/app/handlers/encounter-init.handler.ts @@ -39,6 +39,7 @@ const ChemoMedicineProtocolListAsync = defineAsyncComponent( const DeviceOrderAsync = defineAsyncComponent(() => import('~/components/content/device-order/main.vue')) const PrescriptionAsync = defineAsyncComponent(() => import('~/components/content/prescription/main.vue')) const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue')) +const CprjAsync = defineAsyncComponent(() => import('~/components/content/cprj/entry.vue')) const RadiologyAsync = defineAsyncComponent(() => import('~/components/content/radiology-order/main.vue')) const ConsultationAsync = defineAsyncComponent(() => import('~/components/content/consultation/list.vue')) const DocUploadListAsync = defineAsyncComponent(() => import('~/components/content/document-upload/list.vue')) @@ -259,6 +260,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m } } if (currentKeys?.therapyProtocol) { + // TODO: add component for therapyProtocol currentKeys.therapyProtocol['component'] = null currentKeys.therapyProtocol['props'] = { data: data?.protocolTheraphy, @@ -280,6 +282,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m } } if (currentKeys?.educationAssessment) { + // TODO: add component for education assessment currentKeys.educationAssessment['component'] = null currentKeys.educationAssessment['props'] = { encounter_id: id } } @@ -288,7 +291,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m currentKeys.consent['props'] = { encounter_id: id } } if (currentKeys?.patientNote) { - currentKeys.patientNote['component'] = null + currentKeys.patientNote['component'] = CprjAsync currentKeys.patientNote['props'] = { encounter_id: id } } if (currentKeys?.prescription) { @@ -308,18 +311,22 @@ export function injectComponents(id: string | number, data: EncounterListData, m currentKeys.mcuLabPc['props'] = { encounter_id: id } } if (currentKeys?.mcuLabMicro) { + // TODO: add component for mcuLabMicro currentKeys.mcuLabMicro['component'] = null currentKeys.mcuLabMicro['props'] = { encounter_id: id } } if (currentKeys?.mcuLabPa) { + // TODO: add component for mcuLabPa currentKeys.mcuLabPa['component'] = null currentKeys.mcuLabPa['props'] = { encounter_id: id } } if (currentKeys?.medicalAction) { + // TODO: add component for medicalAction currentKeys.medicalAction['component'] = null currentKeys.medicalAction['props'] = { encounter_id: id } } if (currentKeys?.mcuResult) { + // TODO: add component for mcuResult currentKeys.mcuResult['component'] = null currentKeys.mcuResult['props'] = { encounter_id: id } } @@ -336,6 +343,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m currentKeys.control['props'] = { encounter: data?.letterOfControl } } if (currentKeys?.screening) { + // TODO: add component for screening currentKeys.screening['component'] = null currentKeys.screening['props'] = { encounter_id: id } } @@ -344,6 +352,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m currentKeys.supportingDocument['props'] = { encounter_id: id } } if (currentKeys?.priceList) { + // TODO: add component for priceList currentKeys.priceList['component'] = null currentKeys.priceList['props'] = { encounter_id: id } } @@ -431,7 +440,6 @@ export function getMenuItems( id: string | number, props: any, user: any, - activePosition: any, data: EncounterListData, meta: any, ) { @@ -467,14 +475,14 @@ export function getMenuItems( } const currentListItems = listItems[`installation|${normalClassCode}`] if (!currentListItems) return [] - const unitCode = user?.unit?.code ? `unit|${user.unit.code}` : 'all' + const unitCode = user?.unit_code ? `unit|${user.unit_code}` : 'all' const currentUnitItems: any = currentListItems[`${unitCode}`] if (!currentUnitItems) return [] let menus = [] - if (currentUnitItems.roles && currentUnitItems.roles?.some((role: string) => role === activePosition.value)) { + if (currentUnitItems.roles && currentUnitItems.roles?.includes(user.activeRole)) { menus = [...currentUnitItems.items] } else { - menus = [...currentUnitItems] + menus = unitCode !== 'all' && currentUnitItems?.items ? [...currentUnitItems.items] : [...currentUnitItems] } return menus }