Ver código fonte

术语匹配出参加编码

wangfeng 4 anos atrás
pai
commit
b467213662

+ 1 - 0
src/main/java/com/diagbot/dto/TermConceptDTO.java

@@ -13,6 +13,7 @@ import lombok.Setter;
 public class TermConceptDTO {
     private Long id;
     private String name;
+    private String code;
     //数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
     private Integer source;
 }

+ 5 - 0
src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java

@@ -1,6 +1,10 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.TermConceptDTO;
+import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.service.impl.KlLibraryInfoServiceImpl;
+import com.diagbot.vo.TermMatchingVO;
 import org.springframework.stereotype.Component;
 
 /**
@@ -10,4 +14,5 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class KlLibraryInfoFacade extends KlLibraryInfoServiceImpl {
+
 }

+ 16 - 10
src/main/java/com/diagbot/facade/TermMatchingFacade.java

@@ -10,9 +10,11 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.StandConvertCrfEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.StandConvertCrfVO;
+import com.diagbot.vo.TermMatchingListVO;
 import com.diagbot.vo.TermMatchingVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -36,17 +38,17 @@ public class TermMatchingFacade {
     public List<TermConceptDTO> getTermMatchingAll(TermMatchingVO termMatchingVO) {
         List<TermConceptDTO> list = new ArrayList<>();
         Integer type = convertType(termMatchingVO.getType());
+        TermMatchingVO termMatchingVONew = new TermMatchingVO();
+        BeanUtil.copyProperties(termMatchingVO, termMatchingVONew);
+        termMatchingVONew.setType(type);
         if (type != null) {
-            QueryWrapper<KlLibraryInfo> klLibraryInfo = new QueryWrapper<>();
-            klLibraryInfo.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("type_id", type)
-                    .eq("name", termMatchingVO.getInputStr());
-            KlLibraryInfo libraryInfo = klLibraryInfoFacade.getOne(klLibraryInfo, false);
+            TermConceptDTO libraryInfo = klLibraryInfoFacade.getConcept(termMatchingVONew);
             if (null != libraryInfo) {
                 TermConceptDTO termConceptDTO = new TermConceptDTO();
-                termConceptDTO.setId(libraryInfo.getConceptId());
+                termConceptDTO.setId(libraryInfo.getId());
                 termConceptDTO.setName(libraryInfo.getName());
-                termConceptDTO.setSource(libraryInfo.getIsConcept() == 1 ? 1 : 2);
+                termConceptDTO.setSource(libraryInfo.getSource() == 1 ? 1 : 2);
+                termConceptDTO.setCode(libraryInfo.getCode());
                 list.add(termConceptDTO);
             }
         }
@@ -74,16 +76,20 @@ public class TermMatchingFacade {
                         String placeTo = map.get("standard_word");
                         placeToList.add(placeTo);
                     }
+                    TermMatchingListVO termMatchingListVO = new TermMatchingListVO();
+                    termMatchingListVO.setPlaceToList(placeToList);
+                    termMatchingListVO.setType(type);
                     QueryWrapper<KlLibraryInfo> klLibraryInfo = new QueryWrapper<>();
                     klLibraryInfo.eq("is_deleted", IsDeleteEnum.N.getKey())
                             .eq("type_id", type)
                             .in("name", placeToList);
-                    List<KlLibraryInfo> libraryInfoList = klLibraryInfoFacade.list(klLibraryInfo);
+                    List<TermConceptDTO> libraryInfoList = klLibraryInfoFacade.getConceptList(termMatchingListVO);
                     if (ListUtil.isNotEmpty(libraryInfoList)) {
-                        for (KlLibraryInfo data : libraryInfoList) {
+                        for (TermConceptDTO data : libraryInfoList) {
                             TermConceptDTO termConceptDTO = new TermConceptDTO();
-                            termConceptDTO.setId(data.getConceptId());
+                            termConceptDTO.setId(data.getId());
                             termConceptDTO.setName(data.getName());
+                            termConceptDTO.setCode(data.getCode());
                             termConceptDTO.setSource(5);
                             list.add(termConceptDTO);
                         }

+ 8 - 0
src/main/java/com/diagbot/mapper/KlLibraryInfoMapper.java

@@ -1,7 +1,12 @@
 package com.diagbot.mapper;
 
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KlLibraryInfoMapper extends BaseMapper<KlLibraryInfo> {
 
+    TermConceptDTO getConcept(TermMatchingVO termMatchingVO);
+
+    List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO);
 }

+ 7 - 0
src/main/java/com/diagbot/service/KlLibraryInfoService.java

@@ -1,7 +1,12 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +17,7 @@ import com.diagbot.entity.KlLibraryInfo;
  * @since 2021-01-21
  */
 public interface KlLibraryInfoService extends IService<KlLibraryInfo> {
+    TermConceptDTO getConcept(TermMatchingVO termMatchingVO);
 
+    List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO);
 }

