增加开方-用量 袋数

This commit is contained in:
2026-05-07 11:59:15 +08:00
parent 581c74f11a
commit 477fcf6180
8 changed files with 101 additions and 13 deletions
@@ -798,6 +798,17 @@
/>
</el-form-item>
</el-col>
<el-col v-if="editForm.prescription_type === '浓缩水丸'" :span="8">
<el-form-item label=" " prop="dosage_bag_count" label-width="12px">
<el-select v-model="editForm.dosage_bag_count" placeholder="请选择袋数" class="w-[120px]">
<el-option label="1袋" :value="1" />
<el-option label="2袋" :value="2" />
<el-option label="3袋" :value="3" />
<el-option label="4袋" :value="4" />
<el-option label="5袋" :value="5" />
</el-select>
</el-form-item>
</el-col>
<!-- 饮片代煎选项 -->
<el-col v-if="editForm.prescription_type === '饮片'" :span="8">
@@ -2077,15 +2088,19 @@ const rxUsageText = computed(() => {
if (!v) return '—'
if (v.usage_text) return v.usage_text
const times = Number(v.times_per_day) > 0 ? Number(v.times_per_day) : 3
const bags = Number(v.bags_per_dose) > 0 ? Number(v.bags_per_dose) : 1
const amount = v.dosage_amount != null ? Number(v.dosage_amount) : 10
const unit = v.dosage_unit || 'g'
const usageWay = v.usage_way || '温水送服'
const usageTime = v.usage_time || ''
const seg: string[] = []
seg.push(`每天${times}次`)
seg.push(`一次${bags}包(约${amount}${unit})`)
seg.push(`每包${amount}${unit}`)
if ((v.prescription_type || '浓缩水丸') === '浓缩水丸') {
const bags = Number(v.dosage_bag_count) > 0 ? Number(v.dosage_bag_count) : 1
seg.push(`一次${bags}袋`)
seg.push(`每袋${amount}${unit}`)
} else {
seg.push(`一次${amount}${unit}`)
}
seg.push(usageWay)
if (usageTime) seg.push(usageTime)
return seg.join(', ')
@@ -2254,6 +2269,7 @@ const editForm = reactive({
prescription_type: '浓缩水丸',
dosage_amount: 1 as number | undefined,
dosage_unit: 'g',
dosage_bag_count: 1,
need_decoction: false,
bags_per_dose: 1,
patient_name: '',
@@ -2367,16 +2383,19 @@ watch(() => editForm.prescription_type, (newType) => {
if (newType === '浓缩水丸') {
editForm.dosage_unit = 'g'
editForm.dosage_amount = 1
editForm.dosage_bag_count = 1
editForm.need_decoction = false
editForm.bags_per_dose = 1
} else if (newType === '饮片') {
editForm.dosage_unit = 'ml'
editForm.dosage_amount = 50
editForm.dosage_bag_count = 1
editForm.bags_per_dose = 1
// need_decoction 保持用户选择
} else {
editForm.dosage_unit = 'g'
editForm.dosage_amount = undefined
editForm.dosage_bag_count = 1
editForm.need_decoction = false
editForm.bags_per_dose = 1
}
@@ -2953,6 +2972,11 @@ const removeHerb = (index: number) => {
const resetForm = () => {
editForm.id = 0
editForm.prescription_type = '浓缩水丸'
editForm.dosage_amount = 1
editForm.dosage_unit = 'g'
editForm.dosage_bag_count = 1
editForm.need_decoction = false
editForm.bags_per_dose = 1
editForm.patient_name = ''
editForm.gender = 1
editForm.age = 0
@@ -3070,6 +3094,7 @@ const handleEdit = async (row: any) => {
}
}
editForm.dosage_bag_count = src.dosage_bag_count ? Number(src.dosage_bag_count) : 1
editForm.need_decoction = src.need_decoction === 1 || src.need_decoction === true
editForm.bags_per_dose = src.bags_per_dose ? Number(src.bags_per_dose) : 1
editForm.patient_name = src.patient_name || ''
@@ -801,6 +801,9 @@
<el-descriptions-item label="用量">
<template v-if="detailPrescription.dosage_amount">
{{ detailPrescription.dosage_amount }}{{ detailPrescription.dosage_unit || 'g' }}
<template v-if="detailPrescription.prescription_type === '浓缩水丸'">
· {{ Number(detailPrescription.dosage_bag_count) > 0 ? Number(detailPrescription.dosage_bag_count) : 1 }}袋
</template>
<span v-if="detailPrescription.prescription_type === '饮片' && detailPrescription.need_decoction !== null" class="ml-2 text-gray-500">
({{ detailPrescription.need_decoction ? '代煎' : '不代煎' }})
</span>
@@ -4459,7 +4462,8 @@ const slipPerBagDosageText = computed(() => {
const d = prescriptionViewData.value
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return '—'
if (d.dosage_amount == null || d.dosage_amount === '') return '—'
return `${d.dosage_amount}${d.dosage_unit || 'g'}`
const bags = Number(d.dosage_bag_count) > 0 ? Number(d.dosage_bag_count) : 1
return `${d.dosage_amount}${d.dosage_unit || 'g'} · ${bags}袋`
})
const slipPillGrams = computed(() => {
@@ -4564,15 +4568,19 @@ const rxUsageText = computed(() => {
if (!v) return '—'
if (v.usage_text) return v.usage_text
const times = Number(v.times_per_day) > 0 ? Number(v.times_per_day) : 3
const bags = Number(v.bags_per_dose) > 0 ? Number(v.bags_per_dose) : 1
const amount = v.dosage_amount != null ? Number(v.dosage_amount) : 10
const unit = v.dosage_unit || 'g'
const usageWay = v.usage_way || '温水送服'
const usageTime = v.usage_time || ''
const seg: string[] = []
seg.push(`每天${times}次`)
seg.push(`一次${bags}包(约${amount}${unit})`)
seg.push(`每包${amount}${unit}`)
if ((v.prescription_type || '浓缩水丸') === '浓缩水丸') {
const bags = Number(v.dosage_bag_count) > 0 ? Number(v.dosage_bag_count) : 1
seg.push(`一次${bags}袋`)
seg.push(`每袋${amount}${unit}`)
} else {
seg.push(`一次${amount}${unit}`)
}
seg.push(usageWay)
if (usageTime) seg.push(usageTime)
return seg.join(', ')
@@ -819,6 +819,9 @@
<el-descriptions-item label="用量">
<template v-if="detailPrescription.dosage_amount">
{{ detailPrescription.dosage_amount }}{{ detailPrescription.dosage_unit || 'g' }}
<template v-if="detailPrescription.prescription_type === '浓缩水丸'">
· {{ Number(detailPrescription.dosage_bag_count) > 0 ? Number(detailPrescription.dosage_bag_count) : 1 }}
</template>
<span v-if="detailPrescription.prescription_type === '饮片' && detailPrescription.need_decoction !== null" class="ml-2 text-gray-500">
({{ detailPrescription.need_decoction ? '代煎' : '不代煎' }})
</span>
@@ -4510,7 +4513,8 @@ const slipPerBagDosageText = computed(() => {
const d = prescriptionViewData.value
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return '—'
if (d.dosage_amount == null || d.dosage_amount === '') return '—'
return `${d.dosage_amount}${d.dosage_unit || 'g'}`
const bags = Number(d.dosage_bag_count) > 0 ? Number(d.dosage_bag_count) : 1
return `${d.dosage_amount}${d.dosage_unit || 'g'} · ${bags}`
})
const slipPillGrams = computed(() => {
@@ -4615,15 +4619,19 @@ const rxUsageText = computed(() => {
if (!v) return '—'
if (v.usage_text) return v.usage_text
const times = Number(v.times_per_day) > 0 ? Number(v.times_per_day) : 3
const bags = Number(v.bags_per_dose) > 0 ? Number(v.bags_per_dose) : 1
const amount = v.dosage_amount != null ? Number(v.dosage_amount) : 10
const unit = v.dosage_unit || 'g'
const usageWay = v.usage_way || '温水送服'
const usageTime = v.usage_time || ''
const seg: string[] = []
seg.push(`每天${times}`)
seg.push(`一次${bags}包(约${amount}${unit})`)
seg.push(`每包${amount}${unit}`)
if ((v.prescription_type || '浓缩水丸') === '浓缩水丸') {
const bags = Number(v.dosage_bag_count) > 0 ? Number(v.dosage_bag_count) : 1
seg.push(`一次${bags}`)
seg.push(`每袋${amount}${unit}`)
} else {
seg.push(`一次${amount}${unit}`)
}
seg.push(usageWay)
if (usageTime) seg.push(usageTime)
return seg.join(', ')