Merge pull request #177 from dikstub-rssa/feat/prescription
Feat/prescription
This commit is contained in:
@@ -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: ['name', 'uom_code', 'frequency', 'multiplier', '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 || '-'
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,11 @@ export const config: Config = {
|
|||||||
{ label: 'Bentuk' },
|
{ label: 'Bentuk' },
|
||||||
{ label: 'Freq' },
|
{ label: 'Freq' },
|
||||||
{ label: 'Dosis' },
|
{ label: 'Dosis' },
|
||||||
{ label: 'Interval' },
|
|
||||||
{ label: 'Total' },
|
{ label: 'Total' },
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
keys: ['name', 'uom_code', 'frequency', 'multiplier', 'interval', 'total'],
|
keys: ['medicine.name', 'medicine.medicineForm.name', 'frequency', 'dose', 'total'],
|
||||||
|
|
||||||
delKeyNames: [
|
delKeyNames: [
|
||||||
{ key: 'code', label: 'Kode' },
|
{ key: 'code', label: 'Kode' },
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||||
|
|
||||||
import type { PrescriptionItem } from '~/models/prescription-item';
|
import type { PrescriptionItem } from '~/models/prescription-item';
|
||||||
import { config } from './list.cfg'
|
import { config } from './list.cfg'
|
||||||
|
|
||||||
@@ -13,7 +15,7 @@ const emit = defineEmits<{
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PubMyUiDataTable class="border mb-2 2xl:mb-3"
|
<DataTable class="border mb-2"
|
||||||
v-bind="config"
|
v-bind="config"
|
||||||
:rows="data"
|
:rows="data"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,29 +1,36 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { LucidePlus } from 'lucide-vue-next';
|
|
||||||
|
|
||||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
import Separator from '~/components/pub/ui/separator/Separator.vue';
|
import Separator from '~/components/pub/ui/separator/Separator.vue';
|
||||||
import * as Table from '~/components/pub/ui/table'
|
import * as Table from '~/components/pub/ui/table'
|
||||||
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
||||||
|
import * as CB from '~/components/pub/my-ui/combobox'
|
||||||
|
|
||||||
import { genBase } from '~/models/_base';
|
import { genBase } from '~/models/_base';
|
||||||
import { genMedicine } from '~/models/medicine';
|
import { type Medicine, genMedicine } from '~/models/medicine';
|
||||||
import type { MedicinemixItem } from '~/models/medicinemix-item';
|
import type { MedicinemixItem } from '~/models/medicinemix-item';
|
||||||
import type { PrescriptionItem } from '~/models/prescription-item';
|
import type { PrescriptionItem } from '~/models/prescription-item';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
data: PrescriptionItem
|
data: PrescriptionItem
|
||||||
items: MedicinemixItem[]
|
items: MedicinemixItem[]
|
||||||
|
medicines: Medicine[]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { medicines } = toRefs(props)
|
||||||
|
const medicineItems = ref<CB.Item[]>([])
|
||||||
|
|
||||||
type ClickType = 'close' | 'save'
|
type ClickType = 'close' | 'save'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
close: [],
|
close: [],
|
||||||
save: [data: PrescriptionItem, items: MedicinemixItem[]],
|
save: [data: PrescriptionItem, items: MedicinemixItem[]],
|
||||||
|
'update:searchText': [value: string]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
watch(medicines, (data) => {
|
||||||
|
medicineItems.value = CB.objectsToItems(data, 'code', 'name')
|
||||||
|
})
|
||||||
|
|
||||||
function navClick(type: ClickType) {
|
function navClick(type: ClickType) {
|
||||||
if (type === 'close') {
|
if (type === 'close') {
|
||||||
emit('close')
|
emit('close')
|
||||||
@@ -42,33 +49,43 @@ function addItem() {
|
|||||||
uom_code: '',
|
uom_code: '',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchMedicineText(value: string) {
|
||||||
|
emit('update:searchText', value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteItem(idx: number) {
|
||||||
|
props.items.splice(idx, 1)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DE.Block :colCount="5" :cellFlex="false">
|
<DE.Block :colCount="4" :cellFlex="false">
|
||||||
<DE.Cell :colSpan="5">
|
<DE.Cell :colSpan="4">
|
||||||
<DE.Label>Nama</DE.Label>
|
<DE.Label>Nama</DE.Label>
|
||||||
<DE.Field><Input :value="data.medicineMix?.name" /></DE.Field>
|
<DE.Field>
|
||||||
|
<Input :value="data.medicineMix?.name" />
|
||||||
|
</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="5">
|
<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>
|
||||||
@@ -77,20 +94,29 @@ function addItem() {
|
|||||||
<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>
|
||||||
@@ -102,7 +128,7 @@ function addItem() {
|
|||||||
</Table.Table>
|
</Table.Table>
|
||||||
<div>
|
<div>
|
||||||
<Button @click="addItem">
|
<Button @click="addItem">
|
||||||
<LucidePlus />
|
<Icon name="i-lucide-plus" class="me-2" />
|
||||||
Tambah
|
Tambah
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,40 +2,45 @@
|
|||||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
import Separator from '~/components/pub/ui/separator/Separator.vue'
|
import Separator from '~/components/pub/ui/separator/Separator.vue'
|
||||||
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
||||||
|
import * as CB from '~/components/pub/my-ui/combobox'
|
||||||
|
|
||||||
import { bigTimeUnitCodes } from '~/lib/constants'
|
// import { bigTimeUnitCodes } from '~/lib/constants'
|
||||||
|
|
||||||
|
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<{
|
||||||
data: PrescriptionItem
|
data: PrescriptionItem
|
||||||
|
medicines: Medicine[]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { medicines } = toRefs(props)
|
||||||
|
const medicineItems = ref<CB.Item[]>([])
|
||||||
|
const medicineForm = computed(() => {
|
||||||
|
const medicine = props.medicines.find(m => m.code === props.data.medicine_code)
|
||||||
|
return medicine ? medicine.medicineForm?.name : '--tidak diketahui--'
|
||||||
|
})
|
||||||
|
|
||||||
type ClickType = 'close' | 'save'
|
type ClickType = 'close' | 'save'
|
||||||
type Item = {
|
type Item = {
|
||||||
value: string
|
value: string
|
||||||
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],
|
||||||
|
'update:searchText': [value: string]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
watch(medicines, (data) => {
|
||||||
|
medicineItems.value = CB.objectsToItems(data, 'code', 'name')
|
||||||
|
})
|
||||||
|
|
||||||
function navClick(type: ClickType) {
|
function navClick(type: ClickType) {
|
||||||
if (type === 'close') {
|
if (type === 'close') {
|
||||||
emit('close')
|
emit('close')
|
||||||
@@ -43,13 +48,23 @@ function navClick(type: ClickType) {
|
|||||||
emit('save', props.data)
|
emit('save', props.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchMedicineText(value: string) {
|
||||||
|
emit('update:searchText', value)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DE.Block :colCount="5" :cellFlex="false">
|
<DE.Block :colCount="4" :cellFlex="false">
|
||||||
<DE.Cell :colSpan="5">
|
<DE.Cell :colSpan="4">
|
||||||
<DE.Label>Nama</DE.Label>
|
<DE.Label>Nama</DE.Label>
|
||||||
<DE.Field><Input :value="data.medicineMix?.name" /></DE.Field>
|
<DE.Field>
|
||||||
|
<CB.Combobox
|
||||||
|
v-model="data.medicine_code"
|
||||||
|
:items="medicineItems"
|
||||||
|
@update:searchText="searchMedicineText"
|
||||||
|
/>
|
||||||
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Frequensi</DE.Label>
|
<DE.Label>Frequensi</DE.Label>
|
||||||
@@ -59,11 +74,7 @@ function navClick(type: ClickType) {
|
|||||||
<DE.Label>Dosis</DE.Label>
|
<DE.Label>Dosis</DE.Label>
|
||||||
<DE.Field><Input type="number" v-model.number="data.dose" /></DE.Field>
|
<DE.Field><Input type="number" v-model.number="data.dose" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<!-- <DE.Cell>
|
||||||
<DE.Label>Sediaan</DE.Label>
|
|
||||||
<DE.Field><Input :value="data.medicineMix?.uom_code" readonly /></DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell>
|
|
||||||
<DE.Label>Interval</DE.Label>
|
<DE.Label>Interval</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
<Select
|
<Select
|
||||||
@@ -71,16 +82,20 @@ function navClick(type: ClickType) {
|
|||||||
:items="bigTimeUnitCodeItems"
|
:items="bigTimeUnitCodeItems"
|
||||||
/>
|
/>
|
||||||
</DE.Field>
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell> -->
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Total</DE.Label>
|
<DE.Label>Total</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
<Input v-model="data.quantity" />
|
<Input type="number" v-model="data.quantity" />
|
||||||
</DE.Field>
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell :colSpan="5">
|
<DE.Cell>
|
||||||
|
<DE.Label>Sediaan</DE.Label>
|
||||||
|
<DE.Field><Input :value="medicineForm" readonly /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<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" />
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const props = defineProps<{
|
|||||||
Order {{ data.issuedAt?.substring(0, 10) || data.createdAt?.substring(0, 10) }} - {{ data.status_code }}
|
Order {{ data.issuedAt?.substring(0, 10) || data.createdAt?.substring(0, 10) }} - {{ data.status_code }}
|
||||||
</div>
|
</div>
|
||||||
<div class="max-w-[1000px]">
|
<div class="max-w-[1000px]">
|
||||||
<DE.Block mode="preview" :col-count=5 class="!mb-3">
|
<DE.Block mode="preview" label-size="sm" :col-count=5 class="!mb-3">
|
||||||
<DE.Cell :col-span="2">
|
<DE.Cell :col-span="2">
|
||||||
<DE.Label class="font-semibold">DPJP</DE.Label>
|
<DE.Label class="font-semibold">DPJP</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
|
|||||||
@@ -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,16 +29,22 @@
|
|||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="">
|
||||||
|
<Button>
|
||||||
|
<Icon name="i-lucide-check" />
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</div> -->
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as Table from '~/components/pub/ui/table'
|
||||||
|
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 { Prescription } from '~/models/prescription';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: Prescription[]
|
||||||
|
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: Prescription): 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>
|
||||||
|
<Button>
|
||||||
|
<Icon name="i-lucide-plus" class="me-2 align-middle" />
|
||||||
|
Tambah Order
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Table.Table>
|
||||||
|
<Table.TableHeader>
|
||||||
|
<Table.TableRow>
|
||||||
|
<Table.TableHead class="w-28">Tgl Order</Table.TableHead>
|
||||||
|
<Table.TableHead>DPJP</Table.TableHead>
|
||||||
|
<Table.TableHead>PPDS</Table.TableHead>
|
||||||
|
<Table.TableHead>Jenis Obat</Table.TableHead>
|
||||||
|
<Table.TableHead class="text-center">Status</Table.TableHead>
|
||||||
|
<Table.TableHead class="w-20"></Table.TableHead>
|
||||||
|
</Table.TableRow>
|
||||||
|
</Table.TableHeader>
|
||||||
|
<Table.TableBody>
|
||||||
|
<Table.TableRow v-for="item, idx in data">
|
||||||
|
<Table.TableCell>
|
||||||
|
{{ item.issuedAt?.substring(0, 10) || item.createdAt?.substring(0, 10) }}
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
{{ item.doctor?.employee?.person?.name || '-' }}
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
<div>
|
||||||
|
Racikan: {{ item.items.filter(function(element){ return element.isMix}).length }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Non Racikan: {{ item.items.filter(function(element){ return !element.isMix}).length }}
|
||||||
|
</div>
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell class="text-center">
|
||||||
|
{{ item.status_code }}
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell class="text-end">
|
||||||
|
<Nav
|
||||||
|
v-if="item.status_code == 'new'"
|
||||||
|
:small-mode="true"
|
||||||
|
:default-class="'flex gap-1'"
|
||||||
|
@click="(type) => { navClick(type, item) }"
|
||||||
|
/>
|
||||||
|
</Table.TableCell>
|
||||||
|
</Table.TableRow>
|
||||||
|
</Table.TableBody>
|
||||||
|
</Table.Table>
|
||||||
|
<template v-for="item, idx in data">
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
+1
-2
@@ -5,7 +5,6 @@ import Nav from '~/components/pub/my-ui/nav-footer/ca-ed-su.vue'
|
|||||||
|
|
||||||
import type { Prescription } from '~/models/prescription';
|
import type { Prescription } from '~/models/prescription';
|
||||||
import PrescriptionItem from '~/components/app/prescription-item/list.vue';
|
import PrescriptionItem from '~/components/app/prescription-item/list.vue';
|
||||||
import { add } from 'date-fns';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: Prescription[]
|
data: Prescription[]
|
||||||
@@ -66,7 +65,7 @@ function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</DE.Block>
|
</DE.Block>
|
||||||
<PrescriptionItem :data="item.items || []" @click="console.log('click')" class="mb-10" />
|
<PrescriptionItem :data="item.items || []" class="mb-10" />
|
||||||
<!-- <div v-if="idx < data.length - 1" class="my-8 -mx-4 border-t border-t-slate-300" /> -->
|
<!-- <div v-if="idx < data.length - 1" class="my-8 -mx-4 border-t border-t-slate-300" /> -->
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import { Block, Cell } from '~/components/pub/my-ui/doc-entry/index'
|
import * as DE from '~/components/pub/my-ui/doc-entry';
|
||||||
// import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
|
||||||
// import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -17,40 +15,40 @@
|
|||||||
<Separator class="my-5" />
|
<Separator class="my-5" />
|
||||||
<div class="md:grid md:grid-cols-2 font-semibold">
|
<div class="md:grid md:grid-cols-2 font-semibold">
|
||||||
<div>
|
<div>
|
||||||
<PubCustomUiDocEntryBlock mode="preview">
|
<DE.Block mode="preview">
|
||||||
<PubCustomUiDocEntryCell>
|
<DE.Cell>
|
||||||
<PubCustomUiDocEntryLabel>Order #1</PubCustomUiDocEntryLabel>
|
<DE.Label>Order #1</DE.Label>
|
||||||
<PubCustomUiDocEntryColon />
|
<DE.Colon />
|
||||||
<PubCustomUiDocEntryField>
|
<DE.Field>
|
||||||
2025-01-01
|
2025-01-01
|
||||||
</PubCustomUiDocEntryField>
|
</DE.Field>
|
||||||
</PubCustomUiDocEntryCell>
|
</DE.Cell>
|
||||||
<PubCustomUiDocEntryCell>
|
<DE.Cell>
|
||||||
<PubCustomUiDocEntryLabel>Status</PubCustomUiDocEntryLabel>
|
<DE.Label>Status</DE.Label>
|
||||||
<PubCustomUiDocEntryColon />
|
<DE.Colon />
|
||||||
<PubCustomUiDocEntryField>
|
<DE.Field>
|
||||||
Status
|
Status
|
||||||
</PubCustomUiDocEntryField>
|
</DE.Field>
|
||||||
</PubCustomUiDocEntryCell>
|
</DE.Cell>
|
||||||
</PubCustomUiDocEntryBlock>
|
</DE.Block>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<PubCustomUiDocEntryBlock mode="preview">
|
<DE.Block mode="preview">
|
||||||
<PubCustomUiDocEntryCell>
|
<DE.Cell>
|
||||||
<PubCustomUiDocEntryLabel>DPJP</PubCustomUiDocEntryLabel>
|
<DE.Label>DPJP</DE.Label>
|
||||||
<PubCustomUiDocEntryColon />
|
<DE.Colon />
|
||||||
<PubCustomUiDocEntryField>
|
<DE.Field>
|
||||||
Nama Dokter
|
Nama Dokter
|
||||||
</PubCustomUiDocEntryField>
|
</DE.Field>
|
||||||
</PubCustomUiDocEntryCell>
|
</DE.Cell>
|
||||||
<PubCustomUiDocEntryCell>
|
<DE.Cell>
|
||||||
<PubCustomUiDocEntryLabel>PPDS</PubCustomUiDocEntryLabel>
|
<DE.Label>PPDS</DE.Label>
|
||||||
<PubCustomUiDocEntryColon />
|
<DE.Colon />
|
||||||
<PubCustomUiDocEntryField>
|
<DE.Field>
|
||||||
Nama PPDS
|
Nama PPDS
|
||||||
</PubCustomUiDocEntryField>
|
</DE.Field>
|
||||||
</PubCustomUiDocEntryCell>
|
</DE.Cell>
|
||||||
</PubCustomUiDocEntryBlock>
|
</DE.Block>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,86 +1,215 @@
|
|||||||
<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
|
||||||
|
import { type Medicine } from '~/models/medicine'
|
||||||
|
import { getList as getMedicineList } from '~/services/medicine.service'
|
||||||
|
|
||||||
|
// Prescription
|
||||||
import { getDetail } from '~/services/prescription.service'
|
import { getDetail } from '~/services/prescription.service'
|
||||||
import Detail from '~/components/app/prescription/detail.vue'
|
// import Detail from '~/components/app/prescription/detail.vue'
|
||||||
import { getList as getPrescriptionItemList } from '~/services/prescription-item.service'
|
import Entry from '~/components/app/prescription/entry.vue'
|
||||||
import ItemListEntry from '~/components/app/prescription-item/list-entry.vue'
|
import { remove, submit } from '~/services/prescription.service'
|
||||||
import { type PrescriptionItem } from '~/models/prescription-item'
|
|
||||||
|
|
||||||
import MixItemEntry from '~/components/app/prescription-item/mix-entry.vue'
|
|
||||||
import { create } from '~/services/prescription-item.service';
|
|
||||||
|
|
||||||
import NonMixItemEntry from '~/components/app/prescription-item/non-mix-entry.vue'
|
|
||||||
|
|
||||||
|
// Prescription items
|
||||||
import {
|
import {
|
||||||
|
getList as getItemList,
|
||||||
|
create as createItem,
|
||||||
|
update as updateItem,
|
||||||
|
} from '~/services/prescription-item.service'
|
||||||
|
import {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
recItem,
|
recItem,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
handleActionRemove,
|
||||||
} from '~/handlers/prescription-item.handler'
|
} from '~/handlers/prescription-item.handler'
|
||||||
|
|
||||||
// props
|
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 MixItemEntry from '~/components/app/prescription-item/mix-entry.vue'
|
||||||
|
|
||||||
|
// Props
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
encounter_id: number
|
encounter_id: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// declaration & flows
|
// Prescriptions
|
||||||
// const route = useRoute()
|
const isSubmitConfirmationOpen = ref(false)
|
||||||
const { getQueryParam } = useQueryParam()
|
const isDeleteConfirmationOpen = ref(false)
|
||||||
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 || null
|
|
||||||
const items = ref(data?.items || [])
|
|
||||||
|
|
||||||
|
// Prescription Items
|
||||||
|
const isItemDetailDialogOpen = ref(false)
|
||||||
|
|
||||||
|
// Prescription
|
||||||
|
const { getQueryParam } = useQueryParam()
|
||||||
|
const rawId = getQueryParam('id')
|
||||||
|
const id = typeof rawId === 'string' ? parseInt(rawId) : 0
|
||||||
|
const dataRes = await getDetail(id, { includes: 'encounter,doctor,doctor-employee,doctor-employee-person' })
|
||||||
|
const data = ref(dataRes.body?.data || null)
|
||||||
|
|
||||||
|
// Prescription Items
|
||||||
|
const getItemsOpt = { 'prescription-id': id, includes: 'medicine,medicine-medicineForm,medicineMix' }
|
||||||
const {
|
const {
|
||||||
data: prescriptionItems,
|
data: items,
|
||||||
fetchData: getMyList,
|
isLoading,
|
||||||
} = usePaginatedList<PrescriptionItem> ({
|
fetchData: getPrescriptionItems,
|
||||||
fetchFn: async ({ page, search }) => {
|
} = usePaginatedList({
|
||||||
const result = await getPrescriptionItemList({ 'prescription-id': id, search, page })
|
fetchFn: async (params: any) => {
|
||||||
if (result.success) {
|
const result = await getItemList({
|
||||||
data.value = result.body.data
|
...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 || {} }
|
return { success: result.success || false, body: result.body || {} }
|
||||||
},
|
},
|
||||||
entityName: 'prescription-item',
|
entityName: 'division',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// const items = ref<PrescriptionItem[]>([])
|
||||||
|
const mixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
||||||
|
const medicinemixItems = ref<MedicinemixItem[]>([])
|
||||||
|
const nonMixItem = ref<PrescriptionItem>(genPrescriptionItem())
|
||||||
|
|
||||||
|
mixItem.value.prescription_id = id
|
||||||
|
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[]>([])
|
||||||
|
|
||||||
|
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 () => {
|
||||||
|
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() {
|
||||||
create({data})
|
const res = await createItem(mixItem.value)
|
||||||
|
if (res.success) {
|
||||||
|
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
|
||||||
|
getPrescriptionItems()
|
||||||
|
mixDialogOpenStatus.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveNonMix(data: PrescriptionItem) {
|
async function saveNonMix() {
|
||||||
create({data})
|
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) {
|
||||||
|
medicines.value = res.body.data
|
||||||
|
} else {
|
||||||
|
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>
|
||||||
|
|
||||||
@@ -91,42 +220,147 @@ function saveNonMix(data: PrescriptionItem) {
|
|||||||
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="prescriptionItems"
|
: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="xl"
|
size="lg"
|
||||||
prevent-outside
|
prevent-outside
|
||||||
>
|
>
|
||||||
<MixItemEntry
|
<MixItemEntry
|
||||||
:data="data"
|
:data="mixItem"
|
||||||
:items="items"
|
:items="medicinemixItems"
|
||||||
@close="mixDialogOpen = false"
|
:medicines="medicines"
|
||||||
|
@close="mixDialogOpenStatus = false"
|
||||||
@save="saveMix"
|
@save="saveMix"
|
||||||
|
@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="xl"
|
size="lg"
|
||||||
prevent-outside
|
prevent-outside
|
||||||
>
|
>
|
||||||
<NonMixItemEntry
|
<NonMixItemEntry
|
||||||
:data="data"
|
:data="nonMixItem"
|
||||||
:items="items"
|
:medicines="medicines"
|
||||||
@close="mixDialogOpen = false"
|
@close="mixDialogOpenStatus = false"
|
||||||
@save="saveNonMix"
|
@save="saveNonMix"
|
||||||
|
@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>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// Composables
|
||||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
|
||||||
@@ -12,7 +14,6 @@ import {
|
|||||||
recAction,
|
recAction,
|
||||||
recItem,
|
recItem,
|
||||||
isReadonly,
|
isReadonly,
|
||||||
isFormEntryDialogOpen,
|
|
||||||
isRecordConfirmationOpen,
|
isRecordConfirmationOpen,
|
||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleActionSave,
|
handleActionSave,
|
||||||
@@ -20,17 +21,17 @@ import {
|
|||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getList, getDetail } from '~/services/prescription.service'
|
import { getList, getDetail } from '~/services/prescription.service'
|
||||||
import List from '~/components/app/prescription/list.vue'
|
import FlatList from '~/components/app/prescription/flat-list.vue'
|
||||||
|
import Grouped from '~/components/app/prescription/grouped-list.vue'
|
||||||
import type { Prescription } from '~/models/prescription'
|
import type { Prescription } from '~/models/prescription'
|
||||||
|
import { submit } from '~/services/prescription.service'
|
||||||
const props = defineProps<{
|
import type { ToastFn } from '~/handlers/_handler'
|
||||||
encounter_id: number
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { setQueryParams } = useQueryParam()
|
const { setQueryParams } = useQueryParam()
|
||||||
|
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
const isSubmitConfirmationOpen = ref(false)
|
||||||
|
|
||||||
const plainEid = route.params.id
|
const plainEid = route.params.id
|
||||||
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0
|
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0
|
||||||
@@ -42,21 +43,40 @@ const {
|
|||||||
searchInput,
|
searchInput,
|
||||||
fetchData: getMyList,
|
fetchData: getMyList,
|
||||||
} = usePaginatedList<Prescription>({
|
} = usePaginatedList<Prescription>({
|
||||||
fetchFn: async ({ page, search }) => {
|
fetchFn: async (params: any) => {
|
||||||
const result = await getList({
|
const result = await getList({
|
||||||
search,
|
|
||||||
page,
|
|
||||||
'encounter-id': encounter_id,
|
'encounter-id': encounter_id,
|
||||||
includes: 'doctor,doctor-employee,doctor-employee-person',
|
includes: 'doctor,doctor-employee,doctor-employee-person,items,items-medicine,items-medicine-medicineForm',
|
||||||
|
search: params.search,
|
||||||
|
page: params.page,
|
||||||
|
'page-number': params['page-number'] || 0,
|
||||||
|
'page-size': params['page-size'] || 10,
|
||||||
})
|
})
|
||||||
return { success: result.success || false, body: result.body || {} }
|
return { success: result.success || false, body: result.body || {} }
|
||||||
},
|
},
|
||||||
entityName: 'prescription'
|
entityName: 'prescription'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function updateProvidedVal(val: boolean) {
|
||||||
|
flatMode.value = val
|
||||||
|
}
|
||||||
|
const flatMode = ref(false)
|
||||||
|
const flatModeLabel = ref('Mode Flat: Tidak')
|
||||||
|
provide('flatMode', { flatMode, updateProvidedVal })
|
||||||
|
watch(flatMode, (newVal) => {
|
||||||
|
flatModeLabel.value = newVal ? 'Mode Flat: Ya' : 'Mode Flat: Tidak'
|
||||||
|
})
|
||||||
|
|
||||||
|
const vFn = () => {} // Void function
|
||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
title: 'Order Obat',
|
title: 'Order Obat',
|
||||||
icon: 'i-lucide-box',
|
icon: 'i-lucide-box',
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
component: defineAsyncComponent(() => import('~/components/pub/my-ui/toggle/provided-toggle.vue')),
|
||||||
|
props: { variant: 'outline', label: flatModeLabel, providedKey: 'flatMode' }
|
||||||
|
},
|
||||||
|
],
|
||||||
refSearchNav: {
|
refSearchNav: {
|
||||||
placeholder: 'Cari (min. 3 karakter)...',
|
placeholder: 'Cari (min. 3 karakter)...',
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
@@ -71,11 +91,17 @@ const headerPrep: HeaderPrep = {
|
|||||||
addNav: {
|
addNav: {
|
||||||
label: 'Tambah',
|
label: 'Tambah',
|
||||||
icon: 'i-lucide-plus',
|
icon: 'i-lucide-plus',
|
||||||
onClick: () => {
|
onClick: async () => {
|
||||||
recItem.value = null
|
recItem.value = null
|
||||||
recId.value = 0
|
recId.value = 0
|
||||||
isFormEntryDialogOpen.value = true
|
|
||||||
isReadonly.value = false
|
isReadonly.value = false
|
||||||
|
const saveResp = await handleActionSave({ encounter_id }, vFn, vFn, vFn)
|
||||||
|
if (saveResp.success) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': saveResp.body?.data?.id.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -85,53 +111,13 @@ provide('rec_action', recAction)
|
|||||||
provide('rec_item', recItem)
|
provide('rec_item', recItem)
|
||||||
provide('table_data_loader', isLoading)
|
provide('table_data_loader', isLoading)
|
||||||
|
|
||||||
const getMyDetail = async (id: number | string) => {
|
function confirmCancel(data: Prescription) {
|
||||||
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 cancel(data: Prescription) {
|
|
||||||
recId.value = data.id
|
recId.value = data.id
|
||||||
recItem.value = data
|
recItem.value = data
|
||||||
isRecordConfirmationOpen.value = true
|
isRecordConfirmationOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit(data: Prescription) {
|
function goToEdit(data: Prescription) {
|
||||||
setQueryParams({
|
setQueryParams({
|
||||||
'mode': 'entry',
|
'mode': 'entry',
|
||||||
'id': data.id.toString()
|
'id': data.id.toString()
|
||||||
@@ -139,21 +125,45 @@ function edit(data: Prescription) {
|
|||||||
recItem.value = data
|
recItem.value = data
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit(data: Prescription) {
|
function confirmSubmit(data: Prescription) {
|
||||||
|
recId.value = data.id
|
||||||
|
recItem.value = data
|
||||||
|
isSubmitConfirmationOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleActionSubmit(id: number, refresh: () => void, toast: ToastFn) {
|
||||||
|
const result = await submit(id)
|
||||||
|
if (result.success) {
|
||||||
|
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
|
||||||
|
setTimeout(refresh, 300)
|
||||||
|
} else {
|
||||||
|
toast({ title: 'Gagal', description: 'Gagal menjalankan perintah', variant: 'destructive' })
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Header :prep="{ ...headerPrep }" />
|
<Header :prep="{ ...headerPrep }" />
|
||||||
<List
|
<template v-if="!flatMode">
|
||||||
v-if="!isLoading.dataListLoading"
|
<Grouped
|
||||||
:data="data"
|
v-if="!isLoading.dataListLoading"
|
||||||
:pagination-meta="paginationMeta"
|
:data="data"
|
||||||
@cancel="cancel"
|
:pagination-meta="paginationMeta"
|
||||||
@edit="edit"
|
@cancel="confirmCancel"
|
||||||
@submit="submit"
|
@edit="goToEdit"
|
||||||
/>
|
@submit="confirmSubmit"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<FlatList
|
||||||
|
v-if="!isLoading.dataListLoading"
|
||||||
|
:data="data"
|
||||||
|
:pagination-meta="paginationMeta"
|
||||||
|
@cancel="confirmCancel"
|
||||||
|
@edit="goToEdit"
|
||||||
|
@submit="confirmSubmit"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<RecordConfirmation
|
<RecordConfirmation
|
||||||
v-model:open="isRecordConfirmationOpen"
|
v-model:open="isRecordConfirmationOpen"
|
||||||
@@ -162,5 +172,37 @@ function submit(data: Prescription) {
|
|||||||
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
@confirm="() => handleActionRemove(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
|
||||||
|
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="() => handleActionSubmit(recId, getMyList, toast)"
|
||||||
|
@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>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const selected = ref<any[]>([])
|
|||||||
function toggleSelection(row: any, event?: Event) {
|
function toggleSelection(row: any, event?: Event) {
|
||||||
if (event) event.stopPropagation() // cegah event bubble ke TableRow
|
if (event) event.stopPropagation() // cegah event bubble ke TableRow
|
||||||
|
|
||||||
const isMultiple = props.selectMode === 'multiple' // props.selectMode === 'multi' ||
|
const isMultiple = props.selectMode === 'multiple' // props.selectMode === 'multi' ||
|
||||||
|
|
||||||
// gunakan pembanding berdasarkan id atau stringify data
|
// gunakan pembanding berdasarkan id atau stringify data
|
||||||
const findIndex = selected.value.findIndex((r) => JSON.stringify(r) === JSON.stringify(row))
|
const findIndex = selected.value.findIndex((r) => JSON.stringify(r) === JSON.stringify(row))
|
||||||
@@ -128,7 +128,7 @@ function handleActionCellClick(event: Event, _cellRef: string) {
|
|||||||
'bg-green-50':
|
'bg-green-50':
|
||||||
props.selectMode === 'single' && selected.some((r) => JSON.stringify(r) === JSON.stringify(row)),
|
props.selectMode === 'single' && selected.some((r) => JSON.stringify(r) === JSON.stringify(row)),
|
||||||
'bg-blue-50':
|
'bg-blue-50':
|
||||||
(props.selectMode === 'multiple') && // props.selectMode === 'multi' ||
|
(props.selectMode === 'multiple') && // props.selectMode === 'multi' ||
|
||||||
selected.some((r) => JSON.stringify(r) === JSON.stringify(row)),
|
selected.some((r) => JSON.stringify(r) === JSON.stringify(row)),
|
||||||
}"
|
}"
|
||||||
@click="toggleSelection(row)"
|
@click="toggleSelection(row)"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createCrudHandler, genCrudHandler } from '~/handlers/_handler'
|
import { genCrudHandler } from '~/handlers/_handler'
|
||||||
import { create, update, remove } from '~/services/prescription.service'
|
import { create, update, remove } from '~/services/prescription.service'
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
|
import type { MedicineFormData } from "~/schemas/medicine.schema"
|
||||||
import { type Base, genBase } from "./_base"
|
import { type Base, genBase } from "./_base"
|
||||||
|
import type { MedicineGroup } from "./medicine-group"
|
||||||
|
import type { MedicineMethod } from "./medicine-method"
|
||||||
|
|
||||||
export interface Medicine extends Base {
|
export interface Medicine extends Base {
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
medicineGroup_code: string
|
medicineGroup_code?: string
|
||||||
medicineMethod_code: string
|
medicineGroup?: MedicineGroup
|
||||||
|
medicineMethod_code?: string
|
||||||
|
medicineMethod?: MedicineMethod
|
||||||
|
medicineForm_code?: string
|
||||||
|
medicineForm?: MedicineFormData
|
||||||
uom_code: string
|
uom_code: string
|
||||||
infra_id?: string | null
|
infra_id?: string | null
|
||||||
stock: number
|
stock: number
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { type Base, genBase } from "./_base"
|
import { type Base, genBase } from "./_base"
|
||||||
import { type Medicine, genMedicine } from "./medicine";
|
import { type Medicine, genMedicine } from "./medicine";
|
||||||
|
|
||||||
interface MedicinemixItem extends Base {
|
export interface MedicinemixItem extends Base {
|
||||||
id: number
|
id: number
|
||||||
medicineMix_id: number
|
medicineMix_id: number
|
||||||
medicine_id: number
|
medicine_id: number
|
||||||
@@ -35,7 +35,7 @@ export interface DeleteDto {
|
|||||||
id: number
|
id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MedicinemixItem(): MedicinemixItem {
|
export function genMedicinemixItem(): MedicinemixItem {
|
||||||
return {
|
return {
|
||||||
...genBase(),
|
...genBase(),
|
||||||
medicineMix_id: 0,
|
medicineMix_id: 0,
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ export interface PrescriptionItem {
|
|||||||
id: number;
|
id: number;
|
||||||
prescription_id: number;
|
prescription_id: number;
|
||||||
isMix: boolean;
|
isMix: boolean;
|
||||||
medicine_id: number;
|
medicine_code?: string;
|
||||||
medicine: Medicine;
|
medicine?: Medicine;
|
||||||
medicineMix_id: number;
|
medicineMix_id?: number;
|
||||||
medicineMix: Medicinemix
|
medicineMix?: Medicinemix
|
||||||
frequency: number;
|
frequency: number;
|
||||||
dose: number;
|
dose: number;
|
||||||
interval: number;
|
interval: number;
|
||||||
@@ -29,35 +29,35 @@ export interface CreateDto {
|
|||||||
quantity: number;
|
quantity: number;
|
||||||
usage: string;
|
usage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetListDto {
|
export interface GetListDto {
|
||||||
page: number
|
page: number
|
||||||
size: number
|
size: number
|
||||||
name?: string
|
name?: string
|
||||||
// code?: string
|
// code?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetDetailDto {
|
export interface GetDetailDto {
|
||||||
id?: string
|
id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateDto extends CreateDto {
|
export interface UpdateDto extends CreateDto {
|
||||||
id?: number
|
id?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteDto {
|
export interface DeleteDto {
|
||||||
id?: string
|
id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genPresciptionItem(): PrescriptionItem {
|
export function genPrescriptionItem(): PrescriptionItem {
|
||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
prescription_id: 0,
|
prescription_id: 0,
|
||||||
isMix: false,
|
isMix: false,
|
||||||
medicine_id: 0,
|
// medicine_code: '',
|
||||||
medicine: genMedicine(),
|
// medicine: genMedicine(),
|
||||||
medicineMix_id: 0,
|
// medicineMix_id: 0,
|
||||||
medicineMix: genMedicinemix(),
|
// medicineMix: genMedicinemix(),
|
||||||
frequency: 0,
|
frequency: 0,
|
||||||
dose: 0,
|
dose: 0,
|
||||||
interval: 0,
|
interval: 0,
|
||||||
@@ -66,4 +66,3 @@ export function genPresciptionItem(): PrescriptionItem {
|
|||||||
usage: ''
|
usage: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
|
import { xfetch } from '~/composables/useXfetch'
|
||||||
|
|
||||||
const path = '/api/v1/prescription'
|
const path = '/api/v1/prescription'
|
||||||
const name = 'prescription'
|
const name = 'prescription'
|
||||||
@@ -22,3 +23,16 @@ export function update(id: number | string, data: any) {
|
|||||||
export function remove(id: number | string) {
|
export function remove(id: number | string) {
|
||||||
return base.remove(path, id)
|
return base.remove(path, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function submit(id: number) {
|
||||||
|
try {
|
||||||
|
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
|
||||||
|
const result: any = {}
|
||||||
|
result.success = resp.success
|
||||||
|
result.body = (resp.body as Record<string, any>) || {}
|
||||||
|
return result
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error submitting ${name}:`, error)
|
||||||
|
throw new Error(`Failed to submit ${name}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user