Parcourir la source

编码检索诊断

zhaops il y a 3 ans
Parent
commit
0c3e020378

+ 15 - 0
src/main/java/com/diagbot/dto/DiseaseIndexDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2022/4/8 13:52
+ */
+@Data
+public class DiseaseIndexDTO {
+    private Long id;
+    private String name;
+    private String code;
+}

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

@@ -1,6 +1,8 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.DiseaseIndexDTO;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.LisDetailDTO;
 import com.diagbot.dto.RetrievalConceptDTO;
@@ -13,6 +15,7 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
+import com.diagbot.vo.DiseaseIndexPageVO;
 import com.diagbot.vo.MedRetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
@@ -333,4 +336,15 @@ public class MedRetrievalFacade {
         }
         return typeName;
     }
+
+    /**
+     * 通过编码查询疾病
+     *
+     * @param diseaseIndexPageVO
+     * @return
+     */
+    public IPage<DiseaseIndexDTO> diseaseIndex(DiseaseIndexPageVO diseaseIndexPageVO) {
+        IPage<DiseaseIndexDTO> page = klConceptFacade.findDiseaeByCode(diseaseIndexPageVO);
+        return page;
+    }
 }

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

@@ -1,6 +1,8 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DiseaseIndexDTO;
 import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
@@ -9,6 +11,7 @@ import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.vo.*;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -37,4 +40,6 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
 
     List<GatherDTO> getGather(GatherVO gatherVO);
+
+    IPage<DiseaseIndexDTO> findDiseaeByCode(@Param("diseaseIndexPageVO") DiseaseIndexPageVO diseaseIndexPageVO);
 }

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

@@ -1,6 +1,8 @@
 package com.diagbot.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.DiseaseIndexDTO;
 import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
@@ -8,6 +10,7 @@ import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.entity.KlConcept;
+import com.diagbot.vo.DiseaseIndexPageVO;
 import com.diagbot.vo.GatherVO;
 import com.diagbot.vo.IndexByApprovalVO;
 import com.diagbot.vo.KllisDetailVO;
@@ -15,6 +18,7 @@ import com.diagbot.vo.MedRetrievalVO;
 import com.diagbot.vo.SearchCollectionConceptVO;
 import com.diagbot.vo.SearchConceptVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -46,4 +50,7 @@ public interface KlConceptService extends IService<KlConcept> {
     List<GetAllForRelationDTO> searchCollectionConcept(SearchCollectionConceptVO searchCollectionConceptVO);
 
     List<GatherDTO> getGather(GatherVO gatherVO);
+
+    //通过编码查询疾病
+    IPage<DiseaseIndexDTO> findDiseaeByCode(@Param("diseaseIndexPageVO") DiseaseIndexPageVO diseaseIndexPageVO);
 }

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

@@ -1,7 +1,9 @@
 package com.diagbot.service.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.DiseaseIndexDTO;
 import com.diagbot.dto.GatherDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndexBatchDTO;
@@ -12,6 +14,7 @@ import com.diagbot.entity.KlConcept;
 import com.diagbot.mapper.KlConceptMapper;
 import com.diagbot.service.KlConceptService;
 import com.diagbot.vo.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -34,7 +37,7 @@ public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept
     }
 
     @Override
-    public List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO){
+    public List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO) {
         return baseMapper.indexByApproval(indexByApprovalVO);
     }
 
@@ -68,4 +71,9 @@ public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept
         return baseMapper.getGather(gatherVO);
     }
 
+    //通过编码查询疾病
+    @Override
+    public IPage<DiseaseIndexDTO> findDiseaeByCode(@Param("diseaseIndexPageVO") DiseaseIndexPageVO diseaseIndexPageVO) {
+        return baseMapper.findDiseaeByCode(diseaseIndexPageVO);
+    }
 }

+ 26 - 0
src/main/java/com/diagbot/vo/DiseaseIndexPageVO.java

@@ -0,0 +1,26 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2022/4/8 13:49
+ */
+@Data
+public class DiseaseIndexPageVO extends Page {
+    /**
+     * 类型:1-Icd10编码,2-国临编码
+     */
+    @NotNull(message = "请输入检索类型")
+    private Integer type;
+    /**
+     * 检索内容
+     */
+    @NotBlank(message = "请输入检索内容")
+    private String inputStr;
+}

+ 17 - 0
src/main/java/com/diagbot/web/RetrievalController.java

@@ -1,13 +1,19 @@
 package com.diagbot.web;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.DiseaseIndexDTO;
 import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.facade.KlConceptFacade;
 import com.diagbot.facade.MedRetrievalFacade;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.DiseaseIndexPageVO;
 import com.diagbot.vo.FilterVO;
 import com.diagbot.vo.IndexByApprovalVO;
 import com.diagbot.vo.KllisDetailVO;
@@ -100,4 +106,15 @@ public class RetrievalController {
         List<IndexBatchDTO> data = klConceptFacade.indexByApproval(indexByApprovalVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "通过编码查询疾病[zhaops]",
+            notes = "type: 1-医保编码查询、2-国临编码查询<br>" +
+                    "inputStr: 检索内容<br>")
+    @PostMapping("/diseaseIndex")
+    public RespDTO<Page<DiseaseIndexDTO>> diseaseIndex(@Valid @RequestBody DiseaseIndexPageVO diseaseIndexPageVO) {
+        IPage<DiseaseIndexDTO> data = klConceptFacade.findDiseaeByCode(diseaseIndexPageVO);
+        Page<KlConceptStaticDTO> page = new Page<>();
+        BeanUtil.copyProperties(data, page);
+        return RespDTO.onSuc(data);
+    }
 }

