bug 349 350 351 354 356 357

This commit is contained in:
Ranyunqiao
2026-04-13 12:10:22 +08:00
parent 13e83e0c82
commit 49eed7c784
10 changed files with 227 additions and 63 deletions

View File

@@ -134,7 +134,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
if (poolSaved) { if (poolSaved) {
// 创建号源槽 // 创建号源槽
List<ScheduleSlot> slots = createScheduleSlots(pool.getId().intValue(), newSchedule.getLimitNumber(), List<ScheduleSlot> slots = createScheduleSlots(pool.getId(), newSchedule.getLimitNumber(),
newSchedule.getStartTime(), newSchedule.getEndTime()); newSchedule.getStartTime(), newSchedule.getEndTime());
boolean slotsSaved = scheduleSlotService.saveBatch(slots); boolean slotsSaved = scheduleSlotService.saveBatch(slots);
@@ -224,7 +224,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
if (poolSaved) { if (poolSaved) {
// 创建号源槽 // 创建号源槽
List<ScheduleSlot> slots = createScheduleSlots(pool.getId().intValue(), newSchedule.getLimitNumber(), List<ScheduleSlot> slots = createScheduleSlots(pool.getId(), newSchedule.getLimitNumber(),
newSchedule.getStartTime(), newSchedule.getEndTime()); newSchedule.getStartTime(), newSchedule.getEndTime());
boolean slotsSaved = scheduleSlotService.saveBatch(slots); boolean slotsSaved = scheduleSlotService.saveBatch(slots);
@@ -384,7 +384,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
/** /**
* 创建号源槽 * 创建号源槽
*/ */
private List<ScheduleSlot> createScheduleSlots(Integer poolId, Integer limitNumber, LocalTime startTime, private List<ScheduleSlot> createScheduleSlots(Long poolId, Integer limitNumber, LocalTime startTime,
LocalTime endTime) { LocalTime endTime) {
List<ScheduleSlot> slots = new ArrayList<>(); List<ScheduleSlot> slots = new ArrayList<>();
@@ -514,7 +514,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
.in("pool_id", poolIds)); .in("pool_id", poolIds));
if (ObjectUtil.isNotEmpty(slots)) { if (ObjectUtil.isNotEmpty(slots)) {
List<Integer> slotIds = slots.stream().map(ScheduleSlot::getId) List<Long> slotIds = slots.stream().map(ScheduleSlot::getId)
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
// 3. 逻辑删除所有号源槽 // 3. 逻辑删除所有号源槽
scheduleSlotService.removeByIds(slotIds); scheduleSlotService.removeByIds(slotIds);

View File

@@ -581,8 +581,33 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
.collect(Collectors.groupingBy(Practitioner::getOrgId)); .collect(Collectors.groupingBy(Practitioner::getOrgId));
// 构建树形结构 // 构建树形结构
// 过滤条件:科室分类只要包含"门诊(编码1)"或"住院(编码2)"其一,即可显示
List<DepartmentTreeDto> treeList = new ArrayList<>(); List<DepartmentTreeDto> treeList = new ArrayList<>();
for (Organization dept : deptList) { for (Organization dept : deptList) {
// 过滤科室:只显示包含门诊(1)或住院(2)分类的科室
String classEnum = dept.getClassEnum();
boolean needShow = false;
if (classEnum != null && !classEnum.isEmpty()) {
// 拆分分类编码,检查是否包含 1 或 2
String[] codes = classEnum.split(",");
for (String code : codes) {
code = code.trim();
if ("1".equals(code) || "2".equals(code)) {
needShow = true;
break;
}
}
} else {
// 如果没有分类,默认显示
needShow = true;
}
if (!needShow) {
// 既不包含门诊也不包含住院,跳过
continue;
}
DepartmentTreeDto treeDto = new DepartmentTreeDto(); DepartmentTreeDto treeDto = new DepartmentTreeDto();
treeDto.setId(dept.getId()); treeDto.setId(dept.getId());
treeDto.setLabel(dept.getName()); treeDto.setLabel(dept.getName());
@@ -599,11 +624,10 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
treeDto.setChildren(children); treeDto.setChildren(children);
} else { // 只添加有医生的科室
treeDto.setChildren(new ArrayList<>()); treeList.add(treeDto);
} }
// 没有医生的科室不添加到列表中
treeList.add(treeDto);
} }
@@ -1340,9 +1364,13 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
throw new IllegalArgumentException("会诊申请不存在"); throw new IllegalArgumentException("会诊申请不存在");
} }
// 只有已提交状态才能确认 // 会诊必须处于已提交或已确认状态才能确认
if (request.getConsultationStatus() != ConsultationStatusEnum.SUBMITTED.getCode()) { // - 已提交(10):还没有医生确认
throw new IllegalArgumentException("只有已提交状态的会诊申请才能确认"); // - 已确认(20):已有部分医生确认,允许其他医生继续确认(每个医生独立确认,类似已读)
// - 已签名(30)或已完成(40):不能再确认
if (request.getConsultationStatus() != null &&
request.getConsultationStatus() >= ConsultationStatusEnum.SIGNED.getCode()) {
throw new IllegalArgumentException("会诊已签名或完成,无法再确认");
} }
// 2. 获取当前登录医生信息 // 2. 获取当前登录医生信息
@@ -1360,26 +1388,20 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
throw new IllegalArgumentException("您不在被邀请的医生列表中"); throw new IllegalArgumentException("您不在被邀请的医生列表中");
} }
log.info("会诊确认检查currentPhysicianId={}, invitedId={}, invitedStatus={}, CONFIRMED.code={}",
currentPhysicianId, invited.getId(), invited.getInvitedStatus(), ConsultationStatusEnum.CONFIRMED.getCode());
if (invited.getInvitedStatus() != null && invited.getInvitedStatus() >= ConsultationStatusEnum.CONFIRMED.getCode()) { if (invited.getInvitedStatus() != null && invited.getInvitedStatus() >= ConsultationStatusEnum.CONFIRMED.getCode()) {
throw new IllegalArgumentException("您已经确认过了,无需重复确认"); throw new IllegalArgumentException("您已经确认过了,无需重复确认");
} }
// 4. 更新邀请记录(存储会诊意见) // 4. 更新邀请记录(存储会诊意见)
// 格式:科室-会诊确认参加医师:意见内容 // 直接存储用户输入的原始意见内容,不添加医师姓名前缀
// 兼容:若前端未填写“会诊确认参加医师”,则回退为当前医生姓名
String confirmingPhysicianText =
StringUtils.hasText(dto.getConfirmingPhysician()) ? dto.getConfirmingPhysician().trim() : currentPhysicianName;
String formattedOpinion = String.format("%s-%s%s",
currentDeptName,
confirmingPhysicianText,
dto.getConsultationOpinion());
invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode()); // 已确认 invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode()); // 已确认
invited.setConfirmOpinion(formattedOpinion); invited.setConfirmOpinion(dto.getConsultationOpinion()); // 直接存储原始意见,不添加前缀
invited.setConfirmTime(new Date()); invited.setConfirmTime(new Date());
consultationInvitedMapper.updateById(invited); consultationInvitedMapper.updateById(invited);
log.info("医生 {} 确认会诊,意见:{}", currentPhysicianName, formattedOpinion); log.info("医生 {} 确认会诊", currentPhysicianName);
// 5. 更新会诊申请的确认计数 // 5. 更新会诊申请的确认计数
Integer confirmedCount = (request.getConfirmedCount() == null ? 0 : request.getConfirmedCount()) + 1; Integer confirmedCount = (request.getConfirmedCount() == null ? 0 : request.getConfirmedCount()) + 1;

