From ef4a3fc96bb50d87ffa7ddcb8a9a8555b3e21324 Mon Sep 17 00:00:00 2001 From: liu Date: Thu, 21 Dec 2023 10:14:26 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=E4=BF=AE=E5=A4=8D=E4=BD=93=E6=B8=A9?= =?UTF-8?q?=E8=AE=A1=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=B0=E7=BB=93=E6=9E=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AskPhysicalServiceImpl.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java index 8efe98c4..a0ce7d34 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java @@ -54,27 +54,26 @@ public class AskPhysicalServiceImpl implements AskPhysicalService { ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("工具不支持")); // 是否需要具体的部位,0否1是 ConfigPhysicalLocation location = new ConfigPhysicalLocation(); - DiseasePhysical result = new DiseasePhysical(); - if (1 == tool.getRequireLocation() && StrUtil.isBlank(reqVO.getLocationCode())) { - throw new BusinessException("请选择对应的位置"); - } if (1 == tool.getRequireLocation()) { - location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1") - .oneOpt().orElseGet(ConfigPhysicalLocation::new); - } - if (1 == tool.getRequireLocation() && StrUtil.isEmpty(location.getId())) { - result.setResult("无相关资讯"); - } else { - result = diseasePhysicalService.lambdaQuery().eq(DiseasePhysical::getDiseaseId, process.getMedicalRecId()) - .eq(DiseasePhysical::getToolId, tool.getId()).eq(StrUtil.isNotBlank(location.getId()), DiseasePhysical::getLocationId, location.getId()).last("limit 1") - .oneOpt() - .orElseGet(() -> { - DiseasePhysical diseasePhysical = new DiseasePhysical(); - diseasePhysical.setResult("无相关资讯"); - return diseasePhysical; - }); + if (StrUtil.isBlank(reqVO.getLocationCode())) { + throw new BusinessException("请选择对应的位置"); + } else { + location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1") + .oneOpt().orElseGet(ConfigPhysicalLocation::new); + } } + DiseasePhysical result = diseasePhysicalService.lambdaQuery().eq(DiseasePhysical::getDiseaseId, process.getDiseaseId()) + .eq(DiseasePhysical::getToolId, tool.getId()) + .eq(StrUtil.isNotBlank(location.getId()), DiseasePhysical::getLocationId, location.getId()).last("limit 1") + .oneOpt() + .orElseGet(() -> { + DiseasePhysical diseasePhysical = new DiseasePhysical(); + diseasePhysical.setResult("无相关资讯"); + return diseasePhysical; + }); + + // 检查记录保存到数据库中 DiagnosisPhysicalRecord diagnosisPhysicalRecord = new DiagnosisPhysicalRecord(); diagnosisPhysicalRecord.setProcessId(process.getId()); @@ -87,7 +86,7 @@ public class AskPhysicalServiceImpl implements AskPhysicalService { diagnosisPhysicalRecord.insert(); // 保存初步诊断 - if (CollUtil.isNotEmpty(reqVO.getPrimaryIdList())){ + if (CollUtil.isNotEmpty(reqVO.getPrimaryIdList())) { for (String primaryId : reqVO.getPrimaryIdList()) { DiagnosisPrimaryRelation diagnosisPrimaryRelation = new DiagnosisPrimaryRelation(); diagnosisPrimaryRelation.setProcessId(process.getId());