zhoutg 3 vuotta sitten
vanhempi
commit
42a087a852

+ 5 - 0
src/main/java/com/diagbot/dto/DefaultExportDTO.java

@@ -34,10 +34,15 @@ public class DefaultExportDTO implements Serializable {
     private String libName;
     // baseConcept
     private Long baseConcept;
+    // baseType
+    private Integer baseType;
+
     @Excel(name="术语名称", width = 25, orderNum = "30")
     private String baseName = "";
     @Excel(name="术语类型", width = 17, orderNum = "35")
     private String baseTypeCn;
+    @Excel(name="术语子元素", width = 35, orderNum = "38")
+    private String sonName;
     @Excel(name="匹配条件", width = 17, orderNum = "40")
     private String tabooType;
     @Excel(name="最小值", width = 10, orderNum = "60")

+ 18 - 0
src/main/java/com/diagbot/dto/GatherDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2021/6/7 10:27
+ */
+@Data
+public class GatherDTO {
+    // 集合标准名
+    private String parName;
+    // 集合类型
+    private String parLibType;
+    // 元素标准名
+    private String sonName;
+}

+ 33 - 0
src/main/java/com/diagbot/dto/IndicationNewExportDTO.java

@@ -0,0 +1,33 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description: 开单导出
+ * @author: zhoutg
+ * @date: 2021/8/2 13:40
+ */
+@Data
+public class IndicationNewExportDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Excel(needMerge = true, name="规则名称", width = 25, orderNum = "10")
+    private String ruleGroup = "";
+    @Excel(needMerge = true, name="开单名称", width = 25, orderNum = "11")
+    private String libName;
+    @Excel(needMerge = true, name="开单类型", width = 17, orderNum = "12")
+    private String libTypeCn;
+    @Excel(needMerge = true, name="开单子名称", width = 25, orderNum = "13")
+    private String sonLibName;
+    @ExcelCollection(name="组内明细", orderNum = "20")
+    private List<DefaultExportDTO> defaultExportDTOList= new ArrayList<>();
+    @Excel(needMerge = true, name="提示语", width = 25, orderNum = "30")
+    private String msg;
+}

+ 14 - 0
src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -1,6 +1,7 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.KllisDetailDTO;
@@ -10,6 +11,7 @@ import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.entity.KlOperation;
 import com.diagbot.entity.TcmDisease;
 import com.diagbot.entity.TcmSyndrome;
+import com.diagbot.enums.CommonEnum;
 import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
@@ -17,10 +19,12 @@ import com.diagbot.enums.MatchSourceEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.service.impl.KlConceptServiceImpl;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExtUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.GatherVO;
 import com.diagbot.vo.IndexByApprovalVO;
 import com.diagbot.vo.KllisDetailVO;
 import com.diagbot.vo.SearchCollectionConceptVO;
@@ -33,6 +37,7 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -528,4 +533,13 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         List<GetAllForRelationDTO> getAllForRelationDTOS = this.searchCollectionConcept(searchCollectionConceptVO);
         return getAllForRelationDTOS;
     }
+
+    public Map<String, List<GatherDTO>> getGatherFac(GatherVO gatherVO) {
+        if (gatherVO == null || ListUtil.isEmpty(gatherVO.getGatherNameList())) {
+            return new LinkedHashMap<>();
+        }
+        List<GatherDTO> gatherList = getGather(gatherVO);
+        Map<String, List<GatherDTO>> map = ExtUtil.getMultiKeyList(gatherList, CommonEnum.splitSymbol.getName(), "parName", "parLibType");
+        return map;
+    }
 }

+ 59 - 8
src/main/java/com/diagbot/facade/KlRuleFacade.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.DefaultExportDTO;
+import com.diagbot.dto.GatherDTO;
+import com.diagbot.dto.IndicationNewExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleByIdParDTO;
 import com.diagbot.dto.KlRuleByIdSubDTO;
@@ -24,6 +26,7 @@ import com.diagbot.util.ExtUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ExportDafaultVO;
+import com.diagbot.vo.GatherVO;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoClearVO;
 import com.diagbot.vo.KlRuleInfoSaveSubVO;
