fix: 修复手术安排计费报"未关联就诊记录"及 encounterId=undefined 异常
1. vxe-table 4.x current-change 事件参数为 { row } 对象,handleCurrentChange
未解构导致 selectedRow 存的是事件对象而非行数据,计费/医嘱按钮读取
visitId 始终为 undefined → 报"该手术安排未关联就诊记录"
修复:const currentRow = args?.row || args
2. getPrescriptionList 等 API 函数直接用字符串拼接 URL 参数,当
encounterId 为 undefined 时拼接成字符串 "undefined" 发送到后端,
导致 Long 类型转换异常 MethodArgumentTypeMismatchException
修复:encounterId 为 null/undefined/空字符串时直接返回空数组,
不再拼接无效值到 URL
This commit is contained in:
@@ -59,6 +59,9 @@ export function singOut(data) {
|
||||
* 获取患者本次就诊处方
|
||||
*/
|
||||
export function getPrescriptionList(encounterId, generateSourceEnum, sourceBillNo) {
|
||||
if (encounterId == null || encounterId === '') {
|
||||
return Promise.resolve({ data: [] });
|
||||
}
|
||||
let url = '/doctor-station/advice/request-base-info?encounterId=' + encounterId
|
||||
if (generateSourceEnum != null) {
|
||||
url += '&generateSourceEnum=' + generateSourceEnum
|
||||
|
||||
@@ -325,6 +325,10 @@ export function singOut(data) {
|
||||
* 获取患者本次就诊处方
|
||||
*/
|
||||
export function getPrescriptionList(encounterId) {
|
||||
// encounterId 为 undefined/null 时不发请求,避免后端 Long 类型转换异常
|
||||
if (encounterId == null || encounterId === '') {
|
||||
return Promise.resolve({ data: [] });
|
||||
}
|
||||
// 添加时间戳参数防止浏览器缓存,确保签发后总能获取到最新数据
|
||||
const timestamp = Date.now();
|
||||
return request({
|
||||
|
||||
@@ -241,6 +241,9 @@ export function cancelStopAdvice(data) {
|
||||
* 获取患者本次就诊处方
|
||||
*/
|
||||
export function getPrescriptionList(encounterId) {
|
||||
if (encounterId == null || encounterId === '') {
|
||||
return Promise.resolve({ data: [] });
|
||||
}
|
||||
return request({
|
||||
url: '/reg-doctorstation/advice-manage/reg-request-base-info?encounterId=' + encounterId,
|
||||
method: 'get',
|
||||
|
||||
@@ -153,8 +153,9 @@
|
||||
<vxe-table
|
||||
v-loading="loading"
|
||||
:data="surgeryList"
|
||||
:row-config="{ keyField: 'scheduleId', keyField: 'surgeryNo' }"
|
||||
:row-config="{ keyField: 'scheduleId' }"
|
||||
:row-class-name="getRowClassName"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<vxe-column
|
||||
@@ -2172,7 +2173,9 @@ function handleView(row) {
|
||||
}
|
||||
|
||||
// 行选中事件处理
|
||||
function handleCurrentChange(currentRow, oldRow) {
|
||||
// vxe-table 4.x current-change 回调参数为 { row } 对象,需解构取 row
|
||||
function handleCurrentChange(args, oldRow) {
|
||||
const currentRow = args?.row || args
|
||||
if (currentRow) {
|
||||
selectedRow.value = currentRow
|
||||
selectedRowIndex.value = surgeryList.value.findIndex(row => row.scheduleId === currentRow.scheduleId)
|
||||
@@ -2200,12 +2203,17 @@ async function handleChargeCharge(row) {
|
||||
if (!row && selectedRow.value) {
|
||||
row = selectedRow.value
|
||||
}
|
||||
|
||||
|
||||
// 如果还是没有行数据,显示提示
|
||||
if (!row) {
|
||||
proxy.$modal.msgWarning('请先选择要计费的手术安排')
|
||||
return
|
||||
}
|
||||
// 校验就诊ID是否存在(visitId 为空说明手术安排未关联就诊记录,无法计费)
|
||||
if (!row.visitId) {
|
||||
proxy.$modal.msgError('该手术安排未关联就诊记录,无法计费。请先确认患者已完成就诊登记。')
|
||||
return
|
||||
}
|
||||
|
||||
// 调用接口获取账户信息
|
||||
let accountId = null
|
||||
@@ -2215,15 +2223,17 @@ async function handleChargeCharge(row) {
|
||||
// 从返回数据中提取accountId - data是数组,取第一个元素的accountId
|
||||
accountId = contractResult.data[0].accountId || contractResult.data[0].id
|
||||
} else {
|
||||
proxy.$modal.msgError('获取账户信息失败')
|
||||
proxy.$modal.msgError('获取账户信息失败,请确认该就诊记录是否已建立计费账户。')
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
return
|
||||
proxy.$modal.msgError('获取账户信息异常,请稍后重试。')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 设置计费弹窗数据 - 直接复制划价页面的逻辑
|
||||
chargeDialogTitle.value = '手术计费 - ' + row.patientName + ' - ' + row.operName
|
||||
|
||||
|
||||
// 构建患者信息,传递encounterId和机构ID
|
||||
chargePatientInfo.value = {
|
||||
encounterId: row.visitId, // 就诊ID
|
||||
@@ -2289,6 +2299,12 @@ function handleMedicalAdvice(row) {
|
||||
return
|
||||
}
|
||||
|
||||
// 校验就诊ID是否存在(visitId 为空会导致后端 encounterId="undefined" 类型转换异常)
|
||||
if (!row.visitId) {
|
||||
proxy.$modal.msgError('该手术安排未关联就诊记录,无法开具医嘱。请先确认患者已完成就诊登记。')
|
||||
return
|
||||
}
|
||||
|
||||
// 设置临时医嘱弹窗数据
|
||||
temporaryPatientInfo.value = {
|
||||
patientName: row.patientName,
|
||||
|
||||
Reference in New Issue
Block a user