From 477fcf61801a783751bf3bedb316d26b120c6fd4 Mon Sep 17 00:00:00 2001
From: ShengLong <452591453@qq.com>
Date: Thu, 7 May 2026 11:59:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E6=96=B9-=E7=94=A8?=
=?UTF-8?q?=E9=87=8F=20=E8=A2=8B=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/tcm-prescription/index.vue | 24 ++++++++++++++
.../src/views/consumer/prescription/index.vue | 31 +++++++++++++++++--
.../consumer/prescription/order_list.vue | 16 +++++++---
.../consumer/prescription/order_list_h5.vue | 16 +++++++---
.../adminapi/logic/tcm/PrescriptionLogic.php | 16 ++++++++++
.../validate/tcm/PrescriptionValidate.php | 7 +++--
server/app/common/model/tcm/Prescription.php | 1 +
.../add_prescription_dosage_bag_count.sql | 3 ++
8 files changed, 101 insertions(+), 13 deletions(-)
create mode 100644 server/sql/1.9.20260507/add_prescription_dosage_bag_count.sql
diff --git a/admin/src/components/tcm-prescription/index.vue b/admin/src/components/tcm-prescription/index.vue
index 7d850863..ef923bbe 100644
--- a/admin/src/components/tcm-prescription/index.vue
+++ b/admin/src/components/tcm-prescription/index.vue
@@ -190,6 +190,18 @@
{{ formData.dosage_unit }}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -676,6 +688,7 @@ interface PrescriptionForm {
prescription_type: string
dosage_amount: number | undefined // 用量数值
dosage_unit: string // 用量单位 (g 或 ml)
+ dosage_bag_count: number // 用量袋数(浓缩水丸,1-5袋)
need_decoction: boolean // 是否代煎(仅饮片)
bags_per_dose: number // 每贴出包数(仅饮片,1-9包)
patient_name: string
@@ -764,6 +777,7 @@ const formData = reactive({
prescription_type: '浓缩水丸',
dosage_amount: 10,
dosage_unit: 'g',
+ dosage_bag_count: 1,
need_decoction: false,
bags_per_dose: 1,
patient_name: '',
@@ -954,6 +968,7 @@ const open = async (data: any, options?: { templateId?: number; stationName?: st
formData.prescription_type = '浓缩水丸'
formData.dosage_unit = 'g'
formData.dosage_amount = 10
+ formData.dosage_bag_count = 1
formData.patient_name = data.patient_name || diagnosis.patient_name || ''
formData.gender = data.patient_gender ?? diagnosis.gender ?? 0
formData.gender_desc = formData.gender === 1 ? '男' : '女'
@@ -980,6 +995,8 @@ const open = async (data: any, options?: { templateId?: number; stationName?: st
formData.doctor_name = userStore.userInfo?.name || ''
formData.doctor_signature = ''
formData.is_shared = 0
+ formData.need_decoction = false
+ formData.bags_per_dose = 1
savedPrescription.value = null
visible.value = true
@@ -1206,16 +1223,19 @@ watch(() => formData.prescription_type, (newType) => {
if (newType === '浓缩水丸') {
formData.dosage_unit = 'g'
formData.dosage_amount = 10
+ formData.dosage_bag_count = 1
formData.need_decoction = false
formData.bags_per_dose = 1
} else if (newType === '饮片') {
formData.dosage_unit = 'ml'
formData.dosage_amount = 50
+ formData.dosage_bag_count = 1
formData.bags_per_dose = 1
// need_decoction 保持用户选择
} else {
formData.dosage_unit = 'g'
formData.dosage_amount = undefined
+ formData.dosage_bag_count = 1
formData.need_decoction = false
formData.bags_per_dose = 1
}
@@ -1275,6 +1295,7 @@ const handleSave = async () => {
dose_unit: formData.dose_unit,
dosage_amount: formData.dosage_amount,
dosage_unit: formData.dosage_unit,
+ dosage_bag_count: formData.dosage_bag_count,
need_decoction: formData.need_decoction,
bags_per_dose: formData.bags_per_dose,
usage_days: formData.usage_days,
@@ -1354,12 +1375,15 @@ const handleNewPrescription = async () => {
if (formData.prescription_type === '浓缩水丸') {
formData.dosage_unit = 'g'
formData.dosage_amount = 10
+ formData.dosage_bag_count = 1
} else if (formData.prescription_type === '饮片') {
formData.dosage_unit = 'ml'
formData.dosage_amount = 50
+ formData.dosage_bag_count = 1
} else {
formData.dosage_unit = 'g'
formData.dosage_amount = undefined
+ formData.dosage_bag_count = 1
}
formData.patient_name = saved.patient_name || ''
formData.gender = saved.gender ?? 0
diff --git a/admin/src/views/consumer/prescription/index.vue b/admin/src/views/consumer/prescription/index.vue
index 2d8b9898..8900af65 100644
--- a/admin/src/views/consumer/prescription/index.vue
+++ b/admin/src/views/consumer/prescription/index.vue
@@ -798,6 +798,17 @@
/>
+
+
+
+
+
+
+
+
+
+
+
@@ -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 || ''
diff --git a/admin/src/views/consumer/prescription/order_list.vue b/admin/src/views/consumer/prescription/order_list.vue
index 806c9ec5..158f177c 100644
--- a/admin/src/views/consumer/prescription/order_list.vue
+++ b/admin/src/views/consumer/prescription/order_list.vue
@@ -801,6 +801,9 @@
{{ detailPrescription.dosage_amount }}{{ detailPrescription.dosage_unit || 'g' }}
+
+ · {{ Number(detailPrescription.dosage_bag_count) > 0 ? Number(detailPrescription.dosage_bag_count) : 1 }}袋
+
({{ detailPrescription.need_decoction ? '代煎' : '不代煎' }})
@@ -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(', ')
diff --git a/admin/src/views/consumer/prescription/order_list_h5.vue b/admin/src/views/consumer/prescription/order_list_h5.vue
index b8d48d25..4f5127be 100644
--- a/admin/src/views/consumer/prescription/order_list_h5.vue
+++ b/admin/src/views/consumer/prescription/order_list_h5.vue
@@ -819,6 +819,9 @@
{{ detailPrescription.dosage_amount }}{{ detailPrescription.dosage_unit || 'g' }}
+
+ · {{ Number(detailPrescription.dosage_bag_count) > 0 ? Number(detailPrescription.dosage_bag_count) : 1 }}袋
+
({{ detailPrescription.need_decoction ? '代煎' : '不代煎' }})
@@ -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(', ')
diff --git a/server/app/adminapi/logic/tcm/PrescriptionLogic.php b/server/app/adminapi/logic/tcm/PrescriptionLogic.php
index 08afd791..8d60d412 100644
--- a/server/app/adminapi/logic/tcm/PrescriptionLogic.php
+++ b/server/app/adminapi/logic/tcm/PrescriptionLogic.php
@@ -152,6 +152,19 @@ class PrescriptionLogic
return $ts ? date('Y-m-d', $ts) : date('Y-m-d');
}
+ private static function normalizeDosageBagCount($raw): int
+ {
+ $count = (int) $raw;
+ if ($count < 1) {
+ return 1;
+ }
+ if ($count > 5) {
+ return 5;
+ }
+
+ return $count;
+ }
+
/**
* 同一诊单、同一开方人、同一处方日期:仅允许一张「未作废」的未删除记录;已作废的可再新开一张。
*
@@ -230,6 +243,7 @@ class PrescriptionLogic
'prescription_type' => $params['prescription_type'] ?? '浓缩水丸',
'dosage_amount' => isset($params['dosage_amount']) ? (float)$params['dosage_amount'] : null,
'dosage_unit' => $params['dosage_unit'] ?? '',
+ 'dosage_bag_count' => self::normalizeDosageBagCount($params['dosage_bag_count'] ?? 1),
'need_decoction' => (int)($params['need_decoction'] ?? 0),
'bags_per_dose' => isset($params['bags_per_dose']) ? (int)$params['bags_per_dose'] : 1,
'diagnosis_id' => (int)($params['diagnosis_id'] ?? 0),
@@ -359,6 +373,7 @@ class PrescriptionLogic
'prescription_type' => $params['prescription_type'] ?? $prescription->prescription_type,
'dosage_amount' => isset($params['dosage_amount']) ? (float)$params['dosage_amount'] : $prescription->dosage_amount,
'dosage_unit' => $params['dosage_unit'] ?? $prescription->dosage_unit,
+ 'dosage_bag_count' => self::normalizeDosageBagCount($params['dosage_bag_count'] ?? ($prescription->dosage_bag_count ?? 1)),
'need_decoction' => isset($params['need_decoction']) ? (int)$params['need_decoction'] : (int)($prescription->need_decoction ?? 0),
'bags_per_dose' => isset($params['bags_per_dose']) ? (int)$params['bags_per_dose'] : (int)($prescription->bags_per_dose ?? 1),
'patient_name' => $params['patient_name'] ?? $prescription->patient_name,
@@ -811,6 +826,7 @@ class PrescriptionLogic
'prescription_type' => '浓缩水丸',
'dosage_amount' => 1.0,
'dosage_unit' => 'g',
+ 'dosage_bag_count' => 1,
'need_decoction' => 0,
'bags_per_dose' => 1,
'diagnosis_id' => $diagnosisId,
diff --git a/server/app/adminapi/validate/tcm/PrescriptionValidate.php b/server/app/adminapi/validate/tcm/PrescriptionValidate.php
index 189ad07a..e7642750 100644
--- a/server/app/adminapi/validate/tcm/PrescriptionValidate.php
+++ b/server/app/adminapi/validate/tcm/PrescriptionValidate.php
@@ -12,6 +12,7 @@ class PrescriptionValidate extends BaseValidate
'id' => 'require',
'diagnosis_id' => 'number',
'appointment_id' => 'number',
+ 'dosage_bag_count' => 'integer|between:1,5',
'patient_name' => 'require',
'clinical_diagnosis' => 'require',
'herbs' => 'require|array',
@@ -20,6 +21,8 @@ class PrescriptionValidate extends BaseValidate
];
protected $message = [
+ 'dosage_bag_count.integer' => '用量袋数必须为整数',
+ 'dosage_bag_count.between' => '用量袋数必须在1到5袋之间',
'patient_name.require' => '患者姓名不能为空',
'clinical_diagnosis.require' => '临床诊断不能为空',
'herbs.require' => '请添加中药',
@@ -28,7 +31,7 @@ class PrescriptionValidate extends BaseValidate
public function sceneAdd()
{
return $this->only([
- 'prescription_type', 'dosage_amount', 'dosage_unit', 'need_decoction', 'bags_per_dose',
+ 'prescription_type', 'dosage_amount', 'dosage_unit', 'dosage_bag_count', 'need_decoction', 'bags_per_dose',
'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
@@ -41,7 +44,7 @@ class PrescriptionValidate extends BaseValidate
public function sceneEdit()
{
return $this->only([
- 'id', 'prescription_type', 'dosage_amount', 'dosage_unit', 'need_decoction', 'bags_per_dose',
+ 'id', 'prescription_type', 'dosage_amount', 'dosage_unit', 'dosage_bag_count', 'need_decoction', 'bags_per_dose',
'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
diff --git a/server/app/common/model/tcm/Prescription.php b/server/app/common/model/tcm/Prescription.php
index 4a41fb32..32803f02 100644
--- a/server/app/common/model/tcm/Prescription.php
+++ b/server/app/common/model/tcm/Prescription.php
@@ -24,6 +24,7 @@ class Prescription extends BaseModel
// 字段类型转换
protected $type = [
'dosage_amount' => 'float',
+ 'dosage_bag_count' => 'integer',
'need_decoction' => 'integer',
];
diff --git a/server/sql/1.9.20260507/add_prescription_dosage_bag_count.sql b/server/sql/1.9.20260507/add_prescription_dosage_bag_count.sql
new file mode 100644
index 00000000..82471de7
--- /dev/null
+++ b/server/sql/1.9.20260507/add_prescription_dosage_bag_count.sql
@@ -0,0 +1,3 @@
+-- 添加处方用量袋数字段(浓缩水丸等开方场景,1-5袋)
+ALTER TABLE `zyt_tcm_prescription`
+ADD COLUMN `dosage_bag_count` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '用量袋数(1-5袋)' AFTER `dosage_unit`;