feat: Implement encounter list views with new configurations, vclaim SEP/SIPP document handling, and initial encounter entry forms.

This commit is contained in:
riefive
2025-12-08 14:02:41 +07:00
parent 53b40ec732
commit 703d3f902a
6 changed files with 139 additions and 11 deletions

No files matched your search

@@ -43,7 +43,7 @@ const emit = defineEmits<{
}>() }>()
// Validation schema // Validation schema
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationEncounterFormData>({ const { handleSubmit, errors, defineField, meta } = useForm<any>({
validationSchema: toTypedSchema(IntegrationEncounterSchema), validationSchema: toTypedSchema(IntegrationEncounterSchema),
}) })
@@ -141,7 +141,7 @@ function onAddSep() {
registerDate: registerDate.value, registerDate: registerDate.value,
cardNumber: cardNumber.value, cardNumber: cardNumber.value,
paymentType: paymentType.value, paymentType: paymentType.value,
sepType: sepType.value sepType: sepType.value,
} }
emit('event', 'add-sep', formValues) emit('event', 'add-sep', formValues)
} }
@@ -454,7 +454,7 @@ defineExpose({
name="i-lucide-loader-2" name="i-lucide-loader-2"
class="h-4 w-4 animate-spin" class="h-4 w-4 animate-spin"
/> />
<Icon <Icon
v-else v-else
name="i-lucide-plus" name="i-lucide-plus"
class="h-4 w-4" class="h-4 w-4"
+3 -3
View File
@@ -147,7 +147,8 @@ export const ambulatoryConfig: Config = {
parses: { parses: {
registeredAt: (rec: unknown): unknown => { registeredAt: (rec: unknown): unknown => {
const recX = rec as Encounter const recX = rec as Encounter
return recX.registeredAt ? (recX.registeredAt as string).substring(0, 10) : '-' const currentDate = recX.registeredAt ? (recX.registeredAt as string) : (recX as any).createdAt
return currentDate ? currentDate.substring(0, 10) : '-'
}, },
patientNumber: (rec: unknown): unknown => { patientNumber: (rec: unknown): unknown => {
const recX = rec as any const recX = rec as any
@@ -194,10 +195,9 @@ export const ambulatoryConfig: Config = {
}, },
components: { components: {
sep(rec, idx) { sep(rec) {
const res: RecComponent = { const res: RecComponent = {
rec: rec as object, rec: rec as object,
idx,
component: vclaimSepInfo, component: vclaimSepInfo,
} }
return res return res
@@ -1,33 +1,75 @@
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ const props = defineProps<{
rec: any rec: any
idx: number
}>() }>()
const recSepId = inject<Ref<number>>('rec_sep_id')!
const recSepMenu = inject<Ref<string>>('rec_sep_menu')!
const recSepSubMenu = inject<Ref<string>>('rec_sep_sub_menu')!
const sepFileReview = ref<any>({})
const sippFileReview = ref<any>({})
const getEncounterDocument = () => {
const encounter = props.rec
if (encounter.encounterDocuments && Array.isArray(encounter.encounterDocuments)) {
for (const doc of encounter.encounterDocuments) {
if (doc.type_code === 'vclaim-sep') {
sepFileReview.value = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
} else if (doc.type_code === 'vclaim-sipp') {
sippFileReview.value = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
}
}
}
}
function handleSepView(menu: string, subMenu: string) {
recSepId.value = props.rec.id || 0
recSepMenu.value = menu
recSepSubMenu.value = subMenu
}
onMounted(() => {
getEncounterDocument()
})
</script> </script>
<template> <template>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<Button <Button
variant="ghost" variant="outline"
type="button" type="button"
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50" class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
@click="handleSepView('sipp', sippFileReview.id ? 'edit' : 'view')"
> >
<Icon <Icon
v-if="sippFileReview.id"
name="i-lucide-eye" name="i-lucide-eye"
class="h-5 w-5" class="h-5 w-5"
/> />
Lihat SIPP <Icon
v-else
name="i-lucide-upload"
class="h-5 w-5"
/>
{{ sippFileReview.id ? 'Lihat SIPP' : 'Upload File SIPP' }}
</Button> </Button>
<Button <Button
variant="ghost" variant="outline"
type="button" type="button"
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50" class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
@click="handleSepView('sep', sepFileReview.id ? 'edit' : 'view')"
> >
<Icon <Icon
v-if="sepFileReview.id"
name="i-lucide-eye" name="i-lucide-eye"
class="h-5 w-5" class="h-5 w-5"
/> />
Lihat SEP <Icon
v-else
name="i-lucide-upload"
class="h-5 w-5"
/>
{{ sepFileReview.id ? 'Lihat SEP' : 'Upload File SEP' }}
</Button> </Button>
</div> </div>
</template> </template>
+85
View File
@@ -7,6 +7,7 @@ import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue' import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import * as CH from '~/components/pub/my-ui/content-header' import * as CH from '~/components/pub/my-ui/content-header'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue' import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import FileUpload from '~/components/pub/my-ui/form/file-field.vue'
import { useSidebar } from '~/components/pub/ui/sidebar/utils' import { useSidebar } from '~/components/pub/ui/sidebar/utils'
// App libs // App libs
@@ -19,6 +20,9 @@ import {
cancel as cancelEncounter, cancel as cancelEncounter,
} from '~/services/encounter.service' } from '~/services/encounter.service'
// Handlers
import { uploadAttachmentCustom } from '~/handlers/supporting-document.handler'
// Apps // Apps
import Content from '~/components/app/encounter/list.vue' import Content from '~/components/app/encounter/list.vue'
import FilterNav from '~/components/app/encounter/filter-nav.vue' import FilterNav from '~/components/app/encounter/filter-nav.vue'
@@ -53,9 +57,13 @@ const isLoading = reactive<DataTableLoader>({
const recId = ref<number>(0) const recId = ref<number>(0)
const recAction = ref<string>('') const recAction = ref<string>('')
const recItem = ref<any>(null) const recItem = ref<any>(null)
const recSepId = ref<number>(0)
const recSepMenu = ref<string>('')
const recSepSubMenu = ref<string>('')
const isFilterFormDialogOpen = ref(false) const isFilterFormDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false) const isRecordConfirmationOpen = ref(false)
const isRecordCancelOpen = ref(false) const isRecordCancelOpen = ref(false)
const uploadFile = ref<any>(null)
// Headers // Headers
const hreaderPrep: CH.Config = { const hreaderPrep: CH.Config = {
@@ -102,6 +110,9 @@ provide('activeServicePosition', activeServicePosition)
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('rec_sep_id', recSepId)
provide('rec_sep_menu', recSepMenu)
provide('rec_sep_sub_menu', recSepSubMenu)
provide('table_data_loader', isLoading) provide('table_data_loader', isLoading)
watch(getActiveRole, (role?: string) => { watch(getActiveRole, (role?: string) => {
@@ -129,6 +140,19 @@ watch(
}, },
) )
watch([recSepId, recSepMenu, recSepSubMenu], (value) => {
const id = value[0]
const menu = value[1]
const subMenu = value[2]
if (!id) return
if (subMenu === 'view') {
handleViewFile(id, menu, subMenu)
}
if (subMenu === 'edit') {
handleUploadFile(id, menu)
}
})
onMounted(() => { onMounted(() => {
getPatientList() getPatientList()
}) })
@@ -172,6 +196,55 @@ async function getPatientList() {
} }
} }
function handleUploadFile(id: number, menu: string) {
uploadFile.value = null
document.getElementById('uploadFile')?.click()
}
async function handleUploadFileSubmit() {
if (!uploadFile.value) return
const result = await uploadAttachmentCustom({
file: uploadFile.value,
refId: recSepId.value,
entityTypeCode: 'encounter',
type: recSepMenu.value === 'sep' ? 'vclaim-sep' : 'vclaim-sipp',
})
if (result.success) {
toast({
title: 'Berhasil',
description: 'File berhasil diunggah',
variant: 'default',
})
await getPatientList()
} else {
toast({
title: 'Gagal',
description: 'File gagal diunggah',
variant: 'destructive',
})
}
}
function handleViewFile(id: number, menu: string, subMenu: string) {
const currentData: any = data.value.find((item: any) => item.id === id)
if (!currentData) return
let fileReviewSep: any = null
let fileReviewSipp: any = null
for (const doc of currentData.encounterDocuments) {
if (doc.type_code === 'vclaim-sep') {
fileReviewSep = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
} else if (doc.type_code === 'vclaim-sipp') {
fileReviewSipp = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
}
}
if (fileReviewSep && menu === 'sep' && subMenu === 'view') {
window.open(fileReviewSep.filePath, '_blank')
}
if (fileReviewSipp && menu === 'sipp' && subMenu === 'view') {
window.open(fileReviewSipp.filePath, '_blank')
}
}
function handleFilterApply(filters: { personName: string; startDate: string; endDate: string }) { function handleFilterApply(filters: { personName: string; startDate: string; endDate: string }) {
filterParams.value = { filterParams.value = {
'person-name': filters.personName, 'person-name': filters.personName,
@@ -356,4 +429,16 @@ function handleRemoveConfirmation() {
> >
Hak akses tidak memenuhi kriteria untuk proses ini. Hak akses tidak memenuhi kriteria untuk proses ini.
</Dialog> </Dialog>
<FileUpload
id="uploadFile"
class="hidden"
field-name="uploadFile"
label="Dokumen"
placeholder="Pilih file"
:accept="['pdf', 'jpg', 'png']"
:max-size-mb="1"
v-model="uploadFile"
@file-selected="handleUploadFileSubmit"
/>
</template> </template>
@@ -27,6 +27,7 @@ export async function uploadAttachmentCustom(payload: any) {
const { user } = useUserStore() const { user } = useUserStore()
const formData = new FormData() const formData = new FormData()
formData.append('code', payload.type)
formData.append('content', payload.file) formData.append('content', payload.file)
formData.append('entityType_code', payload.entityTypeCode) formData.append('entityType_code', payload.entityTypeCode)
formData.append('type_code', payload.type) formData.append('type_code', payload.type)