fix: encounter conflict solve

This commit is contained in:
riefive
2025-12-05 16:38:36 +07:00
21 changed files with 373 additions and 235 deletions
+19 -12
View File
@@ -10,12 +10,13 @@ import ComboBox from '~/components/pub/my-ui/combobox/combobox.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import type { CheckInFormData } from '~/schemas/encounter.schema'
import type { Encounter } from '~/models/encounter'
import { now } from '@internationalized/date';
interface Props {
schema: z.ZodSchema<any>
values: any
doctors: { value: string; label: string }[]
employees: { value: string; label: string }[]
// employees: { value: string; label: string }[]
encounter: Encounter
isLoading?: boolean
isReadonly?: boolean
@@ -36,18 +37,23 @@ const { defineField, errors, meta } = useForm({
} as Partial<CheckInFormData>,
})
const [responsible_doctor_id, responsible_doctor_idAttrs] = defineField('responsible_doctor_id')
const [adm_employee_id, adm_employee_idAttrs] = defineField('discharge_method_code')
const [responsible_doctor_code, responsible_doctor_codeAttrs] = defineField('responsible_doctor_code')
// const [adm_employee_id, adm_employee_idAttrs] = defineField('discharge_method_code')
const [registeredAt, registeredAtAttrs] = defineField('registeredAt')
function submitForm() {
const formData: CheckInFormData = {
responsible_doctor_id: responsible_doctor_id.value,
adm_employee_id: adm_employee_id.value,
// registeredAt: registeredAt.value || '',
responsible_doctor_code: responsible_doctor_code.value,
// adm_employee_id: adm_employee_id.value,
registeredAt: registeredAt.value || '',
}
emit('submit', formData)
}
function setTime() {
const today = new Date()
registeredAt.value = today.toISOString().substring(0, 10) + ' ' + today.toLocaleTimeString('id-ID').substring(0, 5).replace('.', ':');
}
</script>
<template>
@@ -57,8 +63,8 @@ function submitForm() {
<DE.Field>
<ComboBox
id="doctor"
v-model="responsible_doctor_id"
v-bind="responsible_doctor_idAttrs"
v-model="responsible_doctor_code"
v-bind="responsible_doctor_codeAttrs"
:items="doctors"
:disabled="isLoading || isReadonly"
placeholder="Pilih Dokter DPJP"
@@ -67,7 +73,7 @@ function submitForm() {
/>
</DE.Field>
</DE.Cell>
<DE.Cell>
<!-- <DE.Cell>
<DE.Label>PJ Berkas</DE.Label>
<DE.Field>
<ComboBox
@@ -81,7 +87,7 @@ function submitForm() {
empty-message="Petugas tidak ditemukan"
/>
</DE.Field>
</DE.Cell>
</DE.Cell> -->
<DE.Cell>
<DE.Label>Waktu Masuk</DE.Label>
<DE.Field>
@@ -89,7 +95,8 @@ function submitForm() {
id="name"
v-model="registeredAt"
v-bind="registeredAtAttrs"
:disabled="isLoading || isReadonly"
@click="setTime"
readonly
/>
</DE.Field>
</DE.Cell>
@@ -104,4 +111,4 @@ function submitForm() {
<style>
</style>
</style>
+25 -20
View File
@@ -7,43 +7,48 @@ import type { Encounter } from '~/models/encounter'
interface Props {
encounter: Encounter
canUpdate?: boolean
isLoading?: boolean
}
const props = defineProps<Props>()
const doctor = ref('-belum dipilih-')
const doctor = computed(() => {
return props.encounter.responsible_doctor?.employee?.person?.name ?? '-belum dipilih-'
})
const adm = ref('-belum dipilih-')
const emit = defineEmits<{
edit: []
}>()
watch(props.encounter, () => {
doctor.value = props.encounter.responsible_doctor?.employee?.person?.name ?? props.encounter.appointment_doctor?.employee?.person?.name ?? '-belum dipilih-'
adm.value = props.encounter.adm_employee?.person?.name ?? '-belum dipilih-'
})
</script>
<template>
<DE.Block :cell-flex="false">
<DE.Cell>
<DE.Label class="font-semibold">Waktu Masuk</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter?.registeredAt?.substring(0, 15).replace('T', ' ') || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">PJ Berkas</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter.adm_employee?.person?.name || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Perawat</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter.responsible_nurse?.employee?.person?.name || '-' }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Dokter</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ doctor }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">PJ Berkas</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ adm }}</div>
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Waktu Masuk</DE.Label>
<DE.Field>
<div class="py-2 border-b border-b-slate-300">{{ encounter?.registeredAt || '-' }}</div>
</DE.Field>
</DE.Cell>
</DE.Block>
<div class="text-center">
<div v-if="canUpdate" class="text-center">
<Button @click="() => emit('edit')">
<LucidePen />
Edit
@@ -53,4 +58,4 @@ watch(props.encounter, () => {
<style>
</style>
</style>
@@ -12,8 +12,7 @@ import type { Encounter } from '~/models/encounter';
interface Props {
encounter: Encounter
isLoading?: boolean
isReadonly?: boolean
canUpdate?: boolean
}
const props = defineProps<Props>()
@@ -73,7 +72,7 @@ const emit = defineEmits<{
</DE.Field>
</DE.Cell>
</DE.Block>
<div class="text-center [&>*]:mx-1">
<div v-if="canUpdate" class="text-center [&>*]:mx-1">
<Button @click="() => emit('edit')">
<LucidePen />
Edit
@@ -87,4 +86,4 @@ const emit = defineEmits<{
<style>
</style>
</style>
+6 -2
View File
@@ -23,7 +23,6 @@ import { paymentMethodCodes } from '~/const/key-val/common'
// App things
import { genEncounter, type Encounter } from '~/models/encounter'
import { se } from 'date-fns/locale'
// Props
const props = defineProps<{
@@ -50,7 +49,7 @@ model.value = genEncounter()
// Common preparation
const defaultCBItems = [{ label: 'Pilih', value: '' }]
const paymentMethodItems = CB.recStrToItem(paymentMethodCodes)
const paymentMethodItems = ref<any>({})
// Emit preparation
const emit = defineEmits<{
@@ -237,6 +236,11 @@ function submitForm() {
defineExpose({
submitForm,
})
onMounted(() => {
const isPaymentMethodVclaim = true
paymentMethodItems.value = isPaymentMethodVclaim ? props.payments : CB.recStrToItem(paymentMethodCodes)
})
</script>
<template>
+5 -5
View File
@@ -42,14 +42,14 @@ if (props.data.responsible_doctor) {
</script>
<template>
<div class="w-full">
<div class="w-full py-3 2xl:py-4 px-5">
<!-- Data Pasien -->
<h2 class="mb-2 font-semibold md:text-base 2xl:text-lg">
{{ data.patient.person.name }} - {{ data.patient.number }}
</h2>
<div class="grid grid-cols-3">
<div>
<DE.Block mode="preview">
<DE.Block mode="preview" class="!mb-0">
<DE.Cell>
<DE.Label class="font-semibold">Tgl. Lahir</DE.Label>
<DE.Colon />
@@ -58,7 +58,7 @@ if (props.data.responsible_doctor) {
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label class="font-semibold">Jns. Kelamin</DE.Label>
<DE.Label class="font-semibold"><span class="hidden xl:inline">Jns.</span> Kelamin</DE.Label>
<DE.Colon />
<DE.Field>
{{ genderCodes[data.patient.person.gender_code as keyof typeof genderCodes] }}
@@ -74,7 +74,7 @@ if (props.data.responsible_doctor) {
</DE.Block>
</div>
<div>
<DE.Block mode="preview">
<DE.Block mode="preview" class="!mb-0">
<DE.Cell>
<DE.Label position="dynamic" class="font-semibold">Tgl. Masuk</DE.Label>
<DE.Colon />
@@ -99,7 +99,7 @@ if (props.data.responsible_doctor) {
</DE.Block>
</div>
<div>
<DE.Block mode="preview">
<DE.Block mode="preview" class="!mb-0">
<DE.Cell>
<DE.Label position="dynamic" class="font-semibold">DPJP</DE.Label>
<DE.Colon />
+41 -39
View File
@@ -87,44 +87,46 @@ function handleClick(value: string) {
</script>
<template>
<h2 class="mb-4 font-semibold md:text-base 2xl:text-lg">Menu Cepat:</h2>
<div class="flex flex-wrap gap-2 mb-2">
<Button
v-for="item in itemsOne"
:key="item.value"
:class="[
'flex items-center gap-2 rounded-lg border px-3 py-1 text-sm font-medium transition-colors',
activeMenu === item.value
? 'border-orange-300 bg-orange-400 text-white'
: 'border-orange-300 bg-white text-orange-500 hover:bg-orange-400 hover:text-white'
]"
@click="handleClick(item.value)"
>
<Icon v-if="item.type === 'icon'"
:name="item.icon"
class="h-4 w-4"
/>
<img v-else-if="item.type === 'image'" :src="item.icon" class="h-[24px] w-[24px] object-contain" />
{{ item.label }}
</Button>
</div>
<div class="flex flex-wrap gap-2 mb-2">
<Button
v-for="item in itemsTwo"
:key="item.value"
:class="[
'flex items-center gap-2 rounded-lg border px-3 py-1 text-sm font-medium transition-colors',
activeMenu === item.value
? 'border-orange-300 bg-orange-400 text-white'
: 'border-orange-300 bg-white text-orange-500 hover:bg-orange-400 hover:text-white'
]"
@click="handleClick(item.value)"
>
<Icon
:name="item.icon"
class="h-4 w-4"
/>
{{ item.label }}
</Button>
<div class="w-full py-3 2xl:py-4 px-5">
<h2 class="mb-2 font-semibold md:text-base 2xl:text-lg">Akses Cepat:</h2>
<div class="flex flex-wrap gap-2 mb-2">
<Button
v-for="item in itemsOne"
:key="item.value"
:class="[
'flex items-center gap-2 rounded-lg border px-3 py-1 text-sm font-medium transition-colors',
activeMenu === item.value
? 'border-orange-300 bg-orange-400 text-white'
: 'border-orange-300 bg-white text-orange-500 hover:bg-orange-400 hover:text-white'
]"
@click="handleClick(item.value)"
>
<Icon v-if="item.type === 'icon'"
:name="item.icon"
class="h-4 w-4"
/>
<img v-else-if="item.type === 'image'" :src="item.icon" class="h-[24px] w-[24px] object-contain" />
{{ item.label }}
</Button>
</div>
<div class="flex flex-wrap gap-2 mb-2">
<Button
v-for="item in itemsTwo"
:key="item.value"
:class="[
'flex items-center gap-2 rounded-lg border px-3 py-1 text-sm font-medium transition-colors',
activeMenu === item.value
? 'border-orange-300 bg-orange-400 text-white'
: 'border-orange-300 bg-white text-orange-500 hover:bg-orange-400 hover:text-white'
]"
@click="handleClick(item.value)"
>
<Icon
:name="item.icon"
class="h-4 w-4"
/>
{{ item.label }}
</Button>
</div>
</div>
</template>
@@ -31,12 +31,6 @@ function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void
<template>
<div v-if="data.length == 0" class="p-10 text-center">
<div class="mb-4 xl:mb-5">Belum Ada Data</div>
<div>
<Button>
<Icon name="i-lucide-plus" class="me-2 align-middle" />
Tambah Order
</Button>
</div>
</div>
<Table.Table>
<Table.TableHeader>
@@ -32,12 +32,6 @@ function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void
<template>
<div v-if="data.length == 0" class="p-10 text-center">
<div class="mb-4 xl:mb-5">Belum Ada Data</div>
<div>
<Button>
<Icon name="i-lucide-plus" class="me-2 align-middle" />
Tambah Order
</Button>
</div>
</div>
<template v-for="item, idx in data">
<div :class="'text-sm 2xl:text-base font-semibold ' + (item.status_code == 'new' ? 'mb-2' : 'mb-2')">
+14 -20
View File
@@ -43,6 +43,10 @@ import EncounterHistoryButtonMenu from '~/components/app/encounter/quick-shortcu
const props = defineProps<{
classCode: EncounterProps['classCode']
subClassCode?: EncounterProps['subClassCode']
canCreate?: boolean
canRead?: boolean
canUpdate?: boolean
canDelete?: boolean
}>()
// Common preparations
@@ -154,7 +158,7 @@ onMounted(async () => {
///// Functions
function handleClick(type: string) {
if (type === 'draft') {
router.back()
router.push(`/${props.classCode}/encounter`)
}
}
@@ -181,27 +185,13 @@ async function getData() {
<template>
<div class="w-full">
<div class="bg-white p-4 dark:bg-slate-800 2xl:p-5">
<div class="mb-4 flex">
<div>
<ContentNavBa
label="Kembali"
@click="handleClick"
/>
</div>
<!-- <div class="ms-auto pe-3 pt-1 text-end text-xl 2xl:text-2xl font-semibold">
Pasien: {{ data.patient.person.name }} --- No. RM: {{ data.patient.number }}
</div> -->
<div class="bg-white dark:bg-slate-800">
<div class="p-3 2xl:p-4 border-b border-slate-300 dark:border-slate-700">
<ContentNavBa label="Kembali Ke Daftar" @click="handleClick" />
</div>
<ContentSwitcher
:active="1"
:height="150"
>
<ContentSwitcher :active="1" class="h-[130px] 2xl:h-[160px]">
<template v-slot:content1>
<EncounterPatientInfo
v-if="isShowPatient"
:data="data"
/>
<EncounterPatientInfo v-if="isShowPatient" :data="data" />
</template>
<template v-slot:content2>
<EncounterHistoryButtonMenu v-if="isShowPatient" />
@@ -212,6 +202,10 @@ async function getData() {
:data="menus"
:initial-active-menu="activeMenu"
@change-menu="activeMenu = $event"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/>
</div>
</template>
+19 -11
View File
@@ -5,6 +5,7 @@ import { getValueLabelList as getEmployeeValueLabelList } from '~/services/emplo
import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service'
import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema'
import { CheckInSchema, CheckOutSchema } from '~/schemas/encounter.schema'
import { getEncounterData } from '~/handlers/encounter-process.handler'
//
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
@@ -18,10 +19,12 @@ import { checkIn } from '~/services/encounter.service'
//
const props = defineProps<{
encounter: Encounter
canUpdate?: boolean
}>()
// doctors
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'})
const localEncounter = ref<Encounter>(props.encounter)
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'}, true)
const employees = await getEmployeeValueLabelList({'includes': 'person', 'position-code': 'reg'})
const units = await getUnitValueLabelList()
@@ -32,7 +35,7 @@ const checkInValues = ref<any>({
// registeredAt: '',
})
const checkInIsLoading = ref(false)
const checkInIsReadonly = ref(false)
const checkInIsReadonly = ref(props.canUpdate )
const checkInDialogOpen = ref(false)
// check out
@@ -49,8 +52,15 @@ function editCheckIn() {
checkInDialogOpen.value = true
}
function submitCheckIn(values: CheckInFormData) {
checkIn(props.encounter.id, values)
async function submitCheckIn(values: CheckInFormData) {
const res = await checkIn(props.encounter.id, values)
if (res.success) {
checkInDialogOpen.value = false
const resEnc = await getEncounterData(props.encounter.id)
if (resEnc.success) {
localEncounter.value = resEnc.body.data
}
}
}
function editCheckOut() {
@@ -67,9 +77,8 @@ function submitCheckOut(values: CheckOutFormData) {
<div class="border-r lg:pe-4 xl:pe-5 mb-10">
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
<CheckInView
:encounter="encounter"
:is-loading="checkInIsLoading"
:is-readonly="checkInIsReadonly"
:encounter="localEncounter"
:can-update="canUpdate"
@edit="editCheckIn"
/>
</div>
@@ -77,9 +86,8 @@ function submitCheckOut(values: CheckOutFormData) {
<Separator class="lg:hidden my-4 xl:my-5" />
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
<CheckOutView
:encounter="encounter"
:is-loading="checkOutIsLoading"
:is-readonly="checkOutIsReadonly"
:encounter="localEncounter"
:can-update="canUpdate"
@edit="editCheckOut"
/>
</div>
@@ -122,4 +130,4 @@ function submitCheckOut(values: CheckOutFormData) {
@cancel="checkInDialogOpen = false"
/>
</Dialog>
</template>
</template>
@@ -1,40 +1,33 @@
<script setup lang="ts">
const props = defineProps<{
height?: number
class?: string
activeTab?: 1 | 2
}>()
const classVal = computed(() => {
return props.class ? props.class : ''
})
const activeTab = ref(props.activeTab || 1)
function handleClick(value: 1 | 2) {
activeTab.value = value
function switchActiveTab() {
activeTab.value = activeTab.value === 1 ? 2 : 1
}
</script>
<template>
<div class="content-switcher" :style="`height: ${height || 200}px`">
<div :class="`${activeTab === 1 ? 'active' : 'inactive'}`">
<div class="content-wrapper">
<div>
<slot name="content1" />
</div>
<div :class="`content-switcher ${classVal}`" :style="height ? `height:${200}px` : ''">
<div class="wrapper">
<div :class="`item item-1 ${activeTab === 1 ? 'active' : 'inactive'}`">
<slot name="content1" />
</div>
<div class="content-nav">
<button @click="handleClick(1)">
<Icon name="i-lucide-chevron-right" />
<div :class="`nav border-slate-300 ${ activeTab == 1 ? 'border-l' : 'border-r'}`">
<button @click="switchActiveTab()" class="!p-0 w-full h-full">
<Icon :name="activeTab == 1 ? 'i-lucide-chevron-left' : 'i-lucide-chevron-right'" class="text-3xl" />
</button>
</div>
</div>
<div :class="`${activeTab === 2 ? 'active' : 'inactive'}`">
<div class="content-nav">
<button @click="handleClick(2)">
<Icon name="i-lucide-chevron-left" />
</button>
</div>
<div class="content-wrapper">
<div>
<slot name="content2" />
</div>
<div :class="`item item-2 ${activeTab === 2 ? 'active' : 'inactive'}`">
<slot name="content2" />
</div>
</div>
</div>
@@ -42,45 +35,24 @@ function handleClick(value: 1 | 2) {
<style>
.content-switcher {
@apply flex overflow-hidden gap-3
@apply overflow-hidden
}
.content-switcher > * {
@apply border border-slate-300 rounded-md flex overflow-hidden
.wrapper {
@apply flex w-[200%] h-full
}
.item {
@apply w-[calc(50%-60px)]
}
.content-wrapper {
@apply p-4 2xl:p-5 overflow-hidden grow
.item-1.active {
@apply ms-0 transition-all duration-500 ease-in-out
}
.inactive .content-wrapper {
@apply p-0 w-0
.item-1.inactive {
@apply -ms-[calc(50%-60px)] transition-all duration-500 ease-in-out
}
.content-nav {
@apply h-full flex flex-row items-center justify-center content-center !text-2xl overflow-hidden
.nav {
@apply h-full w-[60px] flex flex-row items-center justify-center content-center !text-2xl overflow-hidden
}
.content-nav button {
@apply pt-2 px-2 h-full w-full
}
/* .content-switcher .inactive > .content-wrapper {
@apply w-0 p-0 opacity-0 transition-all duration-500 ease-in-out
} */
.content-switcher .inactive {
@apply w-16 transition-all duration-500 ease-in-out
}
.content-switcher .inactive > .content-nav {
@apply w-full transition-all duration-100 ease-in-out
}
.content-switcher .active {
@apply grow transition-all duration-500 ease-in-out
}
.content-switcher .active > .content-nav {
@apply w-0 transition-all duration-100 ease-in-out
}
/* .content-switcher .active > .content-wrapper {
@apply w-full delay-1000 transition-all duration-1000 ease-in-out
} */
</style>
+2 -2
View File
@@ -53,8 +53,8 @@ const settingClass = computed(() => {
'[&_.cell]:2xl:flex',
][getBreakpointIdx(props.cellFlexPoint)]
cls += ' [&_.label]:flex-shrink-0 ' + [
'[&_.label]:md:w-12 [&_.label]:xl:w-20',
'[&_.label]:md:w-16 [&_.label]:xl:w-24',
'[&_.label]:md:w-16 [&_.label]:xl:w-20',
'[&_.label]:md:w-20 [&_.label]:xl:w-24',
'[&_.label]:md:w-24 [&_.label]:xl:w-32',
'[&_.label]:md:w-32 [&_.label]:xl:w-40',
'[&_.label]:md:w-44 [&_.label]:xl:w-52',
+10 -1
View File
@@ -4,6 +4,10 @@ import { type EncounterItem } from "~/handlers/encounter-init.handler";
const props = defineProps<{
initialActiveMenu: string
data: EncounterItem[]
canCreate?: boolean
canRead?: boolean
canUpdate?: boolean
canDelete?: boolean
}>()
const activeMenu = ref(props.initialActiveMenu)
@@ -38,7 +42,12 @@ function changeMenu(value: string) {
class="flex-1 rounded-md border bg-white p-4 shadow-sm dark:bg-neutral-950">
<component
:is="data.find((m) => m.id === activeMenu)?.component"
v-bind="data.find((m) => m.id === activeMenu)?.props" />
v-bind="data.find((m) => m.id === activeMenu)?.props"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/>
</div>
</div>
</div>
+127 -7
View File
@@ -39,14 +39,134 @@ export const permissions: Record<string, Record<string, Permission[]>> = {
'emp|reg': ['C', 'R', 'U', 'D'],
},
'/ambulatory/encounter/[id]/process': {
'emp|doc': ['R', 'U'],
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R', 'U'],
'emp|miw': ['R', 'U'],
'emp|nut': ['R', 'U'],
'emp|pha': ['R', 'U'],
'emp|lab': ['R', 'U'],
'emp|rad': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=status': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=early-medical-assessment': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=fkr': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=education-assessment': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=general-consent': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=patient-amb-note': {
'emp|doc': ['R'],
'emp|nur': ['R', 'U'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=prescription': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=device-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=radiology-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=cp-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=micro-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/encounter/[id]/process?menu=pa-lab-order': {
'emp|doc': ['R', 'U'],
'emp|nur': ['R'],
'emp|thr': ['R'],
'emp|miw': ['R'],
'emp|nut': ['R'],
'emp|pha': ['R'],
'emp|lab': ['R'],
'emp|rad': ['R'],
},
'/ambulatory/consulation': {
'emp|doc': ['R'],
+38 -32
View File
@@ -82,7 +82,7 @@ const defaultKeys: Record<string, any> = {
consultation: 'consultation',
controlLetter: 'control-letter',
inpatientLetter: 'inpatient-letter',
kfr: 'kfr',
fkr: 'fkr',
refBack: 'reference-back',
screening: 'screening',
supportingDocument: 'supporting-document',
@@ -99,17 +99,19 @@ const defaultMenus: Record<string, any> = {
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
earlyNurseryAssessment: {
id: defaultKeys.earlyNurseryAssessment,
title: 'Pengkajian Awal Keperawatan',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
// NOTE : HIDDEN UNTIL IT IS READY
// earlyNurseryAssessment: {
// id: defaultKeys.earlyNurseryAssessment,
// title: 'Pengkajian Awal Keperawatan',
// classCode: ['ambulatory', 'emergency', 'inpatient'],
// unit: 'all',
// },
earlyMedicalAssessment: {
id: defaultKeys.earlyMedicalAssessment,
title: 'Pengkajian Awal Medis',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
afterId: 'early-medical-assessment',
},
earlyMedicalRehabAssessment: {
id: defaultKeys.earlyMedicalRehabAssessment,
@@ -118,20 +120,27 @@ const defaultMenus: Record<string, any> = {
unit: 'rehab',
afterId: defaultKeys.earlyMedicalAssessment,
},
functionAssessment: {
id: defaultKeys.functionAssessment,
title: 'Asesmen Fungsi',
classCode: ['ambulatory'],
unit: 'rehab',
afterId: defaultKeys.rehabMedicalAssessment,
},
therapyProtocol: {
id: defaultKeys.therapyProtocol,
classCode: ['ambulatory'],
title: 'Protokol Terapi',
unit: 'rehab',
afterId: defaultKeys.functionAssessment,
fkr: {
id: defaultKeys.fkr,
title: 'FKR',
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',
// },
chemotherapyProtocol: {
id: defaultKeys.chemotherapyProtocol,
title: 'Protokol Kemoterapi',
@@ -253,13 +262,7 @@ const defaultMenus: Record<string, any> = {
title: 'SPRI',
classCode: ['ambulatory', 'emergency'],
unit: 'all',
},
kfr: {
id: defaultKeys.kfr,
title: 'KFR',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
},
refBack: {
id: defaultKeys.refBack,
title: 'PRB',
@@ -449,9 +452,9 @@ export function injectComponents(id: string | number, data: EncounterListData, m
currentKeys.refBack['component'] = PrbListAsync
currentKeys.refBack['props'] = { encounter: data?.encounter }
}
if (currentKeys?.kfr) {
currentKeys.kfr['component'] = KfrListAsync
currentKeys.kfr['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
@@ -536,9 +539,12 @@ export function mapResponseToEncounter(result: any): any {
? result.visitDate
: result.registeredAt || result.patient?.registeredAt || null,
adm_employee_id: result.adm_employee_id || 0,
appointment_doctor_id: result.appointment_doctor_id || null,
responsible_doctor_id: result.responsible_doctor_id || null,
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,
+6 -2
View File
@@ -9,7 +9,11 @@ export async function getEncounterData(id: string | number) {
try {
const dataRes = await getDetail(id, {
includes:
'patient,patient-person,patient-person-addresses,unit,Appointment_Doctor,Appointment_Doctor-employee,Appointment_Doctor-employee-person,Responsible_Doctor,Responsible_Doctor-employee,Responsible_Doctor-employee-person',
'patient,patient-person,patient-person-addresses,unit,' +
'Adm_Employee,Adm_Employee,Adm_Employee-Person,' +
'Responsible_Nurse,Responsible_Nurse-Employee,Responsible_Nurse-Employee-Person,' +
'Appointment_Doctor,Appointment_Doctor-employee,Appointment_Doctor-employee-person,' +
'Responsible_Doctor,Responsible_Doctor-employee,Responsible_Doctor-employee-person',
})
const dataResBody = dataRes.body ?? null
const result = dataResBody?.data ?? null
@@ -29,4 +33,4 @@ export async function getEncounterData(id: string | number) {
data = null
}
return data
}
}
+1
View File
@@ -79,6 +79,7 @@ export const paymentTypes: Record<string, string> = {
jkmm: 'JKMM (Jaminan Kesehatan Mandiri)',
spm: 'SPM (Sistem Pembayaran Mandiri)',
pks: 'PKS (Pembiayaan Kesehatan Sosial)',
umum: 'Umum',
}
export const sepRefTypeCodes: Record<string, string> = {
+1 -1
View File
@@ -52,7 +52,7 @@ export function genEncounter(): Encounter {
patient: genPatient(),
registeredAt: '',
class_code: '',
unit_code: 0,
unit_code: '',
unit: genUnit(),
visitDate: '',
adm_employee_id: 0,
+2
View File
@@ -1,7 +1,9 @@
import { type Base, genBase } from "./_base"
import type { Employee } from "./employee"
export interface Nurse extends Base {
employee_id: number
employee?: Employee
ihs_number?: string
unit_id: number
infra_id: number
@@ -12,7 +12,7 @@ import Error from '~/components/pub/my-ui/error/error.vue'
// Apps
import Content from '~/components/content/encounter/process.vue'
const { getRouteTitle, getPageAccess } = usePageChecker()
const { getRouteTitle, getPageAccess, hasCreateAccess, hasReadAccess, hasUpdateAccess, hasDeleteAccess } = usePageChecker()
definePageMeta({
middleware: ['rbac'],
@@ -28,16 +28,32 @@ useHead({
})
// Preps role checking
const roleAccess: Record<string, Permission[]> = permissions['/ambulatory/encounter/[id]/process'] || {}
const hasAccess = getPageAccess(roleAccess, 'read')
const route = useRoute()
const menu = computed(() => route.query.menu as string | undefined)
const accessKey = computed(() => `/ambulatory/encounter/[id]/process` + (menu.value ? `?menu=${menu.value}` : ''))
const roleAccess: Record<string, Permission[]> = permissions[accessKey.value] || {}
const hasAccess = getPageAccess(roleAccess, 'read') || true
const canCreate = hasCreateAccess(roleAccess)
const canRead = hasReadAccess(roleAccess)
const canUpdate = hasUpdateAccess(roleAccess)
const canDelete = hasDeleteAccess(roleAccess)
</script>
<template>
<!--
{{ accessKey }}
{{ roleAccess }}
{{ hasAccess }}
{{ canUpdate }}
-->
<div v-if="hasAccess">
<Content class-code="ambulatory" />
<Content
class-code="ambulatory"
:can-create="canCreate"
:can-read="canRead"
:can-update="canUpdate"
:can-delete="canDelete"
/>
</div>
<Error
v-else
:status-code="403"
/>
<Error v-else :status-code="403" />
</template>
+3 -2
View File
@@ -4,8 +4,9 @@ import { InternalReferenceSchema } from './internal-reference.schema'
// Check In
const CheckInSchema = z.object({
// registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
responsible_doctor_id: z.number({ required_error: 'Dokter harus diisi' }).gt(0, 'Dokter harus diisi'),
adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
responsible_doctor_code: z.string({ required_error: 'Dokter harus diisi' }),
// adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
registeredAt: z.string({ required_error: 'waktu harus diisi' }),
})
type CheckInFormData = z.infer<typeof CheckInSchema>