feat/ap-lab-order-52: wip
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
type SmallDetailDto = any
|
||||
|
||||
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, {}, {}, { width: 50 }],
|
||||
|
||||
headers: [[
|
||||
{ label: 'Tgl. Order' },
|
||||
{ label: 'No. Order' },
|
||||
{ label: 'Jadwal Pemeriksaan' },
|
||||
{ label: 'Lokalisasi' },
|
||||
{ label: 'Stadium' },
|
||||
{ label: 'Status' },
|
||||
{ label: 'Resume' },
|
||||
{ label: '' }]],
|
||||
|
||||
keys: [
|
||||
'date',
|
||||
'number',
|
||||
'examinationDate',
|
||||
'localization',
|
||||
'stadium',
|
||||
'resume',
|
||||
'',
|
||||
],
|
||||
|
||||
delKeyNames: [
|
||||
{ key: 'date', label: 'Tanggal' },
|
||||
{ key: 'number', label: 'Nomor' },
|
||||
],
|
||||
|
||||
parses: {
|
||||
parent: (rec: unknown): unknown => {
|
||||
const recX = rec as SmallDetailDto
|
||||
return recX.parent?.name || '-'
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
action(rec, idx) {
|
||||
const res: RecComponent = {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: action,
|
||||
props: {
|
||||
size: 'sm',
|
||||
},
|
||||
}
|
||||
return res
|
||||
},
|
||||
},
|
||||
|
||||
htmls: {},
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
|
||||
|
||||
// Types
|
||||
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||
|
||||
// Configs
|
||||
import { config } from './list.cfg'
|
||||
|
||||
interface Props {
|
||||
data: any[]
|
||||
paginationMeta: PaginationMeta
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
pageChange: [page: number]
|
||||
}>()
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
emit('pageChange', page)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<DataTable
|
||||
v-bind="config"
|
||||
:rows="data"
|
||||
:skeleton-size="paginationMeta?.pageSize"
|
||||
/>
|
||||
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,157 @@
|
||||
<script setup lang="ts">
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import * as Cbx from '~/components/pub/my-ui/checkboxes'
|
||||
import { fi } from 'date-fns/locale';
|
||||
|
||||
const substances = [
|
||||
{ value: 'biopsi', label: 'Biopsi'},
|
||||
{ value: 'operation', label: 'Operasi' },
|
||||
{ value: 'scraping', label: 'Kerokan' },
|
||||
{ value: 'cytology', label: 'Sitologi' },
|
||||
{ value: 'fnab', label: 'FNAB' },
|
||||
]
|
||||
|
||||
const fications = [
|
||||
{ value: 'pa-formaline-10p', label: 'pA. Formalin 10%' },
|
||||
{ value: 'spt-alcohol-70p', label: 'Sputum Alkohol 70%' },
|
||||
{ value: 'urn-alcohol-50p', label: 'Urine Alkohol 50%' },
|
||||
{ value: 'vgn-smr-alcohol-95p', label: 'Vagibal Smear 95%' },
|
||||
]
|
||||
|
||||
const prevAp = [
|
||||
{ value: 'clinical', label: 'Klinik' },
|
||||
{ value: 'ro', label: 'RO' },
|
||||
{ value: 'clinical-pat', label: 'Pat. Klinik' },
|
||||
{ value: 'operation', label: 'Operasi' },
|
||||
{ value: 'necropsy', label: 'Nekropsi' },
|
||||
]
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="header">Data Order</div>
|
||||
<DE.Block :col-count="3" :cell-flex="false">
|
||||
<DE.Cell>
|
||||
<DE.Label>Tgl. Order</DE.Label>
|
||||
<DE.Field>
|
||||
<Input readonly />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>DPJP</DE.Label>
|
||||
<DE.Field>
|
||||
<Input readonly />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>PPDS</DE.Label>
|
||||
<DE.Field>
|
||||
<Input readonly />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<div class="header">Bahan</div>
|
||||
<DE.Block :cell-flex="false">
|
||||
<DE.Cell>
|
||||
<DE.Field>
|
||||
<Cbx.Checkboxes :items="substances" :use-flex="true" />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<div class="header">Fiksasi</div>
|
||||
<DE.Block :cell-flex="false">
|
||||
<DE.Cell>
|
||||
<DE.Field>
|
||||
<Cbx.Checkboxes :items="fications" :use-flex="true" />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<div class="header">Data Klinis Pasien</div>
|
||||
<DE.Block :col-count="6" :cell-flex="false">
|
||||
<DE.Cell :col-span="3">
|
||||
<DE.Label>Lokalisasi</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell :col-span="3">
|
||||
<DE.Label>Diagnosa Klinik</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Stadium T</DE.Label>
|
||||
<DE.Field>
|
||||
<Input />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Stadium M</DE.Label>
|
||||
<DE.Field>
|
||||
<Input />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Stadium N</DE.Label>
|
||||
<DE.Field>
|
||||
<Input />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<div class=""></div>
|
||||
<DE.Cell :col-span="3">
|
||||
<DE.Label>Keterangan Klinik</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea rows="2" />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<div class="header">Riwayat Pemeriksaan</div>
|
||||
<DE.Block :col-count="2" :cell-flex="false">
|
||||
<DE.Cell>
|
||||
<DE.Label>Riwayat Dulu</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Riwayat Sekarang</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Pemeriksaan PA Sebelumnya</DE.Label>
|
||||
<DE.Field>
|
||||
<Cbx.Checkboxes :items="prevAp" :use-flex="true" />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<div></div>
|
||||
<DE.Cell>
|
||||
<DE.Label>Keterangan PA Sebelumnya</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Pemeriksaan Penunjang</DE.Label>
|
||||
<DE.Field>
|
||||
<Textarea />
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
</DE.Block>
|
||||
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.header {
|
||||
@apply mb-1.5 text-sm 2xl:text-base font-semibold
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,77 @@
|
||||
<script setup lang="ts">
|
||||
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
|
||||
import NavOk from '~/components/pub/my-ui/nav-footer/ok.vue'
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
|
||||
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
||||
import { type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
// mcu src category
|
||||
import ScrCategorySwitcher from '~/components/app/mcu-src-category/switcher.vue'
|
||||
import { getList as getMcuCategoryList } from '~/services/mcu-src-category.service'
|
||||
|
||||
// mcu src
|
||||
import { type McuSrc } from '~/models/mcu-src'
|
||||
import { getList as getMcuSrcList } from '~/services/mcu-src.service'
|
||||
import McuSrcPicker from '~/components/app/mcu-src/picker-accordion.vue'
|
||||
|
||||
// mcu order
|
||||
import { getDetail } from '~/services/mcu-order.service'
|
||||
import Detail from '~/components/app/mcu-order/detail.vue'
|
||||
|
||||
// mcu order item, manually not using composable
|
||||
import {
|
||||
getList as getMcuOrderItemList,
|
||||
create as createMcuOrderItem,
|
||||
remove as removeMcuOrderItem,
|
||||
} from '~/services/mcu-order-item.service'
|
||||
import { type McuOrderItem } from '~/models/mcu-order-item'
|
||||
import Entry from '~/components/app/mcu-order/entry-for-ap.vue'
|
||||
|
||||
// props
|
||||
const props = defineProps<{
|
||||
encounter_id: number
|
||||
}>()
|
||||
|
||||
// declaration & flows
|
||||
|
||||
// MCU Order
|
||||
const { getQueryParam } = useQueryParam()
|
||||
const id = getQueryParam('id')
|
||||
const dataRes = await getDetail(
|
||||
typeof id === 'string' ? parseInt(id) : 0,
|
||||
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
|
||||
)
|
||||
const data = dataRes.body?.data
|
||||
|
||||
// MCU Sources
|
||||
const { backToList } = useQueryCRUDMode()
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: 'Entry Order LAB PA',
|
||||
icon: 'i-lucide-box',
|
||||
}
|
||||
|
||||
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
||||
if (type === 'back') {
|
||||
backToList()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header
|
||||
:prep="headerPrep"
|
||||
:ref-search-nav="headerPrep.refSearchNav"
|
||||
class="mb-4 xl:mb-5"
|
||||
/>
|
||||
|
||||
<Entry />
|
||||
<Separator class="my-5" />
|
||||
|
||||
<div class="w-full flex justify-center">
|
||||
<Nav @click="navClick" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,159 @@
|
||||
<script setup lang="ts">
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||
|
||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
// Handlers
|
||||
import {
|
||||
recId,
|
||||
recAction,
|
||||
recItem,
|
||||
isReadonly,
|
||||
isFormEntryDialogOpen,
|
||||
isRecordConfirmationOpen,
|
||||
handleActionSave,
|
||||
handleActionRemove,
|
||||
} from '~/handlers/mcu-order.handler'
|
||||
|
||||
// Apps
|
||||
import { getList, getDetail } from '~/services/mcu-order.service'
|
||||
import List from '~/components/app/mcu-order/list.vue'
|
||||
import type { McuOrder } from '~/models/mcu-order'
|
||||
|
||||
const route = useRoute()
|
||||
const { setQueryParams } = useQueryParam()
|
||||
const { crudQueryParams } = useQueryCRUD()
|
||||
|
||||
const title = ref('')
|
||||
|
||||
const plainEid = route.params.id
|
||||
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0 // here the
|
||||
|
||||
const {
|
||||
data,
|
||||
isLoading,
|
||||
paginationMeta,
|
||||
searchInput,
|
||||
handlePageChange,
|
||||
handleSearch,
|
||||
fetchData: getMyList,
|
||||
} = usePaginatedList<McuOrder>({
|
||||
fetchFn: async ({ page, search }) => {
|
||||
const result = await getList({
|
||||
search,
|
||||
page,
|
||||
'scope-code': "ap-lab",
|
||||
'encounter-id': encounter_id,
|
||||
includes: 'doctor,doctor-employee,doctor-employee-person',
|
||||
})
|
||||
return { success: result.success || false, body: result.body || {} }
|
||||
},
|
||||
entityName: 'mcu-order'
|
||||
})
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: 'Order Lab PA',
|
||||
icon: 'i-lucide-box',
|
||||
refSearchNav: {
|
||||
placeholder: 'Cari (min. 3 karakter)...',
|
||||
minLength: 3,
|
||||
debounceMs: 500,
|
||||
showValidationFeedback: true,
|
||||
onInput: (value: string) => {
|
||||
searchInput.value = value
|
||||
},
|
||||
onClick: () => {},
|
||||
onClear: () => {},
|
||||
},
|
||||
addNav: {
|
||||
label: 'Tambah',
|
||||
icon: 'i-lucide-plus',
|
||||
onClick: () => {
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
crudQueryParams.value = { mode: 'entry', recordId: undefined }
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
const getMyDetail = async (id: number | string) => {
|
||||
const result = await getDetail(id)
|
||||
if (result.success) {
|
||||
const currentValue = result.body?.data || {}
|
||||
recItem.value = currentValue
|
||||
isFormEntryDialogOpen.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// Watch for row actions when recId or recAction changes
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getMyDetail(recId.value)
|
||||
title.value = 'Detail Order Lab PK'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getMyDetail(recId.value)
|
||||
title.value = 'Edit Order Lab PK'
|
||||
isReadonly.value = false
|
||||
break
|
||||
case ActionEvents.showConfirmDelete:
|
||||
isRecordConfirmationOpen.value = true
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
watch([isFormEntryDialogOpen], async () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
})
|
||||
|
||||
function cancel(data: McuOrder) {
|
||||
recId.value = data.id
|
||||
recItem.value = data
|
||||
isRecordConfirmationOpen.value = true
|
||||
}
|
||||
|
||||
function edit(data: McuOrder) {
|
||||
setQueryParams({
|
||||
'mode': 'entry',
|
||||
'id': data.id.toString()
|
||||
})
|
||||
recItem.value = data
|
||||
}
|
||||
|
||||
function submit(data: McuOrder) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header :prep="{ ...headerPrep }" />
|
||||
|
||||
<List
|
||||
v-if="!isLoading.dataListLoading"
|
||||
:data="data"
|
||||
:pagination-meta="paginationMeta"
|
||||
@cancel="cancel"
|
||||
@edit="edit"
|
||||
@submit="submit"
|
||||
/>
|
||||
|
||||
<RecordConfirmation
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||
@cancel=""
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
//
|
||||
import List from './list.vue'
|
||||
import Entry from './entry.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
encounter_id: number
|
||||
}>()
|
||||
|
||||
const { mode } = useQueryCRUDMode()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
|
||||
<Entry v-else :encounter_id="encounter_id" />
|
||||
</template>
|
||||
@@ -158,7 +158,7 @@ export const permissions: Record<string, Record<string, Permission[]>> = {
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/ambulatory/encounter/[id]/process?menu=pa-lab-order': {
|
||||
'/ambulatory/encounter/[id]/process?menu=ap-lab-order': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
|
||||
@@ -42,6 +42,7 @@ const PrescriptionAsync = defineAsyncComponent(() => import('~/components/conten
|
||||
const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue'))
|
||||
const ProcedureRoomOrderAsync = defineAsyncComponent(() => import('~/components/content/procedure-room-order/main.vue'))
|
||||
const MicroLabOrderAsync = defineAsyncComponent(() => import('~/components/content/micro-lab-order/main.vue'))
|
||||
const ApLabOrderAsync = defineAsyncComponent(() => import('~/components/content/ap-lab-order/main.vue'))
|
||||
const CprjAsync = defineAsyncComponent(() => import('~/components/content/cprj/entry.vue'))
|
||||
const RadiologyAsync = defineAsyncComponent(() => import('~/components/content/radiology-order/main.vue'))
|
||||
const ConsultationAsync = defineAsyncComponent(() => import('~/components/content/consultation/list.vue'))
|
||||
@@ -173,8 +174,8 @@ const defaultKeys: Record<string, any> = {
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
paLabOrder: {
|
||||
id: 'pa-lab-order',
|
||||
apLabOrder: {
|
||||
id: 'ap-lab-order',
|
||||
title: 'Order Lab PA',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
@@ -392,10 +393,10 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
||||
currentKeys.microLabOrder['component'] = MicroLabOrderAsync
|
||||
currentKeys.microLabOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.paLabOrder) {
|
||||
// TODO: add component for paLabOrder
|
||||
currentKeys.paLabOrder['component'] = null
|
||||
currentKeys.paLabOrder['props'] = { encounter_id: id }
|
||||
if (currentKeys?.apLabOrder) {
|
||||
// TODO: add component for apLabOrder
|
||||
currentKeys.apLabOrder['component'] = ApLabOrderAsync
|
||||
currentKeys.apLabOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.procedureRoomOrder) {
|
||||
currentKeys.procedureRoomOrder['component'] = ProcedureRoomOrderAsync
|
||||
|
||||
@@ -0,0 +1,587 @@
|
||||
import { isValidDate } from '~/lib/date'
|
||||
import { medicalRoles } from '~/const/common/role'
|
||||
|
||||
export interface EncounterItem {
|
||||
id: string
|
||||
title: string
|
||||
classCode?: string[]
|
||||
unit?: string
|
||||
afterId?: string
|
||||
component?: any
|
||||
props?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface EncounterProps {
|
||||
classCode: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient'
|
||||
subClassCode: 'reg' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk'
|
||||
}
|
||||
|
||||
export interface EncounterListData {
|
||||
encounter?: any
|
||||
status?: any
|
||||
medicalAssessment?: any
|
||||
medicalAssessmentRehab: any
|
||||
functionAssessment?: any
|
||||
protocolTheraphy?: any
|
||||
protocolChemotherapy?: any
|
||||
medicineProtocolChemotherapy?: any
|
||||
consultation?: any
|
||||
letterOfControl?: any
|
||||
}
|
||||
|
||||
const StatusAsync = defineAsyncComponent(() => import('~/components/content/encounter/status.vue'))
|
||||
const EarlyMedicalRehabListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
|
||||
const EarlyMedicalAssesmentListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
|
||||
const InitialNursingStudyAsync = defineAsyncComponent(() => import('~/components/content/initial-nursing/entry.vue'))
|
||||
// const AssesmentFunctionListAsync = defineAsyncComponent(() => import('~/components/content/soapi/entry.vue'))
|
||||
const KfrListAsync = defineAsyncComponent(() => import('~/components/content/kfr/main.vue'))
|
||||
const ChemoProtocolListAsync = defineAsyncComponent(() => import('~/components/app/chemotherapy/list.protocol.vue'))
|
||||
const ChemoMedicineProtocolListAsync = defineAsyncComponent(() => import('~/components/app/chemotherapy/list.medicine.vue'))
|
||||
const GeneralConsentListAsync = defineAsyncComponent(() => import('~/components/content/general-consent/entry.vue'))
|
||||
const CprjAsync = defineAsyncComponent(() => import('~/components/content/cprj/entry.vue'))
|
||||
|
||||
const PrescriptionAsync = defineAsyncComponent(() => import('~/components/content/prescription/main.vue'))
|
||||
const DeviceOrderAsync = defineAsyncComponent(() => import('~/components/content/device-order/main.vue'))
|
||||
const RadiologyOrderAsync = defineAsyncComponent(() => import('~/components/content/radiology-order/main.vue'))
|
||||
const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue'))
|
||||
const MicroLabOrderAsync = defineAsyncComponent(() => import('~/components/content/micro-lab-order/main.vue'))
|
||||
const ApLabOrderAsync = defineAsyncComponent(() => import('~/components/content/ap-lab-order/main.vue'))
|
||||
const ProcedureRoomOrderAsync = defineAsyncComponent(() => import('~/components/content/procedure-room-order/main.vue'))
|
||||
|
||||
const ConsultationAsync = defineAsyncComponent(() => import('~/components/content/consultation/list.vue'))
|
||||
const DocUploadListAsync = defineAsyncComponent(() => import('~/components/content/document-upload/main.vue'))
|
||||
const ResumeListAsync = defineAsyncComponent(() => import('~/components/content/resume/main.vue'))
|
||||
const ControlLetterListAsync = defineAsyncComponent(() => import('~/components/content/control-letter/main.vue'))
|
||||
const PrbListAsync = defineAsyncComponent(() => import('~/components/content/prb/main.vue'))
|
||||
const SurgeryReportListAsync = defineAsyncComponent(() => import('~/components/content/surgery-report/main.vue'))
|
||||
const VaccineDataListAsync = defineAsyncComponent(() => import('~/components/content/vaccine-data/main.vue'))
|
||||
|
||||
const defaultKeys: Record<string, any> = {
|
||||
status: {
|
||||
id: 'status',
|
||||
title: 'Status Masuk/Keluar',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
earlyMedicalRehabAssessment: {
|
||||
id: 'rehab-medical-assessment',
|
||||
title: 'Pengkajian Awal Medis Rehabilitasi Medis',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'rehab',
|
||||
},
|
||||
earlyMedicalAssessment: {
|
||||
id: 'early-medical-assessment',
|
||||
title: 'Pengkajian Awal Medis',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
afterId: 'early-medical-assessment',
|
||||
},
|
||||
initialNursingStudy: {
|
||||
id: 'initial-nursing-study',
|
||||
title: 'Kajian Awal Keperawatan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
fkr: {
|
||||
id: 'fkr',
|
||||
title: 'FKR',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'rehab',
|
||||
},
|
||||
chemotherapyProtocol: {
|
||||
id: 'chemotherapy-protocol',
|
||||
title: 'Protokol Kemoterapi',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'chemo',
|
||||
},
|
||||
chemotherapyMedicine: {
|
||||
id: 'chemotherapy-medicine',
|
||||
title: 'Protokol Obat Kemoterapi',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'chemo',
|
||||
},
|
||||
educationAssessment: {
|
||||
id: 'education-assessment',
|
||||
title: 'Asesmen Kebutuhan Edukasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
|
||||
// NOTE: Replaced by FRK
|
||||
// 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',
|
||||
// },
|
||||
generalConsent: {
|
||||
id: 'general-consent',
|
||||
title: 'General Consent',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
patientAmbNote: { // CPRJ
|
||||
id: 'patient-amb-note',
|
||||
title: 'CPRJ',
|
||||
classCode: ['ambulatory', 'emergency'],
|
||||
unit: 'ambulatory',
|
||||
},
|
||||
patientDevNote: { // CPPT
|
||||
id: 'patient-dev-note',
|
||||
title: 'CPP',
|
||||
classCode: ['inpatient'],
|
||||
unit: 'inpatient',
|
||||
},
|
||||
|
||||
prescription: {
|
||||
id: 'prescription',
|
||||
title: 'Order Obat',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
deviceOrder: {
|
||||
id: 'device-order',
|
||||
title: 'Order Alkes',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
radiologyOrder: {
|
||||
id: 'radiology-order',
|
||||
title: 'Order Radiologi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
cpLabOrder: {
|
||||
id: 'cp-lab-order',
|
||||
title: 'Order Lab PK',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
microLabOrder: {
|
||||
id: 'micro-lab-order',
|
||||
title: 'Order Lab Mikro',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
paLabOrder: {
|
||||
id: 'pa-lab-order',
|
||||
title: 'Order Lab PA',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
procedureRoomOrder: {
|
||||
id: 'procedure-room-order',
|
||||
title: 'Order Ruang Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
mcuResult: {
|
||||
id: 'mcu-result',
|
||||
title: 'Hasil Penunjang',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
procedureReport: {
|
||||
id: 'action-report',
|
||||
title: 'Laporan Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
operationReport: {
|
||||
id: 'action-report',
|
||||
title: 'Laporan Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
ambulanceOrder: {
|
||||
id: 'ambulance-order',
|
||||
title: 'Order Ambulans',
|
||||
classCode: ['ambulatory', 'emergency'],
|
||||
unit: 'all',
|
||||
},
|
||||
surgeryReport: {
|
||||
id: 'surgery-report',
|
||||
title: 'Laporan Operasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
forensic: {
|
||||
id: 'surgery-report',
|
||||
title: 'Laporan Operasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
consultation: {
|
||||
id: 'consultation',
|
||||
title: 'Konsultasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
resume: {
|
||||
id: 'resume',
|
||||
title: 'Resume Medis',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
controlLetter: {
|
||||
id: 'control-letter',
|
||||
title: 'Surat Kontrol',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
inpatientLetter: {
|
||||
id: 'inpatient-letter',
|
||||
title: 'SPRI',
|
||||
classCode: ['ambulatory', 'emergency'],
|
||||
unit: 'all',
|
||||
},
|
||||
refBack: {
|
||||
id: 'reference-back',
|
||||
title: 'PRB',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
screening: {
|
||||
id: 'screening',
|
||||
title: 'Skrinning MPP',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
supportingDocument: {
|
||||
id: 'supporting-document',
|
||||
title: 'Upload Dokumen Pendukung',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'all',
|
||||
},
|
||||
vaccineData: {
|
||||
id: 'vaccine-data',
|
||||
title: 'Data Vaksin',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
priceList: {
|
||||
id: 'price-list',
|
||||
title: 'Tarif Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
}
|
||||
|
||||
export function getItemsByClassCode(classCode: string, items: EncounterItem[]) {
|
||||
return items.filter((item) => item.classCode?.includes(classCode))
|
||||
}
|
||||
|
||||
export function getItemsByUnit(unit: string, items: EncounterItem[]) {
|
||||
return items.filter((item) => item.unit === unit)
|
||||
}
|
||||
|
||||
export function getItemsByIds(ids: string[], items: EncounterItem[]) {
|
||||
return items.filter((item) => ids.includes(item.id))
|
||||
}
|
||||
|
||||
export function getIndexById(id: string, items: EncounterItem[]) {
|
||||
return items.findIndex((item) => item.id === id)
|
||||
}
|
||||
|
||||
export const getItemsAll = (classCode: string, unit: string, items: EncounterItem[]) => {
|
||||
const prevItems = [...items]
|
||||
let updateItems = getItemsByClassCode(classCode, prevItems)
|
||||
updateItems = getItemsByUnit(unit, updateItems)
|
||||
return updateItems
|
||||
}
|
||||
|
||||
export function insertItemByAfterId(id: string, items: EncounterItem[], newItem: EncounterItem) {
|
||||
const index = getIndexById(id, items)
|
||||
if (index > -1) {
|
||||
items.splice(index + 1, 0, newItem)
|
||||
}
|
||||
}
|
||||
|
||||
export function injectComponents(id: string | number, data: EncounterListData, meta: EncounterListData) {
|
||||
const currentKeys = { ...defaultKeys }
|
||||
if (currentKeys?.status) {
|
||||
currentKeys.status['component'] = StatusAsync
|
||||
currentKeys.status['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.earlyMedicalAssessment) {
|
||||
currentKeys.earlyMedicalAssessment['component'] = EarlyMedicalAssesmentListAsync
|
||||
currentKeys.earlyMedicalAssessment['props'] = {
|
||||
encounter: data?.encounter,
|
||||
type: 'early-medic',
|
||||
label: currentKeys.earlyMedicalAssessment['title'],
|
||||
}
|
||||
}
|
||||
if (currentKeys?.earlyMedicalRehabAssessment) {
|
||||
currentKeys.earlyMedicalRehabAssessment['component'] = EarlyMedicalRehabListAsync
|
||||
currentKeys.earlyMedicalRehabAssessment['props'] = {
|
||||
encounter: data?.encounter,
|
||||
type: 'early-rehab',
|
||||
label: currentKeys.earlyMedicalRehabAssessment['title'],
|
||||
}
|
||||
}
|
||||
if (currentKeys?.functionAssessment) {
|
||||
currentKeys.functionAssessment['component'] = AssesmentFunctionListAsync
|
||||
currentKeys.functionAssessment['props'] = {
|
||||
encounter: data?.encounter,
|
||||
type: 'function',
|
||||
label: currentKeys.functionAssessment['title'],
|
||||
}
|
||||
}
|
||||
if (currentKeys?.therapyProtocol) {
|
||||
// TODO: add component for therapyProtocol
|
||||
currentKeys.therapyProtocol['component'] = null
|
||||
currentKeys.therapyProtocol['props'] = {
|
||||
data: data?.encounter,
|
||||
paginationMeta: meta?.protocolTheraphy,
|
||||
}
|
||||
}
|
||||
if (currentKeys?.chemotherapyProtocol) {
|
||||
currentKeys.chemotherapyProtocol['component'] = ChemoProtocolListAsync
|
||||
currentKeys.chemotherapyProtocol['props'] = {
|
||||
data: data?.encounter,
|
||||
paginationMeta: meta?.protocolChemotherapy,
|
||||
}
|
||||
}
|
||||
if (currentKeys?.chemotherapyMedicine) {
|
||||
currentKeys.chemotherapyMedicine['component'] = ChemoMedicineProtocolListAsync
|
||||
currentKeys.chemotherapyMedicine['props'] = {
|
||||
data: data?.encounter,
|
||||
paginationMeta: meta?.medicineProtocolChemotherapy,
|
||||
}
|
||||
}
|
||||
if (currentKeys?.educationAssessment) {
|
||||
// TODO: add component for education assessment
|
||||
currentKeys.educationAssessment['component'] = null
|
||||
currentKeys.educationAssessment['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.generalConsent) {
|
||||
currentKeys.generalConsent['component'] = GeneralConsentListAsync
|
||||
currentKeys.generalConsent['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.patientAmbNote) {
|
||||
currentKeys.patientAmbNote['component'] = CprjAsync
|
||||
currentKeys.patientAmbNote['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.prescription) {
|
||||
currentKeys.prescription['component'] = PrescriptionAsync
|
||||
currentKeys.prescription['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.deviceOrder) {
|
||||
currentKeys.deviceOrder['component'] = DeviceOrderAsync
|
||||
currentKeys.deviceOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.radiologyOrder) {
|
||||
currentKeys.radiologyOrder['component'] = RadiologyOrderAsync
|
||||
currentKeys.radiologyOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.cpLabOrder) {
|
||||
currentKeys.cpLabOrder['component'] = CpLabOrderAsync
|
||||
currentKeys.cpLabOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.microLabOrder) {
|
||||
currentKeys.microLabOrder['component'] = MicroLabOrderAsync
|
||||
currentKeys.microLabOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.paLabOrder) {
|
||||
// TODO: add component for paLabOrder
|
||||
currentKeys.paLabOrder['component'] = null
|
||||
currentKeys.paLabOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.procedureRoomOrder) {
|
||||
currentKeys.procedureRoomOrder['component'] = ProcedureRoomOrderAsync
|
||||
currentKeys.procedureRoomOrder['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.mcuResult) {
|
||||
// TODO: add component for mcuResult
|
||||
currentKeys.mcuResult['component'] = null
|
||||
currentKeys.mcuResult['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.consultation) {
|
||||
currentKeys.consultation['component'] = ConsultationAsync
|
||||
currentKeys.consultation['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.resume) {
|
||||
currentKeys.resume['component'] = ResumeListAsync
|
||||
currentKeys.resume['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.controlLetter) {
|
||||
currentKeys.controlLetter['component'] = ControlLetterListAsync
|
||||
currentKeys.controlLetter['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.refBack) {
|
||||
currentKeys.refBack['component'] = PrbListAsync
|
||||
currentKeys.refBack['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.fkr) {
|
||||
currentKeys.fkr['component'] = KfrListAsync
|
||||
currentKeys.fkr['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.screening) {
|
||||
// TODO: add component for screening
|
||||
currentKeys.screening['component'] = null
|
||||
currentKeys.screening['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.surgeryReport) {
|
||||
currentKeys.surgeryReport['component'] = SurgeryReportListAsync
|
||||
currentKeys.surgeryReport['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.vaccineData) {
|
||||
currentKeys.vaccineData['component'] = VaccineDataListAsync
|
||||
currentKeys.vaccineData['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
if (currentKeys?.supportingDocument) {
|
||||
currentKeys.supportingDocument['component'] = DocUploadListAsync
|
||||
currentKeys.supportingDocument['props'] = { encounter_id: id }
|
||||
}
|
||||
if (currentKeys?.priceList) {
|
||||
// TODO: add component for priceList
|
||||
currentKeys.priceList['component'] = null
|
||||
currentKeys.priceList['props'] = { encounter_id: id }
|
||||
}
|
||||
|
||||
if (currentKeys?.initialNursingStudy) {
|
||||
currentKeys.initialNursingStudy['component'] = InitialNursingStudyAsync
|
||||
currentKeys.initialNursingStudy['props'] = { encounter: data?.encounter }
|
||||
}
|
||||
|
||||
return currentKeys
|
||||
}
|
||||
|
||||
export function mergeArrayAt<T>(arraysOne: T[], arraysTwo: T[] | T, deleteCount = 0): T[] {
|
||||
const prevItems = arraysOne.slice()
|
||||
if (!prevItems) return prevItems
|
||||
const nextItems = Array.isArray(arraysTwo) ? arraysTwo : [arraysTwo]
|
||||
if (nextItems.length === 0) return prevItems
|
||||
// determine insertion position using the first item's `id` if available
|
||||
const firstId = (nextItems[0] as any)?.afterId || (prevItems[0] as any)?.id
|
||||
let pos = prevItems.length
|
||||
if (typeof firstId === 'string') {
|
||||
const index = prevItems.findIndex((item: any) => item.id === firstId)
|
||||
pos = index < 0 ? Math.max(prevItems.length + index, 0) : Math.min(index, prevItems.length)
|
||||
}
|
||||
prevItems.splice(pos, deleteCount, ...nextItems)
|
||||
return prevItems
|
||||
}
|
||||
|
||||
// Function to map API response to Encounter structure
|
||||
export function mapResponseToEncounter(result: any): any {
|
||||
if (!result) return null
|
||||
|
||||
// Check if patient and patient.person exist (minimal validation)
|
||||
if (!result.patient || !result.patient.person) {
|
||||
return null
|
||||
}
|
||||
|
||||
const mapped: any = {
|
||||
id: result.id || 0,
|
||||
patient_id: result.patient_id || result.patient?.id || 0,
|
||||
patient: {
|
||||
id: result.patient?.id || 0,
|
||||
number: result.patient?.number || '',
|
||||
person: {
|
||||
id: result.patient?.person?.id || 0,
|
||||
name: result.patient?.person?.name || '',
|
||||
birthDate: result.patient?.person?.birthDate || null,
|
||||
gender_code: result.patient?.person?.gender_code || '',
|
||||
residentIdentityNumber: result.patient?.person?.residentIdentityNumber || null,
|
||||
frontTitle: result.patient?.person?.frontTitle || '',
|
||||
endTitle: result.patient?.person?.endTitle || '',
|
||||
addresses: result.patient?.person?.addresses || [],
|
||||
},
|
||||
},
|
||||
registeredAt: result.registeredAt || result.patient?.registeredAt || null,
|
||||
class_code: result.class_code || '',
|
||||
unit_id: result.unit_id || 0,
|
||||
unit: result.unit || null,
|
||||
specialist_id: result.specialist_id || null,
|
||||
subspecialist_id: result.subspecialist_id || null,
|
||||
visitDate: isValidDate(result.visitDate)
|
||||
? result.visitDate
|
||||
: result.registeredAt || result.patient?.registeredAt || null,
|
||||
adm_employee_id: result.adm_employee_id || 0,
|
||||
adm_employee: result.adm_employee || null,
|
||||
responsible_nurse_code: result.responsible_nurse_code || null,
|
||||
responsible_nurse: result.responsible_nurse || null,
|
||||
appointment_doctor_code: result.appointment_doctor_code || null,
|
||||
appointment_doctor: result.appointment_doctor || null,
|
||||
responsible_doctor_code: result.responsible_doctor_id || null,
|
||||
responsible_doctor: result.responsible_doctor || null,
|
||||
refSource_name: result.refSource_name || null,
|
||||
appointment_id: result.appointment_id || null,
|
||||
earlyEducation: result.earlyEducation || null,
|
||||
medicalDischargeEducation: result.medicalDischargeEducation || '',
|
||||
admDischargeEducation: result.admDischargeEducation || null,
|
||||
discharge_method_code: result.discharge_method_code || null,
|
||||
discharge_reason: result.dischargeReason || result.discharge_reason || null,
|
||||
discharge_date: result.discharge_date || null,
|
||||
status_code: result.status_code || '',
|
||||
// Payment related fields
|
||||
paymentMethod_code:
|
||||
result.paymentMethod_code && result.paymentMethod_code.trim() !== '' ? result.paymentMethod_code : null,
|
||||
trx_number: result.trx_number || null,
|
||||
member_number: result.member_number || null,
|
||||
ref_number: result.ref_number || null,
|
||||
}
|
||||
|
||||
return mapped
|
||||
}
|
||||
|
||||
export function getMenuItems(
|
||||
id: string | number,
|
||||
props: any,
|
||||
user: any,
|
||||
data: EncounterListData,
|
||||
meta: any,
|
||||
) {
|
||||
// const normalClassCode = props.classCode === 'ambulatory' ? 'outpatient' : props.classCode
|
||||
const normalClassCode = props.classCode === 'ambulatory' ? 'ambulatory' : props.classCode
|
||||
const currentKeys = injectComponents(id, data, meta)
|
||||
const defaultItems: EncounterItem[] = Object.values(currentKeys)
|
||||
const listItemsForOutpatientRehab = mergeArrayAt(
|
||||
getItemsAll('ambulatory', 'all', defaultItems),
|
||||
getItemsAll('ambulatory', 'rehab', defaultItems),
|
||||
)
|
||||
const listItemsForOutpatientChemo = mergeArrayAt(
|
||||
getItemsAll('ambulatory', 'all', defaultItems),
|
||||
getItemsAll('ambulatory', 'chemo', defaultItems),
|
||||
)
|
||||
const listItems: Record<string, Record<string, Record<string, any>>> = {
|
||||
'installation|ambulatory': {
|
||||
'unit|rehab': {
|
||||
items: listItemsForOutpatientRehab,
|
||||
roles: medicalRoles,
|
||||
},
|
||||
'unit|chemo': {
|
||||
items: listItemsForOutpatientChemo,
|
||||
roles: medicalRoles,
|
||||
},
|
||||
all: getItemsAll('ambulatory', 'all', defaultItems),
|
||||
},
|
||||
'installation|emergency': {
|
||||
all: getItemsAll('emergency', 'all', defaultItems),
|
||||
},
|
||||
'installation|inpatient': {
|
||||
all: getItemsAll('inpatient', 'all', defaultItems),
|
||||
},
|
||||
}
|
||||
const currentListItems = listItems[`installation|${normalClassCode}`]
|
||||
if (!currentListItems) return []
|
||||
const unitCode = user?.unit_code ? `unit|${user.unit_code}` : 'all'
|
||||
const currentUnitItems: any = currentListItems[`${unitCode}`]
|
||||
if (!currentUnitItems) return []
|
||||
let menus = []
|
||||
if (currentUnitItems.roles && currentUnitItems.roles?.includes(user.activeRole)) {
|
||||
menus = [...currentUnitItems.items]
|
||||
} else {
|
||||
menus = unitCode !== 'all' && currentUnitItems?.items ? [...currentUnitItems.items] : [...currentUnitItems]
|
||||
}
|
||||
return menus
|
||||
}
|
||||
Reference in New Issue
Block a user