Merge pull request #155 from dikstub-rssa/feat/radiology-order-54
Feat/radiology order 54
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||||
|
const input = defineAsyncComponent(() => import('~/components/pub/ui/input/Input.vue'))
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}, { classVal: '!p-0.5' }, { width: 50 }],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Jenis' },
|
||||||
|
{ label: 'Catatan' },
|
||||||
|
{ label: '' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['mcuSrc.name', 'mcuSrc.mcuSrcCategory.name', 'note'],
|
||||||
|
|
||||||
|
delKeyNames: [
|
||||||
|
{ key: 'mcuSrc.name', label: 'Nama' },
|
||||||
|
],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
note(rec, idx) {
|
||||||
|
return {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: input,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action(rec, idx) {
|
||||||
|
return {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: action,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
htmls: {},
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { config } from './list-entry.cfg'
|
||||||
|
import type { McuOrderItem } from '~/models/mcu-order-item';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: McuOrderItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
requestItem: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<PubMyUiDataTable class="border mb-3 2xl:mb-4"
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
/>
|
||||||
|
<div class="-mx-1 [&_button]:mx-1">
|
||||||
|
<Button @click="emit('requestItem')">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Pilih Item
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Jenis' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['mcuSrc.name', 'mcuSrcCategory.name'],
|
||||||
|
|
||||||
|
delKeyNames: [
|
||||||
|
{ key: 'mcuSrc.name', label: 'Nama' },
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { McuOrderItem } from '~/models/mcu-order-item';
|
||||||
|
import { config } from './list.cfg'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: McuOrderItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
tambah: [mode: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<PubMyUiDataTable class="border"
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { McuOrder } from '~/models/mcu-order';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: McuOrder
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="text-sm 2xl:text-base font-semibold mb-3">
|
||||||
|
Order {{ data?.createdAt?.substring(0, 10) }} - {{ data.status_code }}
|
||||||
|
</div>
|
||||||
|
<div class="max-w-[1000px]">
|
||||||
|
<DE.Block mode="preview" :col-count=5 class="!mb-3">
|
||||||
|
<DE.Cell :col-span="2">
|
||||||
|
<DE.Label class="font-semibold">DPJP</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
{{ data?.doctor?.employee?.person?.name || '.........' }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell></DE.Cell>
|
||||||
|
<DE.Cell :col-span="2">
|
||||||
|
<DE.Label class="font-semibold">PPDS</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
...........
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry';
|
||||||
|
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||||
|
import Nav from '~/components/pub/my-ui/nav-footer/ca-ed-su.vue'
|
||||||
|
|
||||||
|
import type { McuOrder } from '~/models/mcu-order';
|
||||||
|
import McuOrderItems from '~/components/app/mcu-order-item/list.vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: McuOrder[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
cancel: [data: any]
|
||||||
|
edit: [data: any],
|
||||||
|
submit: [data: any]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function navClick(type: 'cancel' | 'edit' | 'submit', data: McuOrder): void {
|
||||||
|
if (type === 'cancel') {
|
||||||
|
emit('cancel', data)
|
||||||
|
} else if (type === 'edit') {
|
||||||
|
emit('edit', data)
|
||||||
|
} else if (type === 'submit') {
|
||||||
|
emit('submit', data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="data.length == 0" class="p-10 text-center">
|
||||||
|
<div class="mb-4 xl:mb-5">Belum Ada Data</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')">
|
||||||
|
Order #{{ data.length - idx }} - {{ item.createdAt?.substring(0, 10) }} - {{ item.status_code }}
|
||||||
|
</div>
|
||||||
|
<DE.Block mode="preview" :col-count=7 class="!mb-3">
|
||||||
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">DPJP</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
{{ item.doctor?.employee?.person?.name || '........' }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">PPDS</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
...........
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<div class="flex justify-end" >
|
||||||
|
<Nav
|
||||||
|
v-if="item.status_code == 'new'"
|
||||||
|
:small-mode="true"
|
||||||
|
:default-class="'flex gap-1'"
|
||||||
|
@click="(type) => { navClick(type, item) }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</DE.Block>
|
||||||
|
<McuOrderItems :data="item.items || []" @click="console.log('click')" class="!mb-5" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry';
|
||||||
|
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||||
|
import Nav from '~/components/pub/my-ui/nav-footer/ca-ed-su.vue'
|
||||||
|
|
||||||
|
import type { McuOrder } from '~/models/mcu-order';
|
||||||
|
import McuOrderItems from '~/components/app/mcu-order-item/list.vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: McuOrder[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
cancel: [data: any]
|
||||||
|
edit: [data: any],
|
||||||
|
submit: [data: any]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function navClick(type: 'cancel' | 'edit' | 'submit', data: McuOrder): void {
|
||||||
|
if (type === 'cancel') {
|
||||||
|
emit('cancel', data)
|
||||||
|
} else if (type === 'edit') {
|
||||||
|
emit('edit', data)
|
||||||
|
} else if (type === 'submit') {
|
||||||
|
emit('submit', data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="data.length == 0" class="p-10 text-center">
|
||||||
|
<div class="mb-4 xl:mb-5">Belum Ada Data</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')">
|
||||||
|
Order #{{ data.length - idx }} - {{ item.createdAt?.substring(0, 10) }} - {{ item.status_code }}
|
||||||
|
</div>
|
||||||
|
<DE.Block mode="preview" :col-count=7 class="!mb-3">
|
||||||
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">DPJP</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
{{ item.doctor?.employee?.person?.name || '........' }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">PPDS</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
...........
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<div class="flex justify-end" >
|
||||||
|
<Nav
|
||||||
|
v-if="item.status_code == 'new'"
|
||||||
|
:small-mode="true"
|
||||||
|
:default-class="'flex gap-1'"
|
||||||
|
@click="(type) => { navClick(type, item) }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</DE.Block>
|
||||||
|
<McuOrderItems :data="item.items || []" @click="console.log('click')" class="!mb-5" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { McuSrcCategory } from '~/models/mcu-src-category';
|
||||||
|
|
||||||
|
const model = defineModel()
|
||||||
|
const props = defineProps<{
|
||||||
|
data: McuSrcCategory[]
|
||||||
|
}>()
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [category: McuSrcCategory]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
if (!model.value && props.data.length > 0) {
|
||||||
|
model.value = props.data[0]?.code
|
||||||
|
}
|
||||||
|
|
||||||
|
function pick(category: McuSrcCategory) {
|
||||||
|
model.value = category.code
|
||||||
|
emit('pick', category)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold mb-1.5">
|
||||||
|
Kategori
|
||||||
|
</div>
|
||||||
|
<div class="-mx-1 [&_button]:mx-1 ">
|
||||||
|
<Button v-for="item, idx in data" :variant="model === item.code ? 'default' : 'outline'" @click="pick(item)">
|
||||||
|
{{ item.name }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { McuSrc } from '~/models/mcu-src';
|
||||||
|
import type { McuOrderItem } from '~/models/mcu-order-item';
|
||||||
|
|
||||||
|
const data = defineModel({ type: Array as PropType<McuOrderItem[]>, required: true })
|
||||||
|
defineProps<{
|
||||||
|
dataSource: McuSrc[]
|
||||||
|
// data: number[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [item: McuSrc]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function pick(item: McuSrc) {
|
||||||
|
emit('pick', item)
|
||||||
|
// if (data.value.some(e => e.mcuSrc_id === item.id)) {
|
||||||
|
// const pos = data.value.map(e => e.mcuSrc_id).indexOf(item.id)
|
||||||
|
// data.value.splice(pos, 1)
|
||||||
|
// } else {
|
||||||
|
// data.value.push({
|
||||||
|
// id: 0,
|
||||||
|
// mcuOrder_id: 0,
|
||||||
|
// mcuSrc_id: item.id,
|
||||||
|
// createdAt: "",
|
||||||
|
// updatedAt: "",
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold mb-1.5">
|
||||||
|
Daftar Item
|
||||||
|
</div>
|
||||||
|
<div class="grid lg:grid-cols-4 2xl:grid-cols-5 gap-2 [&_button]:w-full">
|
||||||
|
<div v-for="item, idx in dataSource" :key="idx" class="flex gap-2">
|
||||||
|
<Button
|
||||||
|
:variant="data.some(e => e.mcuSrc_id === item.id) ? 'default' : 'outline'"
|
||||||
|
type="button"
|
||||||
|
@click="pick(item)"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -15,6 +15,7 @@ import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
|
|||||||
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
||||||
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
|
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
|
||||||
import PrescriptionList from '~/components/content/prescription/list.vue'
|
import PrescriptionList from '~/components/content/prescription/list.vue'
|
||||||
|
import Radiology from '~/components/content/radiology-order/main.vue'
|
||||||
import Consultation from '~/components/content/consultation/list.vue'
|
import Consultation from '~/components/content/consultation/list.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -62,7 +63,7 @@ const tabs: TabItem[] = [
|
|||||||
{ value: 'patient-note', label: 'CPRJ' },
|
{ value: 'patient-note', label: 'CPRJ' },
|
||||||
{ value: 'prescription', label: 'Order Obat', component: PrescriptionList },
|
{ value: 'prescription', label: 'Order Obat', component: PrescriptionList },
|
||||||
{ value: 'device', label: 'Order Alkes' },
|
{ value: 'device', label: 'Order Alkes' },
|
||||||
{ value: 'mcu-radiology', label: 'Order Radiologi' },
|
{ value: 'mcu-radiology', label: 'Order Radiologi', component: Radiology, props: { encounter_id: data.id } },
|
||||||
{ value: 'mcu-lab-pc', label: 'Order Lab PK' },
|
{ value: 'mcu-lab-pc', label: 'Order Lab PK' },
|
||||||
{ value: 'mcu-lab-micro', label: 'Order Lab Mikro' },
|
{ value: 'mcu-lab-micro', label: 'Order Lab Mikro' },
|
||||||
{ value: 'mcu-lab-pa', label: 'Order Lab PA' },
|
{ value: 'mcu-lab-pa', label: 'Order Lab PA' },
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
|
||||||
|
import NavOk from '~/components/pub/my-ui/nav-footer/ok.vue'
|
||||||
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
|
||||||
|
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
||||||
|
import { type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
|
|
||||||
|
// mcu src category
|
||||||
|
import ScrCategorySwitcher from '~/components/app/mcu-src-category/switcher.vue'
|
||||||
|
import { getList as getMcuCategoryList } from '~/services/mcu-src-category.service'
|
||||||
|
|
||||||
|
// mcu src
|
||||||
|
import { type McuSrc } from '~/models/mcu-src'
|
||||||
|
import { getList as getMcuSrcList } from '~/services/mcu-src.service'
|
||||||
|
import McuSrcPicker from '~/components/app/mcu-src/picker-accordion.vue'
|
||||||
|
|
||||||
|
// mcu order
|
||||||
|
import { getDetail } from '~/services/mcu-order.service'
|
||||||
|
import Detail from '~/components/app/mcu-order/detail.vue'
|
||||||
|
|
||||||
|
// mcu order item, manually not using composable
|
||||||
|
import {
|
||||||
|
getList as getMcuOrderItemList,
|
||||||
|
create as createMcuOrderItem,
|
||||||
|
remove as removeMcuOrderItem,
|
||||||
|
} from '~/services/mcu-order-item.service'
|
||||||
|
import { type McuOrderItem } from '~/models/mcu-order-item'
|
||||||
|
import ItemListEntry from '~/components/app/mcu-order-item/list-entry.vue'
|
||||||
|
|
||||||
|
// props
|
||||||
|
const props = defineProps<{
|
||||||
|
encounter_id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// declaration & flows
|
||||||
|
|
||||||
|
// MCU Order
|
||||||
|
const { getQueryParam } = useQueryParam()
|
||||||
|
const id = getQueryParam('id')
|
||||||
|
const dataRes = await getDetail(
|
||||||
|
typeof id === 'string' ? parseInt(id) : 0,
|
||||||
|
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
|
||||||
|
)
|
||||||
|
const data = dataRes.body?.data
|
||||||
|
|
||||||
|
// MCU items
|
||||||
|
const items = ref<McuOrderItem[]>([])
|
||||||
|
|
||||||
|
// MCU Categories
|
||||||
|
const mcuSrcCategoryRes = await getMcuCategoryList()
|
||||||
|
const mcuSrcCategories = mcuSrcCategoryRes.body?.data
|
||||||
|
const selectedMcuSrcCategory_code = ref('')
|
||||||
|
|
||||||
|
// MCU Sources
|
||||||
|
const mcuSrcs = ref<McuSrc[]>([])
|
||||||
|
|
||||||
|
// const {
|
||||||
|
// data: items,
|
||||||
|
// fetchData: getItems,
|
||||||
|
// } = usePaginatedList<McuOrderItem> ({
|
||||||
|
// fetchFn: async ({ page, search }) => {
|
||||||
|
// const result = await getMcuOrderItemList({ 'mcu-order-id': id, search, page })
|
||||||
|
// if (result.success) {
|
||||||
|
// items.value = result.body.data
|
||||||
|
// }
|
||||||
|
// return { success: result.success || false, body: result.body || {} }
|
||||||
|
// },
|
||||||
|
// entityName: 'mcu-order-item',
|
||||||
|
// })
|
||||||
|
|
||||||
|
const { backToList } = useQueryCRUDMode()
|
||||||
|
|
||||||
|
const headerPrep: HeaderPrep = {
|
||||||
|
title: 'Detail dan List Item Order Radiologi ',
|
||||||
|
icon: 'i-lucide-box',
|
||||||
|
}
|
||||||
|
|
||||||
|
const pickerDialogOpen = ref(false)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await getItems()
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(selectedMcuSrcCategory_code, async () => {
|
||||||
|
const res = await getMcuSrcList({ 'mcu-src-category-code': selectedMcuSrcCategory_code.value })
|
||||||
|
mcuSrcs.value = res.body?.data
|
||||||
|
})
|
||||||
|
|
||||||
|
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
||||||
|
if (type === 'back') {
|
||||||
|
backToList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestItem() {
|
||||||
|
pickerDialogOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickItem(item: McuSrc) {
|
||||||
|
const exItem = items.value.find(e => e.mcuSrc_id === item.id)
|
||||||
|
if (exItem) {
|
||||||
|
await removeMcuOrderItem(exItem.id)
|
||||||
|
await getItems()
|
||||||
|
} else {
|
||||||
|
const intId = parseInt(id?.toString() || '0')
|
||||||
|
await createMcuOrderItem({
|
||||||
|
mcuOrder_id: intId,
|
||||||
|
mcuSrc_id: item.id,
|
||||||
|
})
|
||||||
|
await getItems()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getItems() {
|
||||||
|
const itemsRes = await getMcuOrderItemList({ 'mcu-order-id': id, includes: 'mcuSrc,mcuSrc-mcuSrcCategory' })
|
||||||
|
if (itemsRes.success) {
|
||||||
|
items.value = itemsRes.body.data
|
||||||
|
} else {
|
||||||
|
items.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Header
|
||||||
|
:prep="headerPrep"
|
||||||
|
:ref-search-nav="headerPrep.refSearchNav"
|
||||||
|
class="mb-4 xl:mb-5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Detail :data="data" />
|
||||||
|
|
||||||
|
<ItemListEntry
|
||||||
|
:data="items"
|
||||||
|
@requestItem="requestItem"/>
|
||||||
|
<Separator class="my-5" />
|
||||||
|
|
||||||
|
<div class="w-full flex justify-center">
|
||||||
|
<Nav @click="navClick" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="pickerDialogOpen"
|
||||||
|
title="Pilih Item"
|
||||||
|
size="2xl"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<ScrCategorySwitcher :data="mcuSrcCategories" v-model="selectedMcuSrcCategory_code" />
|
||||||
|
<McuSrcPicker v-model="items" :data-source="mcuSrcs" @pick="pickItem" />
|
||||||
|
<Separator />
|
||||||
|
<NavOk @click="() => pickerDialogOpen = false" class="justify-center" />
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
|
|
||||||
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
|
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
|
|
||||||
|
// Handlers
|
||||||
|
import {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionRemove,
|
||||||
|
} from '~/handlers/mcu-order.handler'
|
||||||
|
|
||||||
|
// Apps
|
||||||
|
import { getList, getDetail } from '~/services/mcu-order.service'
|
||||||
|
import List from '~/components/app/mcu-order/list.vue'
|
||||||
|
import type { McuOrder } from '~/models/mcu-order'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const { setQueryParams } = useQueryParam()
|
||||||
|
|
||||||
|
const title = ref('')
|
||||||
|
|
||||||
|
const plainEid = route.params.id
|
||||||
|
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0 // here the
|
||||||
|
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
isLoading,
|
||||||
|
paginationMeta,
|
||||||
|
searchInput,
|
||||||
|
handlePageChange,
|
||||||
|
handleSearch,
|
||||||
|
fetchData: getMyList,
|
||||||
|
} = usePaginatedList<McuOrder>({
|
||||||
|
fetchFn: async ({ page, search }) => {
|
||||||
|
const result = await getList({
|
||||||
|
search,
|
||||||
|
page,
|
||||||
|
'scope-code': "rad",
|
||||||
|
'encounter-id': encounter_id,
|
||||||
|
includes: 'doctor,doctor-employee,doctor-employee-person',
|
||||||
|
})
|
||||||
|
return { success: result.success || false, body: result.body || {} }
|
||||||
|
},
|
||||||
|
entityName: 'mcu-order'
|
||||||
|
})
|
||||||
|
|
||||||
|
const headerPrep: HeaderPrep = {
|
||||||
|
title: 'Order Radiologi',
|
||||||
|
icon: 'i-lucide-box',
|
||||||
|
refSearchNav: {
|
||||||
|
placeholder: 'Cari (min. 3 karakter)...',
|
||||||
|
minLength: 3,
|
||||||
|
debounceMs: 500,
|
||||||
|
showValidationFeedback: true,
|
||||||
|
onInput: (value: string) => {
|
||||||
|
searchInput.value = value
|
||||||
|
},
|
||||||
|
onClick: () => {},
|
||||||
|
onClear: () => {},
|
||||||
|
},
|
||||||
|
addNav: {
|
||||||
|
label: 'Tambah',
|
||||||
|
icon: 'i-lucide-plus',
|
||||||
|
onClick: () => {
|
||||||
|
recItem.value = null
|
||||||
|
recId.value = 0
|
||||||
|
isFormEntryDialogOpen.value = true
|
||||||
|
isReadonly.value = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
provide('rec_id', recId)
|
||||||
|
provide('rec_action', recAction)
|
||||||
|
provide('rec_item', recItem)
|
||||||
|
provide('table_data_loader', isLoading)
|
||||||
|
|
||||||
|
const getMyDetail = async (id: number | string) => {
|
||||||
|
const result = await getDetail(id)
|
||||||
|
if (result.success) {
|
||||||
|
const currentValue = result.body?.data || {}
|
||||||
|
recItem.value = currentValue
|
||||||
|
isFormEntryDialogOpen.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch for row actions when recId or recAction changes
|
||||||
|
watch([recId, recAction], () => {
|
||||||
|
switch (recAction.value) {
|
||||||
|
case ActionEvents.showDetail:
|
||||||
|
getMyDetail(recId.value)
|
||||||
|
title.value = 'Detail Order Radiologi'
|
||||||
|
isReadonly.value = true
|
||||||
|
break
|
||||||
|
case ActionEvents.showEdit:
|
||||||
|
getMyDetail(recId.value)
|
||||||
|
title.value = 'Edit Order Radiologi'
|
||||||
|
isReadonly.value = false
|
||||||
|
break
|
||||||
|
case ActionEvents.showConfirmDelete:
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch([isFormEntryDialogOpen], async () => {
|
||||||
|
if (isFormEntryDialogOpen.value) {
|
||||||
|
isFormEntryDialogOpen.value = false;
|
||||||
|
const saveResp = await handleActionSave({ encounter_id }, getMyList, () =>{}, toast)
|
||||||
|
if (saveResp.success) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': saveResp.body?.data?.id.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
})
|
||||||
|
|
||||||
|
function cancel(data: McuOrder) {
|
||||||
|
recId.value = data.id
|
||||||
|
recItem.value = data
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit(data: McuOrder) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': data.id.toString()
|
||||||
|
})
|
||||||
|
recItem.value = data
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(data: McuOrder) {
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Header :prep="{ ...headerPrep }" />
|
||||||
|
|
||||||
|
<List
|
||||||
|
v-if="!isLoading.dataListLoading"
|
||||||
|
:data="data"
|
||||||
|
:pagination-meta="paginationMeta"
|
||||||
|
@cancel="cancel"
|
||||||
|
@edit="edit"
|
||||||
|
@submit="submit"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isRecordConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||||
|
@cancel=""
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
//
|
||||||
|
import List from './list.vue'
|
||||||
|
import Entry from './entry.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
encounter_id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { mode } = useQueryCRUDMode()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
|
||||||
|
<Entry v-else :encounter_id="encounter_id" />
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { createCrudHandler, genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/prescription.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { createCrudHandler, genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/mcu-order.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// Handlers
|
||||||
|
import { genCrudHandler } from '~/handlers/_handler'
|
||||||
|
|
||||||
|
// Services
|
||||||
|
import { create, update, remove } from '~/services/mcu-src-category.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({
|
||||||
|
create,
|
||||||
|
update,
|
||||||
|
remove,
|
||||||
|
})
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
import { type Base, genBase } from "./_base"
|
import { type Base, genBase } from "./_base"
|
||||||
|
import { type Doctor, genDoctor } from "./doctor"
|
||||||
|
import type { McuOrderItem } from "./mcu-order-item"
|
||||||
|
|
||||||
export interface McuOrder extends Base {
|
export interface McuOrder extends Base {
|
||||||
encounter_id: number
|
encounter_id: number
|
||||||
doctor_id: number
|
doctor_id: number
|
||||||
|
doctor: Doctor
|
||||||
status_code?: string
|
status_code?: string
|
||||||
specimenPickTime: string
|
specimenPickTime: string
|
||||||
examinationDate: string
|
examinationDate: string
|
||||||
number?: number
|
number?: number
|
||||||
temperature?: number
|
temperature?: number
|
||||||
mcuUrgencyLevel_code?: string
|
mcuUrgencyLevel_code?: string
|
||||||
|
items: McuOrderItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genMcuOrder(): McuOrder {
|
export function genMcuOrder(): McuOrder {
|
||||||
@@ -16,8 +20,10 @@ export function genMcuOrder(): McuOrder {
|
|||||||
...genBase(),
|
...genBase(),
|
||||||
encounter_id: 0,
|
encounter_id: 0,
|
||||||
doctor_id: 0,
|
doctor_id: 0,
|
||||||
|
doctor: genDoctor(),
|
||||||
specimenPickTime: '',
|
specimenPickTime: '',
|
||||||
examinationDate: ''
|
examinationDate: '',
|
||||||
|
items: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/mcu-order-item'
|
||||||
|
const name = 'mcu-order-item'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string, params?: any) {
|
||||||
|
return base.getDetail(path, id, name, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/mcu-order'
|
||||||
|
const name = 'mcu-order'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string, params?: any) {
|
||||||
|
return base.getDetail(path, id, name, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Base
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/mcu-src-category'
|
||||||
|
const name = 'mcu-src-category'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Base
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/mcu-src'
|
||||||
|
const name = 'mcu-src'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user