@@ -11,16 +11,17 @@ export const config: Config = {
|
|||||||
headers: [
|
headers: [
|
||||||
[
|
[
|
||||||
{ label: 'Nama' },
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Cara Buat' },
|
||||||
{ label: 'Bentuk' },
|
{ label: 'Bentuk' },
|
||||||
{ label: 'Freq' },
|
{ label: 'Freq' },
|
||||||
{ label: 'Dosis' },
|
{ label: 'Dosis' },
|
||||||
{ label: 'Interval' },
|
// { label: 'Interval' },
|
||||||
{ label: 'Total' },
|
{ label: 'Total' },
|
||||||
{ label: '' },
|
{ label: '' },
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
keys: ['medicine.name', 'medicine.medicineForm.name', 'frequency', 'dose', 'interval', 'total', 'action'],
|
keys: ['medicine.name', 'isMix', 'medicine.medicineForm.name', 'frequency', 'dose', 'quantity', 'action'], //
|
||||||
|
|
||||||
delKeyNames: [
|
delKeyNames: [
|
||||||
{ key: 'code', label: 'Kode' },
|
{ key: 'code', label: 'Kode' },
|
||||||
@@ -28,17 +29,8 @@ export const config: Config = {
|
|||||||
],
|
],
|
||||||
|
|
||||||
parses: {
|
parses: {
|
||||||
cateogry: (rec: unknown): unknown => {
|
isMix: (rec: unknown): unknown => {
|
||||||
return (rec as SmallDetailDto).medicineCategory?.name || '-'
|
return (rec as SmallDetailDto).isMix ? 'Racikan' : 'Non Racikan'
|
||||||
},
|
|
||||||
group: (rec: unknown): unknown => {
|
|
||||||
return (rec as SmallDetailDto).medicineGroup?.name || '-'
|
|
||||||
},
|
|
||||||
method: (rec: unknown): unknown => {
|
|
||||||
return (rec as SmallDetailDto).medicineMethod?.name || '-'
|
|
||||||
},
|
|
||||||
unit: (rec: unknown): unknown => {
|
|
||||||
return (rec as SmallDetailDto).medicineUnit?.name || '-'
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const { medicines } = toRefs(props)
|
const { medicines } = toRefs(props)
|
||||||
const medicineItems = ref<CB.Item[]>([])
|
const medicineItems = ref<CB.Item[]>([])
|
||||||
const selectedMedicine_code = ref<string>(props.data.medicine?.code || '')
|
|
||||||
|
|
||||||
type ClickType = 'close' | 'save'
|
type ClickType = 'close' | 'save'
|
||||||
|
|
||||||
@@ -54,35 +53,39 @@ function addItem() {
|
|||||||
function searchMedicineText(value: string) {
|
function searchMedicineText(value: string) {
|
||||||
emit('update:searchText', value)
|
emit('update:searchText', value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteItem(idx: number) {
|
||||||
|
props.items.splice(idx, 1)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DE.Block :colCount="4" :cellFlex="false">
|
<DE.Block :colCount="4" :cellFlex="false">
|
||||||
<DE.Cell :colSpan="4">
|
<DE.Cell :colSpan="4">
|
||||||
<DE.Label>Nama</DE.Label>
|
<DE.Label>Nama</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
<Input :value="data.medicineMix?.name" />
|
<Input :value="data.medicineMix?.name" />
|
||||||
</DE.Field>
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Frequensi</DE.Label>
|
<DE.Label>Frequensi</DE.Label>
|
||||||
<DE.Field><Input v-model="data.frequency" /></DE.Field>
|
<DE.Field><Input v-model="data.frequency" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Dosis</DE.Label>
|
<DE.Label>Dosis</DE.Label>
|
||||||
<DE.Field><Input v-model="data.dose" /></DE.Field>
|
<DE.Field><Input v-model="data.dose" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Sediaan</DE.Label>
|
<DE.Label>Sediaan</DE.Label>
|
||||||
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
|
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Total</DE.Label>
|
<DE.Label>Total</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input v-model="data.quantity" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell :colSpan="4">
|
<DE.Cell :colSpan="4">
|
||||||
<DE.Label>Cara Pakai</DE.Label>
|
<DE.Label>Cara Pakai</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input v-model="data.usage" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
</DE.Block>
|
</DE.Block>
|
||||||
<div class="text-sm 2xl:text-base font-semibold !mb-3">Daftar Obat</div>
|
<div class="text-sm 2xl:text-base font-semibold !mb-3">Daftar Obat</div>
|
||||||
@@ -91,20 +94,29 @@ function searchMedicineText(value: string) {
|
|||||||
<Table.TableRow>
|
<Table.TableRow>
|
||||||
<Table.TableHead>Nama</Table.TableHead>
|
<Table.TableHead>Nama</Table.TableHead>
|
||||||
<Table.TableHead class="w-24">Dosis</Table.TableHead>
|
<Table.TableHead class="w-24">Dosis</Table.TableHead>
|
||||||
<Table.TableHead class="w-24">Satuan</Table.TableHead>
|
<!-- <Table.TableHead class="w-24">Satuan</Table.TableHead> -->
|
||||||
<Table.TableHead class="w-20">..</Table.TableHead>
|
<Table.TableHead class="w-10"></Table.TableHead>
|
||||||
</Table.TableRow>
|
</Table.TableRow>
|
||||||
</Table.TableHeader>
|
</Table.TableHeader>
|
||||||
<Table.TableBody class="[&_td]:p-0.6">
|
<Table.TableBody class="[&_td]:p-0.6">
|
||||||
<Table.TableRow v-if="items.length > 0" v-for="item in items">
|
<Table.TableRow v-if="items.length > 0" v-for="item, idx in items">
|
||||||
<Table.TableCell>
|
<Table.TableCell>
|
||||||
<Input v-model="item.medicine.name" />
|
<CB.Combobox
|
||||||
|
v-model="data.medicine_code"
|
||||||
|
:items="medicineItems"
|
||||||
|
@update:searchText="searchMedicineText"
|
||||||
|
/>
|
||||||
</Table.TableCell>
|
</Table.TableCell>
|
||||||
<Table.TableCell>
|
<Table.TableCell>
|
||||||
<Input v-model="item.dose" />
|
<Input v-model="item.dose" />
|
||||||
</Table.TableCell>
|
</Table.TableCell>
|
||||||
<Table.TableCell>
|
<!-- <Table.TableCell>
|
||||||
<Input />
|
<Input />
|
||||||
|
</Table.TableCell> -->
|
||||||
|
<Table.TableCell class="text-center">
|
||||||
|
<Button class="!w-7 !h-7 !p-0 rounded-full" @click="deleteItem(idx)">
|
||||||
|
<Icon name="i-lucide-trash" />
|
||||||
|
</Button>
|
||||||
</Table.TableCell>
|
</Table.TableCell>
|
||||||
</Table.TableRow>
|
</Table.TableRow>
|
||||||
<Table.TableRow v-else>
|
<Table.TableRow v-else>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import * as CB from '~/components/pub/my-ui/combobox'
|
|||||||
|
|
||||||
// import { bigTimeUnitCodes } from '~/lib/constants'
|
// import { bigTimeUnitCodes } from '~/lib/constants'
|
||||||
|
|
||||||
import { type Medicine, genMedicine } from '~/models/medicine';
|
import { type Medicine } from '~/models/medicine';
|
||||||
import type { PrescriptionItem } from '~/models/prescription-item'
|
import type { PrescriptionItem } from '~/models/prescription-item'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -20,7 +20,6 @@ const medicineForm = computed(() => {
|
|||||||
const medicine = props.medicines.find(m => m.code === props.data.medicine_code)
|
const medicine = props.medicines.find(m => m.code === props.data.medicine_code)
|
||||||
return medicine ? medicine.medicineForm?.name : '--tidak diketahui--'
|
return medicine ? medicine.medicineForm?.name : '--tidak diketahui--'
|
||||||
})
|
})
|
||||||
// const selectedMedicine_code = ref<string>(props.data.medicine_code || '')
|
|
||||||
|
|
||||||
type ClickType = 'close' | 'save'
|
type ClickType = 'close' | 'save'
|
||||||
type Item = {
|
type Item = {
|
||||||
@@ -28,19 +27,10 @@ type Item = {
|
|||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const bigTimeUnitCodeItems: Item[] = []
|
|
||||||
|
|
||||||
if(!props.data.intervalUnit_code) {
|
if(!props.data.intervalUnit_code) {
|
||||||
props.data.intervalUnit_code = 'day'
|
props.data.intervalUnit_code = 'day'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Object.keys(bigTimeUnitCodes).forEach((key) => {
|
|
||||||
// bigTimeUnitCodeItems.push({
|
|
||||||
// value: key,
|
|
||||||
// label: bigTimeUnitCodes[key] || '',
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
close: [],
|
close: [],
|
||||||
save: [data: PrescriptionItem],
|
save: [data: PrescriptionItem],
|
||||||
@@ -105,7 +95,7 @@ function searchMedicineText(value: string) {
|
|||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell :colSpan="4">
|
<DE.Cell :colSpan="4">
|
||||||
<DE.Label>Cara Pakai</DE.Label>
|
<DE.Label>Cara Pakai</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input v-model="data.usage" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
</DE.Block>
|
</DE.Block>
|
||||||
<Separator class="my-5" />
|
<Separator class="my-5" />
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Prescription } from '~/models/prescription';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: Prescription
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="md:grid md:grid-cols-2 font-semibold">
|
<div class="md:grid md:grid-cols-2">
|
||||||
<div class="md:pe-10">
|
<div class="md:pe-10">
|
||||||
<PubMyUiDocEntryBlock>
|
<PubMyUiDocEntryBlock>
|
||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryField>
|
||||||
<Input />
|
<Input :value="data.issuedAt || data.createdAt?.substring(0, 10)" readonly />
|
||||||
</PubMyUiDocEntryField>
|
</PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryField>
|
||||||
<Input />
|
<Input v-model="data.status_code" readonly />
|
||||||
</PubMyUiDocEntryField>
|
</PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryCell>
|
||||||
</PubMyUiDocEntryBlock>
|
</PubMyUiDocEntryBlock>
|
||||||
@@ -21,13 +29,13 @@
|
|||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryLabel position="dynamic">DPJP</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryLabel position="dynamic">DPJP</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryField>
|
||||||
<Input />
|
<Input v-model="data.doctor.employee.person.name" readonly />
|
||||||
</PubMyUiDocEntryField>
|
</PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryLabel position="dynamic">PPDS</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryLabel position="dynamic">PPDS</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryField>
|
||||||
<Input />
|
<Input value="......" readonly />
|
||||||
</PubMyUiDocEntryField>
|
</PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryCell>
|
||||||
</PubMyUiDocEntryBlock>
|
</PubMyUiDocEntryBlock>
|
||||||
|
|||||||
@@ -1,112 +1,216 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { type HeaderPrep, ActionEvents } from '~/components/pub/my-ui/data/types'
|
||||||
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
|
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
|
||||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
|
|
||||||
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
||||||
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
|
|
||||||
|
|
||||||
// medicine
|
// Medicine
|
||||||
import { type Medicine } from '~/models/medicine'
|
import { type Medicine } from '~/models/medicine'
|
||||||
|
|
||||||
// prescription
|
|
||||||
import { getDetail } from '~/services/prescription.service'
|
|
||||||
import { getList as getMedicineList } from '~/services/medicine.service'
|
import { getList as getMedicineList } from '~/services/medicine.service'
|
||||||
import Detail from '~/components/app/prescription/detail.vue'
|
|
||||||
|
|
||||||
// prescription items
|
// Prescription
|
||||||
|
import { getDetail } from '~/services/prescription.service'
|
||||||
|
// import Detail from '~/components/app/prescription/detail.vue'
|
||||||
|
import Entry from '~/components/app/prescription/entry.vue'
|
||||||
|
import { remove, submit } from '~/services/prescription.service'
|
||||||
|
|
||||||
|
// Prescription items
|
||||||
import {
|
import {
|
||||||
getList as getPrescriptionItemList,
|
getList as getItemList,
|
||||||
create as createPrescriptionItem,
|
create as createItem,
|
||||||
remove as removePrescriptionItem,
|
update as updateItem,
|
||||||
} from '~/services/prescription-item.service'
|
} from '~/services/prescription-item.service'
|
||||||
import { type PrescriptionItem, genPrescriptionItem } from '~/models/prescription-item'
|
import {
|
||||||
import ItemListEntry from '~/components/app/prescription-item/list-entry.vue'
|
recId,
|
||||||
import type { MedicinemixItem } from '~/models/medicinemix-item';
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
handleActionRemove,
|
||||||
|
} from '~/handlers/prescription-item.handler'
|
||||||
|
|
||||||
import { recItem } from '~/handlers/prescription-item.handler'
|
import { type PrescriptionItem, genPrescriptionItem } from '~/models/prescription-item'
|
||||||
|
import { type MedicinemixItem } from '~/models/medicinemix-item';
|
||||||
|
import ItemListEntry from '~/components/app/prescription-item/list-entry.vue'
|
||||||
import NonMixItemEntry from '~/components/app/prescription-item/non-mix-entry.vue'
|
import NonMixItemEntry from '~/components/app/prescription-item/non-mix-entry.vue'
|
||||||
import MixItemEntry from '~/components/app/prescription-item/mix-entry.vue'
|
import MixItemEntry from '~/components/app/prescription-item/mix-entry.vue'
|
||||||
|
|
||||||
// props
|
// Props
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
encounter_id: number
|
encounter_id: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// declaration & flows
|
// Prescriptions
|
||||||
|
const isSubmitConfirmationOpen = ref(false)
|
||||||
|
const isDeleteConfirmationOpen = ref(false)
|
||||||
|
|
||||||
|
// Prescription Items
|
||||||
|
const isItemDetailDialogOpen = ref(false)
|
||||||
|
|
||||||
// Prescription
|
// Prescription
|
||||||
const { getQueryParam } = useQueryParam()
|
const { getQueryParam } = useQueryParam()
|
||||||
const id = getQueryParam('id')
|
const rawId = getQueryParam('id')
|
||||||
const dataRes = await getDetail(
|
const id = typeof rawId === 'string' ? parseInt(rawId) : 0
|
||||||
typeof id === 'string' ? parseInt(id) : 0,
|
const dataRes = await getDetail(id, { includes: 'encounter,doctor,doctor-employee,doctor-employee-person' })
|
||||||
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
|
const data = ref(dataRes.body?.data || null)
|
||||||
)
|
|
||||||
const data = dataRes.body?.data || null
|
|
||||||
|
|
||||||
// Prescription Items
|
// Prescription Items
|
||||||
const items = ref<PrescriptionItem[]>([])
|
const getItemsOpt = { 'prescription-id': id, includes: 'medicine,medicine-medicineForm,medicineMix' }
|
||||||
|
const {
|
||||||
|
data: items,
|
||||||
|
isLoading,
|
||||||
|
fetchData: getPrescriptionItems,
|
||||||
|
} = usePaginatedList({
|
||||||
|
fetchFn: async (params: any) => {
|
||||||
|
const result = await getItemList({
|
||||||
|
...getItemsOpt,
|
||||||
|
search: params.search,
|
||||||
|
sort: 'createdAt:asc',
|
||||||
|
'page-number': params['page-number'] || 0,
|
||||||
|
'page-size': params['page-size'] || 10,
|
||||||
|
})
|
||||||
|
return { success: result.success || false, body: result.body || {} }
|
||||||
|
},
|
||||||
|
entityName: 'division',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// const items = ref<PrescriptionItem[]>([])
|
||||||
const mixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
const mixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
||||||
const medicinemixItems = ref<MedicinemixItem[]>([])
|
const medicinemixItems = ref<MedicinemixItem[]>([])
|
||||||
const nonMixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
const nonMixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
||||||
|
|
||||||
mixItem.value.prescription_id = typeof id === 'string' ? parseInt(id) : 0
|
mixItem.value.prescription_id = id
|
||||||
nonMixItem.value.prescription_id = typeof id === 'string' ? parseInt(id) : 0
|
nonMixItem.value.prescription_id = id
|
||||||
|
|
||||||
const { backToList } = useQueryCRUDMode()
|
const { backToList } = useQueryCRUDMode()
|
||||||
|
|
||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
title: 'Tambah Order Obat / Resep',
|
title: 'Pembuatan Order Obat / Resep',
|
||||||
icon: 'i-lucide-box',
|
icon: 'i-lucide-box',
|
||||||
}
|
}
|
||||||
|
|
||||||
const mixDialogOpen = ref(false)
|
const mixDialogOpenStatus = ref(false)
|
||||||
const nonMixDialogOpen = ref(false)
|
const nonMixDialogOpenStatus = ref(false)
|
||||||
const medicines = ref<Medicine[]>([])
|
const medicines = ref<Medicine[]>([])
|
||||||
|
|
||||||
|
provide('rec_id', recId)
|
||||||
|
provide('rec_action', recAction)
|
||||||
|
provide('rec_item', recItem)
|
||||||
|
provide('table_data_loader', isLoading)
|
||||||
|
|
||||||
|
watch([recId, recAction], () => {
|
||||||
|
let item: PrescriptionItem | null
|
||||||
|
switch (recAction.value) {
|
||||||
|
case ActionEvents.showDetail:
|
||||||
|
item = pickItem()
|
||||||
|
if (item) {
|
||||||
|
isItemDetailDialogOpen.value = true
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case ActionEvents.showEdit:
|
||||||
|
item = pickItem()
|
||||||
|
if (item) {
|
||||||
|
if(item.isMix) {
|
||||||
|
mixDialogOpenStatus.value = true
|
||||||
|
} else {
|
||||||
|
nonMixDialogOpenStatus.value = true
|
||||||
|
}
|
||||||
|
getMedicines('', item.medicine_code)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case ActionEvents.showConfirmDelete:
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getItems()
|
await getPrescriptionItems()
|
||||||
})
|
})
|
||||||
|
|
||||||
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
||||||
if (type === 'back') {
|
if (type === 'back') {
|
||||||
backToList()
|
backToList()
|
||||||
|
} else if (type === 'delete') {
|
||||||
|
isDeleteConfirmationOpen.value = true
|
||||||
|
} else if (type === 'submit') {
|
||||||
|
isSubmitConfirmationOpen.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function removePrescription() {
|
||||||
|
const res = await remove(id)
|
||||||
|
if (res.success) {
|
||||||
|
backToList()
|
||||||
|
}
|
||||||
|
// handleActionRemove(recId.value, getItems, toast)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitPrescription() {
|
||||||
|
const res = await submit(id)
|
||||||
|
if (res.success) {
|
||||||
|
backToList()
|
||||||
|
}
|
||||||
|
// handleActionRemove(recId.value, getItems, toast)
|
||||||
|
}
|
||||||
|
|
||||||
function addItem(mode: 'mix' | 'non-mix') {
|
function addItem(mode: 'mix' | 'non-mix') {
|
||||||
if (mode === 'mix') {
|
if (mode === 'mix') {
|
||||||
mixDialogOpen.value = true
|
mixDialogOpenStatus.value = true
|
||||||
} else if (mode === 'non-mix') {
|
} else if (mode === 'non-mix') {
|
||||||
nonMixDialogOpen.value = true
|
nonMixDialogOpenStatus.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveMix() {
|
async function saveMix() {
|
||||||
createPrescriptionItem(mixItem.value)
|
const res = await createItem(mixItem.value)
|
||||||
}
|
|
||||||
|
|
||||||
function saveNonMix() {
|
|
||||||
createPrescriptionItem(nonMixItem.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getItems() {
|
|
||||||
const res = await getPrescriptionItemList({ 'prescription-id': id, includes: 'medicine,medicine-medicineForm,medicineMix' })
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
items.value = res.body.data
|
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
|
||||||
} else {
|
getPrescriptionItems()
|
||||||
items.value = []
|
mixDialogOpenStatus.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMedicines(value: string) {
|
async function saveNonMix() {
|
||||||
const res = await getMedicineList({ 'search': value, 'includes': 'medicineForm' })
|
let res: any;
|
||||||
|
if(!nonMixItem.value.id) {
|
||||||
|
res = await createItem(nonMixItem.value)
|
||||||
|
} else {
|
||||||
|
res = await updateItem(nonMixItem.value.id, nonMixItem.value)
|
||||||
|
}
|
||||||
|
if (res.success) {
|
||||||
|
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
|
||||||
|
getPrescriptionItems()
|
||||||
|
nonMixDialogOpenStatus.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getMedicines(value: string, code?: string) {
|
||||||
|
const res = await getMedicineList({ 'search': value, 'includes': 'medicineForm', 'code': code })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
medicines.value = res.body.data
|
medicines.value = res.body.data
|
||||||
} else {
|
} else {
|
||||||
medicines.value = []
|
medicines.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pickItem(): PrescriptionItem | null {
|
||||||
|
const item = items.value.find(item => item.id === recId.value)
|
||||||
|
if (!item) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if(item.isMix) {
|
||||||
|
mixItem.value = item
|
||||||
|
} else {
|
||||||
|
nonMixItem.value = item
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -116,20 +220,49 @@ async function getMedicines(value: string) {
|
|||||||
class="mb-4 xl:mb-5"
|
class="mb-4 xl:mb-5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Detail :data="data" />
|
<Entry :data="data" />
|
||||||
|
|
||||||
|
<!-- <div class="mb-8">
|
||||||
|
<Button>
|
||||||
|
<Icon name="i-lucide-check" />
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
<ItemListEntry
|
<ItemListEntry
|
||||||
:data="items"
|
:data="items"
|
||||||
@add="addItem"/>
|
@add="addItem"/>
|
||||||
|
|
||||||
<Separator class="my-5" />
|
<Separator class="my-5" />
|
||||||
|
|
||||||
<div class="w-full flex justify-center">
|
<div class="w-full flex justify-center">
|
||||||
<Nav @click="navClick" />
|
<Nav @click="navClick" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Confirm delete -->
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isDeleteConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="removePrescription()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Confirm submit -->
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isSubmitConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
customTitle="Ajukan Resep"
|
||||||
|
customMessage="Proses akan mengajukan resep ini untuk diproses lebih lanjut. Lanjutkan?"
|
||||||
|
customConfirmText="Ajukan"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="submitPrescription"
|
||||||
|
@cancel=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Mix form -->
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model:open="mixDialogOpen"
|
v-model:open="mixDialogOpenStatus"
|
||||||
:title="recItem?.id ? 'Edit Racikan' : 'Tambah Racikan'"
|
title="Pembuatan Racikan"
|
||||||
size="lg"
|
size="lg"
|
||||||
prevent-outside
|
prevent-outside
|
||||||
>
|
>
|
||||||
@@ -137,24 +270,97 @@ async function getMedicines(value: string) {
|
|||||||
:data="mixItem"
|
:data="mixItem"
|
||||||
:items="medicinemixItems"
|
:items="medicinemixItems"
|
||||||
:medicines="medicines"
|
:medicines="medicines"
|
||||||
@close="mixDialogOpen = false"
|
@close="mixDialogOpenStatus = false"
|
||||||
@save="saveMix"
|
@save="saveMix"
|
||||||
@update:searchText="getMedicines"
|
@update:searchText="getMedicines"
|
||||||
/>
|
/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- Non mix form -->
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model:open="nonMixDialogOpen"
|
v-model:open="nonMixDialogOpenStatus"
|
||||||
:title="recItem?.id ? 'Edit Non Racikan' : 'Tambah Non Racikan'"
|
title="Pembuatan Non Racikan"
|
||||||
size="lg"
|
size="lg"
|
||||||
prevent-outside
|
prevent-outside
|
||||||
>
|
>
|
||||||
<NonMixItemEntry
|
<NonMixItemEntry
|
||||||
:data="nonMixItem"
|
:data="nonMixItem"
|
||||||
:medicines="medicines"
|
:medicines="medicines"
|
||||||
@close="mixDialogOpen = false"
|
@close="mixDialogOpenStatus = false"
|
||||||
@save="saveNonMix"
|
@save="saveNonMix"
|
||||||
@update:searchText="getMedicines"
|
@update:searchText="getMedicines"
|
||||||
/>
|
/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- Detail item -->
|
||||||
|
<Dialog
|
||||||
|
v-model:open="isItemDetailDialogOpen"
|
||||||
|
title="Detail Obat"
|
||||||
|
size="lg"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<DE.Block mode="preview" label-size="small">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Nama</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>
|
||||||
|
{{ recItem.medicine.name }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Dosis</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>
|
||||||
|
{{ recItem.dose }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Sediaan</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>
|
||||||
|
{{ recItem.medicine.medicineForm.name }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Jumlah</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>
|
||||||
|
{{ recItem.quantity }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Cara Pakai</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>
|
||||||
|
{{ recItem.Usage }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- Confirm delete items -->
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isRecordConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="() => handleActionRemove(recId, getPrescriptionItems, toast)"
|
||||||
|
@cancel=""
|
||||||
|
>
|
||||||
|
<template #default="{ record }">
|
||||||
|
<div class="text-sm">
|
||||||
|
<p>
|
||||||
|
<strong>ID:</strong>
|
||||||
|
{{ record?.id }}
|
||||||
|
</p>
|
||||||
|
<p v-if="record?.name">
|
||||||
|
<strong>Nama:</strong>
|
||||||
|
{{ record.name }}
|
||||||
|
</p>
|
||||||
|
<p v-if="record?.code">
|
||||||
|
<strong>Kode:</strong>
|
||||||
|
{{ record.code }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</RecordConfirmation>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { usePaginatedList } from '~/composables/usePaginatedList'
|
|||||||
|
|
||||||
// Pubs component
|
// Pubs component
|
||||||
import { toast } from '~/components/pub/ui/toast'
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
import { type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
recAction,
|
recAction,
|
||||||
recItem,
|
recItem,
|
||||||
isReadonly,
|
isReadonly,
|
||||||
isFormEntryDialogOpen,
|
|
||||||
isRecordConfirmationOpen,
|
isRecordConfirmationOpen,
|
||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleActionSave,
|
handleActionSave,
|
||||||
@@ -112,68 +111,6 @@ provide('rec_action', recAction)
|
|||||||
provide('rec_item', recItem)
|
provide('rec_item', recItem)
|
||||||
provide('table_data_loader', isLoading)
|
provide('table_data_loader', isLoading)
|
||||||
|
|
||||||
// Watch for row actions when recId or recAction changes
|
|
||||||
watch([recId, recAction], () => {
|
|
||||||
switch (recAction.value) {
|
|
||||||
case ActionEvents.showDetail:
|
|
||||||
getMyDetail(recId.value)
|
|
||||||
isReadonly.value = true
|
|
||||||
break
|
|
||||||
case ActionEvents.showEdit:
|
|
||||||
getMyDetail(recId.value)
|
|
||||||
isReadonly.value = false
|
|
||||||
break
|
|
||||||
case ActionEvents.showConfirmDelete:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// watch([isFormEntryDialogOpen], async () => {
|
|
||||||
// if (isFormEntryDialogOpen.value) {
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
// Functions
|
|
||||||
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 Konsultasi'
|
|
||||||
isReadonly.value = true
|
|
||||||
break
|
|
||||||
case ActionEvents.showEdit:
|
|
||||||
getMyDetail(recId.value)
|
|
||||||
title.value = 'Edit Konsultasi'
|
|
||||||
isReadonly.value = false
|
|
||||||
break
|
|
||||||
case ActionEvents.showConfirmDelete:
|
|
||||||
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()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function confirmCancel(data: Prescription) {
|
function confirmCancel(data: Prescription) {
|
||||||
recId.value = data.id
|
recId.value = data.id
|
||||||
recItem.value = data
|
recItem.value = data
|
||||||
@@ -235,15 +172,15 @@ async function handleActionSubmit(id: number, refresh: () => void, toast: ToastF
|
|||||||
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||||
@cancel=""
|
@cancel=""
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="flex mb-2">
|
||||||
<div class="w-40">Tanggal</div>
|
<div class="w-20">Tanggal</div>
|
||||||
<div class="w-5 text-cneter">:</div>
|
<div class="w-4">:</div>
|
||||||
<div class="">:</div>
|
<div class="">{{ recItem.createdAt.substring(0, 10) }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="w-40">Tanggal</div>
|
<div class="w-20">DPJP</div>
|
||||||
<div class="w-5 text-cneter">:</div>
|
<div class="w-4">:</div>
|
||||||
<div class="">:</div>
|
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</RecordConfirmation>
|
</RecordConfirmation>
|
||||||
|
|
||||||
@@ -257,5 +194,15 @@ async function handleActionSubmit(id: number, refresh: () => void, toast: ToastF
|
|||||||
@confirm="() => handleActionSubmit(recId, getMyList, toast)"
|
@confirm="() => handleActionSubmit(recId, getMyList, toast)"
|
||||||
@cancel=""
|
@cancel=""
|
||||||
>
|
>
|
||||||
|
<div class="flex mb-2">
|
||||||
|
<div class="w-20">Tanggal</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.createdAt.substring(0, 10) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="w-20">DPJP</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
|
||||||
|
</div>
|
||||||
</RecordConfirmation>
|
</RecordConfirmation>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user