mv treatment-report to action-report based on encounter menu id list

This commit is contained in:
Khafid Prayoga
2025-12-03 17:38:15 +07:00
parent 8fa1f61b19
commit da26790513
26 changed files with 45 additions and 52 deletions
@@ -4,7 +4,7 @@ import { toTypedSchema } from '@vee-validate/zod'
import { type Duration, intervalToDuration } from 'date-fns'
// schema
import { type TreatmentReportFormData, TreatmentReportSchema } from '~/schemas/treatment-report.schema'
import { type ActionReportFormData, ActionReportSchema } from '~/schemas/action-report.schema'
// type
import type { Doctor } from '~/models/doctor'
@@ -34,7 +34,7 @@ import { SelectDoctor } from '~/components/app/doctor/fields'
// Helpers
// #region Props & Emits
interface FormData extends TreatmentReportFormData {
interface FormData extends ActionReportFormData {
_operationDuration: string
_anesthesiaDuration: string
}
@@ -71,10 +71,10 @@ const isReadonly = computed(() => {
return false
})
const formSchema = toTypedSchema(TreatmentReportSchema)
const formSchema = toTypedSchema(ActionReportSchema)
const { errors, handleSubmit, values, meta, resetForm, setFieldValue, setValues, validate } = useForm<FormData>({
name: 'treatmentReportForm',
name: 'encounterActionReportForm',
validationSchema: formSchema,
initialValues: props.initialValues ? props.initialValues : {},
validateOnMount: false,
@@ -141,7 +141,7 @@ watch(
setFieldValue('_operationDuration', formatTime(res))
},
{ immediate: true }
{ immediate: true },
)
watch(
@@ -163,7 +163,7 @@ watch(
setFieldValue('_anesthesiaDuration', formatTime(res))
},
{ immediate: true }
{ immediate: true },
)
// #endregion
</script>
@@ -4,7 +4,7 @@ import { format } from 'date-fns'
import { id } from 'date-fns/locale'
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import type { TreatmentReportData } from '~/components/app/treatment-report/sample'
import type { ActionReportData } from '~/components/app/action-report/sample'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-d.vue'))
export const config: Config = {
@@ -41,13 +41,13 @@ export const config: Config = {
parses: {
reportAt: (rec: unknown): unknown => {
const attr = (rec as TreatmentReportData).reportAt
const attr = (rec as ActionReportData).reportAt
const result = format(new Date(attr), 'd MMMM yyyy, HH:mm', { locale: id })
return result
},
operationAt: (rec: unknown): unknown => {
const attr = (rec as TreatmentReportData).operationAt
const attr = (rec as ActionReportData).operationAt
const result = format(new Date(attr), 'd MMMM yyyy', { locale: id })
return result
@@ -4,7 +4,7 @@ import { format } from 'date-fns'
import { id } from 'date-fns/locale'
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import type { TreatmentReportData } from '~/components/app/treatment-report/sample'
import type { ActionReportData } from '~/components/app/action-report/sample'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const config: Config = {
@@ -42,13 +42,13 @@ export const config: Config = {
parses: {
reportAt: (rec: unknown): unknown => {
const attr = (rec as TreatmentReportData).reportAt
const attr = (rec as ActionReportData).reportAt
const result = format(new Date(attr), 'd MMMM yyyy, HH:mm', { locale: id })
return result
},
operationAt: (rec: unknown): unknown => {
const attr = (rec as TreatmentReportData).operationAt
const attr = (rec as ActionReportData).operationAt
const result = format(new Date(attr), 'd MMMM yyyy', { locale: id })
return result
@@ -4,7 +4,7 @@ import { id } from 'date-fns/locale'
// type
import { type ProcedureSrc } from '~/models/procedure-src'
import { type TreatmentReportFormData } from '~/schemas/treatment-report.schema'
import { type ActionReportFormData } from '~/schemas/action-report.schema'
// componenets
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '~/components/pub/ui/accordion'
@@ -14,7 +14,7 @@ import ArrangementProcedurePicker from '~/components/app/therapy-protocol/picker
// #region Props & Emits
const props = defineProps<{
data: TreatmentReportFormData
data: ActionReportFormData
}>()
const emit = defineEmits<{
@@ -1,6 +1,6 @@
import { addWeeks, formatISO } from 'date-fns'
export type TreatmentReportData = {
export type ActionReportData = {
id: number
reportAt: string
operationAt: string
@@ -17,7 +17,7 @@ export type TreatmentReportData = {
asal: string
}
export const sampleRows: TreatmentReportData[] = [
export const sampleRows: ActionReportData[] = [
{
id: 1,
reportAt: formatISO(addWeeks(new Date(), -1)),
@@ -3,18 +3,18 @@ import mockData from './sample'
// type
import { genDoctor, type Doctor } from '~/models/doctor'
import type { TreatmentReportFormData } from '~/schemas/treatment-report.schema'
import type { ActionReportFormData } from '~/schemas/action-report.schema'
// components
import { toast } from '~/components/pub/ui/toast'
import AppTreatmentReportEntry from '~/components/app/treatment-report/entry-form.vue'
import AppActionReportEntry from '~/components/app/action-report/entry-form.vue'
import ArrangementProcedurePicker from '~/components/app/therapy-protocol/picker-dialog/arrangement-procedure/procedure-picker.vue'
// states
const route = useRoute()
const { mode, goBack } = useQueryCRUDMode('mode')
const { recordId } = useQueryCRUDRecordId('record-id')
const reportData = ref<TreatmentReportFormData>({} as unknown as TreatmentReportFormData)
const reportData = ref<ActionReportFormData>({} as unknown as ActionReportFormData)
const doctors = ref<Doctor[]>([])
const isLoading = ref<boolean>(false)
@@ -40,14 +40,14 @@ onMounted(async () => {
async function loadEntryForEdit(id: number | string) {
isLoading.value = true
const result = mockData
reportData.value = result as TreatmentReportFormData
reportData.value = result as ActionReportFormData
isLoading.value = false
isDataReady.value = true
}
</script>
<template>
<AppTreatmentReportEntry
<AppActionReportEntry
v-if="isDataReady"
:isLoading="isLoading"
:mode="entryMode"
@@ -72,7 +72,7 @@ async function loadEntryForEdit(id: number | string) {
sub-title="Pilih Prosedur"
/>
</template>
</AppTreatmentReportEntry>
</AppActionReportEntry>
<div
v-else
class="flex items-center justify-center p-8"
@@ -1,20 +1,20 @@
<script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import AppTreatmentReportList from '~/components/app/treatment-report/list.vue'
import AppTreatmentReportListHistory from '~/components/app/treatment-report/list-history.vue'
import AppActionReportList from '~/components/app/action-report/list.vue'
import AppActionReportListHistory from '~/components/app/action-report/list-history.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ButtonAction } from '~/components/pub/my-ui/form'
// config
import { config } from '~/components/app/treatment-report/list.cfg'
import { config } from '~/components/app/action-report/list.cfg'
// types
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import type { Encounter } from '~/models/encounter'
// Samples
import { sampleRows, type TreatmentReportData } from '~/components/app/treatment-report/sample'
import { sampleRows, type ActionReportData } from '~/components/app/action-report/sample'
import sampleReport from './sample'
// helpers
@@ -63,7 +63,7 @@ import {
// filter + pencarian sederhana (client-side)
const filtered = computed(() => {
const q = search.value.trim().toLowerCase()
return sampleRows.filter((r: TreatmentReportData) => {
return sampleRows.filter((r: ActionReportData) => {
if (q) {
return r.nama.toLowerCase().includes(q) || r.noRm.toLowerCase().includes(q) || r.dokter.toLowerCase().includes(q)
}
@@ -205,7 +205,7 @@ watch([recId, recAction], (newVal) => {
</div>
<div class="overflow-x-auto p-4">
<AppTreatmentReportList
<AppActionReportList
:data="filtered"
:pagination-meta="{
recordCount: 2,
@@ -230,7 +230,7 @@ watch([recId, recAction], (newVal) => {
}
"
>
<AppTreatmentReportListHistory
<AppActionReportListHistory
:data="filtered"
:pagination-meta="{
recordCount: 2,
@@ -2,11 +2,11 @@
import mockData from './sample'
// types
import { type TreatmentReportFormData } from '~/schemas/treatment-report.schema'
import { type ActionReportFormData } from '~/schemas/action-report.schema'
import { type Encounter } from '~/models/encounter'
// Components
import AppTreatmentReportPreview from '~/components/app/treatment-report/preview.vue'
import AppActionReportPreview from '~/components/app/action-report/preview.vue'
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
// #region Props & Emits
@@ -25,7 +25,7 @@ const props = defineProps<{
// #endregion
// #region State & Computed
const reportData = ref<TreatmentReportFormData | null>(null)
const reportData = ref<ActionReportFormData | null>(null)
const headerPrep: HeaderPrep = {
title: 'Detail Laporan Tindakan',
@@ -36,7 +36,7 @@ const headerPrep: HeaderPrep = {
// #region Lifecycle Hooks
onMounted(async () => {
reportData.value = mockData as unknown as TreatmentReportFormData
reportData.value = mockData as unknown as ActionReportFormData
})
// #endregion
@@ -46,7 +46,7 @@ onMounted(async () => {
// #region Utilities & event handlers
function onEdit() {
router.push({
name: 'treatment-report-id-edit',
name: 'action-report-id-edit',
params: { id: 100 },
})
}
@@ -58,7 +58,7 @@ function onBack() {}
</script>
<template>
<AppTreatmentReportPreview
<AppActionReportPreview
v-if="reportData"
:data="reportData"
@back="backToList"
+2 -2
View File
@@ -29,7 +29,7 @@ import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
import Radiology from '~/components/content/radiology-order/main.vue'
import Consultation from '~/components/content/consultation/list.vue'
import Cprj from '~/components/content/cprj/entry.vue'
import TreatmentReport from '~/components/content/treatment-report/entry.vue'
import ActionReport from '~/components/content/action-report/entry.vue'
import DocUploadList from '~/components/content/document-upload/list.vue'
import GeneralConsentList from '~/components/content/general-consent/entry.vue'
import ResumeList from '~/components/content/resume/list.vue'
@@ -115,7 +115,7 @@ const protocolRows = [
value: 'report',
label: 'Laporan Tindakan',
groups: ['ambulatory', 'rehabilitation', 'chemotherapy'],
component: TreatmentReport,
component: ActionReport,
props: { encounter: data },
},
{
+6 -13
View File
@@ -47,7 +47,7 @@ const DocUploadListAsync = defineAsyncComponent(() => import('~/components/conte
const GeneralConsentListAsync = defineAsyncComponent(() => import('~/components/content/general-consent/entry.vue'))
const ResumeListAsync = defineAsyncComponent(() => import('~/components/content/resume/list.vue'))
const ControlLetterListAsync = defineAsyncComponent(() => import('~/components/content/control-letter/list.vue'))
const TreatmentReportEntryAsync = defineAsyncComponent(() => import('~/components/content/treatment-report/entry.vue'))
const ActionReportEntryAsync = defineAsyncComponent(() => import('~/components/content/action-report/entry.vue'))
const defaultKeys: Record<string, any> = {
status: {
@@ -247,12 +247,6 @@ const defaultKeys: Record<string, any> = {
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
treatmentReport: {
id: 'treatment-report',
title: 'Laporan Tindakan',
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
}
export function getItemsByClassCode(classCode: string, items: EncounterItem[]) {
@@ -413,15 +407,14 @@ export function injectComponents(id: string | number, data: EncounterListData, m
currentKeys.priceList['props'] = { encounter_id: id }
}
if (currentKeys?.treatmentReport) {
currentKeys.treatmentReport['component'] = TreatmentReportEntryAsync
currentKeys.treatmentReport['props'] = {
if (currentKeys?.actionReport) {
currentKeys.actionReport['component'] = ActionReportEntryAsync
currentKeys.actionReport['props'] = {
encounter: data?.encounter,
type: 'treatment-report',
label: currentKeys.treatmentReport['title'],
type: 'action-report',
label: currentKeys.actionReport['title'],
}
}
return currentKeys
}
@@ -105,7 +105,7 @@ const TissueNoteSchema = z.object({
.optional(),
})
export const TreatmentReportSchema = z.object({
export const ActionReportSchema = z.object({
operatorTeam: OperatorTeamSchema,
procedures: z.array(ProcedureSchema).min(1, { message: 'Silahkan pilih prosedur' }),
@@ -118,4 +118,4 @@ export const TreatmentReportSchema = z.object({
tissueNotes: z.array(TissueNoteSchema).optional(),
})
export type TreatmentReportFormData = z.infer<typeof TreatmentReportSchema>
export type ActionReportFormData = z.infer<typeof ActionReportSchema>