@@ -31,6 +34,7 @@ import com.diagbot.vo.KlRuleInfoSaveVO;
 import com.diagbot.vo.KlRuleInfoVO;
 import com.diagbot.vo.KlRuleSatartOrdisaVO;
 import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -39,6 +43,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -51,6 +56,8 @@ public class KlRuleFacade extends KlRuleServiceImpl {
     KlRuleConditionFacade klRuleConditionFacade;
     @Autowired
     KlRuleBaseFacade klRuleBaseFacade;
+    @Autowired
+    KlConceptFacade klConceptFacade;
 
     /**
      * @param klRuleInfoVO
@@ -252,25 +259,69 @@ public class KlRuleFacade extends KlRuleServiceImpl {
      * @return
      */
     public void exportIndicationFac(HttpServletResponse response) {
-        // List<IndicationExportDTO> indicationExportDTOS = exportIndication();
         ExportDafaultVO exportDafaultVO = new ExportDafaultVO();
         exportDafaultVO.setRuleType(1);
-        List<OtherExportDTO> otherExportDTOList = Lists.newArrayList();
+        List<IndicationNewExportDTO> res = Lists.newArrayList();
         List<DefaultExportDTO> defaultExportDTOS = exportOther(exportDafaultVO);
+        GatherVO gatherVO = new GatherVO();
+        List<String> gatherNameList = Lists.newArrayList();
+        for (DefaultExportDTO defaultExportDTO : defaultExportDTOS) {
+            // 开单名称集合
+            if (isGatherType(defaultExportDTO.getLibType())) {
+                gatherNameList.add(defaultExportDTO.getLibName() + CommonEnum.splitSymbol.getName() + defaultExportDTO.getLibType());
+            }
+            // 规则集合
+            if (isGatherType(defaultExportDTO.getBaseType())) {
+                gatherNameList.add(defaultExportDTO.getBaseName() + CommonEnum.splitSymbol.getName() + defaultExportDTO.getBaseType());
+            }
+        }
+        gatherVO.setGatherNameList(gatherNameList);
+        Map<String, List<GatherDTO>> gatherMap = klConceptFacade.getGatherFac(gatherVO);
         Map<String, List<DefaultExportDTO>> multiKeyList = ExtUtil.getMultiKeyList(defaultExportDTOS, CommonEnum.splitSymbol.getName(), "ruleId", "groupType");
         for (String key : multiKeyList.keySet()) {
             List<DefaultExportDTO> defaultList = multiKeyList.get(key);
+            for (DefaultExportDTO defaultExportDTO : defaultList) {
+                // 集合类型对集合元素赋值
+                if (isGatherType(defaultExportDTO.getBaseType())) {
+                    List<GatherDTO> gatherDTOS = gatherMap.get(defaultExportDTO.getBaseName() + CommonEnum.splitSymbol.getName() + defaultExportDTO.getBaseType());
+                    List<String> sonNameList = gatherDTOS.stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                    // 子元素赋值
+                    defaultExportDTO.setSonName(StringUtils.join(sonNameList, CommonEnum.splitSymbol.getName()));
+                }
+            }
             DefaultExportDTO defaultExportDTO = defaultList.get(0);
-            OtherExportDTO otherExportDTO = new OtherExportDTO();
-            otherExportDTO.setRuleGroup(defaultExportDTO.getRuleGroup());
-            otherExportDTO.setMsg(defaultExportDTO.getMsg());
-            otherExportDTO.setDefaultExportDTOList(defaultList);
-            otherExportDTOList.add(otherExportDTO);
+            IndicationNewExportDTO indicationNewExportDTO = new IndicationNewExportDTO();
+            indicationNewExportDTO.setRuleGroup(defaultExportDTO.getRuleGroup());
+            indicationNewExportDTO.setLibName(defaultExportDTO.getLibName());
+            indicationNewExportDTO.setLibTypeCn(defaultExportDTO.getLibTypeCn());
+            indicationNewExportDTO.setMsg(defaultExportDTO.getMsg());
+            indicationNewExportDTO.setDefaultExportDTOList(defaultList);
+            // 集合类型对集合元素赋值
+            if (isGatherType(defaultExportDTO.getLibType())) {
+                List<GatherDTO> gatherDTOS = gatherMap.get(defaultExportDTO.getLibName() + CommonEnum.splitSymbol.getName() + defaultExportDTO.getLibType());
+                List<String> sonNameList = gatherDTOS.stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                // 子元素赋值
+                indicationNewExportDTO.setSonLibName(StringUtils.join(sonNameList, CommonEnum.splitSymbol.getName()));
+            }
+            res.add(indicationNewExportDTO);
         }
-        ExcelUtils.exportExcel(otherExportDTOList, null, "开单合理性", OtherExportDTO.class, "indication.xlsx",
+        ExcelUtils.exportExcel(res, null, "开单合理性", IndicationNewExportDTO.class, "indication.xlsx",
                 response, 12.8f);
     }
 
+    /**
+     * 是否集合类型
+     *
+     * @param type
+     * @return
+     */
+    public Boolean isGatherType(Integer type) {
+        if (type != null && type >= 308 && type <= 329) {
+            return true;
+        }
+        return false;
+    }
+
     /**
      * 其他值提醒化验导出
      *

+ 3 - 0
src/main/java/com/diagbot/mapper/KlConceptMapper.java

@@ -1,6 +1,7 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
@@ -34,4 +35,6 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
     List<GetAllForRelationDTO> searchByTypeAndNameAdd(SearchConceptVO searchConceptVO);
 
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
+
+    List<GatherDTO> getGather(GatherVO gatherVO);
 }

+ 9 - 1
src/main/java/com/diagbot/service/KlConceptService.java

@@ -1,13 +1,20 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.entity.KlConcept;
-import com.diagbot.vo.*;
+import com.diagbot.vo.GatherVO;
+import com.diagbot.vo.IndexByApprovalVO;
+import com.diagbot.vo.KllisDetailVO;
+import com.diagbot.vo.MedRetrievalVO;
+import com.diagbot.vo.SearchCollectionConceptVO;
+import com.diagbot.vo.SearchConceptVO;
+import com.diagbot.vo.StaticKnowledgeIndexVO;
 
 import java.util.List;
 
@@ -38,4 +45,5 @@ public interface KlConceptService extends IService<KlConcept> {
     //查找(集合模块术语)
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
 
+    List<GatherDTO> getGather(GatherVO gatherVO);
 }

+ 6 - 0
src/main/java/com/diagbot/service/impl/KlConceptServiceImpl.java

@@ -2,6 +2,7 @@ package com.diagbot.service.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
@@ -62,4 +63,9 @@ public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept
         return baseMapper.searchCollectionConcept(searchCollectionConceptVO);
     }
 
+    @Override
+    public List<GatherDTO> getGather(GatherVO gatherVO) {
+        return baseMapper.getGather(gatherVO);
+    }
+
 }

+ 19 - 0
src/main/java/com/diagbot/vo/GatherVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2020-03-13 16:11
+ */
+@Setter
+@Getter
+public class GatherVO {
+
+    // 集合列表
+    private List<String> gatherNameList;
+}

+ 25 - 0
src/main/resources/mapper/KlConceptMapper.xml

@@ -979,4 +979,29 @@
         t1.approval-->
     </select>
 
+    <select id="getGather" resultType="com.diagbot.dto.GatherDTO">
+        SELECT
+            a.lib_name par_name,
+            a.lib_type par_lib_type,
+            c.lib_name son_name
+        FROM
+            `kl_concept` a,
+            kl_relation b,
+            kl_concept c
+        WHERE
+            a.is_deleted = 'N'
+          AND b.is_deleted = 'N'
+          AND c.is_deleted = 'N'
+          AND a.`status` = 1
+          AND c.`status` = 1
+          AND a.id = b.start_id
+          AND b.end_id = c.id
+          AND b.relation_id = 600
+          AND CONCAT(a.lib_name, '#', a.lib_type) IN
+          <foreach collection="gatherNameList" item="item" open="(" close=")" separator=",">
+                #{item}
+          </foreach>
+    </select>
+
+
 </mapper>

+ 1 - 0
src/main/resources/mapper/KlRuleMapper.xml

@@ -315,6 +315,7 @@
             b.msg,
             c.concept_id base_concept,
             d.lib_name baseName,
+            d.lib_type baseType,
             e. NAME baseTypeCn,
             CASE
                 WHEN c.type = '1' THEN