浏览代码

静态知识检索

zhaops 4 年之前
父节点
当前提交
467abe8352

+ 2 - 0
doc/001.00000000初始化脚本/cdss_init.sql

@@ -317,3 +317,5 @@ CREATE TABLE `tran_dept_config` (
   `unique_code` varchar(255) DEFAULT NULL COMMENT '标准编码',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='科室映射表';
+
+ALTER TABLE `graph_concept_info`  MODIFY   `name` varchar(255) CHARACTER SET utf8mb4 NOT NULL COMMENT '标准术语';

+ 27 - 6
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -88,6 +88,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 .stream()
                 .filter(i -> i.getHasInfo().equals(1))
                 .collect(Collectors.toList());
+        if (staticKnowledgeIndexDTOList.size() > 100) {
+            staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, 100);
+        }
         return staticKnowledgeIndexDTOList;
     }
 
@@ -104,6 +107,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 .stream()
                 .filter(i -> i.getHasInfo().equals(0))
                 .collect(Collectors.toList());
+        if (staticKnowledgeIndexDTOList.size() > 100) {
+            staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, 100);
+        }
         return staticKnowledgeIndexDTOList;
     }
 
@@ -125,9 +131,6 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         RespDTOUtil.respNGDealCover(respDTO, "检索失败");
         staticKnowledgeIndexDTOList = respDTO.data;
         if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)) {
-            if (staticKnowledgeIndexDTOList.size() > 100) {
-                staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, 100);
-            }
             //typeName转换
             staticKnowledgeIndexDTOList.forEach(item -> {
                 item.setTypeName(convertTypeName(item.getTypeName(), 2, dicTypeMappingList));
@@ -137,10 +140,28 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                     .stream()
                     .map(i -> i.getName())
                     .collect(Collectors.toList());
+            List<ConceptInfo> conceptInfoList = Lists.newLinkedList();
             QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
-            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("name", conNameList);
-            List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
+            int n = 0;
+            do {
+                List<String> subConNameList = new ArrayList<>();
+                if (n + 1000 < conNameList.size()) {
+                    subConNameList = conNameList.subList(n, n + 1000);
+                } else {
+                    subConNameList = conNameList.subList(n, conNameList.size());
+                }
+                conceptInfoQueryWrapper = new QueryWrapper<>();
+                conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+                conceptInfoQueryWrapper.in("name", subConNameList);
+                List<ConceptInfo> subConceptInfoList = this.list(conceptInfoQueryWrapper);
+                if (ListUtil.isNotEmpty(subConceptInfoList)) {
+                    conceptInfoList.addAll(subConceptInfoList);
+                }
+                n += 1000;
+            } while (conceptInfoList.size() < 100 && n < conNameList.size());
+
+            staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, n);
+
             if (ListUtil.isNotEmpty(conceptInfoList)) {
                 //typeName转换
                 conceptInfoList.forEach(item -> {