签署原文中金额为 0、辅方不代煎时不再写入
- 金额(元)为 0 / 0.00 时省略,非 0 照常写入 - 辅方代煎为 0 时省略;代煎时显示「是」(与主方代煎一致),不再显示 0/1 Co-Authored-By: Claude Opus 5 (1M context) <[EMAIL]>
This commit is contained in:
co-authored by
Claude Opus 5 (1M context)
parent
c22be5d586
commit
7c916d8053
@@ -65,7 +65,10 @@ final class PrescriptionPdf
|
||||
$add($label, $row[$key]);
|
||||
}
|
||||
$add('代煎', $row['need_decoction'] === '1' ? '是' : '否');
|
||||
$add('金额(元)', $row['amount']);
|
||||
// 金额为 0(含 0.00)时不写入签署原文。
|
||||
if (is_numeric($row['amount']) && (float) $row['amount'] != 0.0) {
|
||||
$add('金额(元)', $row['amount']);
|
||||
}
|
||||
// 开方表单总会带一份默认辅方用法;只有药品里确有辅方(与笺面 formula_type 判定一致)才写入。
|
||||
$hasAux = array_filter((array) $row['herbs'], static fn ($herb): bool =>
|
||||
is_array($herb) && ($herb['formula_type'] ?? '') === '辅方') !== [];
|
||||
@@ -76,6 +79,13 @@ final class PrescriptionPdf
|
||||
$label = ['dosage_amount' => '单次用量', 'dosage_bag_count' => '单次袋数', 'need_decoction' => '代煎',
|
||||
'times_per_day' => '每日次数', 'usage_days' => '服用天数',
|
||||
'prescription_name' => '方名'][$key] ?? $key;
|
||||
if ($key === 'need_decoction') {
|
||||
// 辅方不代煎(0)时不写;代煎时与主方一样显示「是」。
|
||||
if ((int) $value === 0) {
|
||||
continue;
|
||||
}
|
||||
$value = '是';
|
||||
}
|
||||
$add('辅方' . $label, $value);
|
||||
}
|
||||
$pages = array_chunk($lines, 33);
|
||||
|
||||
Reference in New Issue
Block a user