+ 160 - 1
src/main/resources/mapper/KlConceptMapper.xml

@@ -1066,5 +1066,164 @@
           </foreach>
     </select>
 
-
+    <!--ICD编码查询-->
+    <select id="findDiseaeByCode" resultType="com.diagbot.dto.DiseaseIndexDTO">
+        SELECT
+        t.id,
+        <if test="diseaseIndexPageVO.type != null">
+            <choose>
+                <when test="diseaseIndexPageVO.type == 1">
+                    t.lib_name AS NAME,
+                    t.icd10_code AS CODE,
+                </when>
+                <when test="diseaseIndexPageVO.type == 2">
+                    t.guoname AS NAME,
+                    t.guocode AS CODE,
+                </when>
+                <otherwise>
+                </otherwise>
+            </choose>
+        </if>
+        t.partId
+        FROM
+        (
+        SELECT
+        a.id,
+        a.lib_name,
+        b.spell,
+        c.icd10_code,
+        c.guoname,
+        c.guocode,
+        c.guospell,
+        CONCAT( '1', a.lib_type ) AS partId
+        FROM
+        kl_concept a,
+        kl_library_info b,
+        kl_disease c
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.id = b.concept_id
+        AND a.id = c.concept_id
+        AND b.is_concept = 1
+        AND a.lib_type = 100
+        AND a.`status` = 1
+        <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
+            <choose>
+                <when test="diseaseIndexPageVO.type == 1">
+                    AND c.icd10_code IS NOT NULL
+                    AND c.icd10_code != ''
+                    AND ( a.lib_name LIKE #{diseaseIndexPageVO.inputStr}
+                    OR b.spell LIKE #{diseaseIndexPageVO.inputStr}
+                    OR c.icd10_code LIKE #{diseaseIndexPageVO.inputStr} )
+                </when>
+                <when test="diseaseIndexPageVO.type == 2">
+                    AND c.guocode IS NOT NULL
+                    AND c.guocode != ''
+                    AND ( c.guoname LIKE #{diseaseIndexPageVO.inputStr}
+                    OR c.guospell LIKE #{diseaseIndexPageVO.inputStr}
+                    OR c.guocode LIKE #{diseaseIndexPageVO.inputStr} )
+                </when>
+                <otherwise></otherwise>
+            </choose>
+        </if>
+        UNION
+        SELECT
+        a.id,
+        a.lib_name,
+        b.spell,
+        c.icd10_code,
+        c.guoname,
+        c.guocode,
+        c.guospell,
+        CONCAT( '2', a.lib_type ) AS partId
+        FROM
+        kl_concept a,
+        kl_library_info b,
+        kl_disease c
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.id = b.concept_id
+        AND a.id = c.concept_id
+        AND b.is_concept = 1
+        AND a.lib_type = 100
+        AND a.`status` = 1
+        <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
+            <choose>
+                <when test="diseaseIndexPageVO.type == 1">
+                    AND c.icd10_code IS NOT NULL
+                    AND c.icd10_code != ''
+                    AND ( a.lib_name LIKE  CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR b.spell LIKE  CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.icd10_code LIKE  CONCAT( #{diseaseIndexPageVO.inputStr}, '%' ) )
+                </when>
+                <when test="diseaseIndexPageVO.type == 2">
+                    AND c.guocode IS NOT NULL
+                    AND c.guocode != ''
+                    AND ( c.guoname LIKE  CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.guospell LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.guocode LIKE  CONCAT( #{diseaseIndexPageVO.inputStr}, '%' ) )
+                </when>
+                <otherwise></otherwise>
+            </choose>
+        </if>
+        UNION
+        SELECT
+        a.id,
+        a.lib_name,
+        b.spell,
+        c.icd10_code,
+        c.guoname,
+        c.guocode,
+        c.guospell,
+        CONCAT( '3', a.lib_type ) AS partId
+        FROM
+        kl_concept a,
+        kl_library_info b,
+        kl_disease c
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.id = b.concept_id
+        AND a.id = c.concept_id
+        AND b.is_concept = 1
+        AND a.lib_type = 100
+        AND a.`status` = 1
+        <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
+            <choose>
+                <when test="diseaseIndexPageVO.type == 1">
+                    AND c.icd10_code IS NOT NULL
+                    AND c.icd10_code != ''
+                    AND ( a.lib_name LIKE  CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR b.spell LIKE  CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.icd10_code LIKE  CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
+                    AND (
+                    a.lib_name NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    AND b.spell NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    AND c.icd10_code NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    )
+                </when>
+                <when test="diseaseIndexPageVO.type == 2">
+                    AND c.guocode IS NOT NULL
+                    AND c.guocode != ''
+                    AND ( c.guoname LIKE  CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.guospell LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
+                    OR c.guocode LIKE  CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
+                    AND (
+                    c.guoname NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    AND c.guospell NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    AND c.guocode NOT LIKE CONCAT(  #{diseaseIndexPageVO.inputStr}, '%' )
+                    )
+                </when>
+                <otherwise></otherwise>
+            </choose>
+        </if>
+        ) t
+        ORDER BY
+        t.partId
+    </select>
 </mapper>