Fix Bug #458: 门诊医生站:诊疗类医嘱保存成功后,列表"医嘱类型"列显示为空值
增强 mapAdviceTypeLabel 函数的兜底映射:在原有表名匹配兜底的基础上, 新增不依赖表名的最终兜底映射(1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=手术), 确保即使字典缺失或表名不匹配也能正确显示类型标签。 同时修复 getListInfo 中 adviceType_dictText 的空字符串判断逻辑, 使用显式 trim() 检查替代 || 运算符,避免后端返回空字符串时未被重新计算。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return found.label;
|
return found.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
|
||||||
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||||
if (type === 6) return '手术';
|
if (type === 6) return '手术';
|
||||||
if (type === 4) return '手术';
|
if (type === 4) return '手术';
|
||||||
@@ -1036,6 +1036,15 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return '诊疗';
|
return '诊疗';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔧 Bug #458 Fix: 兜底映射,确保所有有效 adviceType 都有显示标签
|
||||||
|
// 不依赖字典数据和表名,直接返回标准类型名称
|
||||||
|
if (type === 3) return '诊疗';
|
||||||
|
if (type === 6) return '手术';
|
||||||
|
if (type === 4) return '耗材';
|
||||||
|
if (type === 1) return '西药';
|
||||||
|
if (type === 2) return '中成药';
|
||||||
|
if (type === 5) return '会诊';
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1663,7 +1672,11 @@ function getListInfo(addNewRow) {
|
|||||||
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
||||||
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
||||||
|
|
||||||
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
|
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText,需重新计算
|
||||||
|
const backendDictText = item.adviceType_dictText;
|
||||||
|
let adviceType_dictText = (backendDictText && backendDictText.trim())
|
||||||
|
? backendDictText
|
||||||
|
: mapAdviceTypeLabel(adviceType, adviceTableName);
|
||||||
|
|
||||||
// 如果是会诊类型,设置为会诊类型
|
// 如果是会诊类型,设置为会诊类型
|
||||||
if (isConsultation) {
|
if (isConsultation) {
|
||||||
|
|||||||
Reference in New Issue
Block a user