feat(medicalOrderSet): 优化医嘱组套功能实现

- 实现医嘱基础列表的分页功能,添加loading状态和缓存机制
- 添加防抖处理和组织机构ID参数支持,优化性能表现
- 实现医嘱组套的完整编辑功能,包括增删改查操作界面
- 添加医嘱组套预览、应用和管理功能模块
- 实现西医组套筛选功能,确保tcmFlag参数正确传递
- 优化医嘱组套数据结构,完善明细项信息处理逻辑
- 添加表单验证和错误处理,提升用户体验和系统稳定性
- 重构代码结构,采用响应式设计提高可维护性
This commit is contained in:
2026-03-17 09:57:21 +08:00
parent 03939fb232
commit 8a7d2abb4a
30 changed files with 2066 additions and 543 deletions

View File

@@ -1165,7 +1165,8 @@ function setValue(row) {
let selectedStock = undefined;
if (row.adviceType != 3) {
if (row.inventoryList && row.inventoryList.length == 0) {
// 🔧 Bug #144 修复:检查 inventoryList 是否存在,避免 undefined 错误
if (!row.inventoryList || row.inventoryList.length == 0) {
expandOrder.value = [];
proxy.$modal.msgWarning(row.adviceName + '无库存');
return;
@@ -1229,35 +1230,75 @@ function setValue(row) {
prescriptionList.value[rowIndex.value] = updatedRow;
}
// 选择组套
// 选择组套 - 适配新版 OrderGroupDrawer 组件
function handleSaveGroup(orderGroupList) {
if (!orderGroupList || !Array.isArray(orderGroupList) || orderGroupList.length === 0) {
proxy.$modal.msgWarning('组套数据为空');
return;
}
let successCount = 0;
orderGroupList.forEach((item) => {
rowIndex.value = prescriptionList.value.length;
setValue(item.orderDetailInfos);
if (!item) {
console.warn('组套中的项目为空');
return;
}
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
const mergedDetail = item.mergedDetail || {
...(item.orderDetailInfos || {}),
adviceName: item.orderDetailInfos?.adviceName || item.orderDefinitionName || '未知项目',
adviceType: item.orderDetailInfos?.adviceType,
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
quantity: item.quantity,
unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
unitCodeName: item.unitCodeName,
dose: item.dose || item.orderDetailInfos?.dose,
rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
dispensePerDuration: item.dispensePerDuration || item.orderDetailInfos?.dispensePerDuration,
doseQuantity: item.doseQuantity,
inventoryList: item.orderDetailInfos?.inventoryList || [],
priceList: item.orderDetailInfos?.priceList || [],
partPercent: item.orderDetailInfos?.partPercent || 1,
positionId: item.orderDetailInfos?.positionId,
defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
therapyEnum: item.orderDetailInfos?.therapyEnum || '1',
};
// 预初始化空行
prescriptionList.value[rowIndex.value] = {
uniqueKey: nextId.value++,
isEdit: true,
statusEnum: 1,
};
setValue(mergedDetail);
// 创建新的处方项目
const newRow = {
...prescriptionList.value[rowIndex.value],
uniqueKey: nextId.value++,
patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId,
accountId: accountId.value, // 费用性质
quantity: item.quantity, // 数量
methodCode: item.methodCode, // 用法
rateCode: item.rateCode, // 频次
dispensePerDuration: item.dispensePerDuration, // 用药天数
dose: item.dose, // 单次用量
doseQuantity: item.doseQuantity, // 单次用量(小单位)
executeNum: 1, // 执行次数默认1
unitCode: item.unitCode, // 大单位
accountId: accountId.value,
quantity: item.quantity,
methodCode: item.methodCode,
rateCode: item.rateCode,
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
executeNum: 1,
unitCode: item.unitCode,
unitCode_dictText: item.unitCodeName || '',
statusEnum: 1, // 签发状态 默认是待保存
orgId: item.positionId, // 默认执行科室
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1', // 1新增2编辑
conditionId: conditionId.value, // 诊断id
conditionDefinitionId: conditionDefinitionId.value, // 诊断定义id
encounterDiagnosisId: encounterDiagnosisId.value, // 就诊诊断id
// 确保 therapyEnum 被正确设置,默认为长期医嘱('1')
statusEnum: 1,
orgId: item.orderDetailInfos?.positionId || mergedDetail.positionId,
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value,
therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || '1',
};
@@ -1270,12 +1311,17 @@ function handleSaveGroup(orderGroupList) {
} else {
newRow.price = newRow.unitPrice;
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity * item.orderDetailInfos.partPercent;
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
}
newRow.contentJson = JSON.stringify(newRow);
prescriptionList.value[rowIndex.value] = newRow;
successCount++;
});
if (successCount > 0) {
proxy.$modal.msgSuccess(`成功添加 ${successCount} 个医嘱项`);
}
}
// 历史医嘱复用