fix(consultation): 修复会诊取消提交逻辑并优化医生列表显示
新增检查医生确认/签名状态的逻辑,防止已确认/签名的会诊被取消提交 优化前端参与医生列表的显示,只显示已确认或已签名的医生
This commit is contained in:
@@ -444,6 +444,17 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
if (!ConsultationStatusEnum.SUBMITTED.getCode().equals(entity.getConsultationStatus())) {
|
||||
throw new IllegalArgumentException("只有已提交状态的会诊申请才能取消提交");
|
||||
}
|
||||
|
||||
// 🎯 新增:检查是否有医生已确认或签名
|
||||
// 即使整体状态还是10(部分医生确认/签名),也不允许取消提交
|
||||
LambdaQueryWrapper<ConsultationInvited> invitedCheckWrapper = new LambdaQueryWrapper<>();
|
||||
invitedCheckWrapper.eq(ConsultationInvited::getConsultationRequestId, entity.getId())
|
||||
.ge(ConsultationInvited::getInvitedStatus, ConsultationStatusEnum.CONFIRMED.getCode());
|
||||
long confirmedOrSignedCount = consultationInvitedMapper.selectCount(invitedCheckWrapper);
|
||||
if (confirmedOrSignedCount > 0) {
|
||||
throw new IllegalArgumentException("已有医生确认或签名,无法取消提交");
|
||||
}
|
||||
|
||||
// 取消提交:将状态从"已提交"改回"新开"
|
||||
entity.setConsultationStatus(ConsultationStatusEnum.NEW.getCode());
|
||||
entity.setConfirmingPhysician(null);
|
||||
@@ -724,8 +735,8 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
dto.setInvitedList(invitedDtoList);
|
||||
|
||||
|
||||
|
||||
|
||||
// 🎯 如果会诊已确认、已签名或已完成,填充会诊记录信息(从会诊确认表中获取)
|
||||
// 会诊状态:20=已确认,30=已签名,40=已完成
|
||||
if (entity.getConsultationStatus() != null &&
|
||||
@@ -785,11 +796,6 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("填充会诊记录信息,已确认和已签名医生数:{},已签名医生数:{}",
|
||||
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,7 +1204,7 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
// 10=已提交(待确认)、20=已确认(待签名)、30=已签名,排除40=已完成
|
||||
LambdaQueryWrapper<ConsultationInvited> invitedWrapper = new LambdaQueryWrapper<>();
|
||||
invitedWrapper.eq(ConsultationInvited::getInvitedPhysicianId, currentPhysicianId)
|
||||
.in(ConsultationInvited::getInvitedStatus,
|
||||
.in(ConsultationInvited::getInvitedStatus,
|
||||
ConsultationStatusEnum.SUBMITTED.getCode(), // 10-待确认
|
||||
ConsultationStatusEnum.CONFIRMED.getCode(), // 20-已确认(待签名)
|
||||
ConsultationStatusEnum.SIGNED.getCode()) // 30-已签名
|
||||
@@ -1312,9 +1318,9 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
|
||||
// 4. 更新邀请记录(存储会诊意见)
|
||||
// 格式:科室-医生:意见内容
|
||||
String formattedOpinion = String.format("%s-%s:%s",
|
||||
currentDeptName,
|
||||
currentPhysicianName,
|
||||
String formattedOpinion = String.format("%s-%s:%s",
|
||||
currentDeptName,
|
||||
currentPhysicianName,
|
||||
dto.getConsultationOpinion());
|
||||
|
||||
invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode()); // 已确认
|
||||
|
||||
@@ -57,11 +57,18 @@
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 已提交状态:显示取消提交按钮 -->
|
||||
<template v-else-if="row.consultationStatus === 10">
|
||||
<!-- 🎯 修复:如果有医生已确认或签名,则隐藏取消提交按钮 -->
|
||||
<template v-else-if="row.consultationStatus === 10 && !hasConfirmedOrSignedDoctor(row)">
|
||||
<el-button type="warning" size="small" @click="handleCancelSubmit(row)">
|
||||
取消提交
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 已提交但有医生确认/签名:显示查看按钮 -->
|
||||
<template v-else-if="row.consultationStatus === 10 && hasConfirmedOrSignedDoctor(row)">
|
||||
<el-button type="info" size="small" @click="handleView(row)">
|
||||
查看
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 已确认状态:显示待签名按钮 -->
|
||||
<template v-else-if="row.consultationStatus === 20">
|
||||
<el-button type="success" size="small" @click="handleView(row)">
|
||||
@@ -239,7 +246,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<!-- 🎯 新增:参与医生列表(表格形式) -->
|
||||
<el-form-item label="参与医生签名:" v-if="participatingPhysicians.length > 0">
|
||||
<el-form-item label="参与医生签名:">
|
||||
<el-table
|
||||
:data="participatingPhysicians"
|
||||
border
|
||||
@@ -247,11 +254,11 @@
|
||||
style="width: 100%"
|
||||
max-height="300"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="confirmingDeptName" label="代表科室" width="120" align="center" />
|
||||
<el-table-column prop="confirmingPhysicianName" label="所属医生" width="100" align="center" />
|
||||
<el-table-column prop="signature" label="签名医生" width="100" align="center" />
|
||||
<el-table-column prop="signatureDate" label="签名时间" width="160" align="center">
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" />
|
||||
<el-table-column prop="confirmingDeptName" label="代表科室" min-width="120" align="center" />
|
||||
<el-table-column prop="confirmingPhysicianName" label="所属医生" min-width="100" align="center" />
|
||||
<el-table-column prop="signature" label="签名医生" min-width="100" align="center" />
|
||||
<el-table-column prop="signatureDate" label="签名时间" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.signatureDate) }}
|
||||
</template>
|
||||
@@ -629,6 +636,14 @@ const clearAllSelections = () => {
|
||||
selectedPhysiciansList.value = [];
|
||||
};
|
||||
|
||||
// 🎯 检查是否有医生已确认或签名
|
||||
const hasConfirmedOrSignedDoctor = (row) => {
|
||||
if (!row.invitedList || row.invitedList.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return row.invitedList.some(inv => inv.invitedStatus >= 20);
|
||||
};
|
||||
|
||||
// 加载会诊列表
|
||||
const loadConsultationList = async () => {
|
||||
if (!props.patientInfo?.encounterId) {
|
||||
@@ -772,14 +787,16 @@ const handleRowClick = async (row) => {
|
||||
console.log('填充的医生列表:', selectedPhysiciansList.value);
|
||||
|
||||
// 🎯 填充参与医生列表(显示确认和签名状态)
|
||||
participatingPhysicians.value = row.invitedList.map(inv => ({
|
||||
physicianId: inv.physicianId,
|
||||
confirmingPhysicianName: inv.physicianName || '',
|
||||
confirmingDeptName: inv.deptName || '',
|
||||
signature: inv.signatureTime ? inv.physicianName : '', // 有签名时间才显示签名医生
|
||||
signatureDate: inv.signatureTime || null,
|
||||
}));
|
||||
|
||||
participatingPhysicians.value = row.invitedList
|
||||
.filter(inv => inv.invitedStatus >= 20) // 只显示已确认或已签名的医生
|
||||
.map(inv => ({
|
||||
physicianId: inv.physicianId,
|
||||
confirmingPhysicianName: inv.physicianName || '',
|
||||
confirmingDeptName: inv.deptName || '',
|
||||
signature: inv.invitedStatus >= 30 ? inv.physicianName : '', // 已签名才显示签名医生
|
||||
signatureDate: inv.signatureTime || null,
|
||||
}));
|
||||
|
||||
console.log('参与医生列表:', participatingPhysicians.value);
|
||||
} else {
|
||||
selectedPhysiciansList.value = [];
|
||||
@@ -1073,7 +1090,16 @@ const handleCompleteRow = async (row) => {
|
||||
// 查看详情
|
||||
const handleView = (row) => {
|
||||
handleRowClick(row);
|
||||
ElMessage.info('该申请已完成或已取消,仅可查看');
|
||||
// 根据状态显示不同的提示消息
|
||||
if (row.consultationStatus === 10 && hasConfirmedOrSignedDoctor(row)) {
|
||||
ElMessage.info('已有医生确认或签名,无法取消提交,仅可查看');
|
||||
} else if (row.consultationStatus === 20) {
|
||||
ElMessage.info('该申请已确认,等待签名');
|
||||
} else if (row.consultationStatus === 40) {
|
||||
ElMessage.info('该申请已完成,仅可查看');
|
||||
} else if (row.consultationStatus === 50) {
|
||||
ElMessage.info('该申请已取消,仅可查看');
|
||||
}
|
||||
};
|
||||
|
||||
// 作废
|
||||
|
||||
Reference in New Issue
Block a user