4 Commits

Author SHA1 Message Date
d41d3066b3 Merge remote-tracking branch 'origin/develop' into develop 2026-03-19 10:25:59 +08:00
3bfe25c2f2 fix(medical): 修复医嘱剂量计算和数据同步问题
- 修正剂量转换公式,将乘法改为除法以正确计算
- 修复剂量数量字段的计算逻辑错误
- 添加字典文本字段回显支持
- 实现医嘱组套字段同步功能
- 保留组套中的原始值而不是强制重置
- 修复设备名称映射字段错误
2026-03-19 10:25:34 +08:00
0c06b05764 fix(print): 优化打印功能调试日志和修复位置ID获取问题 BUG#217
- 在printUtils.js中添加详细的打印诊断日志,包含hiprint对象检查、模板数据检查、医院名称处理等步骤
- 修复orderGroupDrawer.vue中的positionId获取逻辑,优先使用item.positionId
- 修复prescriptionlist.vue中quantity和totalPrice的计算问题
- 修复服务器端DiagTreatMAppServiceImpl中pricingFlag过滤条件处理问题
- 修复EleInvoiceMapper.xml中orgClassEnum类型的CAST转换问题
- 优化打印错误处理和异常捕获机制
- 添加完整的打印流程日志跟踪功能
2026-03-18 18:17:54 +08:00
7c29c6359f feat(print): 更新门诊收费结算单打印配置和诊断治疗页面功能 BUG#217
- 修改门诊收费结算单名称字段为数字类型
- 添加面板页面规则、页码续传、扩展CSS等打印配置选项
- 集成水印、重印、布局等高级打印功能
- 为收费项目列表添加列选择、固定列等表格功能
- 将线元素类型从line更改为hline并调整标题显示
- 在诊断治疗页面添加划价标记筛选条件
- 更新查询参数结构以支持新的划价标记过滤功能
2026-03-18 16:55:29 +08:00
12 changed files with 368 additions and 97 deletions

View File

@@ -200,6 +200,13 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
DiagnosisTreatmentSelParam.setInspectionTypeId(null); // 临时移除防止HisQueryUtils处理 DiagnosisTreatmentSelParam.setInspectionTypeId(null); // 临时移除防止HisQueryUtils处理
} }
// 临时保存pricingFlag值手动添加带表别名的条件
Integer pricingFlagValue = null;
if (DiagnosisTreatmentSelParam != null && DiagnosisTreatmentSelParam.getPricingFlag() != null) {
pricingFlagValue = DiagnosisTreatmentSelParam.getPricingFlag();
DiagnosisTreatmentSelParam.setPricingFlag(null); // 临时移除防止HisQueryUtils处理
}
// 构建查询条件 // 构建查询条件
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam,
searchKey, new HashSet<>(Arrays.asList("T1.bus_no", "T1.name", "T1.py_str", "T1.wb_str")), request); searchKey, new HashSet<>(Arrays.asList("T1.bus_no", "T1.name", "T1.py_str", "T1.wb_str")), request);
@@ -218,6 +225,13 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
DiagnosisTreatmentSelParam.setInspectionTypeId(inspectionTypeIdValue); DiagnosisTreatmentSelParam.setInspectionTypeId(inspectionTypeIdValue);
} }
// 如果需要按划价标记过滤,添加带表别名的条件
if (pricingFlagValue != null) {
queryWrapper.eq("T1.pricing_flag", pricingFlagValue);
// 恢复参数对象中的值
DiagnosisTreatmentSelParam.setPricingFlag(pricingFlagValue);
}
// 分页查询 // 分页查询
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper); = activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper);

View File

@@ -33,4 +33,7 @@ public class DiagnosisTreatmentSelParam {
/** 检验类型ID */ /** 检验类型ID */
private Long inspectionTypeId; private Long inspectionTypeId;
/** 划价标记 */
private Integer pricingFlag;
} }

