feat/role-check: wip

This commit is contained in:
2025-12-10 05:23:24 +07:00
parent ff19c022bb
commit 56e71ea693
13 changed files with 299 additions and 124 deletions
+21 -50
View File
@@ -30,13 +30,12 @@ export interface EncounterListData {
}
const StatusAsync = defineAsyncComponent(() => import('~/components/content/encounter/status.vue'))
const AssesmentFunctionListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
const EarlyMedicalRehabAssessmentListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
const EarlyMedicalAssesmentListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
const EarlyMedicalRehabListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
const initialNursesAssessmentAsync = defineAsyncComponent(() => import('~/components/content/initial-nursing/entry.vue'))
const AssesmentFunctionListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
const ChemoProtocolListAsync = defineAsyncComponent(() => import('~/components/app/chemotherapy/list.protocol.vue'))
const ChemoMedicineProtocolListAsync = defineAsyncComponent(
() => import('~/components/app/chemotherapy/list.medicine.vue'),
)
const ChemoMedicineProtocolListAsync = defineAsyncComponent(() => import('~/components/app/chemotherapy/list.medicine.vue'))
const DeviceOrderAsync = defineAsyncComponent(() => import('~/components/content/device-order/main.vue'))
const PrescriptionAsync = defineAsyncComponent(() => import('~/components/content/prescription/main.vue'))
const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue'))
@@ -54,7 +53,6 @@ const KfrListAsync = defineAsyncComponent(() => import('~/components/content/kfr
const PrbListAsync = defineAsyncComponent(() => import('~/components/content/prb/list.vue'))
const SurgeryReportListAsync = defineAsyncComponent(() => import('~/components/content/surgery-report/list.vue'))
const VaccineDataListAsync = defineAsyncComponent(() => import('~/components/content/vaccine-data/list.vue'))
const InitialNursingStudyAsync = defineAsyncComponent(() => import('~/components/content/initial-nursing/entry.vue'))
const AssessmentEducationEntryAsync = defineAsyncComponent(
() => import('~/components/content/assessment-education/entry.vue'),
)
@@ -68,18 +66,6 @@ const defaultKeys: Record<string, any> = {
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
// earlyNurseryAssessment: {
// id: 'early-nursery-assessment',
// title: 'Pengkajian Awal Keperawatan',
// classCode: ['ambulatory', 'emergency', 'inpatient'],
// unit: 'all',
// },
earlyMedicalAssessment: {
id: 'early-medical-assessment',
title: 'Pengkajian Awal Medis',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
earlyMedicalRehabAssessment: {
id: 'rehab-medical-assessment',
title: 'Pengkajian Awal Medis Rehabilitasi Medis',
@@ -87,21 +73,14 @@ const defaultKeys: Record<string, any> = {
unit: 'rehab',
afterId: 'early-medical-assessment',
},
// functionAssessment: {
// id: 'function-assessment',
// title: 'Asesmen Fungsi',
// classCode: ['ambulatory'],
// unit: 'rehab',
// afterId: 'rehab-medical-assessment',
// },
// therapyProtocol: {
// id: 'therapy-protocol',
// classCode: ['ambulatory'],
// title: 'Protokol Terapi',
// unit: 'rehab',
// afterId: 'function-assessment',
initialNursingStudy: {
id: 'initial-nursing-study',
earlyMedicalAssessment: {
id: 'early-medical-assessment',
title: 'Pengkajian Awal Medis',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
initialNursesAssessment: {
id: 'early-nurse-assessment',
title: 'Kajian Awal Keperawatan',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
@@ -270,7 +249,7 @@ const defaultKeys: Record<string, any> = {
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
// initialNursingStudy: {
// initialNursesAssessment: {
// id: 'initial-nursing-study',
// title: 'Kajian Awal Keperawatan',
// classCode: ['ambulatory', 'emergency', 'inpatient'],
@@ -329,7 +308,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
}
}
if (currentKeys?.earlyMedicalRehabAssessment) {
currentKeys.earlyMedicalRehabAssessment['component'] = EarlyMedicalRehabListAsync
currentKeys.earlyMedicalRehabAssessment['component'] = EarlyMedicalRehabAssessmentListAsync
currentKeys.earlyMedicalRehabAssessment['props'] = {
encounter: data?.encounter,
type: 'early-rehab',
@@ -459,21 +438,10 @@ export function injectComponents(id: string | number, data: EncounterListData, m
currentKeys.priceList['props'] = { encounter_id: id }
}
if (currentKeys?.initialNursingStudy) {
currentKeys.initialNursingStudy['component'] = InitialNursingStudyAsync
currentKeys.initialNursingStudy['props'] = { encounter: data?.encounter }
if (currentKeys?.initialNursesAssessment) {
currentKeys.initialNursesAssessment['component'] = initialNursesAssessmentAsync
currentKeys.initialNursesAssessment['props'] = { encounter: data?.encounter }
}
if (currentKeys?.initialNursingStudy) {
currentKeys.initialNursingStudy['component'] = InitialNursingStudyAsync
currentKeys.initialNursingStudy['props'] = { encounter: data?.encounter }
}
if (currentKeys?.initialNursingStudy) {
currentKeys.initialNursingStudy['component'] = InitialNursingStudyAsync
currentKeys.initialNursingStudy['props'] = { encounter: data?.encounter }
}
if (currentKeys?.actionReport) {
currentKeys.actionReport['component'] = ActionReportEntryAsync
currentKeys.actionReport['props'] = {
@@ -537,6 +505,9 @@ export function mapResponseToEncounter(result: any): any {
? result.visitDate
: result.registeredAt || result.patient?.registeredAt || null,
adm_employee_id: result.adm_employee_id || 0,
adm_employee: result.adm_employee || null,
responsible_nurse_id: result.responsible_nurse_id || null,
responsible_nurse: result.responsible_nurse || null,
appointment_doctor_id: result.appointment_doctor_id || null,
responsible_doctor_id: result.responsible_doctor_id || null,
appointment_doctor: result.appointment_doctor || null,
@@ -599,7 +570,7 @@ export function getMenuItems(id: string | number, props: any, user: any, data: E
const currentUnitItems: any = currentListItems[`${unitCode}`]
if (!currentUnitItems) return []
let menus = []
if (currentUnitItems.roles && currentUnitItems.roles?.includes(user.activeRole)) {
if (currentUnitItems.roles && currentUnitItems.roles && user.activeRole in currentUnitItems.roles) {
menus = [...currentUnitItems.items]
} else {
menus = unitCode !== 'all' && currentUnitItems?.items ? [...currentUnitItems.items] : [...currentUnitItems]