已签署处方在业务订单中可修改服用参数(只改订单页面与药房下单,不改 CA 签署原件);查看处方可下载 CA 原件或当前样式的药房联/处方联
- 处方已电子签署(内容冻结)时,「修改服用参数」改写为订单级覆盖值 usage_override(次数/天数/袋数,含辅方), 签署原文、快照哈希与 CA PDF 不变;订单详情、处方笺、甘草/洛阳下单按本订单生效值;未签署处方仍直接修改处方 - 已发货锁定天数按生效值比较;重新开方改关联时清除旧覆盖值 - 迁移 2026_11_30_prescription_order_usage_override.sql - 业务订单「查看处方」下载改为下拉:CA 签署处方 PDF、药房联 PDF、处方联 PDF(当前页面样式,A4);PC 与 H5 一致 - 重新构建管理后台 Co-Authored-By: Claude Opus 5 <[EMAIL]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
562f8d6ce4
commit
dc18098566
@@ -327,6 +327,40 @@ function computeAuxOutPellet(data: Record<string, any>): string {
|
||||
return days > 0 && times > 0 && doseG > 0 ? formatNum(days * times * doseG * bags) : ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并业务订单的服用参数覆盖:已签署(CA 冻结)处方在订单中修改的次数/天数/袋数记在订单 usage_override,
|
||||
* 只作用于该订单的页面与药房下单,签署原文不变。与服务端 PrescriptionOrderLogic::applyUsageOverride 一致。
|
||||
*/
|
||||
export function applyOrderUsageOverride<T extends Record<string, any>>(rx: T, rawOverride: unknown): T {
|
||||
let override: unknown = rawOverride
|
||||
if (typeof override === 'string') {
|
||||
try {
|
||||
override = JSON.parse(override)
|
||||
} catch {
|
||||
override = null
|
||||
}
|
||||
}
|
||||
if (!override || typeof override !== 'object' || Array.isArray(override)) return rx
|
||||
const o = override as Record<string, any>
|
||||
const out: Record<string, any> = { ...rx }
|
||||
for (const key of ['times_per_day', 'usage_days', 'dosage_bag_count']) {
|
||||
if (o[key] != null && Number.isFinite(Number(o[key]))) out[key] = Number(o[key])
|
||||
}
|
||||
if (o.aux_usage && typeof o.aux_usage === 'object') {
|
||||
let aux = out.aux_usage
|
||||
if (typeof aux === 'string') {
|
||||
try {
|
||||
aux = JSON.parse(aux)
|
||||
} catch {
|
||||
aux = null
|
||||
}
|
||||
}
|
||||
out.aux_usage = { ...(aux && typeof aux === 'object' ? aux : {}), ...o.aux_usage }
|
||||
}
|
||||
out.usage_overridden = 1
|
||||
return out as T
|
||||
}
|
||||
|
||||
export function rxOutPelletText(data: Record<string, any> | null | undefined): string {
|
||||
if (!data) return ''
|
||||
const out = computeOutPellet(data)
|
||||
|
||||
Reference in New Issue
Block a user