View File

@@ -194,7 +194,7 @@
SELECT tad.dev_act_id, SELECT tad.dev_act_id,
tad.quantity, tad.quantity,
tad.unit_code, tad.unit_code,
addf.device_name, addf.name AS device_name,
addf.py_str AS device_py_str, addf.py_str AS device_py_str,
addf.wb_str AS device_wb_str addf.wb_str AS device_wb_str
FROM tmp_activity_device tad FROM tmp_activity_device tad

View File

@@ -140,7 +140,7 @@
ON LEFT (T3.bus_no, 6) = T11.bus_no ON LEFT (T3.bus_no, 6) = T11.bus_no
WHERE T2.id = #{encounterId} WHERE T2.id = #{encounterId}
AND T2.class_enum = #{encClassEnum} AND T2.class_enum = #{encClassEnum}
AND T3.class_enum = #{orgClassEnum} AND T3.class_enum = CAST(#{orgClassEnum} AS VARCHAR)
AND T1.delete_flag = '0' AND T1.delete_flag = '0'
LIMIT 1 LIMIT 1
</select> </select>

View File

@@ -2,7 +2,7 @@
"panels": [ "panels": [
{ {
"index": 0, "index": 0,
"name": "门诊收费结算单", "name": 1,
"paperType": "自定义", "paperType": "自定义",
"height": 500, "height": 500,
"width": 80, "width": 80,
@@ -11,9 +11,33 @@
"width": 80, "width": 80,
"height": 500 "height": 500
}, },
"panelPageRule": "none",
"paperHeader": 0, "paperHeader": 0,
"paperFooter": 1128, "paperFooter": 1128,
"paperNumberDisabled": true, "paperNumberDisabled": true,
"paperNumberContinue": true,
"expandCss": "",
"panelAngle": 0,
"overPrintOptions": {
"content": "",
"opacity": 0.7,
"type": 1
},
"watermarkOptions": {
"content": "",
"fillStyle": "rgba(87, 13, 248, 0.5)",
"fontSize": "36px",
"rotate": 25,
"width": 200,
"height": 150,
"timestamp": true,
"format": "YYYY-MM-DD HH:mm"
},
"panelLayoutOptions": {
"layoutType": "column",
"layoutRowGap": 0,
"layoutColumnGap": 0
},
"printElements": [ "printElements": [
{ {
"options": { "options": {
@@ -130,32 +154,59 @@
"field": "chargeItemsList", "field": "chargeItemsList",
"textAlign": "center", "textAlign": "center",
"fontSize": 8, "fontSize": 8,
"coordinateSync": false,
"widthHeightSync": false,
"columns": [ "columns": [
[ [
{ {
"title": "收费名称", "title": "收费名称",
"width": 62, "width": 62,
"field": "chargeItemName" "field": "chargeItemName",
"checked": true,
"columnId": "chargeItemName",
"fixed": false,
"rowspan": 1,
"colspan": 1
}, },
{ {
"title": "规格", "title": "规格",
"width": 37, "width": 37,
"field": "totalVolume" "field": "totalVolume",
"checked": true,
"columnId": "totalVolume",
"fixed": false,
"rowspan": 1,
"colspan": 1
}, },
{ {
"title": "数量", "title": "数量",
"width": 37, "width": 37,
"field": "quantityWithUnit" "field": "quantityWithUnit",
"checked": true,
"columnId": "quantityWithUnit",
"fixed": false,
"rowspan": 1,
"colspan": 1
}, },
{ {
"title": "金额", "title": "金额",
"width": 35, "width": 35,
"field": "totalPrice" "field": "totalPrice",
"checked": true,
"columnId": "totalPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
}, },
{ {
"title": "类别", "title": "类别",
"width": 37, "width": 37,
"field": "dirClass" "field": "dirClass",
"checked": true,
"columnId": "dirClass",
"fixed": false,
"rowspan": 1,
"colspan": 1
} }
] ]
] ]
@@ -371,8 +422,8 @@
"borderColor": "#CCCCCC" "borderColor": "#CCCCCC"
}, },
"printElementType": { "printElementType": {
"title": "线", "title": "线",
"type": "line" "type": "hline"
} }
}, },
{ {

View File

@@ -269,23 +269,63 @@ export function executePrint(data, template, printerName, options = {}, business
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
// 调试信息 // 调试信息
console.log('hiprint 对象:', hiprint); console.log('========== 打印诊断日志开始 ==========');
console.log('hiprint.PrintTemplate:', hiprint.PrintTemplate); console.log('[1] hiprint对象检查:');
console.log('模板数据:', template); console.log(' - hiprint存在:', !!hiprint);
console.log(' - hiprint.PrintTemplate存在:', !!(hiprint && hiprint.PrintTemplate));
console.log(' - hiprint.hiwebSocket存在:', !!(hiprint && hiprint.hiwebSocket));
console.log(' - hiprint.hiwebSocket.connected:', hiprint?.hiwebSocket?.connected);
console.log('[2] 模板数据检查:');
console.log(' - 模板类型:', typeof template);
console.log(' - 模板存在:', !!template);
console.log(' - 模板panels存在:', !!(template && template.panels));
console.log(' - panels数量:', template?.panels?.length);
if (template?.panels?.[0]) {
const panel = template.panels[0];
console.log(' - panel.name:', panel.name, '(类型:', typeof panel.name, ')');
console.log(' - panel.index:', panel.index);
console.log(' - panel.printElements数量:', panel.printElements?.length);
// 检查每个元素的类型
if (panel.printElements) {
panel.printElements.forEach((el, idx) => {
console.log(` - 元素[${idx}]:`, el.printElementType?.type, '-', el.printElementType?.title);
});
}
}
const userStore = useUserStore(); const userStore = useUserStore();
const processedTemplate = JSON.parse( console.log('[3] 医院名称:', userStore.hospitalName);
let processedTemplate;
try {
processedTemplate = JSON.parse(
JSON.stringify(template).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName) JSON.stringify(template).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
); );
console.log('[4] 模板处理成功');
} catch (parseError) {
console.error('[4] 模板处理失败:', parseError);
throw new Error('模板处理失败: ' + parseError.message);
}
console.log('打印模板:', processedTemplate.panels?.[0]?.name, '元素数量:', processedTemplate.panels?.[0]?.printElements?.length); console.log('[5] 打印数据检查:');
console.log(' - 数据类型:', typeof data);
console.log(' - 数据存在:', !!data);
if (data && typeof data === 'object') {
console.log(' - 数据字段:', Object.keys(data));
}
// 创建打印模板 // 创建打印模板
let hiprintTemplate; let hiprintTemplate;
try { try {
console.log('[6] 开始创建PrintTemplate...');
hiprintTemplate = new hiprint.PrintTemplate({ template: processedTemplate }); hiprintTemplate = new hiprint.PrintTemplate({ template: processedTemplate });
console.log('[6] PrintTemplate创建成功:', hiprintTemplate);
} catch (templateError) { } catch (templateError) {
console.error('创建打印模板失败:', templateError); console.error('[6] 创建打印模板失败:', templateError);
console.error('错误堆栈:', templateError.stack);
console.error('模板内容:', JSON.stringify(processedTemplate, null, 2)); console.error('模板内容:', JSON.stringify(processedTemplate, null, 2));
throw new Error('打印模板创建失败: ' + templateError.message); throw new Error('打印模板创建失败: ' + templateError.message);
} }
@@ -296,47 +336,79 @@ export function executePrint(data, template, printerName, options = {}, business
width: 148, width: 148,
...options, ...options,
}; };
console.log('[7] 打印选项:', printOptions);
// 检查客户端是否连接 // 检查客户端是否连接
const isClientConnected = hiprint.hiwebSocket && hiprint.hiwebSocket.connected; const isClientConnected = hiprint.hiwebSocket && hiprint.hiwebSocket.connected;
console.log('[8] 客户端连接状态:', isClientConnected);
// 如果指定了打印机且客户端已连接,添加到打印选项中 // 如果指定了打印机且客户端已连接,添加到打印选项中
if (printerName && isClientConnected) { if (printerName && isClientConnected) {
printOptions.printer = printerName; printOptions.printer = printerName;
// 保存到缓存 // 保存到缓存
savePrinterToCache(printerName, businessName); savePrinterToCache(printerName, businessName);
console.log('[8] 使用指定打印机:', printerName);
} }
// 打印成功回调 // 打印成功回调
hiprintTemplate.on('printSuccess', function (e) { hiprintTemplate.on('printSuccess', function (e) {
console.log('[9] 打印成功:', e);
console.log('========== 打印诊断日志结束 ==========');
resolve({ success: true, event: e }); resolve({ success: true, event: e });
}); });
// 打印失败回调 // 打印失败回调
hiprintTemplate.on('printError', function (e) { hiprintTemplate.on('printError', function (e) {
console.error('[9] 打印失败:', e);
console.log('========== 打印诊断日志结束 ==========');
reject({ success: false, event: e, message: '打印失败' }); reject({ success: false, event: e, message: '打印失败' });
}); });
// 根据客户端连接状态选择打印方式 // 根据客户端连接状态选择打印方式
console.log('[10] 开始执行打印...');
if (isClientConnected && printerName) { if (isClientConnected && printerName) {
// 客户端已连接且指定了打印机,使用静默打印 // 客户端已连接且指定了打印机,使用静默打印
console.log('[10] 使用print2静默打印');
try {
hiprintTemplate.print2(data, printOptions); hiprintTemplate.print2(data, printOptions);
console.log('[10] print2调用完成');
} catch (print2Error) {
console.error('[10] print2调用失败:', print2Error);
console.error('[10] print2错误堆栈:', print2Error.stack);
throw new Error('print2打印失败: ' + print2Error.message);
}
} else { } else {
// 客户端未连接或未指定打印机,使用浏览器打印预览(不需要客户端连接) // 客户端未连接或未指定打印机,使用浏览器打印预览(不需要客户端连接)
console.log('打印客户端未连接,使用浏览器打印预览方式'); console.log('[10] 使用print浏览器打印预览');
console.log('[10] hiprintTemplate.print方法存在:', typeof hiprintTemplate.print === 'function');
try {
hiprintTemplate.print(data, printOptions, { hiprintTemplate.print(data, printOptions, {
styleHandler: () => { styleHandler: () => {
console.log('[10] styleHandler被调用');
return '<style>@media print { @page { margin: 0; } }</style>'; return '<style>@media print { @page { margin: 0; } }</style>';
}, },
callback: () => { callback: (e) => {
console.log('打印窗口已打开'); console.log('[10] 打印回调被调用:', e);
} }
}); });
console.log('[10] print调用完成');
} catch (printError) {
console.error('[10] print调用失败:', printError);
console.error('[10] print错误堆栈:', printError.stack);
throw new Error('print打印失败: ' + printError.message);
}
// 浏览器打印模式下直接resolve因为打印窗口已打开 // 浏览器打印模式下直接resolve因为打印窗口已打开
console.log('[10] 浏览器打印模式,直接返回成功');
console.log('========== 打印诊断日志结束 ==========');
resolve({ success: true, message: '打印窗口已打开' }); resolve({ success: true, message: '打印窗口已打开' });
} }
} catch (error) { } catch (error) {
reject({ success: false, error: error, message: error.message || '打印过程中发生错误' }); console.error('[ERROR] 打印过程中发生错误:', error);
console.error('[ERROR] 错误类型:', error?.constructor?.name);
console.error('[ERROR] 错误消息:', error?.message);
console.error('[ERROR] 错误堆栈:', error?.stack);
console.log('========== 打印诊断日志结束 ==========');
reject({ success: false, error: error, message: error?.message || '打印过程中发生错误' });
} }
}); });
} }

