fix(print): 优化打印功能调试日志和修复位置ID获取问题 BUG#217
- 在printUtils.js中添加详细的打印诊断日志,包含hiprint对象检查、模板数据检查、医院名称处理等步骤 - 修复orderGroupDrawer.vue中的positionId获取逻辑,优先使用item.positionId - 修复prescriptionlist.vue中quantity和totalPrice的计算问题 - 修复服务器端DiagTreatMAppServiceImpl中pricingFlag过滤条件处理问题 - 修复EleInvoiceMapper.xml中orgClassEnum类型的CAST转换问题 - 优化打印错误处理和异常捕获机制 - 添加完整的打印流程日志跟踪功能
This commit is contained in:
@@ -253,10 +253,22 @@ const getUnitLabel = (unitCode) => {
|
||||
|
||||
async function printReceipt(param) {
|
||||
// 打印收费小票数据
|
||||
console.log('打印收费小票数据:', param.chargedItems);
|
||||
// console.log('!!!!!!!!!选中的收费项目:', param.chargedItems);
|
||||
console.log('患者信息:', props.patientInfo);
|
||||
// formData.totalAmount = props.totalAmount;
|
||||
console.log('========== 打印收费小票 - 开始 ==========');
|
||||
console.log('[A] 传入参数检查:');
|
||||
console.log(' - param对象:', param ? '存在' : '不存在');
|
||||
console.log(' - param.chargedItems:', param?.chargedItems ? `存在(${param.chargedItems.length}条)` : '不存在/空');
|
||||
console.log(' - param.detail:', param?.detail ? `存在(${param.detail.length}条)` : '不存在/空');
|
||||
console.log(' - param.regNo:', param?.regNo);
|
||||
console.log(' - param.fixmedinsName:', param?.fixmedinsName);
|
||||
console.log(' - props.patientInfo:', props.patientInfo ? '存在' : '不存在');
|
||||
|
||||
if (param?.chargedItems) {
|
||||
console.log('[B] 收费项目数据:');
|
||||
param.chargedItems.forEach((item, idx) => {
|
||||
console.log(` - 项目[${idx}]:`, item.chargeItemName || '未命名', '-', item.quantityWithUnit || item.quantityValue);
|
||||
});
|
||||
}
|
||||
|
||||
// 确保第一个支付方式的金额与总金额一致;
|
||||
if (formData.selfPay.length > 0) {
|
||||
formData.selfPay[0].amount = props.totalAmount;
|
||||
@@ -271,6 +283,7 @@ async function printReceipt(param) {
|
||||
|
||||
try {
|
||||
// 处理param.chargedItems,添加quantityWithUnit字段
|
||||
console.log('[C] 开始处理收费项目列表...');
|
||||
const processedChargeItems = (param.chargedItems || []).map((item) => {
|
||||
// 获取单位标签
|
||||
const unitLabel = getUnitLabel(item.quantityUnit);
|
||||
@@ -284,8 +297,10 @@ async function printReceipt(param) {
|
||||
quantityWithUnit, // 添加带单位的数量字段供打印使用
|
||||
};
|
||||
});
|
||||
console.log('[C] 处理完成,项目数:', processedChargeItems.length);
|
||||
|
||||
// 构造打印数据,整合选中行信息
|
||||
console.log('[D] 开始构造打印数据...');
|
||||
const printData = {
|
||||
data: [
|
||||
{
|
||||
@@ -566,12 +581,27 @@ async function printReceipt(param) {
|
||||
|
||||
// 使用printUtils进行打印
|
||||
// 选择门诊收费打印模板并传递正确的数据格式
|
||||
console.log('789797987897', printData.data[0]);
|
||||
console.log('[E] 最终打印数据检查:');
|
||||
console.log(' - printData.data[0]存在:', !!printData.data[0]);
|
||||
console.log(' - 关键字段:');
|
||||
console.log(' * patientName:', printData.data[0]?.patientName);
|
||||
console.log(' * regNo:', printData.data[0]?.regNo);
|
||||
console.log(' * chargeItemsList:', printData.data[0]?.chargeItemsList ? `${printData.data[0].chargeItemsList.length}条` : '无');
|
||||
console.log(' * totalAmount:', printData.data[0]?.totalAmount);
|
||||
console.log(' * currentDate:', printData.data[0]?.currentDate);
|
||||
|
||||
console.log('[F] 开始调用printUtils.print...');
|
||||
console.log(' - 模板:', 'OUTPATIENT_CHARGE');
|
||||
|
||||
await printUtils.print(PRINT_TEMPLATE.OUTPATIENT_CHARGE, printData.data[0]);
|
||||
|
||||
console.log('打印成功');
|
||||
console.log('[G] 打印调用成功完成');
|
||||
console.log('========== 打印收费小票 - 结束 ==========');
|
||||
} catch (error) {
|
||||
console.error('打印失败:', error);
|
||||
console.error('[ERROR] 打印失败:', error);
|
||||
console.error('[ERROR] 错误详情:', error.message);
|
||||
console.error('[ERROR] 错误堆栈:', error.stack);
|
||||
console.log('========== 打印收费小票 - 异常结束 ==========');
|
||||
proxy.$modal.msgError('打印失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,7 +590,8 @@ function handleUseOrderGroup(row) {
|
||||
inventoryList: orderDetail.inventoryList || [],
|
||||
priceList: orderDetail.priceList || [],
|
||||
partPercent: orderDetail.partPercent || 1,
|
||||
positionId: orderDetail.positionId,
|
||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||
positionId: item.positionId || orderDetail.positionId,
|
||||
defaultLotNumber: orderDetail.defaultLotNumber,
|
||||
|
||||
// 单位信息
|
||||
@@ -615,7 +616,8 @@ function handleUseOrderGroup(row) {
|
||||
inventoryList: orderDetail.inventoryList || [],
|
||||
priceList: orderDetail.priceList || [],
|
||||
partPercent: orderDetail.partPercent || 1,
|
||||
positionId: orderDetail.positionId,
|
||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||
positionId: item.positionId || orderDetail.positionId,
|
||||
defaultLotNumber: orderDetail.defaultLotNumber,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2919,31 +2919,33 @@ function setValue(row) {
|
||||
prescriptionList.value[rowIndex.value].locationId = finalLocationId;
|
||||
prescriptionList.value[rowIndex.value].positionId = finalLocationId;
|
||||
}
|
||||
} else {
|
||||
getOrgList();
|
||||
// 会诊类型(adviceType == 5)和诊疗类型(adviceType == 3)的处理
|
||||
if (row.adviceType == 5) {
|
||||
// 会诊类型:设置默认值
|
||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId; // 执行科室默认为申请医生的科室
|
||||
prescriptionList.value[rowIndex.value].quantity = 1; // 执行次数默认1次
|
||||
prescriptionList.value[rowIndex.value].unitPrice = row.priceList && row.priceList[0] ? row.priceList[0].price : (row.unitPrice || 0);
|
||||
prescriptionList.value[rowIndex.value].totalPrice = prescriptionList.value[rowIndex.value].unitPrice;
|
||||
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
||||
} else {
|
||||
// 诊疗类型(adviceType == 3)
|
||||
prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId;
|
||||
prescriptionList.value[rowIndex.value].quantity = 1;
|
||||
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
||||
if (row.priceList && row.priceList.length > 0) {
|
||||
prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
|
||||
prescriptionList.value[rowIndex.value].totalPrice = row.priceList[0].price;
|
||||
getOrgList();
|
||||
// 会诊类型(adviceType == 5)和诊疗类型(adviceType == 3)的处理
|
||||
if (row.adviceType == 5) {
|
||||
// 会诊类型:设置默认值
|
||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId; // 执行科室默认为申请医生的科室
|
||||
prescriptionList.value[rowIndex.value].quantity = 1; // 执行次数默认1次
|
||||
prescriptionList.value[rowIndex.value].unitPrice = row.priceList && row.priceList[0] ? row.priceList[0].price : (row.unitPrice || 0);
|
||||
prescriptionList.value[rowIndex.value].totalPrice = prescriptionList.value[rowIndex.value].unitPrice;
|
||||
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
||||
} else {
|
||||
prescriptionList.value[rowIndex.value].unitPrice = 0;
|
||||
prescriptionList.value[rowIndex.value].totalPrice = 0;
|
||||
console.warn('医嘱项价格列表为空:', row.adviceName || '未知医嘱');
|
||||
// 诊疗类型(adviceType == 3)
|
||||
prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId;
|
||||
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
||||
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
||||
if (row.priceList && row.priceList.length > 0) {
|
||||
prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
|
||||
// 🔧 Bug #218 修复:总金额 = 单价 × 数量
|
||||
prescriptionList.value[rowIndex.value].totalPrice = row.priceList[0].price * (row.quantity || 1);
|
||||
} else {
|
||||
prescriptionList.value[rowIndex.value].unitPrice = 0;
|
||||
prescriptionList.value[rowIndex.value].totalPrice = 0;
|
||||
console.warn('医嘱项价格列表为空:', row.adviceName || '未知医嘱');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 选择组套 - 适配新版 OrderGroupDrawer 组件
|
||||
@@ -2986,7 +2988,8 @@ function handleSaveGroup(orderGroupList) {
|
||||
inventoryList: item.orderDetailInfos?.inventoryList || [],
|
||||
priceList: item.orderDetailInfos?.priceList || [],
|
||||
partPercent: item.orderDetailInfos?.partPercent || 1,
|
||||
positionId: item.orderDetailInfos?.positionId,
|
||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||
positionId: item.positionId || item.orderDetailInfos?.positionId,
|
||||
defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
|
||||
};
|
||||
|
||||
@@ -3016,7 +3019,8 @@ function handleSaveGroup(orderGroupList) {
|
||||
unitCode: item.unitCode,
|
||||
unitCode_dictText: item.unitCodeName || '',
|
||||
statusEnum: 1,
|
||||
orgId: item.orderDetailInfos?.positionId || mergedDetail.positionId,
|
||||
// 🔧 Bug #218 修复:优先使用 item.positionId,其次使用 orderDetailInfos.positionId
|
||||
orgId: item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId,
|
||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||
conditionId: conditionId.value,
|
||||
conditionDefinitionId: conditionDefinitionId.value,
|
||||
|
||||
Reference in New Issue
Block a user