+ 14 - 1
src/main/java/com/diagbot/service/impl/KlLibraryInfoServiceImpl.java

@@ -1,11 +1,16 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.mapper.KlLibraryInfoMapper;
 import com.diagbot.service.KlLibraryInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 术语表 服务实现类
@@ -17,4 +22,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class KlLibraryInfoServiceImpl extends ServiceImpl<KlLibraryInfoMapper, KlLibraryInfo> implements KlLibraryInfoService {
 
+    public TermConceptDTO getConcept(TermMatchingVO termMatchingVO) {
+        return baseMapper.getConcept(termMatchingVO);
+    }
+
+    @Override
+    public List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO) {
+        return baseMapper.getConceptList(termMatchingListVO);
+    }
 }

+ 18 - 0
src/main/java/com/diagbot/vo/TermMatchingListVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-24 19:03
+ */
+@Setter
+@Getter
+public class TermMatchingListVO {
+    private List<String> placeToList;
+    private Integer type;
+}

+ 145 - 13
src/main/resources/mapper/KlLibraryInfoMapper.xml

@@ -4,18 +4,150 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.KlLibraryInfo">
-        <id column="id" property="id" />
-        <result column="is_deleted" property="isDeleted" />
-        <result column="gmt_create" property="gmtCreate" />
-        <result column="gmt_modified" property="gmtModified" />
-        <result column="creator" property="creator" />
-        <result column="modifier" property="modifier" />
-        <result column="name" property="name" />
-        <result column="concept_id" property="conceptId" />
-        <result column="is_concept" property="isConcept" />
-        <result column="type_id" property="typeId" />
-        <result column="spell" property="spell" />
-        <result column="remark" property="remark" />
+        <id column="id" property="id"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="gmt_create" property="gmtCreate"/>
+        <result column="gmt_modified" property="gmtModified"/>
+        <result column="creator" property="creator"/>
+        <result column="modifier" property="modifier"/>
+        <result column="name" property="name"/>
+        <result column="concept_id" property="conceptId"/>
+        <result column="is_concept" property="isConcept"/>
+        <result column="type_id" property="typeId"/>
+        <result column="spell" property="spell"/>
+        <result column="remark" property="remark"/>
     </resultMap>
-
+    <select id="getConcept" resultType="com.diagbot.dto.TermConceptDTO">
+        SELECT DISTINCT
+        t.id as id,
+        t.name ,
+        t.isConcept as source
+        <if test="type!=null and type==100">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==127">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            t.code as code
+        </if>
+        FROM
+        (SELECT DISTINCT
+        a.concept_id as id,
+        a.name,
+        a.is_concept as isConcept
+        <if test="type!=null and type==100">,
+            b.icd10_code as code
+        </if>
+        <if test="type!=null and type==127">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            b.operation_code as code
+        </if>
+        FROM
+        kl_library_info a
+        <if test="type!=null and type==100">
+            left join kl_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==127">
+            JOIN kl_tcm_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==128">
+            JOIN kl_tcm_syndrome b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==106">
+            JOIN kl_operation b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        WHERE a.is_deleted = "N"
+        <if test="type!=null">
+            AND a.type_id = #{type}
+        </if>
+        <if test="inputStr!=null and inputStr!=''">
+            AND a.name = #{inputStr}
+        </if>
+        ) t
+    </select>
+    <select id="getConceptList" resultType="com.diagbot.dto.TermConceptDTO">
+        SELECT DISTINCT
+        t.id as id,
+        t.name ,
+        t.isConcept as source
+        <if test="type!=null and type==100">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==127">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            t.code as code
+        </if>
+        FROM
+        (SELECT DISTINCT
+        a.concept_id as id,
+        a.name,
+        a.is_concept as isConcept
+        <if test="type!=null and type==100">,
+            b.icd10_code as code
+        </if>
+        <if test="type!=null and type==127">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            b.operation_code as code
+        </if>
+        FROM
+        kl_library_info a
+        <if test="type!=null and type==100">
+            left join kl_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==127">
+            JOIN kl_tcm_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==128">
+            JOIN kl_tcm_syndrome b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==106">
+            JOIN kl_operation b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        WHERE a.is_deleted = "N"
+        <if test="type!=null">
+            AND a.type_id = #{type}
+        </if>
+        <if test="placeToList != null and placeToList.size > 0">
+            and a.name in
+            <foreach item="name" collection="placeToList" open="(" separator="," close=")">
+                #{name}
+            </foreach>
+        </if>
+        ) t
+    </select>
 </mapper>