feat/prescription: finalize #1

+ integration
+ non mix entry
This commit is contained in:
Andrian Roshandy
2025-11-16 19:52:22 +07:00
parent 0da8701a6c
commit 20649c5917
6 changed files with 329 additions and 174 deletions
@@ -11,16 +11,17 @@ export const config: Config = {
headers: [
[
{ label: 'Nama' },
{ label: 'Cara Buat' },
{ label: 'Bentuk' },
{ label: 'Freq' },
{ label: 'Dosis' },
{ label: 'Interval' },
// { label: 'Interval' },
{ label: 'Total' },
{ label: '' },
],
],
keys: ['medicine.name', 'medicine.medicineForm.name', 'frequency', 'dose', 'interval', 'total', 'action'],
keys: ['medicine.name', 'isMix', 'medicine.medicineForm.name', 'frequency', 'dose', 'quantity', 'action'], //
delKeyNames: [
{ key: 'code', label: 'Kode' },
@@ -28,17 +29,8 @@ export const config: Config = {
],
parses: {
cateogry: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineCategory?.name || '-'
},
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 || '-'
isMix: (rec: unknown): unknown => {
return (rec as SmallDetailDto).isMix ? 'Racikan' : 'Non Racikan'
},
},
@@ -18,7 +18,6 @@ const props = defineProps<{
const { medicines } = toRefs(props)
const medicineItems = ref<CB.Item[]>([])
const selectedMedicine_code = ref<string>(props.data.medicine?.code || '')
type ClickType = 'close' | 'save'
@@ -54,35 +53,39 @@ function addItem() {
function searchMedicineText(value: string) {
emit('update:searchText', value)
}
function deleteItem(idx: number) {
props.items.splice(idx, 1)
}
</script>
<template>
<DE.Block :colCount="4" :cellFlex="false">
<DE.Cell :colSpan="4">
<DE.Label>Nama</DE.Label>
<DE.Field>
<Input :value="data.medicineMix?.name" />
</DE.Field>
<DE.Label>Nama</DE.Label>
<DE.Field>
<Input :value="data.medicineMix?.name" />
</DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label>Frequensi</DE.Label>
<DE.Field><Input v-model="data.frequency" /></DE.Field>
<DE.Label>Frequensi</DE.Label>
<DE.Field><Input v-model="data.frequency" /></DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label>Dosis</DE.Label>
<DE.Field><Input v-model="data.dose" /></DE.Field>
<DE.Label>Dosis</DE.Label>
<DE.Field><Input v-model="data.dose" /></DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label>Sediaan</DE.Label>
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
<DE.Label>Sediaan</DE.Label>
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
</DE.Cell>
<DE.Cell>
<DE.Label>Total</DE.Label>
<DE.Field><Input /></DE.Field>
<DE.Label>Total</DE.Label>
<DE.Field><Input v-model="data.quantity" /></DE.Field>
</DE.Cell>
<DE.Cell :colSpan="4">
<DE.Label>Cara Pakai</DE.Label>
<DE.Field><Input /></DE.Field>
<DE.Label>Cara Pakai</DE.Label>
<DE.Field><Input v-model="data.usage" /></DE.Field>
</DE.Cell>
</DE.Block>
<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.TableHead>Nama</Table.TableHead>
<Table.TableHead class="w-24">Dosis</Table.TableHead>
<Table.TableHead class="w-24">Satuan</Table.TableHead>
<Table.TableHead class="w-20">..</Table.TableHead>
<!-- <Table.TableHead class="w-24">Satuan</Table.TableHead> -->
<Table.TableHead class="w-10"></Table.TableHead>
</Table.TableRow>
</Table.TableHeader>
<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>
<Input v-model="item.medicine.name" />
<CB.Combobox
v-model="data.medicine_code"
:items="medicineItems"
@update:searchText="searchMedicineText"
/>
</Table.TableCell>
<Table.TableCell>
<Input v-model="item.dose" />
</Table.TableCell>
<Table.TableCell>
<!-- <Table.TableCell>
<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.TableRow>
<Table.TableRow v-else>
@@ -6,7 +6,7 @@ import * as CB from '~/components/pub/my-ui/combobox'
// 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'
const props = defineProps<{
@@ -20,7 +20,6 @@ const medicineForm = computed(() => {
const medicine = props.medicines.find(m => m.code === props.data.medicine_code)
return medicine ? medicine.medicineForm?.name : '--tidak diketahui--'
})
// const selectedMedicine_code = ref<string>(props.data.medicine_code || '')
type ClickType = 'close' | 'save'
type Item = {
@@ -28,19 +27,10 @@ type Item = {
label: string
}
const bigTimeUnitCodeItems: Item[] = []
if(!props.data.intervalUnit_code) {
props.data.intervalUnit_code = 'day'
}
// Object.keys(bigTimeUnitCodes).forEach((key) => {
// bigTimeUnitCodeItems.push({
// value: key,
// label: bigTimeUnitCodes[key] || '',
// })
// })
const emit = defineEmits<{
close: [],
save: [data: PrescriptionItem],
@@ -105,7 +95,7 @@ function searchMedicineText(value: string) {
</DE.Cell>
<DE.Cell :colSpan="4">
<DE.Label>Cara Pakai</DE.Label>
<DE.Field><Input /></DE.Field>
<DE.Field><Input v-model="data.usage" /></DE.Field>
</DE.Cell>
</DE.Block>
<Separator class="my-5" />
+13 -5
View File
@@ -1,17 +1,25 @@
<script setup lang="ts">
import type { Prescription } from '~/models/prescription';
defineProps<{
data: Prescription
}>()
</script>
<template>
<div class="md:grid md:grid-cols-2 font-semibold">
<div class="md:grid md:grid-cols-2">
<div class="md:pe-10">
<PubMyUiDocEntryBlock>
<PubMyUiDocEntryCell>
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
<PubMyUiDocEntryField>
<Input />
<Input :value="data.issuedAt || data.createdAt?.substring(0, 10)" readonly />
</PubMyUiDocEntryField>
</PubMyUiDocEntryCell>
<PubMyUiDocEntryCell>
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
<PubMyUiDocEntryField>
<Input />
<Input v-model="data.status_code" readonly />
</PubMyUiDocEntryField>
</PubMyUiDocEntryCell>
</PubMyUiDocEntryBlock>
@@ -21,13 +29,13 @@
<PubMyUiDocEntryCell>
<PubMyUiDocEntryLabel position="dynamic">DPJP</PubMyUiDocEntryLabel>
<PubMyUiDocEntryField>
<Input />
<Input v-model="data.doctor.employee.person.name" readonly />
</PubMyUiDocEntryField>
</PubMyUiDocEntryCell>
<PubMyUiDocEntryCell>
<PubMyUiDocEntryLabel position="dynamic">PPDS</PubMyUiDocEntryLabel>
<PubMyUiDocEntryField>
<Input />
<Input value="......" readonly />
</PubMyUiDocEntryField>
</PubMyUiDocEntryCell>
</PubMyUiDocEntryBlock>