Revert "出丸 计算公式修改"
This commit is contained in:
@@ -2138,6 +2138,22 @@ const rxOutPelletText = computed(() => {
|
|||||||
|
|
||||||
function computeOutPellet(v: any): string {
|
function computeOutPellet(v: any): string {
|
||||||
if (!v) return ''
|
if (!v) return ''
|
||||||
|
if ((v.prescription_type || '浓缩水丸') === '浓缩水丸') {
|
||||||
|
const days = Number(v.medication_days ?? v.usage_days ?? v.dose_count)
|
||||||
|
const times = Number(v.times_per_day)
|
||||||
|
const doseG = Number(v.dosage_amount)
|
||||||
|
const bags = Number(v.dosage_bag_count) > 0 ? Number(v.dosage_bag_count) : 1
|
||||||
|
if (
|
||||||
|
Number.isFinite(days) &&
|
||||||
|
Number.isFinite(times) &&
|
||||||
|
Number.isFinite(doseG) &&
|
||||||
|
days > 0 &&
|
||||||
|
times > 0 &&
|
||||||
|
doseG > 0
|
||||||
|
) {
|
||||||
|
return formatNum(days * times * doseG * bags)
|
||||||
|
}
|
||||||
|
}
|
||||||
const explicit = v.out_pellet || v.total_weight
|
const explicit = v.out_pellet || v.total_weight
|
||||||
if (explicit && Number(explicit) > 0) return formatNum(Number(explicit))
|
if (explicit && Number(explicit) > 0) return formatNum(Number(explicit))
|
||||||
const list = slipHerbsList.value
|
const list = slipHerbsList.value
|
||||||
@@ -3150,9 +3166,14 @@ const handleEdit = async (row: any) => {
|
|||||||
// 提交表单
|
// 提交表单
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
|
|
||||||
await formRef.value.validate()
|
try {
|
||||||
|
await formRef.value.validate()
|
||||||
|
} catch {
|
||||||
|
// Element Plus:校验失败会 reject,表单项已展示错误,勿再向外抛成 Uncaught
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 验证药材
|
// 验证药材
|
||||||
if (!editForm.herbs || editForm.herbs.length === 0) {
|
if (!editForm.herbs || editForm.herbs.length === 0) {
|
||||||
feedback.msgError('请至少添加一味药材')
|
feedback.msgError('请至少添加一味药材')
|
||||||
|
|||||||
@@ -4701,13 +4701,14 @@ const slipPerBagDosageText = computed(() => {
|
|||||||
const slipPillGrams = computed(() => {
|
const slipPillGrams = computed(() => {
|
||||||
const d = prescriptionViewData.value
|
const d = prescriptionViewData.value
|
||||||
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return null
|
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return null
|
||||||
/** 用药疗程以业务订单 medication_days 为准,缺省时回退处方 usage_days / 剂数 */
|
/** 用药疗程以业务订单 medication_days 为准,缺省时回退处方 usage_days / 剂数;出丸 = 每袋用量×袋数×每天次数×服用天数 */
|
||||||
const days = Number(d.medication_days ?? d.usage_days ?? d.dose_count)
|
const days = Number(d.medication_days ?? d.usage_days ?? d.dose_count)
|
||||||
const times = Number(d.times_per_day)
|
const times = Number(d.times_per_day)
|
||||||
const doseG = Number(d.dosage_amount)
|
const doseG = Number(d.dosage_amount)
|
||||||
|
const bags = Number(d.dosage_bag_count) > 0 ? Number(d.dosage_bag_count) : 1
|
||||||
if (!Number.isFinite(days) || !Number.isFinite(times) || !Number.isFinite(doseG)) return null
|
if (!Number.isFinite(days) || !Number.isFinite(times) || !Number.isFinite(doseG)) return null
|
||||||
if (days <= 0 || times <= 0 || doseG <= 0) return null
|
if (days <= 0 || times <= 0 || doseG <= 0) return null
|
||||||
return days * times * doseG
|
return days * times * doseG * bags
|
||||||
})
|
})
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
@@ -4818,7 +4819,7 @@ const rxUsageText = computed(() => {
|
|||||||
return seg.join(', ')
|
return seg.join(', ')
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 出丸:优先用 slipPillGrams(按医嘱天数·次数·每包克数),否则按药材总量×剂数 */
|
/** 出丸:优先用 slipPillGrams(每袋用量×袋数×每天次数×服用天数),否则按药材总量×剂数 */
|
||||||
const rxOutPelletGrams = computed(() => {
|
const rxOutPelletGrams = computed(() => {
|
||||||
const pill = slipPillGrams.value
|
const pill = slipPillGrams.value
|
||||||
if (typeof pill === 'number' && isFinite(pill) && pill > 0) return formatNum(pill)
|
if (typeof pill === 'number' && isFinite(pill) && pill > 0) return formatNum(pill)
|
||||||
|
|||||||
@@ -4653,13 +4653,14 @@ const slipPerBagDosageText = computed(() => {
|
|||||||
const slipPillGrams = computed(() => {
|
const slipPillGrams = computed(() => {
|
||||||
const d = prescriptionViewData.value
|
const d = prescriptionViewData.value
|
||||||
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return null
|
if (!d || (d.prescription_type || '浓缩水丸') !== '浓缩水丸') return null
|
||||||
/** 用药疗程以业务订单 medication_days 为准,缺省时回退处方 usage_days / 剂数 */
|
/** 用药疗程以业务订单 medication_days 为准,缺省时回退处方 usage_days / 剂数;出丸 = 每袋用量×袋数×每天次数×服用天数 */
|
||||||
const days = Number(d.medication_days ?? d.usage_days ?? d.dose_count)
|
const days = Number(d.medication_days ?? d.usage_days ?? d.dose_count)
|
||||||
const times = Number(d.times_per_day)
|
const times = Number(d.times_per_day)
|
||||||
const doseG = Number(d.dosage_amount)
|
const doseG = Number(d.dosage_amount)
|
||||||
|
const bags = Number(d.dosage_bag_count) > 0 ? Number(d.dosage_bag_count) : 1
|
||||||
if (!Number.isFinite(days) || !Number.isFinite(times) || !Number.isFinite(doseG)) return null
|
if (!Number.isFinite(days) || !Number.isFinite(times) || !Number.isFinite(doseG)) return null
|
||||||
if (days <= 0 || times <= 0 || doseG <= 0) return null
|
if (days <= 0 || times <= 0 || doseG <= 0) return null
|
||||||
return days * times * doseG
|
return days * times * doseG * bags
|
||||||
})
|
})
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
@@ -4770,7 +4771,7 @@ const rxUsageText = computed(() => {
|
|||||||
return seg.join(', ')
|
return seg.join(', ')
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 出丸:优先用 slipPillGrams(按医嘱天数·次数·每包克数),否则按药材总量×剂数 */
|
/** 出丸:优先用 slipPillGrams(每袋用量×袋数×每天次数×服用天数),否则按药材总量×剂数 */
|
||||||
const rxOutPelletGrams = computed(() => {
|
const rxOutPelletGrams = computed(() => {
|
||||||
const pill = slipPillGrams.value
|
const pill = slipPillGrams.value
|
||||||
if (typeof pill === 'number' && isFinite(pill) && pill > 0) return formatNum(pill)
|
if (typeof pill === 'number' && isFinite(pill) && pill > 0) return formatNum(pill)
|
||||||
|
|||||||
Reference in New Issue
Block a user