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

No files matched your search

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