217 收费工作站-》门诊收费:【确认收费】报错“打印失败”

220 门诊医生站:新增耗材收费项目医嘱单价/总金额未显示正确的值
This commit is contained in:
Ranyunqiao
2026-03-26 16:55:06 +08:00
parent 8739959be0
commit 188b907907
12 changed files with 304 additions and 66 deletions

View File

@@ -14,10 +14,11 @@ export function getList(queryParams) {
/**
* 患者处方列表
*/
export function getChargeList(encounterId) {
export function getChargeList(encounterId, config = {}) {
return request({
url: '/charge-manage/charge/patient-prescription?encounterId=' + encounterId,
method: 'get',
...config
})
}
@@ -111,11 +112,12 @@ export function unprecharge(data) {
/**
* 发耗材
*/
export function dispenseMedicalConsumables(data) {
export function dispenseMedicalConsumables(data, config = {}) {
return request({
url: '/pharmacy-manage/device-dispense/consumables-dispense',
method: 'put',
data: data
data: data,
...config
})
}
@@ -123,11 +125,12 @@ export function dispenseMedicalConsumables(data) {
/**
* 补打小票
*/
export function getChargeInfo(param) {
export function getChargeInfo(param, config = {}) {
return request({
url: '/payment/bill/getDetail',
method: 'get',
params: param
params: param,
...config
})
}

View File

@@ -476,9 +476,12 @@ async function printReceipt(param) {
return amount > 0 ? amount + ' 元' : amount;
})(), // 个人现金支付金额(现金)
SELF_CASH_VX_VALUE: (() => {
const amount = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
return amount > 0 ? amount + ' 元' : amount;
})(), // 个人现金支付金额(微信)
// 微信+银联+支付宝的合计金额
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + ' 元';
})(),
SELF_CASH_ALI_VALUE: (() => {
const amount = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
return amount > 0 ? amount + ' 元' : amount;
@@ -537,14 +540,6 @@ async function printReceipt(param) {
const amount = param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0;
return amount > 0 ? amount + ' 元' : amount;
})(), // 保健预支基金
//微信刷卡支付
SELF_CASH_VX_VALUE: (() => {
// const cashValue = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + ' 元';
})(),
Mr_QR_Code: param.regNo,
regNo: param.regNo || '',
@@ -659,16 +654,24 @@ async function submit() {
})
.then((res) => {
if (res.code == 200) {
getChargeInfo({ paymentId: props.paymentId }).then((res) => {
// 传递完整的选中数据信息到打印方法
printReceipt({ ...res.data, chargedItems: props.chargedItems });
});
getChargeInfo({ paymentId: props.paymentId }, { skipErrorMsg: true })
.then((res) => {
// 传递完整的选中数据信息到打印方法
printReceipt({ ...res.data, chargedItems: props.chargedItems });
})
.catch(() => {
// 打印失败不影响收费成功流程
});
formData.selfPay = [{ payEnum: 220100, amount: 0.0, payLevelEnum: 2 }];
emit('close', 'success', res.msg);
emit('refresh'); // 发送刷新事件给父组件
// 长春市朝阳区中医院自动发耗材
// 长春市朝阳区中医院自动发耗材(静默执行,不阻塞主流程)
if (userStore.fixmedinsCode == 'H22010200672' && props.consumablesIdList.length > 0) {
dispenseMedicalConsumables(props.consumablesIdList);
dispenseMedicalConsumables(props.consumablesIdList, { skipErrorMsg: true })
.then(() => {})
.catch(() => {
// 发耗材失败不影响收费成功流程
});
}
} else {
proxy.$modal.msgError(res.msg || '收费失败');

View File

@@ -325,7 +325,7 @@ function handleClose(value, msg) {
if (value == 'success') {
proxy.$modal.msgSuccess(msg);
chargeLoading.value = true;
getChargeList(patientInfo.value.encounterId).then((res) => {
getChargeList(patientInfo.value.encounterId, { skipErrorMsg: true }).then((res) => {
chargeList.value = res.data;
setTimeout(() => {
chargeLoading.value = false;

View File

@@ -262,24 +262,19 @@ function fetchFromApi(searchKey) {
adviceBaseList.value = res.data.records.map((item) => {
console.log('[Debug] 耗材项:', item.name, 'price:', item.price, 'retailPrice:', item.retailPrice);
return {
...item,
// 🔧 Bug Fix: 强制覆盖后端返回的字段,确保数据正确
adviceName: item.name || item.busNo,
adviceType: 4,
adviceType: 4, // 强制设置为前端耗材类型
adviceTableName: 'adm_device_definition',
unitCode: item.unitCode || '',
unitCode_dictText: item.unitCode_dictText || '',
minUnitCode: item.minUnitCode || item.unitCode || '',
minUnitCode_dictText: item.minUnitCode_dictText || item.unitCode_dictText || '',
volume: item.size || item.totalVolume || '',
partPercent: item.partPercent || 1,
// 🔧 Bug #220 修复正确处理耗材价格支持price或retailPrice字段
// 零售价可能是0所以不能用简单的布尔判断需要明确检查null/undefined
priceList: (item.price !== undefined && item.price !== null)
? [{ price: item.price }]
: ((item.retailPrice !== undefined && item.retailPrice !== null)
? [{ price: item.retailPrice }]
: []),
inventoryList: [],
adviceDefinitionId: item.id,
adviceTableName: 'adm_device_definition',
chargeItemDefinitionId: item.id,
positionId: item.locationId,
positionName: item.locationId_dictText || '',
@@ -293,17 +288,7 @@ function fetchFromApi(searchKey) {
categoryCode: item.categoryCode || '',
deviceId: item.id,
deviceName: item.name,
// 🔧 Bug Fix: ...item 展开放在前面,然后用前端字段覆盖
...item,
// 确保前端覆盖后端可能冲突的字段
adviceName: item.name || item.busNo,
adviceType: 4, // 强制设置为前端耗材类型
unitCode: item.unitCode || '',
unitCode_dictText: item.unitCode_dictText || '',
minUnitCode: item.minUnitCode || item.unitCode || '',
minUnitCode_dictText: item.minUnitCode_dictText || item.unitCode_dictText || '',
volume: item.size || item.totalVolume || '',
partPercent: item.partPercent || 1,
// 🔧 Bug #220 修复正确处理耗材价格支持price或retailPrice字段
// 价格字段优先使用retailPrice
priceList: (item.retailPrice !== undefined && item.retailPrice !== null)
? [{ price: item.retailPrice }]

View File

@@ -1588,6 +1588,11 @@ function getListInfo(addNewRow) {
console.log('BugFix#219: 过滤掉已作废的会诊医嘱, requestId=', item.requestId);
return false;
}
// 🔧 Bug Fix: 过滤掉项目名称为空的无效医嘱
if (!item.adviceName || item.adviceName.trim() === '') {
console.log('BugFix: 过滤掉空白医嘱, requestId=', item.requestId, 'adviceType=', item.adviceType);
return false;
}
return true;
});
@@ -2333,14 +2338,10 @@ function handleSave(prescriptionId) {
// 签发核心逻辑
function executeSaveLogic() {
// 🔧 Bug Fix: 获取当前选中的费用性质,如果是'ZIFEI'或0则转为null让后端查询默认账户
// 🔧 Bug Fix: 获取当前选中的费用性质,保持字符串类型避免大整数精度丢失
let finalAccountId = accountId.value;
if (finalAccountId === 'ZIFEI' || finalAccountId === 0) {
finalAccountId = null;
} else if (finalAccountId && !isNaN(Number(finalAccountId))) {
finalAccountId = Number(finalAccountId);
} else {
finalAccountId = null;
}
// 🔧 Bug Fix: 校验患者信息完整性
@@ -2878,11 +2879,10 @@ function handleSaveBatch(prescriptionId) {
}
// 🔧 Bug Fix: 在保存时才转换 accountId
// 保持为字符串类型,避免 JavaScript 大整数精度丢失问题
let finalAccountId = accountId.value;
if (finalAccountId === 'ZIFEI') {
if (finalAccountId === 'ZIFEI' || finalAccountId === 0) {
finalAccountId = null;
} else if (finalAccountId && !isNaN(Number(finalAccountId))) {
finalAccountId = Number(finalAccountId);
}
// 更新到处方对象
@@ -2964,12 +2964,10 @@ function handleSaveBatch(prescriptionId) {
};
const contentJson = JSON.stringify(itemToSave);
// 🔧 Bug Fix: 处理accountId如果是'ZIFEI'或0则转为null让后端查询默认账户
// 🔧 Bug Fix: 处理accountId保持字符串类型避免大整数精度丢失
let itemAccountId = finalAccountId;
if (itemAccountId === 'ZIFEI' || itemAccountId === 0) {
itemAccountId = null;
} else if (itemAccountId && !isNaN(Number(itemAccountId))) {
itemAccountId = Number(itemAccountId);
}
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
@@ -3143,6 +3141,12 @@ function syncGroupFields(row) {
}
function setValue(row) {
// 🔧 Bug Fix: 强制设置耗材类型,确保 adviceType 为 4
// 如果 adviceTableName 是 adm_device_definition强制设为耗材类型
if (row.adviceTableName === 'adm_device_definition') {
row.adviceType = 4;
}
unitCodeList.value = [];
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
unitCodeList.value.push({

View File

@@ -375,7 +375,9 @@ async function submit() {
emit('refresh'); // 发送刷新事件给父组件
// 长春市朝阳区中医院自动发耗材
if (userStore.fixmedinsCode == 'H22010200672' && props.consumablesIdList.length > 0) {
dispenseMedicalConsumables(props.consumablesIdList);
dispenseMedicalConsumables(props.consumablesIdList).catch(err => {
console.warn('自动发耗材失败:', err);
});
}
}
})