feat(sep): adjust entry form of sep

This commit is contained in:
riefive
2025-11-06 15:50:29 +07:00
parent 7eecdc67ec
commit daf9c8f46c
3 changed files with 54 additions and 4 deletions
+24 -3
View File
@@ -11,6 +11,7 @@ import { toast } from '~/components/pub/ui/toast'
// Types
import type { SepHistoryData } from '~/components/app/sep/list-cfg.history'
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
// Constants
import {
@@ -27,6 +28,10 @@ import {
} from '~/lib/constants.vclaim'
// Services
import {
getList as getSpecialistList,
getValueTreeItems as getSpecialistTreeItems,
} from '~/services/specialist.service'
import { getValueLabelList as getProvinceList } from '~/services/vclaim-region-province.service'
import { getValueLabelList as getCityList } from '~/services/vclaim-region-city.service'
import { getValueLabelList as getDistrictList } from '~/services/vclaim-region-district.service'
@@ -79,6 +84,7 @@ const classPaySourcesList = ref<Array<{ value: string; label: string }>>([])
const isServiceHidden = ref(false)
const isSaveLoading = ref(false)
const isLetterReadonly = ref(false)
const specialistsTree = ref<TreeItem[]>([])
const resourceType = ref('')
const resourcePath = ref('')
@@ -247,7 +253,8 @@ async function handleEvent(menu: string, value: any) {
if (menu === 'search-patient-by-identifier') {
const text = value.text
const type = value.type
if (type === 'nationalId') {
const prevCardNumber = selectedPatientObject.value?.person?.residentIdentityNumber || ''
if (type === 'nationalId' && text !== prevCardNumber) {
getPatientByIdentifierSearch(text)
}
return
@@ -336,6 +343,18 @@ async function handleFetch(params: any) {
}
}
async function handleFetchSpecialists() {
try {
const specialistsResult = await getSpecialistList({ 'page-size': 100, includes: 'subspecialists' })
if (specialistsResult.success) {
const specialists = specialistsResult.body?.data || []
specialistsTree.value = getSpecialistTreeItems(specialists)
}
} catch (error) {
console.error('Error fetching specialist-subspecialist tree:', error)
}
}
async function handleInit() {
const facilities = await getHealthFacilityLabelList({
healthcare: 'Puskesmas',
@@ -392,6 +411,7 @@ async function handleInit() {
value: item.toString(),
label: classPaySources[item],
})) as any
await handleFetchSpecialists()
if (route.query) {
const queries = route.query as any
isServiceHidden.value = queries['is-service'] === 'true'
@@ -448,6 +468,8 @@ onMounted(async () => {
SEP
</div>
<AppSepEntryForm
:is-save-loading="isSaveLoading"
:is-service="isServiceHidden"
:doctors="doctors"
:diagnoses="diagnoses"
:facilities-from="facilitiesFrom"
@@ -465,8 +487,7 @@ onMounted(async () => {
:class-levels="classLevelsList"
:class-level-upgrades="classLevelUpgradesList"
:class-pay-sources="classPaySourcesList"
:is-save-loading="isSaveLoading"
:is-service="isServiceHidden"
:specialists="specialistsTree"
:patient="selectedPatientObject"
:objects="selectedObjects"
@fetch="handleFetch"