From 289ee73111664013d86e011d0be6a7a22017a994 Mon Sep 17 00:00:00 2001 From: liu Date: Fri, 5 Jan 2024 10:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E6=A0=BC=E6=A3=80=E6=9F=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PhysicalLocationManageController.java | 10 +++++ .../config/PhysicalToolManageController.java | 2 + .../PhysicalLocationManageService.java | 2 + .../PhysicalLocationManageServiceImpl.java | 39 ++++++++++++++++++- .../vo/manage/PhysicalLocationNode.java | 4 ++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalLocationManageController.java b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalLocationManageController.java index 2f2b6d84..8f4406a4 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalLocationManageController.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalLocationManageController.java @@ -4,6 +4,7 @@ package com.supervision.manage.controller.config; import com.supervision.manage.service.PhysicalLocationManageService; import com.supervision.vo.manage.PhysicalLocationNode; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; @@ -26,4 +27,13 @@ public class PhysicalLocationManageController { return physicalLocationManageService.queryTree(); } + + @ApiModelProperty("查询体格检查身体部位配置树(支持已配置部位)") + @GetMapping("queryLocationTreeForPhysicalConfig") + public List queryLocationTreeForPhysicalConfig(String physicalId) { + return physicalLocationManageService.queryLocationTreeForPhysicalConfig(physicalId); + } + + + } diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalToolManageController.java b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalToolManageController.java index 0410410a..52b81bf0 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalToolManageController.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/config/PhysicalToolManageController.java @@ -41,6 +41,8 @@ public class PhysicalToolManageController { return physicalToolManageService.queryConfigPhysicalToolDetail(id); } + + @ApiOperation("保存体格工具") @PostMapping("saveConfigPhysicalTool") public void saveConfigPhysicalTool(@RequestBody PhysicalToolVO physicalToolVO) { diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/service/PhysicalLocationManageService.java b/virtual-patient-manage/src/main/java/com/supervision/manage/service/PhysicalLocationManageService.java index 3c2a8d3b..7f654981 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/service/PhysicalLocationManageService.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/service/PhysicalLocationManageService.java @@ -9,4 +9,6 @@ public interface PhysicalLocationManageService { List queryTree(); + List queryLocationTreeForPhysicalConfig(String physicalId); + } diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/PhysicalLocationManageServiceImpl.java b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/PhysicalLocationManageServiceImpl.java index e719cc52..a44bd0e1 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/PhysicalLocationManageServiceImpl.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/PhysicalLocationManageServiceImpl.java @@ -3,10 +3,15 @@ package com.supervision.manage.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.CoordinateUtil; import cn.hutool.core.util.StrUtil; import com.supervision.manage.service.PhysicalLocationManageService; import com.supervision.model.ConfigPhysicalLocation; +import com.supervision.model.ConfigPhysicalTool; +import com.supervision.model.DefaultPhysicalIndicator; import com.supervision.service.ConfigPhysicalLocationService; +import com.supervision.service.ConfigPhysicalToolService; +import com.supervision.service.DefaultPhysicalIndicatorService; import com.supervision.vo.manage.PhysicalLocationNode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -20,6 +25,9 @@ import java.util.stream.Collectors; public class PhysicalLocationManageServiceImpl implements PhysicalLocationManageService { private final ConfigPhysicalLocationService configPhysicalLocationService; + + private final DefaultPhysicalIndicatorService defaultPhysicalIndicatorService; + @Override public List queryTree() { @@ -30,7 +38,7 @@ public class PhysicalLocationManageServiceImpl implements PhysicalLocationManage Map map = list.stream().collect( Collectors.toMap(ConfigPhysicalLocation::getId, p -> BeanUtil.toBean(p, PhysicalLocationNode.class))); - + // 这里只支持2层 for (Map.Entry entry : map.entrySet()) { PhysicalLocationNode value = entry.getValue(); if (StrUtil.isNotEmpty(value.getParentId())) { @@ -48,4 +56,33 @@ public class PhysicalLocationManageServiceImpl implements PhysicalLocationManage return map.values().stream().filter(n -> StrUtil.isEmpty(n.getParentId())).collect(Collectors.toList()); } + + @Override + public List queryLocationTreeForPhysicalConfig(String physicalId) { + // 首先构建位置树 + List physicalLocationNodes = queryTree(); + // 查询体格检查项目已经配置的部位 + if (StrUtil.isNotEmpty(physicalId)) { + List defaultPhysicalIndicatorList = defaultPhysicalIndicatorService.lambdaQuery().eq(DefaultPhysicalIndicator::getItemId, physicalId).list(); + if (CollUtil.isNotEmpty(defaultPhysicalIndicatorList)) { + Set itemIdSet = defaultPhysicalIndicatorList.stream().map(DefaultPhysicalIndicator::getLocationId).collect(Collectors.toSet()); + if (CollUtil.isNotEmpty(itemIdSet)) { + // 现在只有2层,遍历2次就可以了 + for (PhysicalLocationNode physicalLocationNode : physicalLocationNodes) { + if (itemIdSet.contains(physicalLocationNode.getId())) { + physicalLocationNode.setChoose(1); + } + if (CollUtil.isNotEmpty(physicalLocationNode.getChild())) { + for (PhysicalLocationNode child : physicalLocationNode.getChild()) { + if (itemIdSet.contains(child.getId())) { + child.setChoose(1); + } + } + } + } + } + } + } + return physicalLocationNodes; + } } diff --git a/virtual-patient-model/src/main/java/com/supervision/vo/manage/PhysicalLocationNode.java b/virtual-patient-model/src/main/java/com/supervision/vo/manage/PhysicalLocationNode.java index 2b9d64eb..16b7321c 100644 --- a/virtual-patient-model/src/main/java/com/supervision/vo/manage/PhysicalLocationNode.java +++ b/virtual-patient-model/src/main/java/com/supervision/vo/manage/PhysicalLocationNode.java @@ -1,6 +1,7 @@ package com.supervision.vo.manage; import com.supervision.model.ConfigPhysicalLocation; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -12,4 +13,7 @@ public class PhysicalLocationNode extends ConfigPhysicalLocation{ private List child; + @ApiModelProperty("是否被选中,1已被选中") + private Integer choose = 0; + }