Merge branch 'dev' of github.com:dikstub-rssa/simrs-fe into feat/patient-63-adjustment
This commit is contained in:
@@ -7,8 +7,12 @@ import { ActionEvents } from '~/components/pub/my-ui/data/types'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import * as CH from '~/components/pub/my-ui/content-header'
|
||||
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'
|
||||
|
||||
// Constants
|
||||
import { paymentTypes, sepRefTypeCodes } from '~/lib/constants.vclaim'
|
||||
|
||||
// App libs
|
||||
import { getServicePosition } from '~/lib/roles' // previously getPositionAs
|
||||
|
||||
@@ -18,6 +22,10 @@ import {
|
||||
remove as removeEncounter,
|
||||
cancel as cancelEncounter,
|
||||
} from '~/services/encounter.service'
|
||||
import { getValueLabelList as getUnits } from '~/services/unit.service'
|
||||
|
||||
// Handlers
|
||||
import { uploadAttachmentCustom } from '~/handlers/supporting-document.handler'
|
||||
|
||||
// Apps
|
||||
import Content from '~/components/app/encounter/list.vue'
|
||||
@@ -53,9 +61,16 @@ const isLoading = reactive<DataTableLoader>({
|
||||
const recId = ref<number>(0)
|
||||
const recAction = ref<string>('')
|
||||
const recItem = ref<any>(null)
|
||||
const recSepId = ref<number>(0)
|
||||
const recSepMenu = ref<string>('')
|
||||
const recSepSubMenu = ref<string>('')
|
||||
const isFilterFormDialogOpen = ref(false)
|
||||
const isRecordConfirmationOpen = ref(false)
|
||||
const isRecordCancelOpen = ref(false)
|
||||
const uploadFile = ref<any>(null)
|
||||
const payments = ref<any>([])
|
||||
const units = ref<any>([])
|
||||
const sepsList = ref<any>([])
|
||||
|
||||
// Headers
|
||||
const hreaderPrep: CH.Config = {
|
||||
@@ -72,36 +87,14 @@ if (!props.canCreate) {
|
||||
delete hreaderPrep.addNav
|
||||
}
|
||||
|
||||
// Filters
|
||||
const filter = ref<{
|
||||
installation: {
|
||||
msg: {
|
||||
placeholder: string
|
||||
}
|
||||
items: {
|
||||
value: string
|
||||
label: string
|
||||
code: string
|
||||
}[]
|
||||
}
|
||||
schema: any
|
||||
initialValues?: Partial<any>
|
||||
errors?: any
|
||||
}>({
|
||||
installation: {
|
||||
msg: {
|
||||
placeholder: 'Pilih',
|
||||
},
|
||||
items: [],
|
||||
},
|
||||
schema: {},
|
||||
})
|
||||
|
||||
// Recrod reactivities
|
||||
provide('activeServicePosition', activeServicePosition)
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
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)
|
||||
|
||||
watch(getActiveRole, (role?: string) => {
|
||||
@@ -129,15 +122,50 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
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(async () => {
|
||||
getPatientList()
|
||||
units.value = await getUnits({}, true)
|
||||
payments.value = Object.keys(paymentTypes).map((item) => ({
|
||||
value: item.toString(),
|
||||
label: paymentTypes[item],
|
||||
})) as any
|
||||
sepsList.value = Object.keys(sepRefTypeCodes).map((item) => ({
|
||||
value: item.toString(),
|
||||
label: sepRefTypeCodes[item],
|
||||
})) as any
|
||||
})
|
||||
|
||||
/////// Functions
|
||||
async function getPatientList() {
|
||||
isLoading.isTableLoading = true
|
||||
const includesParams =
|
||||
'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'
|
||||
const includesParamsArrays = [
|
||||
'patient',
|
||||
'patient-person',
|
||||
'patient-person-addresses',
|
||||
'Appointment_Doctor',
|
||||
'Appointment_Doctor-employee',
|
||||
'Appointment_Doctor-employee-person',
|
||||
'Responsible_Doctor',
|
||||
'Responsible_Doctor-employee',
|
||||
'Responsible_Doctor-employee-person',
|
||||
'EncounterDocuments',
|
||||
'unit',
|
||||
'vclaimReference', // vclaimReference | vclaimSep
|
||||
]
|
||||
const includesParams = includesParamsArrays.join(',')
|
||||
data.value = []
|
||||
try {
|
||||
const params: any = { includes: includesParams, ...filterParams.value }
|
||||
@@ -159,15 +187,92 @@ async function getPatientList() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleUploadFile(id: number, menu: string) {
|
||||
uploadFile.value = null
|
||||
const fileInput: HTMLInputElement | undefined | null = document
|
||||
.getElementById('uploadFile')
|
||||
?.querySelector("input[type='file']")
|
||||
if (fileInput) {
|
||||
fileInput.value = ''
|
||||
fileInput.click()
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUploadFileSubmit() {
|
||||
const files = uploadFile.value
|
||||
if (!uploadFile.value || files.length === 0) {
|
||||
recSepId.value = 0
|
||||
recSepMenu.value = ''
|
||||
recSepSubMenu.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',
|
||||
})
|
||||
}
|
||||
recSepId.value = 0
|
||||
recSepMenu.value = ''
|
||||
recSepSubMenu.value = ''
|
||||
}
|
||||
|
||||
function handleViewFile(id: number, menu: string, subMenu: string) {
|
||||
const currentData: any = data.value.find((item: any) => Number(item.id) === Number(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 }) {
|
||||
filterParams.value = {
|
||||
'person-name': filters.personName,
|
||||
// 'person-name': filters.personName,
|
||||
'patient-identifier': filters.personName,
|
||||
'start-date': filters.startDate,
|
||||
'end-date': filters.endDate,
|
||||
}
|
||||
getPatientList()
|
||||
}
|
||||
|
||||
function handleFilterReset() {
|
||||
isFilterFormDialogOpen.value = false
|
||||
filterParams.value = {}
|
||||
getPatientList()
|
||||
}
|
||||
|
||||
function handleFilterSearch(filters: any) {
|
||||
isFilterFormDialogOpen.value = false
|
||||
filterParams.value = { ...filterParams.value, ...filters }
|
||||
getPatientList()
|
||||
}
|
||||
|
||||
// Handle confirmation result
|
||||
async function handleConfirmCancel(record: any, action: string) {
|
||||
if (action === 'deactivate' && record?.id) {
|
||||
@@ -263,23 +368,34 @@ function handleRemoveConfirmation() {
|
||||
<CH.ContentHeader v-bind="hreaderPrep">
|
||||
<FilterNav
|
||||
:active-positon="activeServicePosition"
|
||||
:enable-export="false"
|
||||
@apply="handleFilterApply"
|
||||
@click="() => (isFilterFormDialogOpen = true)"
|
||||
@onExportPdf="() => {}"
|
||||
@onExportExcel="() => {}"
|
||||
@nExportCsv="() => {}"
|
||||
/>
|
||||
</CH.ContentHeader>
|
||||
|
||||
<Content :data="data" />
|
||||
<Content
|
||||
:data="data"
|
||||
:class-code="classCode"
|
||||
/>
|
||||
|
||||
<!-- Filter -->
|
||||
<Dialog
|
||||
v-model:open="isFilterFormDialogOpen"
|
||||
title="Filter"
|
||||
title="Filter Data"
|
||||
size="lg"
|
||||
prevent-outside
|
||||
>
|
||||
<FilterForm v-bind="filter" />
|
||||
<FilterForm
|
||||
:payments="payments"
|
||||
:units="units"
|
||||
:visits="sepsList"
|
||||
@search="handleFilterSearch"
|
||||
@reset="handleFilterReset"
|
||||
/>
|
||||
</Dialog>
|
||||
|
||||
<!-- Batal -->
|
||||
@@ -340,4 +456,15 @@ function handleRemoveConfirmation() {
|
||||
>
|
||||
Hak akses tidak memenuhi kriteria untuk proses ini.
|
||||
</Dialog>
|
||||
|
||||
<FileUpload
|
||||
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>
|
||||
|
||||
@@ -9,7 +9,7 @@ import RehabForm from './form-rehab.vue'
|
||||
import FunctionForm from './form-function.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const type = computed(() => (route.query.tab as string) || 'early-medical-assessment')
|
||||
const type = computed(() => (route.query.menu as string) || 'early-medical-assessment')
|
||||
|
||||
const { mode, goToEntry, backToList } = useQueryCRUDMode('mode')
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import { EarlyRehabSchema } from '~/schemas/soapi.schema'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handler'
|
||||
const { backToList } = useQueryMode('mode')
|
||||
|
||||
const { backToList } = useQueryCRUDMode('mode')
|
||||
const { recordId } = useQueryCRUDRecordId('record-id')
|
||||
|
||||
const route = useRoute()
|
||||
const isOpenProcedure = ref(false)
|
||||
@@ -66,6 +68,7 @@ const model = ref({
|
||||
weight: '',
|
||||
height: '',
|
||||
})
|
||||
const formKey = ref(0)
|
||||
|
||||
const isLoading = reactive<DataTableLoader>({
|
||||
isTableLoading: false,
|
||||
@@ -89,9 +92,23 @@ async function getProcedures() {
|
||||
isLoading.isTableLoading = false
|
||||
}
|
||||
|
||||
async function getDetail() {
|
||||
isLoading.isTableLoading = true
|
||||
const resp = await xfetch(`/api/v1/soapi/${recordId.value}`)
|
||||
if (resp.success) {
|
||||
const raw = (resp.body as Record<string, any>).data
|
||||
const values = JSON.parse(raw.value)
|
||||
console.log('values', values)
|
||||
model.value = values
|
||||
formKey.value++ // Force re-render with new data
|
||||
}
|
||||
isLoading.isTableLoading = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProcedures()
|
||||
getDiagnoses()
|
||||
getDetail()
|
||||
})
|
||||
|
||||
function handleOpen(type: string) {
|
||||
@@ -146,6 +163,7 @@ provide('icdPreview', icdPreview)
|
||||
</script>
|
||||
<template>
|
||||
<Entry
|
||||
:key="formKey"
|
||||
ref="entryRehabRef"
|
||||
v-model="model"
|
||||
:schema="schema"
|
||||
|
||||
@@ -9,7 +9,7 @@ import { toast } from '~/components/pub/ui/toast'
|
||||
import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handler'
|
||||
|
||||
const { goToEntry, backToList } = useQueryCRUDMode('mode')
|
||||
const { recordId } = useQueryCRUDMode('record-id')
|
||||
const { recordId } = useQueryCRUDRecordId('record-id')
|
||||
const route = useRoute()
|
||||
const isOpenProcedure = ref(false)
|
||||
const isOpenDiagnose = ref(false)
|
||||
@@ -44,12 +44,26 @@ const model = ref({
|
||||
const isLoading = reactive<DataTableLoader>({
|
||||
isTableLoading: false,
|
||||
})
|
||||
const formKey = ref(0)
|
||||
|
||||
async function getDiagnoses() {
|
||||
async function getDetail() {
|
||||
isLoading.isTableLoading = true
|
||||
const resp = await xfetch(`/api/v1/soapi/${recordId}`)
|
||||
const resp = await xfetch(`/api/v1/soapi/${recordId.value}`)
|
||||
if (resp.success) {
|
||||
diagnoses.value = (resp.body as Record<string, any>).data
|
||||
const raw = (resp.body as Record<string, any>).data
|
||||
const values = JSON.parse(raw.value)
|
||||
console.log('values', values)
|
||||
model.value = values
|
||||
formKey.value++ // Force re-render with new data
|
||||
}
|
||||
isLoading.isTableLoading = false
|
||||
}
|
||||
|
||||
async function getDiagnose() {
|
||||
isLoading.isTableLoading = true
|
||||
const resp = await xfetch('/api/v1/diagnose-src')
|
||||
if (resp.success) {
|
||||
procedures.value = (resp.body as Record<string, any>).data
|
||||
}
|
||||
isLoading.isTableLoading = false
|
||||
}
|
||||
@@ -64,8 +78,7 @@ async function getProcedures() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProcedures()
|
||||
getDiagnoses()
|
||||
getDetail()
|
||||
})
|
||||
|
||||
function handleOpen(type: string) {
|
||||
@@ -125,6 +138,7 @@ provide('icdPreview', icdPreview)
|
||||
</script>
|
||||
<template>
|
||||
<Entry
|
||||
:key="formKey"
|
||||
ref="entryRef"
|
||||
v-model="model"
|
||||
:schema="schema"
|
||||
|
||||
@@ -64,7 +64,7 @@ const hreaderPrep: HeaderPrep = {
|
||||
},
|
||||
}
|
||||
|
||||
const type = computed(() => (route.query.tab as string) || 'early-medical-assessment')
|
||||
const type = computed(() => (route.query.menu as string) || 'early-medical-assessment')
|
||||
|
||||
onMounted(async () => {
|
||||
await getMyList()
|
||||
|
||||
Reference in New Issue
Block a user