View File

@@ -599,27 +599,40 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
} }
} }
// 药品前端adviceType=1 // 药品前端adviceType=1=西药, 2=中成药 → 都属于药品后端分类
List<AdviceSaveDto> medicineList = adviceSaveList.stream() List<AdviceSaveDto> medicineList = adviceSaveList.stream()
.filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType()) .filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())
|| e.getAdviceType() == 1).collect(Collectors.toList()); || e.getAdviceType() == 1
|| e.getAdviceType() == 2) // 前端中成药类型值为2 → 也属于药品分类
.collect(Collectors.toList());
// 耗材前端adviceType=4后端ItemType.DEVICE=2 // 耗材前端adviceType=4后端ItemType.DEVICE=2
List<AdviceSaveDto> deviceList = adviceSaveList.stream() List<AdviceSaveDto> deviceList = adviceSaveList.stream()
.filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType()) .filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())
|| e.getAdviceType() == 4) // 前端耗材类型值为4 || e.getAdviceType() == 4) // 前端耗材类型值为4
.collect(Collectors.toList()); .collect(Collectors.toList());
// 诊疗活动前端adviceType=3诊疗、adviceType=5会诊、adviceType=6手术 // 诊疗活动前端adviceType=3诊疗、adviceType=5会诊、adviceType=6手术、adviceType=23检查 → 都属于诊疗后端分类
List<AdviceSaveDto> activityList = adviceSaveList.stream() List<AdviceSaveDto> activityList = adviceSaveList.stream()
.filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType()) .filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())
|| e.getAdviceType() == 3 // 前端诊疗类型值为3 || e.getAdviceType() == 3 // 前端诊疗类型值为3
|| e.getAdviceType() == 5 // 前端会诊类型值为5 || e.getAdviceType() == 5 // 前端会诊类型值为5
|| ItemType.SURGERY.getValue().equals(e.getAdviceType())) // 🔧 BugFix#318: 手术类型值为6 || e.getAdviceType() == 6 // 前端手术类型值为6
|| e.getAdviceType() == 23 // 前端检查类型值为23
|| ItemType.SURGERY.getValue().equals(e.getAdviceType())) // 后端手术类型值为6
.collect(Collectors.toList()); .collect(Collectors.toList());
// 🔍 Debug日志: 记录分类结果 // 🔍 Debug日志日志: 记录分类结果
log.info("BugFix#219: 医嘱分类完成 - 药品:{}, 耗材:{}, 诊疗:{}", log.info("BugFix#219: 医嘱分类完成 - 药品:{}, 耗材:{}, 诊疗:{}",
medicineList.size(), deviceList.size(), activityList.size()); medicineList.size(), deviceList.size(), activityList.size());
// 🔍 Debug日志: 打印所有医嘱的adviceType
for (AdviceSaveDto dto : adviceSaveList) {
log.info("BugFix#219: 医嘱详情 - adviceType:{}, requestId:{}, adviceName:{}, dbOpType:{}",
dto.getAdviceType(), dto.getRequestId(),
dto.getContentJson() != null && dto.getContentJson().contains("adviceName")
? dto.getContentJson().substring(0, Math.min(100, dto.getContentJson().length()))
: "N/A",
dto.getDbOpType());
}
// 统计各类删除操作 // 统计各类删除操作
long medDeleteCount = medicineList.stream().filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).count(); long medDeleteCount = medicineList.stream().filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).count();
@@ -679,15 +692,110 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 签发时,把草稿状态的账单更新为待收费 // 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) { if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
// 签发的医嘱id集合 // 签发的医嘱id集合 - 收集所有需要签发的医嘱ID
List<Long> requestIds = adviceSaveList.stream() List<Long> requestIds = adviceSaveList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null) .filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId) .collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 🔧 BugFix: 批量更新药品请求状态为已签发(ACTIVE=2)
if (!requestIds.isEmpty() && !medicineList.isEmpty()) {
List<Long> medicineIds = medicineList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.map(AdviceSaveDto::getRequestId)
.collect(Collectors.toList());
if (!medicineIds.isEmpty()) {
log.info("BugFix: 准备批量更新药品医嘱状态medicineIds={}", medicineIds);
UpdateWrapper<MedicationRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", medicineIds);
updateWrapper.set("status_enum", RequestStatus.ACTIVE.getValue());
boolean updateResult = iMedicationRequestService.update(null, updateWrapper);
log.info("BugFix: 批量更新药品医嘱状态为已签发count={}, result={}", medicineIds.size(), updateResult);
// 🔧 BugFix: 如果批量更新失败,尝试逐个更新
if (!updateResult) {
log.warn("BugFix: 批量更新药品医嘱状态失败,尝试逐个更新");
for (Long medicineId : medicineIds) {
try {
MedicationRequest updateReq = new MedicationRequest();
updateReq.setId(medicineId);
updateReq.setStatusEnum(RequestStatus.ACTIVE.getValue());
boolean singleResult = iMedicationRequestService.updateById(updateReq);
log.info("BugFix: 逐个更新药品医嘱状态id={}, result={}", medicineId, singleResult);
} catch (Exception e) {
log.error("BugFix: 逐个更新药品医嘱状态失败id={}", medicineId, e);
}
}
}
}
}
// 🔧 BugFix: 批量更新耗材请求状态为已签发(ACTIVE=2)
if (!requestIds.isEmpty() && !deviceList.isEmpty()) {
List<Long> deviceIds = deviceList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.map(AdviceSaveDto::getRequestId)
.collect(Collectors.toList());
if (!deviceIds.isEmpty()) {
log.info("BugFix: 准备批量更新耗材医嘱状态deviceIds={}", deviceIds);
UpdateWrapper<DeviceRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", deviceIds);
updateWrapper.set("status_enum", RequestStatus.ACTIVE.getValue());
boolean updateResult = iDeviceRequestService.update(null, updateWrapper);
log.info("BugFix: 批量更新耗材医嘱状态为已签发count={}, result={}", deviceIds.size(), updateResult);
// 🔧 BugFix: 如果批量更新失败,尝试逐个更新
if (!updateResult) {
log.warn("BugFix: 批量更新耗材医嘱状态失败,尝试逐个更新");
for (Long deviceId : deviceIds) {
try {
DeviceRequest updateReq = new DeviceRequest();
updateReq.setId(deviceId);
updateReq.setStatusEnum(RequestStatus.ACTIVE.getValue());
boolean singleResult = iDeviceRequestService.updateById(updateReq);
log.info("BugFix: 逐个更新耗材医嘱状态id={}, result={}", deviceId, singleResult);
} catch (Exception e) {
log.error("BugFix: 逐个更新耗材医嘱状态失败id={}", deviceId, e);
}
}
}
}
}
// 🔧 BugFix: 批量更新诊疗请求状态为已签发(ACTIVE=2)
if (!requestIds.isEmpty() && !activityList.isEmpty()) {
List<Long> activityIds = activityList.stream()
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
.map(AdviceSaveDto::getRequestId)
.collect(Collectors.toList());
if (!activityIds.isEmpty()) {
log.info("BugFix: 准备批量更新诊疗医嘱状态activityIds={}", activityIds);
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("id", activityIds);
updateWrapper.set("status_enum", RequestStatus.ACTIVE.getValue());
boolean updateResult = iServiceRequestService.update(null, updateWrapper);
log.info("BugFix: 批量更新诊疗医嘱状态为已签发count={}, result={}", activityIds.size(), updateResult);
// 🔧 BugFix: 如果批量更新失败,尝试逐个更新
if (!updateResult) {
log.warn("BugFix: 批量更新诊疗医嘱状态失败,尝试逐个更新");
for (Long activityId : activityIds) {
try {
ServiceRequest updateReq = new ServiceRequest();
updateReq.setId(activityId);
updateReq.setStatusEnum(RequestStatus.ACTIVE.getValue());
boolean singleResult = iServiceRequestService.updateById(updateReq);
log.info("BugFix: 逐个更新诊疗医嘱状态id={}, result={}", activityId, singleResult);
} catch (Exception e) {
log.error("BugFix: 逐个更新诊疗医嘱状态失败id={}", activityId, e);
}
}
}
}
}
// 就诊id // 就诊id
Long encounterId = adviceSaveList.get(0).getEncounterId(); Long encounterId = adviceSaveList.get(0).getEncounterId();
// 使用安全的更新方法,避免并发冲突 // 使用安全的更新方法,避免并发冲突 - 更新费用项状态
iChargeItemService.updateChargeStatusByConditionSafe( iChargeItemService.updateChargeStatusByConditionSafe(
encounterId, encounterId,
ChargeItemStatus.DRAFT.getValue(), ChargeItemStatus.DRAFT.getValue(),
@@ -734,11 +842,14 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项 // 声明费用项
ChargeItem chargeItem; ChargeItem chargeItem;
// 新增 + 修改 // 新增 + 修改
// 🔧 BugFix: 如果 requestId 不为空说明是已存在的医嘱,需要更新,即使 dbOpType 不匹配也应该包含进来
List<AdviceSaveDto> insertOrUpdateList = medicineList.stream() List<AdviceSaveDto> insertOrUpdateList = medicineList.stream()
.filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType()) .filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())
|| e.getRequestId() != null))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除 // 删除
// 🔧 BugFix: 如果 dbOpType 不匹配但 requestId 存在,仍然允许删除(增加健壮性)
List<AdviceSaveDto> deleteList = medicineList.stream() List<AdviceSaveDto> deleteList = medicineList.stream()
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList()); .filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
// 校验删除的医嘱是否已经收费 // 校验删除的医嘱是否已经收费
@@ -1151,9 +1262,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项 // 声明费用项
ChargeItem chargeItem; ChargeItem chargeItem;
// 新增 + 修改 // 新增 + 修改
// 🔧 BugFix: 如果 requestId 不为空说明是已存在的医嘱,需要更新,即使 dbOpType 不匹配也应该包含进来
List<AdviceSaveDto> insertOrUpdateList = deviceList.stream() List<AdviceSaveDto> insertOrUpdateList = deviceList.stream()
.filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType()) .filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())
|| e.getRequestId() != null))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除 // 删除
List<AdviceSaveDto> deleteList = deviceList.stream() List<AdviceSaveDto> deleteList = deviceList.stream()
@@ -1439,9 +1552,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 声明费用项 // 声明费用项
ChargeItem chargeItem; ChargeItem chargeItem;
// 新增 + 修改 // 新增 + 修改
// 🔧 BugFix: 如果 requestId 不为空说明是已存在的医嘱,需要更新,即使 dbOpType 不匹配也应该包含进来
List<AdviceSaveDto> insertOrUpdateList = activityList.stream() List<AdviceSaveDto> insertOrUpdateList = activityList.stream()
.filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType()) .filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())
|| e.getRequestId() != null))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除 // 删除
List<AdviceSaveDto> deleteList = activityList.stream() List<AdviceSaveDto> deleteList = activityList.stream()

