feat/role-check: wip

This commit is contained in:
2025-12-14 13:23:28 +07:00
parent b5f1ab7f88
commit 60f60b4187
5 changed files with 7711 additions and 6214 deletions
+20 -14
View File
@@ -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
}
+4 -1
View File
@@ -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
+1 -1
View File
@@ -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}`)
}
}
}
+7686 -6193
View File
File diff suppressed because it is too large Load Diff
-5
View File
@@ -21,11 +21,6 @@
}
]
},
{
"title": "IGD",
"icon": "i-lucide-zap",
"link": "/emergency/encounter"
},
{
"title": "Rawat Inap",
"icon": "i-lucide-building-2",