fix(prescription): 解决处方列表中手术类型和其他医嘱类型的问题
- 更新 lodash.template 修复脚本以处理 assignWith 函数的自定义器参数 - 在多个处方组件中引入 drord_doctor_type 字典用于动态生成医嘱类型列表 - 修复手术类型(adviceType=6)的特殊处理逻辑,包括类型映射和字段过滤 - 调整后端医嘱保存服务中的类型分类逻辑,正确处理手术类型 - 更新数据库查询映射以支持手术类型的正确显示和数据传输 - 修复费用对话框和订单表单中的相关类型显示问题
This commit is contained in:
@@ -957,34 +957,26 @@ const { method_code, unit_code, rate_code, distribution_category_code, drord_doc
|
||||
'drord_doctor_type'
|
||||
);
|
||||
|
||||
// 删除硬编码的adviceTypeList,直接使用drord_doctor_type字典
|
||||
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '西药',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '中成药',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '耗材',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '会诊',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
]);
|
||||
// 使用 drord_doctor_type 字典,不再硬编码
|
||||
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=手术
|
||||
const adviceTypeList = computed(() => {
|
||||
// 如果字典已加载,使用字典数据;否则使用默认值
|
||||
if (drord_doctor_type.value && drord_doctor_type.value.length > 0) {
|
||||
return drord_doctor_type.value.map(item => ({
|
||||
label: item.label,
|
||||
value: parseInt(item.value) || item.value
|
||||
}));
|
||||
}
|
||||
// 默认返回值,确保页面正常显示
|
||||
return [
|
||||
{ label: '西药', value: 1 },
|
||||
{ label: '中成药', value: 2 },
|
||||
{ label: '诊疗', value: 3 },
|
||||
{ label: '耗材', value: 4 },
|
||||
{ label: '会诊', value: 5 },
|
||||
{ label: '手术', value: 6 },
|
||||
];
|
||||
});
|
||||
|
||||
// 根据类型值获取显示标签,避免非编辑态出现空标签
|
||||
const mapAdviceTypeLabel = (type) => {
|
||||
@@ -2394,6 +2386,8 @@ function handleSave(prescriptionId) {
|
||||
saveAdviceType = 1; // 中成药:前端2 -> 后端1
|
||||
} else if (item.adviceType == 5) {
|
||||
saveAdviceType = 3; // 会诊:前端5 -> 后端3(诊疗类)
|
||||
} else if (item.adviceType == 6) {
|
||||
saveAdviceType = 6; // 🔧 BugFix#318: 手术类型保持为6
|
||||
}
|
||||
|
||||
// 🔧 Bug Fix: Validate and fix NaN values before sending to backend
|
||||
@@ -2403,6 +2397,21 @@ function handleSave(prescriptionId) {
|
||||
console.warn('Fixed NaN totalPrice for item:', item.adviceName);
|
||||
}
|
||||
|
||||
// 🔧 BugFix#318: 从 parsedContent 提取标准医嘱字段,排除手术特有字段
|
||||
const standardFields = [
|
||||
'accountId', 'chargeItemId', 'conditionDefinitionId', 'conditionId',
|
||||
'contentJson', 'definitionDetailId', 'definitionId', 'diagnosisName',
|
||||
'dosageInstruction', 'effectiveOrgId', 'encounterDiagnosisId',
|
||||
'encounterId', 'lotNumber', 'patientId', 'practitionerId',
|
||||
'prescriptionNo', 'skinTestFlag', 'unitPrice', 'volume', 'ybClassEnum'
|
||||
];
|
||||
let filteredContent = {};
|
||||
standardFields.forEach(field => {
|
||||
if (parsedContent[field] !== undefined) {
|
||||
filteredContent[field] = parsedContent[field];
|
||||
}
|
||||
});
|
||||
|
||||
// 构造请求参数
|
||||
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
|
||||
// 耗材使用 adm_device_definition 表
|
||||
@@ -2427,10 +2436,12 @@ function handleSave(prescriptionId) {
|
||||
});
|
||||
|
||||
return {
|
||||
...parsedContent,
|
||||
...filteredContent, // 🔧 BugFix#318: 使用过滤后的字段,排除手术特有字段
|
||||
adviceType: saveAdviceType, // 使用转换后的类型
|
||||
requestId: item.requestId,
|
||||
dbOpType: '1',
|
||||
dbOpType: item.requestId ? '2' : '1', // 🔧 BugFix: 根据requestId判断是新增还是修改
|
||||
encounterId: item.encounterId || props.patientInfo.encounterId, // 🔧 BugFix: 确保encounterId
|
||||
patientId: item.patientId || props.patientInfo.patientId, // 🔧 BugFix: 确保patientId
|
||||
groupId: item.groupId,
|
||||
uniqueKey: undefined,
|
||||
// 使用转换后的数量和单位
|
||||
@@ -2723,28 +2734,32 @@ function handleSaveSign(row, index, prescriptionId) {
|
||||
|
||||
formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (row.adviceType != 2) {
|
||||
// 🔧 BugFix#318: 手术类型(adviceType=6)不需要检查绑定耗材/药品
|
||||
if (row.adviceType != 2 && row.adviceType != 6) {
|
||||
// 1:用法绑东西 2:诊疗绑东西
|
||||
let typeCode = row.adviceType == 1 ? '1' : '2';
|
||||
// 用法字典值/诊疗定义id
|
||||
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
|
||||
getBindDevice({ typeCode: typeCode, itemNo: itemNo }).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
// 是否需要打开弹窗
|
||||
let openBindDialog = localStorage.getItem('doctor' + userStore.id);
|
||||
if (!JSON.parse(openBindDialog)) {
|
||||
proxy.$refs['orderBindInfoRef'].open(res.data);
|
||||
} else {
|
||||
// 如果弹窗不提示带出的项目,自动带出
|
||||
// 如果有未签发的项目,并且当前的项目没有带出过绑定项目,则自动带出
|
||||
if (!bindMethod.value[itemNo]) {
|
||||
handleOrderBindInfo(res.data, row.methodCode);
|
||||
bindMethod.value[itemNo] = true;
|
||||
// 🔧 确保 itemNo 有值才调用接口
|
||||
if (itemNo) {
|
||||
getBindDevice({ typeCode: typeCode, itemNo: itemNo }).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 是否需要打开弹窗
|
||||
let openBindDialog = localStorage.getItem('doctor' + userStore.id);
|
||||
if (!JSON.parse(openBindDialog)) {
|
||||
proxy.$refs['orderBindInfoRef'].open(res.data);
|
||||
} else {
|
||||
// 如果弹窗不提示带出的项目,自动带出
|
||||
// 如果有未签发的项目,并且当前的项目没有带出过绑定项目,则自动带出
|
||||
if (!bindMethod.value[itemNo]) {
|
||||
handleOrderBindInfo(res.data, row.methodCode);
|
||||
bindMethod.value[itemNo] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
row.isEdit = false;
|
||||
isAdding.value = false;
|
||||
@@ -2766,15 +2781,20 @@ function handleSaveSign(row, index, prescriptionId) {
|
||||
|
||||
row.conditionId = conditionId.value;
|
||||
// 处理总量为小单位情况,需要把单价也保存成小单位的
|
||||
if (row.unitCodeList.find((item) => item.value == row.unitCode).type == 'unit') {
|
||||
if (row.adviceType != 3) {
|
||||
row.unitPrice = row.unitTempPrice;
|
||||
// 🔧 BugFix#318: 手术类型(adviceType=6)可能没有unitCodeList,需要判断
|
||||
if (row.unitCodeList && row.unitCodeList.length > 0) {
|
||||
const foundUnit = row.unitCodeList.find((item) => item.value == row.unitCode);
|
||||
if (foundUnit && foundUnit.type == 'unit') {
|
||||
if (row.adviceType != 3) {
|
||||
row.unitPrice = row.unitTempPrice;
|
||||
}
|
||||
} else {
|
||||
const minUnitItem = row.unitCodeList.find((item) => item.value == row.minUnitCode);
|
||||
if (minUnitItem) {
|
||||
row.unitCode_dictText = minUnitItem.label;
|
||||
}
|
||||
row.unitPrice = row.minUnitPrice;
|
||||
}
|
||||
} else {
|
||||
row.unitCode_dictText = row.unitCodeList.find(
|
||||
(item) => item.value == row.minUnitCode
|
||||
).label;
|
||||
row.unitPrice = row.minUnitPrice;
|
||||
}
|
||||
row.conditionDefinitionId = conditionDefinitionId.value;
|
||||
row.encounterDiagnosisId = encounterDiagnosisId.value;
|
||||
@@ -2956,8 +2976,27 @@ function handleSaveBatch(prescriptionId) {
|
||||
saveAdviceType = 1; // 中成药前端2 -> 后端1
|
||||
} else if (item.adviceType == 5) {
|
||||
saveAdviceType = 3; // 会诊前端5 -> 后端3(诊疗类)
|
||||
} else if (item.adviceType == 6) {
|
||||
saveAdviceType = 6; // 🔧 BugFix#318: 手术类型保持为6
|
||||
}
|
||||
|
||||
// 🔧 BugFix#318: 过滤掉手术特有字段,只保留标准医嘱字段
|
||||
const standardItemFields = [
|
||||
'adviceDefinitionId', 'adviceName', 'adviceTableName', 'adviceType',
|
||||
'basedOnId', 'chargeItemId', 'chargeStatus', 'conditionDefinitionId',
|
||||
'conditionId', 'contentJson', 'dose', 'doseUnitCode', 'encounterDiagnosisId',
|
||||
'encounterId', 'groupId', 'injectFlag', 'lotNumber', 'methodCode', 'partPercent',
|
||||
'patientId', 'positionId', 'positionName', 'prescriptionNo', 'quantity', 'rateCode',
|
||||
'requestId', 'skinTestFlag', 'sortNumber', 'statusEnum', 'totalPrice',
|
||||
'unitCode', 'unitPrice', 'volume', 'ybClassEnum'
|
||||
];
|
||||
let filteredItem = {};
|
||||
standardItemFields.forEach(field => {
|
||||
if (item[field] !== undefined) {
|
||||
filteredItem[field] = item[field];
|
||||
}
|
||||
});
|
||||
|
||||
// 构造 contentJson (保持前端UI原始数据)
|
||||
const itemToSave = {
|
||||
...item,
|
||||
@@ -3003,7 +3042,7 @@ function handleSaveBatch(prescriptionId) {
|
||||
});
|
||||
|
||||
return {
|
||||
...item,
|
||||
...filteredItem, // 🔧 BugFix#318: 使用过滤后的字段
|
||||
patientId: props.patientInfo.patientId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
adviceType: saveAdviceType,
|
||||
|
||||
Reference in New Issue
Block a user