feat/role-check: wip
This commit is contained in:
@@ -44,7 +44,8 @@ import {
|
||||
export function useEncounterEntry(props: {
|
||||
id: number
|
||||
classCode?: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient'
|
||||
subclassCode?: 'reg' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
|
||||
subclassCode?: 'regular' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
|
||||
specialist_Code?: 'regular' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
|
||||
}) {
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
@@ -207,7 +208,7 @@ export function useEncounterEntry(props: {
|
||||
}
|
||||
|
||||
async function getDoctorInfo(value: string) {
|
||||
const resp = await getDoctorDetail(value, { includes: 'unit,specialist,subspecialist' })
|
||||
const resp = await getDoctorDetail(value, { includes: 'specialist,subspecialist' })
|
||||
if (resp.success) {
|
||||
selectedDoctor.value = resp.body.data
|
||||
}
|
||||
@@ -294,22 +295,22 @@ export function useEncounterEntry(props: {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFetchDoctors(unit?: string, specialist_code?: string, subSpecialist_code?: string) {
|
||||
async function handleFetchDoctors(specialist_code?: string, subSpecialist_code?: string) {
|
||||
try {
|
||||
const filterParams: Record<string, any> = {
|
||||
'page-size': 100,
|
||||
includes: 'employee-Person,unit,specialist,subspecialist'
|
||||
includes: 'employee-Person,specialist,subspecialist'
|
||||
}
|
||||
|
||||
// rehab is special
|
||||
if (unit) {
|
||||
if (unit == 'rehab') {
|
||||
filterParams['unit-code'] = 'rehab'
|
||||
} else {
|
||||
filterParams['unit-code'] = 'rehab'
|
||||
filterParams['unit-code-opt'] = 'ne'
|
||||
}
|
||||
}
|
||||
// if (unit) {
|
||||
// if (unit == 'rehab') {
|
||||
// filterParams['unit-code'] = 'rehab'
|
||||
// } else {
|
||||
// filterParams['unit-code'] = 'rehab'
|
||||
// filterParams['unit-code-opt'] = 'ne'
|
||||
// }
|
||||
// }
|
||||
if (specialist_code) {
|
||||
if (specialist_code == 'rehab') {
|
||||
filterParams['specialist-code'] = 'rehab'
|
||||
@@ -318,7 +319,9 @@ export function useEncounterEntry(props: {
|
||||
filterParams['specialist-code-opt'] = 'ne'
|
||||
}
|
||||
}
|
||||
if (subSpecialist_code) filterParams['subspecialist-code'] = subSpecialist_code
|
||||
if (subSpecialist_code) {
|
||||
filterParams['subspecialist-code'] = subSpecialist_code
|
||||
}
|
||||
doctorsList.value = await getDoctorValueLabelList(filterParams, true)
|
||||
|
||||
// const isSub = getIsSubspecialist(subSpecialistId, specialistsTree.value)
|
||||
@@ -507,6 +510,8 @@ export function useEncounterEntry(props: {
|
||||
}
|
||||
|
||||
async function handleSaveEncounter(formValues: any) {
|
||||
console.log(formValues)
|
||||
return
|
||||
if (!selectedPatient.value || !selectedPatientObject.value) {
|
||||
toast({
|
||||
title: 'Gagal',
|
||||
@@ -556,6 +561,7 @@ export function useEncounterEntry(props: {
|
||||
appointment_doctor_code: formValues.doctor_code || null,
|
||||
class_code: props.classCode || '',
|
||||
subClass_code: props.subclassCode || '',
|
||||
specialist_code: selectedDoctor.value?.specialist_code || '',
|
||||
infra_id: formValues.infra_id ?? null,
|
||||
unit_code: formValues.unitCode ?? userStore?.user?.unit_code ?? null,
|
||||
refSource_name: formValues.refSource_name ?? 'RSSA',
|
||||
@@ -565,7 +571,7 @@ export function useEncounterEntry(props: {
|
||||
registeredAt: formatDate(registeredAtValue),
|
||||
visitDate: formatDate(visitDateValue),
|
||||
}
|
||||
|
||||
|
||||
if (props.classCode !== 'inpatient') {
|
||||
delete payload.infra_id
|
||||
}
|
||||
|
||||
@@ -18,12 +18,15 @@ const ERROR_MESSAGES = {
|
||||
|
||||
const ACCEPTED_UPLOAD_TYPES = ['image/jpeg', 'image/png', 'application/pdf']
|
||||
const isValidationSep = false
|
||||
// const encounterPatientShcema = z.object({
|
||||
// })
|
||||
|
||||
const IntegrationEncounterSchema = z
|
||||
.object({
|
||||
// Patient data (readonly, populated from selected patient)
|
||||
patientSource: z.string().optional(),
|
||||
patientName: z.string().optional(),
|
||||
nationalIdentity: z.string().optional(),
|
||||
residentIdentiyNumber: z.string().optional(),
|
||||
medicalRecordNumber: z.string().optional(),
|
||||
|
||||
// Visit data
|
||||
|
||||
@@ -64,4 +64,4 @@ export async function checkIn(id: number, data: CheckInFormData) {
|
||||
console.error(`Error putting ${name}:`, error)
|
||||
throw new Error(`Failed to put ${name}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+7686
-6193
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "IGD",
|
||||
"icon": "i-lucide-zap",
|
||||
"link": "/emergency/encounter"
|
||||
},
|
||||
{
|
||||
"title": "Rawat Inap",
|
||||
"icon": "i-lucide-building-2",
|
||||
|
||||
Reference in New Issue
Block a user