View File

@@ -778,10 +778,10 @@ public class CommonConstants {
Integer BOOKED = 1; Integer BOOKED = 1;
/** 已取消 / 已停诊 */ /** 已取消 / 已停诊 */
Integer CANCELLED = 2; Integer CANCELLED = 2;
/** 已锁定 */
Integer LOCKED = 3;
/** 已签到 / 已取号 */ /** 已签到 / 已取号 */
Integer CHECKED_IN = 4; Integer CHECKED_IN = 3;
/** 已锁定 */
Integer LOCKED = 4;
/** 已退号 */ /** 已退号 */
Integer RETURNED = 5; Integer RETURNED = 5;
} }

View File

@@ -23,15 +23,15 @@ import java.util.Date;
public class ScheduleSlot extends HisBaseEntity { public class ScheduleSlot extends HisBaseEntity {
/** 明细主键 */ /** 明细主键 */
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Long id;
/** 号源池ID */ /** 号源池ID */
private Integer poolId; private Long poolId;
/** 序号 */ /** 序号 */
private Integer seqNo; private Integer seqNo;
/** 序号状态: 0-可用,1-已预约,2-已取消/已停诊,3-已锁定,4-已签到,5-已退号 */ /** 序号状态: 0-可用,1-已预约,2-已取消/已停诊,3-已签到,4-已锁定,5-已退号 */
private Integer status; private Integer status;
/** 预约订单ID */ /** 预约订单ID */

View File

@@ -53,5 +53,5 @@ public interface SchedulePoolMapper extends BaseMapper<SchedulePool> {
AND locked_num > 0 AND locked_num > 0
AND delete_flag = '0' AND delete_flag = '0'
""") """)
int updatePoolStatsOnCheckIn(@Param("poolId") Integer poolId); int updatePoolStatsOnCheckIn(@Param("poolId") Long poolId);
} }

