From 2239b9463278c51e2808d16bc4eff987b8020513 Mon Sep 17 00:00:00 2001 From: riefive Date: Tue, 28 Oct 2025 10:42:29 +0700 Subject: [PATCH] fix: refetch doctor by specialist --- app/components/content/encounter/entry.vue | 5 +---- app/services/doctor.service.ts | 2 +- app/services/vclaim-doctor.service.ts | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/components/content/encounter/entry.vue b/app/components/content/encounter/entry.vue index 5a3bd592..c6b75930 100644 --- a/app/components/content/encounter/entry.vue +++ b/app/components/content/encounter/entry.vue @@ -122,7 +122,7 @@ async function handleFetchDoctors(subSpecialistId: string) { const isSub = isSubspecialist(subSpecialistId, specialistsTree.value) // Build filter based on selection type - const filterParams: any = { 'page-size': 100 } + const filterParams: any = { 'page-size': 100, includes: 'employee-Person' } if (isSub) { // If selected is subspecialist, filter by subspecialist-id @@ -132,11 +132,8 @@ async function handleFetchDoctors(subSpecialistId: string) { filterParams['specialist-id'] = subSpecialistId } - console.log('Fetching doctors with filter:', filterParams) - const doctors = await getDoctorValueLabelList(filterParams) doctorsList.value = doctors - console.log('Fetched doctors:', doctors) } catch (error) { console.error('Error fetching doctors:', error) doctorsList.value = [] diff --git a/app/services/doctor.service.ts b/app/services/doctor.service.ts index f81def84..1c264902 100644 --- a/app/services/doctor.service.ts +++ b/app/services/doctor.service.ts @@ -33,7 +33,7 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st if (result.success) { const resultData = result.body?.data || [] data = resultData.map((item: Doctor) => ({ - value: item.id ? Number(item.id) : item.id, + value: item.id ? String(item.id) : item.id, label: item.employee?.person?.name || '', })) } diff --git a/app/services/vclaim-doctor.service.ts b/app/services/vclaim-doctor.service.ts index 8131227f..0d5ec9dc 100644 --- a/app/services/vclaim-doctor.service.ts +++ b/app/services/vclaim-doctor.service.ts @@ -14,11 +14,11 @@ export function getList(params: any = null) { url += `/${params.serviceDate}` delete params.serviceDate } - if (params?.specialistCode) { + if (params?.specialistCode || (Number(params.specialistCode) === 0)) { url += `/${params.specialistCode}` delete params.specialistCode } - return base.getList(path, params, name) + return base.getList(url, params, name) } export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {