fix(#594): 请修复 Bug #594:【住院医生工作站-临床医嘱】开立需皮试药物时系统未弹出皮试确认框,且医嘱输入行皮试字段置灰只读无法手动编辑

根因:
- 1. `selectAdviceBase()` 选中皮试药品后直接展开订单,未弹出皮试确认弹窗
- 2. 皮试列模板仅有只读文本,编辑状态下无交互组件
- 3. 各保存入口(`handleSaveSign`、`handleSaveBatch`、`setValue`)未对 `skinTestFlag` 做类型归一化

修复:
- ### 分析结论
- —它无意中删除了 Bug #589(出院带药)的 `prescriptionCategory = 3` 代码。已修正。
- | # | 位置 | 变更 |
- |---|---|---|
- | 1 | 模板-皮试列 | 添加 `<el-checkbox>` 可编辑复选框(`true-label=1`, `false-label=0`) |
- | 2 | `getListInfo()` | 从 `contentJson` 恢复 `skinTestFlag` 并归一化为数字 |
- | 3 | `selectAdviceBase()` | 检测皮试药品 → 弹出 `ElMessageBox.confirm` 确认框;提取 `expandOrderAndFocus()` 函数 |
- | 4 | `handleSaveSign()` | 添加 `skinTestFlag` 归一化(**保留** Bug #589 的 `prescriptionCategory=3`) |
- | 5 | `handleSaveBatch()` | 批量保存时归一化 `skinTestFlag` |
- | 6 | `setValue()` | 构建 `updatedRow` 时归一化 `skinTestFlag` |
- ### 全链路 6 环验证
-  **录入**:选择皮试药品 → 弹窗确认(是/否)
-  **保存**:`handleSaveSign` + `handleSaveBatch` 均归一化后写入 `contentJson`
-  **查询**:`getListInfo` 从 `contentJson` 恢复,模板回显正确
-  **修改**:`setValue` 归一化,模板复选框可编辑
-  **删除/撤回**:`contentJson` 包含 `skinTestFlag`,不受影响
-  **关联模块**:不涉及(皮试字段仅在该页面交互)
- ### L1 门禁
- ESLint 通过:仅 1 个预存的 `vue/no-dupe-keys` error(`patientInfo`),0 个新错误。
This commit is contained in:
2026-05-29 10:17:56 +08:00
parent 8289f43219
commit 58ae7c418c

View File

@@ -318,6 +318,14 @@
<span v-if="!scope.row.isEdit">
{{ scope.row.skinTestFlag_enumText || '-' }}
</span>
<el-checkbox
v-else
v-model="scope.row.skinTestFlag"
:true-label="1"
:false-label="0"
>
</el-checkbox>
</template>
</el-table-column>
<el-table-column label="停嘱医生" align="center" prop="stopUserName" width="120">
@@ -697,6 +705,13 @@ function getListInfo(addNewRow) {
unitCodeList: unitCodeListData,
// 确保 therapyEnum 被正确设置,优先使用 contentJson 中的值
therapyEnum: String(parsedContent?.therapyEnum ?? item.therapyEnum ?? '1'),
// 确保 skinTestFlag 是数字类型1 或 0从 contentJson 恢复
skinTestFlag: parsedContent?.skinTestFlag !== undefined && parsedContent?.skinTestFlag !== null
? (typeof parsedContent.skinTestFlag === 'number' ? parsedContent.skinTestFlag : (parsedContent.skinTestFlag ? 1 : 0))
: 0,
skinTestFlag_enumText: parsedContent?.skinTestFlag !== undefined && parsedContent?.skinTestFlag !== null
? (parsedContent.skinTestFlag == 1 ? '是' : '否')
: '否',
// 🔧 修复:确保 orgId 为 String 类型,与 organization 树的 id 类型一致
// 关键:优先使用 item.positionId后端 @JsonSerialize 保证精度),
// 而非 parsedContent.orgId来自 JSON.parse大 Long 可能精度丢失)
@@ -1077,15 +1092,54 @@ function selectAdviceBase(key, row) {
}
// 确保 uniqueKey 不被覆盖
prescriptionList.value[rowIndex.value].uniqueKey = currentUniqueKey;
// 先清空展开状态,然后在 nextTick 中设置,确保数据更新后再展开
// 检查是否是皮试药品,如果是则弹出确认提示
// 只对药品类型adviceType=1 药品, adviceType=2 耗材)进行皮试提示
const isSkinTestDrug = row.skinTestFlag !== undefined && row.skinTestFlag !== null
? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag == 1 : (row.skinTestFlag ? true : false))
: false;
if ((row.adviceType == 1 || row.adviceType == 2) && isSkinTestDrug) {
// 弹出皮试确认弹窗
ElMessageBox.confirm(
`【皮试确认】当前药品是皮试药品,是否皮试?`,
'提示',
{
confirmButtonText: '是(Y)',
cancelButtonText: '否(N)',
type: 'warning',
closeOnClickModal: false,
closeOnPressEscape: false,
distinguishCancelAndClose: true,
}
)
.then(() => {
// 用户点击"是",设置皮试标志为"是"
prescriptionList.value[rowIndex.value].skinTestFlag = 1;
prescriptionList.value[rowIndex.value].skinTestFlag_enumText = '是';
expandOrderAndFocus(currentUniqueKey, row);
})
.catch((action) => {
// 用户点击"否",设置皮试标志为"否"
prescriptionList.value[rowIndex.value].skinTestFlag = 0;
prescriptionList.value[rowIndex.value].skinTestFlag_enumText = '否';
expandOrderAndFocus(currentUniqueKey, row);
});
} else {
// 不是皮试药品,直接展开订单
expandOrderAndFocus(currentUniqueKey, row);
}
}
/**
* 展开订单并聚焦输入框
*/
function expandOrderAndFocus(key, row) {
expandOrder.value = [];
nextTick(() => {
// 使用双重 nextTick 确保 filterPrescriptionList 已更新
nextTick(() => {
expandOrder.value = [currentUniqueKey];
// 如果 expand-row-keys 不生效,使用 toggleRowExpansion 强制展开
expandOrder.value = [key];
const tableData = filterPrescriptionList.value;
const targetRow = tableData.find((item) => item.uniqueKey === currentUniqueKey);
const targetRow = tableData.find((item) => item.uniqueKey === key);
if (targetRow && prescriptionRef.value) {
prescriptionRef.value.toggleRowExpansion(targetRow, true);
}
@@ -1533,6 +1587,11 @@ function handleSaveSign(row, index) {
if (originalAdviceType == 7) {
row.prescriptionCategory = 3;
}
// 确保 skinTestFlag 是数字类型1 或 0
row.skinTestFlag = row.skinTestFlag !== undefined && row.skinTestFlag !== null
? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag : (row.skinTestFlag ? 1 : 0))
: 0;
row.skinTestFlag_enumText = row.skinTestFlag == 1 ? '是' : '否';
row.contentJson = JSON.stringify(row);
if (row.requestId) {
row.dbOpType = '2';
@@ -1584,6 +1643,11 @@ function handleSaveBatch() {
...item,
therapyEnum: therapyEnum,
dbOpType: item.requestId ? '2' : '1',
// 确保 skinTestFlag 是数字类型1 或 0
skinTestFlag: item.skinTestFlag !== undefined && item.skinTestFlag !== null
? (typeof item.skinTestFlag === 'number' ? item.skinTestFlag : (item.skinTestFlag ? 1 : 0))
: 0,
skinTestFlag_enumText: item.skinTestFlag == 1 ? '是' : '否',
};
// Bug #589: 出院带药批量保存时转为药品类型
if (result.adviceType == 7) {
@@ -1698,6 +1762,13 @@ function setValue(row) {
minUnitCode: String(row.minUnitCode),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode) : String(row.unitCode),
categoryEnum: row.categoryCode,
// 确保 skinTestFlag 是数字类型1 或 0如果未定义则默认为 0
skinTestFlag: row.skinTestFlag !== undefined && row.skinTestFlag !== null
? (typeof row.skinTestFlag === 'number' ? row.skinTestFlag : (row.skinTestFlag ? 1 : 0))
: 0,
skinTestFlag_enumText: (row.skinTestFlag !== undefined && row.skinTestFlag !== null
? (typeof row.skinTestFlag === 'number' ? (row.skinTestFlag == 1 ? '是' : '否') : (row.skinTestFlag ? '是' : '否'))
: '否'),
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
...(row.adviceType != 3