fix(doctorstation): 解决医嘱管理中的状态控制和数据处理问题
- 修复了已收费医嘱仍可被勾选的问题,添加了选择条件限制 - 实现了过滤已作废会诊医嘱的功能,防止无效数据展示 - 完善了医嘱删除逻辑,支持草稿、待签发和已作废状态的医嘱删除 - 修复了医嘱撤回功能中的大整数精度丢失问题 - 优化了签退医嘱的服务端处理逻辑,统一处理各种类型的医嘱作废 - 添加了详细的操作日志记录便于问题排查 - 修复了前端医嘱列表加载和操作过程中的数据类型转换问题
This commit is contained in:
@@ -1397,48 +1397,38 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> signOffAdvice(List<Long> requestIdList) {
|
||||
// 根据请求编号列表查询收费项目信息
|
||||
log.info("BugFix#219: signOffAdvice - requestIdList={}", requestIdList);
|
||||
|
||||
// 🔧 BugFix: 直接对所有requestId进行作废操作,不再先查询分类
|
||||
// 药品、耗材、诊疗请求都尝试作废,只有存在的才会被更新
|
||||
|
||||
// 根据请求编号列表查询收费项目信息(用于检查是否已收费)
|
||||
List<ChargeItem> chargeItemList = iChargeItemService.getChargeItemInfoByReqId(requestIdList);
|
||||
|
||||
|
||||
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
||||
for (ChargeItem chargeItem : chargeItemList) {
|
||||
if (ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum())) {
|
||||
throw new ServiceException("已收费的项目无法签退,请刷新页面后重试");
|
||||
}
|
||||
}
|
||||
// 分别获取各个请求id列表
|
||||
List<Long> medReqIdList = new ArrayList<>();
|
||||
List<Long> devReqIdList = new ArrayList<>();
|
||||
List<Long> serReqIdList = new ArrayList<>();
|
||||
|
||||
chargeItemList.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
|
||||
medReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST ->
|
||||
devReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_SERVICE_REQUEST ->
|
||||
serReqIdList.add(item.getServiceId());
|
||||
}
|
||||
});
|
||||
|
||||
List<Long> chargeItemIdList = chargeItemList.stream().map(ChargeItem::getId).collect(Collectors.toList());
|
||||
// 根据id更新收费项目状态
|
||||
iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue());// 撤回后需要更新为草稿
|
||||
if (!medReqIdList.isEmpty()) {
|
||||
// 根据请求id更新请求状态
|
||||
iMedicationRequestService.updateDraftStatusBatch(medReqIdList, null, null);
|
||||
}
|
||||
if (!devReqIdList.isEmpty()) {
|
||||
// 根据请求id更新请求状态
|
||||
iDeviceRequestService.updateDraftStatusBatch(devReqIdList);
|
||||
}
|
||||
if (!serReqIdList.isEmpty()) {
|
||||
// 根据请求id更新请求状态
|
||||
iServiceRequestService.updateDraftStatusBatch(serReqIdList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
||||
iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue());
|
||||
}
|
||||
|
||||
// 🔧 BugFix: 直接对所有requestId进行作废操作
|
||||
log.info("BugFix#219: signOffAdvice - 作废所有请求, requestIdList={}", requestIdList);
|
||||
|
||||
// 尝试作废药品请求(只有存在的才会更新)
|
||||
iMedicationRequestService.updateCancelledStatusBatch(requestIdList, null, null);
|
||||
// 尝试作废耗材请求(只有存在的才会更新)
|
||||
iDeviceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||
// 尝试作废诊疗请求(只有存在的才会更新)
|
||||
iServiceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||
|
||||
log.info("BugFix#219: signOffAdvice - 所有请求作废完成");
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 医生站-医嘱/处方 controller
|
||||
@@ -91,12 +92,16 @@ public class DoctorStationAdviceController {
|
||||
/**
|
||||
* 门诊签退医嘱
|
||||
*
|
||||
* @param requestIdList 请求id列表
|
||||
* @param requestIdList 请求id列表(字符串类型,避免前端大整数精度丢失)
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/sign-off")
|
||||
public R<?> signOffAdvice(@RequestBody List<Long> requestIdList) {
|
||||
return iDoctorStationAdviceAppService.signOffAdvice(requestIdList);
|
||||
public R<?> signOffAdvice(@RequestBody List<String> requestIdList) {
|
||||
// 🔧 BugFix: 将字符串转换为Long
|
||||
List<Long> ids = requestIdList.stream()
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
return iDoctorStationAdviceAppService.signOffAdvice(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user