View File

@@ -10,8 +10,8 @@
WHEN LOWER(CONCAT('', s.status)) IN ('0', 'unbooked', 'available') THEN 0 WHEN LOWER(CONCAT('', s.status)) IN ('0', 'unbooked', 'available') THEN 0
WHEN LOWER(CONCAT('', s.status)) IN ('1', 'booked') THEN 1 WHEN LOWER(CONCAT('', s.status)) IN ('1', 'booked') THEN 1
WHEN LOWER(CONCAT('', s.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2 WHEN LOWER(CONCAT('', s.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2
WHEN LOWER(CONCAT('', s.status)) IN ('3', 'locked') THEN 3 WHEN LOWER(CONCAT('', s.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3
WHEN LOWER(CONCAT('', s.status)) IN ('4', 'checked', 'checked_in', 'checkin') THEN 4 WHEN LOWER(CONCAT('', s.status)) IN ('4', 'locked') THEN 4
WHEN LOWER(CONCAT('', s.status)) IN ('5', 'returned') THEN 5 WHEN LOWER(CONCAT('', s.status)) IN ('5', 'returned') THEN 5
ELSE NULL ELSE NULL
END END
@@ -32,8 +32,8 @@
WHEN LOWER(CONCAT('', p.status)) IN ('0', 'unbooked', 'available') THEN 0 WHEN LOWER(CONCAT('', p.status)) IN ('0', 'unbooked', 'available') THEN 0
WHEN LOWER(CONCAT('', p.status)) IN ('1', 'booked') THEN 1 WHEN LOWER(CONCAT('', p.status)) IN ('1', 'booked') THEN 1
WHEN LOWER(CONCAT('', p.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2 WHEN LOWER(CONCAT('', p.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2
WHEN LOWER(CONCAT('', p.status)) IN ('3', 'locked') THEN 3 WHEN LOWER(CONCAT('', p.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3
WHEN LOWER(CONCAT('', p.status)) IN ('4', 'checked', 'checked_in', 'checkin') THEN 4 WHEN LOWER(CONCAT('', p.status)) IN ('4', 'locked') THEN 4
WHEN LOWER(CONCAT('', p.status)) IN ('5', 'returned') THEN 5 WHEN LOWER(CONCAT('', p.status)) IN ('5', 'returned') THEN 5
ELSE NULL ELSE NULL
END END
@@ -86,7 +86,8 @@
ORDER BY ORDER BY
p.schedule_date, p.schedule_date,
p.doctor_id, p.doctor_id,
s.expect_time s.expect_time,
s.seq_no ASC
</select> </select>
<select id="selectTicketSlotById" resultType="com.openhis.appointmentmanage.domain.TicketSlotDTO"> <select id="selectTicketSlotById" resultType="com.openhis.appointmentmanage.domain.TicketSlotDTO">
@@ -319,7 +320,7 @@
</when> </when>
<when test="'checked'.equals(query.status) or '已取号'.equals(query.status)"> <when test="'checked'.equals(query.status) or '已取号'.equals(query.status)">
AND ( AND (
<include refid="slotStatusNormExpr" /> = 4 <include refid="slotStatusNormExpr" /> = 3
OR ( OR (
<include refid="slotStatusNormExpr" /> = 1 <include refid="slotStatusNormExpr" /> = 1
AND <include refid="orderStatusNormExpr" /> = 2 AND <include refid="orderStatusNormExpr" /> = 2
@@ -350,7 +351,8 @@
</where> </where>
ORDER BY ORDER BY
p.schedule_date DESC, p.schedule_date DESC,
s.expect_time ASC s.expect_time ASC,
s.seq_no ASC
</select> </select>
<select id="selectDoctorAvailabilitySummary" resultType="com.openhis.appointmentmanage.domain.DoctorAvailabilityDTO"> <select id="selectDoctorAvailabilitySummary" resultType="com.openhis.appointmentmanage.domain.DoctorAvailabilityDTO">

View File

@@ -174,10 +174,10 @@ export const SlotStatus = {
BOOKED: 1, BOOKED: 1,
/** 已取消 / 已停诊 */ /** 已取消 / 已停诊 */
CANCELLED: 2, CANCELLED: 2,
/** 已锁定 */
LOCKED: 3,
/** 已签到 / 已取号 */ /** 已签到 / 已取号 */
CHECKED_IN: 4, CHECKED_IN: 3,
/** 已锁定 */
LOCKED: 4,
}; };
/** /**
@@ -187,8 +187,8 @@ export const SlotStatusDescriptions = {
0: '未预约', 0: '未预约',
1: '已预约', 1: '已预约',
2: '已停诊', 2: '已停诊',
3: '已锁定', 3: '已取号',
4: '已取号', 4: '已锁定',
}; };
/** /**

View File

@@ -325,8 +325,10 @@ export function singOut(data) {
* 获取患者本次就诊处方 * 获取患者本次就诊处方
*/ */
export function getPrescriptionList(encounterId) { export function getPrescriptionList(encounterId) {
// 添加时间戳参数防止浏览器缓存,确保签发后总能获取到最新数据
const timestamp = Date.now();
return request({ return request({
url: '/doctor-station/advice/request-base-info?encounterId=' + encounterId, url: '/doctor-station/advice/request-base-info?encounterId=' + encounterId + '&t=' + timestamp,
method: 'get', method: 'get',
}); });
} }

View File

@@ -1010,6 +1010,13 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
if (type === 2 && adviceTableName === 'adm_device_definition') { if (type === 2 && adviceTableName === 'adm_device_definition') {
return '耗材'; return '耗材';
} }
// 🔧 Bug Fix: 处理检查类型(adviceType=23)
// 检查类型属于诊疗类,应该显示为"检查"
if (type === 23) {
return '检查';
}
const found = adviceTypeList.value.find((item) => item.value === type); const found = adviceTypeList.value.find((item) => item.value === type);
return found ? found.label : ''; return found ? found.label : '';
}; };
@@ -2559,9 +2566,25 @@ function handleSave(prescriptionId) {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('签发成功'); proxy.$modal.msgSuccess('签发成功');
isSaving.value = false; isSaving.value = false;
// 🔧 Bug Fix: 签发成功后立即更新本地医嘱状态,确保用户看到的状态是正确的
// 遍历签发的医嘱列表,更新本地状态
saveList.forEach((item) => {
// 在当前列表中找到对应的医嘱
const index = prescriptionList.value.findIndex(p => p.uniqueKey === item.uniqueKey);
if (index !== -1) {
// 更新状态:从待签发(1)改为已签发(2)
prescriptionList.value[index].statusEnum = 2;
// 更新保存状态
prescriptionList.value[index].isSaved = true;
console.log('BugFix: 更新本地医嘱状态adviceName=', item.adviceName, 'statusEnum=', 2);
}
});
// 刷新列表数据(从后端获取最新状态)
getListInfo(false); getListInfo(false);
bindMethod.value = {}; bindMethod.value = {};
nextId.value == 1; nextId.value = 1;
} else { } else {
proxy.$modal.msgError(res.message); proxy.$modal.msgError(res.message);
isSaving.value = false; isSaving.value = false;