View File

@@ -146,7 +146,7 @@
v-model="scope.row.doseQuantity" v-model="scope.row.doseQuantity"
@input=" @input="
(value) => { (value) => {
scope.row.dose = value * scope.row.unitConversionRatio; scope.row.dose = value / scope.row.unitConversionRatio;
} }
" "
/> />
@@ -164,7 +164,7 @@
v-model="scope.row.dose" v-model="scope.row.dose"
@input=" @input="
(value) => { (value) => {
scope.row.doseQuantity = value / scope.row.unitConversionRatio; scope.row.doseQuantity = value * scope.row.unitConversionRatio;
} }
" "
/> />
@@ -543,7 +543,9 @@ function openEdit(tab, row) {
dose: item.dose, dose: item.dose,
doseQuantity: item.doseQuantity, doseQuantity: item.doseQuantity,
methodCode: item.methodCode, methodCode: item.methodCode,
methodCode_dictText: item.methodCode_dictText,
rateCode: item.rateCode, rateCode: item.rateCode,
rateCode_dictText: item.rateCode_dictText,
// 医嘱类型(药品=1没有则按表名推断药品表 -> 药品) // 医嘱类型(药品=1没有则按表名推断药品表 -> 药品)
adviceType: adviceType:
item.adviceType !== undefined item.adviceType !== undefined

View File

@@ -227,7 +227,7 @@
v-model="scope.row.doseQuantity" v-model="scope.row.doseQuantity"
@input=" @input="
(value) => { (value) => {
scope.row.dose = value * scope.row.unitConversionRatio; scope.row.dose = value / scope.row.unitConversionRatio;
} }
" "
/> />
@@ -238,7 +238,7 @@
v-model="scope.row.dose" v-model="scope.row.dose"
@input=" @input="
(value) => { (value) => {
scope.row.doseQuantity = value / scope.row.unitConversionRatio; scope.row.doseQuantity = value * scope.row.unitConversionRatio;
} }
" "
/> />
@@ -586,6 +586,17 @@ function handleEdit(tab, row) {
selectUnitCode: item.unitCode, selectUnitCode: item.unitCode,
adviceName: item.orderDefinitionName, adviceName: item.orderDefinitionName,
unitCodeName: item.unitCodeName, unitCodeName: item.unitCodeName,
// 回显单次剂量/给药途径/用药频次/天数等字段
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
methodCode: item.methodCode,
methodCode_dictText: item.methodCode_dictText,
rateCode: item.rateCode,
rateCode_dictText: item.rateCode_dictText,
groupId: item.groupId,
groupOrder: item.groupOrder,
therapyEnum: item.therapyEnum != null ? String(item.therapyEnum) : '1',
}; };
}); });
prescriptionList.value.unshift({ prescriptionList.value.unshift({

View File

@@ -69,6 +69,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="划价标记" prop="pricingFlag" label-width="80">
<el-select v-model="queryParams.pricingFlag" placeholder="" clearable>
<el-option
v-for="item in statusWeatherOption"
:key="item.value"
:label="item.info"
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- </el-col> --> <!-- </el-col> -->
</el-row> </el-row>
</el-form> </el-form>
@@ -375,6 +385,7 @@ const data = reactive({
typeEnum: undefined, // 类型(包括 1中药2成药 typeEnum: undefined, // 类型(包括 1中药2成药
statusEnum: undefined, // 状态(包括 1预置2启用3停用 statusEnum: undefined, // 状态(包括 1预置2启用3停用
ybMatchFlag: undefined, // 是否医保匹配(包括 10 ybMatchFlag: undefined, // 是否医保匹配(包括 10
pricingFlag: undefined, // 划价标记(包括 1允许0不允许
ruleId: undefined, // 执行科室 ruleId: undefined, // 执行科室
categoryCode: undefined, // 目录分类 categoryCode: undefined, // 目录分类
}, },

View File

@@ -253,10 +253,22 @@ const getUnitLabel = (unitCode) => {
async function printReceipt(param) { async function printReceipt(param) {
// 打印收费小票数据 // 打印收费小票数据
console.log('打印收费小票数据:', param.chargedItems); console.log('========== 打印收费小票 - 开始 ==========');
// console.log('!!!!!!!!!选中的收费项目:', param.chargedItems); console.log('[A] 传入参数检查:');
console.log('患者信息:', props.patientInfo); console.log(' - param对象:', param ? '存在' : '不存在');
// formData.totalAmount = props.totalAmount; 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) { if (formData.selfPay.length > 0) {
formData.selfPay[0].amount = props.totalAmount; formData.selfPay[0].amount = props.totalAmount;
@@ -271,6 +283,7 @@ async function printReceipt(param) {
try { try {
// 处理param.chargedItems添加quantityWithUnit字段 // 处理param.chargedItems添加quantityWithUnit字段
console.log('[C] 开始处理收费项目列表...');
const processedChargeItems = (param.chargedItems || []).map((item) => { const processedChargeItems = (param.chargedItems || []).map((item) => {
// 获取单位标签 // 获取单位标签
const unitLabel = getUnitLabel(item.quantityUnit); const unitLabel = getUnitLabel(item.quantityUnit);
@@ -284,8 +297,10 @@ async function printReceipt(param) {
quantityWithUnit, // 添加带单位的数量字段供打印使用 quantityWithUnit, // 添加带单位的数量字段供打印使用
}; };
}); });
console.log('[C] 处理完成,项目数:', processedChargeItems.length);
// 构造打印数据,整合选中行信息 // 构造打印数据,整合选中行信息
console.log('[D] 开始构造打印数据...');
const printData = { const printData = {
data: [ data: [
{ {
@@ -566,12 +581,27 @@ async function printReceipt(param) {
// 使用printUtils进行打印 // 使用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]); await printUtils.print(PRINT_TEMPLATE.OUTPATIENT_CHARGE, printData.data[0]);
console.log('打印成功'); console.log('[G] 打印调用成功完成');
console.log('========== 打印收费小票 - 结束 ==========');
} catch (error) { } 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); proxy.$modal.msgError('打印失败: ' + error.message);
} }
} }

View File

@@ -590,7 +590,8 @@ function handleUseOrderGroup(row) {
inventoryList: orderDetail.inventoryList || [], inventoryList: orderDetail.inventoryList || [],
priceList: orderDetail.priceList || [], priceList: orderDetail.priceList || [],
partPercent: orderDetail.partPercent || 1, partPercent: orderDetail.partPercent || 1,
positionId: orderDetail.positionId, // 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId
positionId: item.positionId || orderDetail.positionId,
defaultLotNumber: orderDetail.defaultLotNumber, defaultLotNumber: orderDetail.defaultLotNumber,
// 单位信息 // 单位信息
@@ -615,7 +616,8 @@ function handleUseOrderGroup(row) {
inventoryList: orderDetail.inventoryList || [], inventoryList: orderDetail.inventoryList || [],
priceList: orderDetail.priceList || [], priceList: orderDetail.priceList || [],
partPercent: orderDetail.partPercent || 1, partPercent: orderDetail.partPercent || 1,
positionId: orderDetail.positionId, // 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId
positionId: item.positionId || orderDetail.positionId,
defaultLotNumber: orderDetail.defaultLotNumber, defaultLotNumber: orderDetail.defaultLotNumber,
} }
}; };

View File

@@ -2797,6 +2797,69 @@ function handleSaveBatch(prescriptionId) {
}); });
} }
// 🔧 Bug #218 修复:同步组套中的字段到医嘱列表
function syncGroupFields(row) {
if (!row) return;
// 同步频次(用法)
if (row.rateCode) {
prescriptionList.value[rowIndex.value].rateCode = row.rateCode;
}
// 同步用法(给药途径)
if (row.methodCode) {
prescriptionList.value[rowIndex.value].methodCode = row.methodCode;
}
// 同步总量
if (row.quantity !== undefined && row.quantity !== null) {
prescriptionList.value[rowIndex.value].quantity = row.quantity;
}
// 同步单次剂量
if (row.dose !== undefined && row.dose !== null) {
prescriptionList.value[rowIndex.value].dose = row.dose;
}
// 同步单次剂量单位
if (row.doseUnitCode) {
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
}
// 同步执行科室
if (row.positionId || row.orgId) {
prescriptionList.value[rowIndex.value].orgId = row.positionId || row.orgId;
}
// 同步皮试标记
if (row.skinTestFlag !== undefined && row.skinTestFlag !== null) {
prescriptionList.value[rowIndex.value].skinTestFlag = row.skinTestFlag;
prescriptionList.value[rowIndex.value].skinTestFlag_enumText = row.skinTestFlag == 1 ? '是' : '否';
}
// 同步注射药品标记
if (row.injectionFlag !== undefined && row.injectionFlag !== null) {
prescriptionList.value[rowIndex.value].injectionFlag = row.injectionFlag;
}
// 同步发药持续时间
if (row.dispensePerDuration !== undefined && row.dispensePerDuration !== null) {
prescriptionList.value[rowIndex.value].dispensePerDuration = row.dispensePerDuration;
}
// 同步给药时机
if (row.doseQuantity !== undefined && row.doseQuantity !== null) {
prescriptionList.value[rowIndex.value].doseQuantity = row.doseQuantity;
}
// 计算总金额
const quantity = prescriptionList.value[rowIndex.value].quantity || row.quantity || 1;
const unitPrice = prescriptionList.value[rowIndex.value].unitPrice || 0;
if (unitPrice > 0 && quantity > 0) {
prescriptionList.value[rowIndex.value].totalPrice = (unitPrice * quantity).toFixed(2);
}
}
function setValue(row) { function setValue(row) {
unitCodeList.value = []; unitCodeList.value = [];
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' }); unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
@@ -2836,8 +2899,11 @@ function setValue(row) {
statusEnum: prescriptionList.value[rowIndex.value].statusEnum, statusEnum: prescriptionList.value[rowIndex.value].statusEnum,
showPopover: false, // 确保查询框关闭 showPopover: false, // 确保查询框关闭
}; };
prescriptionList.value[rowIndex.value].orgId = undefined; // 🔧 Bug #218 修复:保留组套中的值,不要强制设为undefined
prescriptionList.value[rowIndex.value].dose = undefined; // 只有当值未定义时才使用默认值
prescriptionList.value[rowIndex.value].orgId = row.positionId || row.orgId;
prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity;
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value; prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value;
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode; prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
prescriptionList.value[rowIndex.value].minUnitCode = row.minUnitCode; prescriptionList.value[rowIndex.value].minUnitCode = row.minUnitCode;
@@ -2893,6 +2959,8 @@ function setValue(row) {
.toFixed(6); .toFixed(6);
prescriptionList.value[rowIndex.value].positionName = stock.locationName; prescriptionList.value[rowIndex.value].positionName = stock.locationName;
} }
// 🔧 Bug #218 修复:同步组套中的其他字段(频次、用法、总量、单次剂量、皮试等)
syncGroupFields(row);
} else if (row.adviceType == 4) { } else if (row.adviceType == 4) {
// 🔧 Bug #147 修复:耗材类型(adviceType=4)的专门处理 // 🔧 Bug #147 修复:耗材类型(adviceType=4)的专门处理
// 耗材从getDeviceList接口获取使用priceList中的价格 // 耗材从getDeviceList接口获取使用priceList中的价格
@@ -2906,8 +2974,9 @@ function setValue(row) {
prescriptionList.value[rowIndex.value].unitPrice = validPrice; prescriptionList.value[rowIndex.value].unitPrice = validPrice;
prescriptionList.value[rowIndex.value].unitTempPrice = validPrice; prescriptionList.value[rowIndex.value].unitTempPrice = validPrice;
prescriptionList.value[rowIndex.value].minUnitPrice = validPrice; prescriptionList.value[rowIndex.value].minUnitPrice = validPrice;
prescriptionList.value[rowIndex.value].quantity = 1; // 🔧 Bug #218 修复保留组套中的quantity如果没有则默认1
prescriptionList.value[rowIndex.value].totalPrice = validPrice; prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
prescriptionList.value[rowIndex.value].totalPrice = validPrice * (row.quantity || 1);
prescriptionList.value[rowIndex.value].positionName = row.positionName || ''; prescriptionList.value[rowIndex.value].positionName = row.positionName || '';
// 🔧 Bug Fix: 使用 positionId如果为空则使用患者信息中的 orgId // 🔧 Bug Fix: 使用 positionId如果为空则使用患者信息中的 orgId
console.log('设置耗材locationId:', { console.log('设置耗材locationId:', {
@@ -2932,11 +3001,13 @@ function setValue(row) {
} else { } else {
// 诊疗类型adviceType == 3 // 诊疗类型adviceType == 3
prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId; prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId;
prescriptionList.value[rowIndex.value].quantity = 1; // 🔧 Bug #218 修复使用组套中维护的quantity如果没有则默认1
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
// 🔧 Bug #144 修复:安全访问 priceList防止 orderDetailInfos 为空时出错 // 🔧 Bug #144 修复:安全访问 priceList防止 orderDetailInfos 为空时出错
if (row.priceList && row.priceList.length > 0) { if (row.priceList && row.priceList.length > 0) {
prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price; prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
prescriptionList.value[rowIndex.value].totalPrice = row.priceList[0].price; // 🔧 Bug #218 修复:总金额 = 单价 × 数量
prescriptionList.value[rowIndex.value].totalPrice = row.priceList[0].price * (row.quantity || 1);
} else { } else {
prescriptionList.value[rowIndex.value].unitPrice = 0; prescriptionList.value[rowIndex.value].unitPrice = 0;
prescriptionList.value[rowIndex.value].totalPrice = 0; prescriptionList.value[rowIndex.value].totalPrice = 0;
@@ -2944,6 +3015,8 @@ function setValue(row) {
} }
} }
} }
// 🔧 Bug #218 修复:最后统一同步组套字段(适用于所有类型)
syncGroupFields(row);
} }
// 选择组套 - 适配新版 OrderGroupDrawer 组件 // 选择组套 - 适配新版 OrderGroupDrawer 组件
@@ -2986,7 +3059,8 @@ function handleSaveGroup(orderGroupList) {
inventoryList: item.orderDetailInfos?.inventoryList || [], inventoryList: item.orderDetailInfos?.inventoryList || [],
priceList: item.orderDetailInfos?.priceList || [], priceList: item.orderDetailInfos?.priceList || [],
partPercent: item.orderDetailInfos?.partPercent || 1, 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, defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
}; };
@@ -3016,7 +3090,8 @@ function handleSaveGroup(orderGroupList) {
unitCode: item.unitCode, unitCode: item.unitCode,
unitCode_dictText: item.unitCodeName || '', unitCode_dictText: item.unitCodeName || '',
statusEnum: 1, 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', dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
conditionId: conditionId.value, conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value, conditionDefinitionId: conditionDefinitionId.value,