fix: change get encounter class to constants
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
|||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleCancelForm,
|
handleCancelForm,
|
||||||
} from '~/handlers/installation.handler'
|
} from '~/handlers/installation.handler'
|
||||||
import { encounterClasses, getEncounterClassList } from '~/handlers/_shared.handler'
|
import { encounterClasses, getEncounterClassConstants } from '~/handlers/_shared.handler'
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getInstallations, getInstallationDetail } from '~/services/installation.service'
|
import { getInstallations, getInstallationDetail } from '~/services/installation.service'
|
||||||
@@ -111,7 +111,7 @@ watch([recId, recAction], () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getEncounterClassList()
|
await getEncounterClassConstants()
|
||||||
await getInstallationList()
|
await getInstallationList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
// types
|
// types
|
||||||
import type { MedicineGroup } from '~/models/medicine-group'
|
import type { MedicineGroup } from '~/models/medicine-group'
|
||||||
import type { MedicineMethod } from '~/models/medicine-method'
|
import type { MedicineMethod } from '~/models/medicine-method'
|
||||||
import type { Installation } from "~/models/installation"
|
import type { Installation } from '~/models/installation'
|
||||||
import type { Specialist } from '~/models/specialist'
|
import type { Specialist } from '~/models/specialist'
|
||||||
import type { Uom } from '~/models/uom'
|
import type { Uom } from '~/models/uom'
|
||||||
import type { Unit } from '~/models/unit'
|
import type { Unit } from '~/models/unit'
|
||||||
|
|
||||||
|
// constants
|
||||||
|
import { encounterClassCodes } from '~/lib/constants'
|
||||||
|
|
||||||
// services
|
// services
|
||||||
import { getMedicineGroups } from '~/services/medicine-group.service'
|
import { getMedicineGroups } from '~/services/medicine-group.service'
|
||||||
import { getMedicineMethods } from '~/services/medicine-method.service'
|
import { getMedicineMethods } from '~/services/medicine-method.service'
|
||||||
@@ -50,10 +53,20 @@ export const getEncounterClassList = async () => {
|
|||||||
const result = await getEncounters()
|
const result = await getEncounters()
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const currentValues = result.body?.data || []
|
const currentValues = result.body?.data || []
|
||||||
encounterClasses.value = currentValues.map((item: any) => ({ value: item.class_code || item.id, label: item.class_code }))
|
encounterClasses.value = currentValues.map((item: any) => ({
|
||||||
|
value: item.class_code || item.id,
|
||||||
|
label: item.class_code,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getEncounterClassConstants() {
|
||||||
|
const allowed = ['ambulatory', 'emergency', 'inpatient']
|
||||||
|
encounterClasses.value = Object.entries(encounterClassCodes)
|
||||||
|
.filter(([key]) => allowed.includes(key))
|
||||||
|
.map(([key, value]) => ({ value: key, label: value }))
|
||||||
|
}
|
||||||
|
|
||||||
export const getInstallationList = async () => {
|
export const getInstallationList = async () => {
|
||||||
const result = await getInstallations()
|
const result = await getInstallations()
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user