Ver código fonte

Merge remote-tracking branch 'origin/dev/mix20191203_staticSearch2' into dev/mix20191203_staticSearch2

gaodm 5 anos atrás
pai
commit
f9003c1fde

+ 26 - 8
aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -365,18 +365,36 @@ public class ConceptFacade extends ConceptServiceImpl {
         RetrievalVO retrievalVO = new RetrievalVO();
         BeanUtil.copyProperties(getStaticKnowledgeVO, retrievalVO);
         List<Integer> types = retrievalVO.getTypes();
+        List<Integer> typesIn = new ArrayList<>();
+        // 是否包含化验
         if (types.contains(LexiconTypeEnum.LIS_PACKAGE.getKey())) {
-            retrievalVO.setHasLis(true);
-            List<Integer> typesNoLis = new ArrayList<>();
-            for (Integer type : types) {
-                if (LexiconTypeEnum.LIS_PACKAGE.getKey() != type.intValue()) {
-                    typesNoLis.add(type);
+            retrievalVO.setHasLis(true); //
+        }
+        // 是否包含量表
+        if (types.contains(LexiconTypeEnum.GAUGE.getKey())) {
+            retrievalVO.setHasGauge(true); // 包含量表
+            if (ListUtil.isNotEmpty(types) && types.size() == 1) {
+                retrievalVO.setOnlyGauge(true); // 只有量表
+                // 查询诊断名称
+                ConceptBaseVO conceptBaseVO = new ConceptBaseVO();
+                conceptBaseVO.setName(getStaticKnowledgeVO.getInputStr());
+                conceptBaseVO.setLibType(LexiconTypeEnum.DIAGNOSIS.getKey());
+                List<ConceptBaseDTO> conceptBaseDTOS = indexConceptFac(conceptBaseVO);
+                // 设置诊断名称
+                if (ListUtil.isNotEmpty(conceptBaseDTOS)) {
+                    getStaticKnowledgeVO.setDisNameList(conceptBaseDTOS.stream().map(row -> row.getName()).collect(Collectors.toList()));
                 }
             }
-            retrievalVO.setTypesNoLis(typesNoLis);
-        } else {
-            retrievalVO.setTypesNoLis(types);
         }
+        for (Integer type : types) {
+            // 化验和量表单独处理,不需要遍历
+            if (LexiconTypeEnum.LIS_PACKAGE.getKey() != type.intValue()
+                    && LexiconTypeEnum.GAUGE.getKey() != type.intValue()) {
+                typesIn.add(type);
+            }
+        }
+        retrievalVO.setTypesIn(typesIn);
+
         List<RetrievalDTO> staticRetrievalList = this.staticKnowledge(retrievalVO);
         for (RetrievalDTO retrievalDTO : staticRetrievalList) {
             retrievalDTO.setType(ParamConvertUtil.libConvert2Concept(retrievalDTO.getLibTypeId().intValue()));

+ 3 - 0
aipt-service/src/main/java/com/diagbot/vo/GetStaticKnowledgeVO.java

@@ -4,6 +4,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -21,4 +22,6 @@ public class GetStaticKnowledgeVO {
     private List<Long> inputIds;
     //指定类型
     private List<Integer> types;
+    // 量表关联的诊断名称
+    private List<String> disNameList = new ArrayList<>();
 }

+ 3 - 1
aipt-service/src/main/java/com/diagbot/vo/RetrievalVO.java

@@ -31,5 +31,7 @@ public class RetrievalVO {
     private Integer isSonShow = 0;
     private List<Integer> types; // 指定类型
     private boolean hasLis = false; // 是否搜索化验
-    private List<Integer> typesNoLis; // 除去化验外的类型
+    private boolean hasGauge = false; // 是否有量表
+    private boolean onlyGauge = false; // 只有量表
+    private List<Integer> typesIn; // 共用需要遍历的类型
 }

+ 181 - 6
aipt-service/src/main/resources/mapper/ConceptMapper.xml

@@ -421,7 +421,7 @@
         FROM
             (
                 -- 除化验外其他类型标签
-                <if test="typesNoLis != null and typesNoLis.size() > 0">
+                <if test="typesIn != null and typesIn.size() > 0">
                 (
                     SELECT
                         b1.*, 0 uniqueId,
@@ -466,7 +466,7 @@
                             AND t6.is_deleted = 'N'
                             AND t7.is_deleted = 'N'
                             AND t1.lib_type IN
-                            <foreach collection="typesNoLis" item="item" open="(" close=")"
+                            <foreach collection="typesIn" item="item" open="(" close=")"
                                      separator=",">
                                 #{item}
                             </foreach>
@@ -521,7 +521,7 @@
                                 AND t6.is_deleted = 'N'
                                 AND t7.is_deleted = 'N'
                                 AND t1.lib_type IN
-                                <foreach collection="typesNoLis" item="item" open="(" close=")"
+                                <foreach collection="typesIn" item="item" open="(" close=")"
                                          separator=",">
                                     #{item}
                                 </foreach>
@@ -576,7 +576,7 @@
                                 AND t6.is_deleted = 'N'
                                 AND t7.is_deleted = 'N'
                                 AND t1.lib_type IN
-                                <foreach collection="typesNoLis" item="item" open="(" close=")"
+                                <foreach collection="typesIn" item="item" open="(" close=")"
                                          separator=",">
                                     #{item}
                                 </foreach>
@@ -588,7 +588,7 @@
                     )
                 </if>
                 -- 化验本体标签公表项匹配静态知识
-                <if test="typesNoLis != null and typesNoLis.size() > 0 and hasLis == true">
+                <if test="typesIn != null and typesIn.size() > 0 and hasLis == true">
                 UNION
                 </if>
                 <if test="hasLis == true">
@@ -1066,6 +1066,179 @@
                         AND b2.id = b3.concept_id
                     )
                 </if>
+
+                -- 量表匹配静态知识,如果只有量表,也同时搜索诊断有关的量表;如果还有其他类型,不搜索诊断相关的量表
+                <if test="hasGauge == true">
+                    <if test="typesIn != null and typesIn.size() > 0 || hasLis == true">
+                    union
+                    </if>
+                    (
+                    SELECT
+                    b1.selfId conceptId,
+                    b1.selfName `name`,
+                    71 AS orderNo,
+                    b1.retrievalName retrievalName,
+                    b1.showType showType,
+                    b1.libTypeId libTypeId,
+                    b1.libTypeName libTypeName,
+                    b1.selfId uniqueId,
+                    b1.selfName uniqueName
+                    FROM
+                    (
+                    SELECT
+                    t1.id selfId,
+                    t1.lib_name selfName,
+                    t2.`name` retrievalName,
+                    t2.is_concept showType,
+                    t1.lib_type libTypeId,
+                    t6.`name` libTypeName
+                    FROM
+                    kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = 48
+                    AND (
+                    UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
+                    OR UPPER(t2. NAME) = UPPER(TRIM(#{InputStr}))
+                    )
+                    ) b1,
+                    kl_scale b2
+                    WHERE
+                    b2.is_deleted = 'N'
+                    AND b1.selfId = b2.concept_id
+                    )
+                    UNION
+                    (
+                    SELECT
+                    b1.selfId conceptId,
+                    b1.selfName `name`,
+                    72 AS orderNo,
+                    b1.retrievalName retrievalName,
+                    b1.showType showType,
+                    b1.libTypeId libTypeId,
+                    b1.libTypeName libTypeName,
+                    b1.selfId uniqueId,
+                    b1.selfName uniqueName
+                    FROM
+                    (
+                    SELECT
+                    t1.id selfId,
+                    t1.lib_name selfName,
+                    t2.`name` retrievalName,
+                    t2.is_concept showType,
+                    t1.lib_type libTypeId,
+                    t6.`name` libTypeName
+                    FROM
+                    kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = 48
+                    AND (
+                    UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
+                    OR UPPER(t2. NAME) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
+                    )
+                    ) b1,
+                    kl_scale b2
+                    WHERE
+                    b2.is_deleted = 'N'
+                    AND b1.selfId = b2.concept_id
+                    )
+                    UNION
+                    (
+                    SELECT
+                    b1.selfId conceptId,
+                    b1.selfName `name`,
+                    73 AS orderNo,
+                    b1.retrievalName retrievalName,
+                    b1.showType showType,
+                    b1.libTypeId libTypeId,
+                    b1.libTypeName libTypeName,
+                    b1.selfId uniqueId,
+                    b1.selfName uniqueName
+                    FROM
+                    (
+                    SELECT
+                    t1.id selfId,
+                    t1.lib_name selfName,
+                    t2.`name` retrievalName,
+                    t2.is_concept showType,
+                    t1.lib_type libTypeId,
+                    t6.`name` libTypeName
+                    FROM
+                    kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = 48
+                    AND (
+                    UPPER(t2.spell) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
+                    OR UPPER(t2. NAME) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})), '%')
+                    )
+                    ) b1
+                    ,kl_scale b2
+                    WHERE
+                    b2.is_deleted = 'N'
+                    AND b1.selfId = b2.concept_id
+                    )
+                </if>
+
+                -- 只有量表时还需要根据诊断去查询量表
+                <if test="onlyGauge">
+                    UNION
+                    SELECT distinct
+                    b2.id conceptId,
+                    b2.lib_name `name`,
+                    74 AS orderNo,
+                    b1.retrievalName retrievalName,
+                    0 showType,
+                    b2.lib_type libTypeId,
+                    '量表' libTypeName,
+                    b2.id uniqueId,
+                    b2.lib_name uniqueName
+                    FROM
+                    (
+                    SELECT
+                    t1.id selfId,
+                    t1.lib_name selfName,
+                    t2.`name` retrievalName,
+                    t2.is_concept showType,
+                    t1.lib_type libTypeId,
+                    t6.`name` libTypeName
+                    FROM
+                    kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = 18
+                    AND (
+                    UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
+                    OR UPPER(t2. NAME) = UPPER(TRIM(#{InputStr}))
+                    )
+                    ) b1
+                    , kl_concept b2, kl_relation b3, kl_scale b4
+                    WHERE
+                    b2.is_deleted = 'N'
+                    AND b3.is_deleted = 'N'
+                    AND b4.is_deleted = 'N'
+                    AND b1.selfId = b3.start_id
+                    AND b2.id = b3.end_id
+                    AND b2.id = b4.concept_id
+                </if>
+
             ) a1
         ORDER BY
             a1.orderNo ASC,
@@ -1110,7 +1283,9 @@
         SELECT DISTINCT b.id concept_id,b.lib_name name  FROM `kl_library_info` a, kl_concept b
         where a.is_deleted = 'N' and b.is_deleted = 'N'
         and a.concept_id = b.id
-        and UPPER(TRIM(a.`name`)) like concat('%',UPPER(TRIM(#{name})),'%') and a.type_id = #{libType} and b.lib_type = #{libType}
+        and (UPPER(TRIM(a.`name`)) like concat('%',UPPER(TRIM(#{name})),'%')
+        or UPPER(TRIM(a.`spell`)) like concat('%',UPPER(TRIM(#{name})),'%'))
+        and a.type_id = #{libType} and b.lib_type = #{libType}
     </select>
 
 </mapper>

+ 2 - 1
data-service/src/main/java/com/diagbot/enums/StaticSearchTypeEnum.java

@@ -14,7 +14,8 @@ public enum StaticSearchTypeEnum implements KeyedNamed {
     LIS_PACKAGE(12, "化验"),
     PACS_ITEMS(16, "辅检"),
     DIAGNOSIS(18, "诊断"),
-    OPERATION(25, "手术");
+    OPERATION(25, "手术"),
+    GAUGE(48, "量表");
 
     @Setter
     private int key;

+ 1 - 0
data-service/src/main/java/com/diagbot/facade/SearchFacade.java

@@ -48,6 +48,7 @@ public class SearchFacade {
             types.add(StaticSearchTypeEnum.LIS_PACKAGE.getKey());
             types.add(StaticSearchTypeEnum.PACS_ITEMS.getKey());
             types.add(StaticSearchTypeEnum.OPERATION.getKey());
+            types.add(StaticSearchTypeEnum.GAUGE.getKey());
             getStaticKnowledgeVO.setTypes(types);
         }
         RespDTO<List<RetrievalDTO>> res

+ 1 - 1
data-service/src/main/java/com/diagbot/web/SearchController.java

@@ -42,7 +42,7 @@ public class SearchController {
      */
     @ApiOperation(value = "静态知识检索[by:zhoutg]",
             notes = "inputStr:检索内容,必填<br>" +
-                    "types:指定类型,1:症状,10:药品,12:化验,16:辅检,18:诊断,25:手术; 不指定:以上全部")
+                    "types:指定类型,1:症状,10:药品,12:化验,16:辅检,18:诊断,25:手术,48:量表; 不指定:以上全部")
     @PostMapping("/getStaticKnowledge")
     @SysLogger("getStaticKnowledge")
     public RespDTO<List<RetrievalDTO>> getStaticKnowledge(@Valid @RequestBody GetStaticVO getStaticVO){

+ 2 - 1
icss-service/src/main/java/com/diagbot/enums/StaticSearchTypeEnum.java

@@ -14,7 +14,8 @@ public enum StaticSearchTypeEnum implements KeyedNamed {
     LIS_PACKAGE(12, "化验"),
     PACS_ITEMS(16, "辅检"),
     DIAGNOSIS(18, "诊断"),
-    OPERATION(25, "手术");
+    OPERATION(25, "手术"),
+    GAUGE(48, "量表");
 
     @Setter
     private int key;

+ 1 - 0
icss-service/src/main/java/com/diagbot/facade/RetrievalFacade.java

@@ -187,6 +187,7 @@ public class RetrievalFacade {
             types.add(StaticSearchTypeEnum.LIS_PACKAGE.getKey());
             types.add(StaticSearchTypeEnum.PACS_ITEMS.getKey());
             types.add(StaticSearchTypeEnum.OPERATION.getKey());
+            types.add(StaticSearchTypeEnum.OPERATION.getKey());
             getStaticKnowledgeVO.setTypes(types);
             return ;
         }

+ 1 - 1
icss-service/src/main/java/com/diagbot/web/RetrievalController.java

@@ -51,7 +51,7 @@ public class RetrievalController {
     @ApiOperation(value = "ICSS三期-静态知识-页面检索[by:wangyu]",
             notes = "inputStr:检索内容,必填<br>" +
                     "inputIds:需要去重的id<br>" +
-                    "types:指定类型,1:症状,10:药品,12:化验,16:辅检,18:诊断,25:手术;不指定:以上全部")
+                    "types:指定类型,1:症状,10:药品,12:化验,16:辅检,18:诊断,25:手术, 48:量表;不指定:以上全部")
     @PostMapping("/getStaticKnowledge")
     @SysLogger("getStaticKnowledge")
     public RespDTO<List<RetrievalDTO>> getStaticKnowledge(@Valid @RequestBody GetStaticVO getStaticVO) {