Просмотр исходного кода

Merge branch 'develop' into dev/tcm_20210512

# Conflicts:
#	src/main/java/com/diagbot/dto/RetrievalDTO.java
#	src/main/java/com/diagbot/facade/MedRetrievalFacade.java
#	src/main/java/com/diagbot/web/RetrievalController.java
gaodm 4 лет назад
Родитель
Сommit
6508e745f2
24 измененных файлов с 430 добавлено и 52 удалено
  1. 19 0
      doc/008.20210520推理调整/cdss.sql
  2. 7 4
      src/main/java/com/diagbot/config/CacheDeleteInit.java
  3. 18 0
      src/main/java/com/diagbot/dto/AnesthesiaInfoDTO.java
  4. 1 0
      src/main/java/com/diagbot/dto/NeoPushDTO.java
  5. 5 0
      src/main/java/com/diagbot/dto/RetrievalDTO.java
  6. 68 0
      src/main/java/com/diagbot/entity/SysDeptPush.java
  7. 3 1
      src/main/java/com/diagbot/enums/PushRelationTypeEnum.java
  8. 3 3
      src/main/java/com/diagbot/enums/RedisEnum.java
  9. 29 14
      src/main/java/com/diagbot/facade/CacheFacade.java
  10. 14 0
      src/main/java/com/diagbot/facade/DeptPushFacade.java
  11. 10 2
      src/main/java/com/diagbot/facade/MedRetrievalFacade.java
  12. 4 0
      src/main/java/com/diagbot/facade/NeoFacade.java
  13. 35 16
      src/main/java/com/diagbot/facade/PushFacade.java
  14. 16 0
      src/main/java/com/diagbot/mapper/SysDeptPushMapper.java
  15. 30 1
      src/main/java/com/diagbot/process/PushProcess.java
  16. 16 0
      src/main/java/com/diagbot/service/SysDeptPushService.java
  17. 22 0
      src/main/java/com/diagbot/service/impl/SysDeptPushServiceImpl.java
  18. 1 1
      src/main/java/com/diagbot/vo/PushNewVO.java
  19. 16 6
      src/main/java/com/diagbot/web/CacheController.java
  20. 1 1
      src/main/java/com/diagbot/web/RetrievalController.java
  21. 1 1
      src/main/resources/mapper/KlRelationMapper.xml
  22. 18 0
      src/main/resources/mapper/SysDeptPushMapper.xml
  23. 2 2
      src/test/java/com/diagbot/CodeGeneration.java
  24. 91 0
      src/test/java/com/diagbot/PrintUtil.java

+ 19 - 0
doc/008.20210520推理调整/cdss.sql

@@ -0,0 +1,19 @@
+USE `cdss`;
+
+DROP TABLE IF EXISTS `sys_dept_push`;
+CREATE TABLE `sys_dept_push` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `dept_name` varchar(255) NOT NULL DEFAULT '' COMMENT '标准科室名称',
+  `push` varchar(255) NOT NULL DEFAULT '' COMMENT '推送模型',
+  `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='标准科室和推送模型映射';
+
+INSERT INTO `cdss`.`sys_dept_push` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `dept_name`, `push`, `remark`) VALUES ('1', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '精神卫生科', '1', NULL);
+
+alter table `cdss`.`tran_hospital_info` MODIFY COLUMN push_mode int(1) NOT NULL DEFAULT '0' COMMENT '0:新版推送,1:5.0推送,2:其他推送';

+ 7 - 4
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -38,14 +38,17 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.getdiseaseFilterCache();
         log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
 
-         cacheFacade.loadAllRuleCache();
-         log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
+        cacheFacade.loadPushModel();
+        log.info("CDSS-CORE服务启动加载医院推送类型成功!");
+
+        cacheFacade.loadDeptPush();
+        log.info("CDSS-CORE服务启动加载科室和推送映射成功!");
 
         cacheFacade.loadAllBaseDiagnoseCache();
         log.info("CDSS-CORE服务启动加载诊断依据缓存成功!");
 
-        cacheFacade.loadHostipalPush();
-        log.info("CDSS-CORE服务启动加载医院大数据推送类型成功!");
+        cacheFacade.loadAllRuleCache();
+        log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
 
 //        cacheFacade.getDiseaseCorrespondCache();
 //        log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");

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

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/4/23 10:55
+ */
+@Getter
+@Setter
+public class AnesthesiaInfoDTO {
+    /**
+     * 麻醉名称
+     */
+    private String name;
+}

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

@@ -20,6 +20,7 @@ public class NeoPushDTO {
     private List<PushBaseDTO> vitals = new ArrayList<>();//体征
     private List<PushBaseDTO> lis = new ArrayList<>();//实验室检查
     private List<PushBaseDTO> pacs = new ArrayList<>();//辅助检查
+    private List<PushBaseDTO> scales = new ArrayList<>();//量表
     // 鉴别诊断
     private List<PushBaseDTO> differentialDis;
     /**

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

@@ -69,4 +69,9 @@ public class RetrievalDTO {
      * 中医证候
      */
     private List<TcmsyndromeInfoDTO> tcmsyndromeNames;
+    /**
+     * 麻醉
+     */
+    private List<AnesthesiaInfoDTO> anesthesiaInfonames;
+
 }

+ 68 - 0
src/main/java/com/diagbot/entity/SysDeptPush.java

@@ -0,0 +1,68 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 标准科室和推送模型映射
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-05-20
+ */
+@Data
+public class SysDeptPush implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 标准科室名称
+     */
+    private String deptName;
+
+    /**
+     * 推送模型
+     */
+    private String push;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 3 - 1
src/main/java/com/diagbot/enums/PushRelationTypeEnum.java

@@ -16,7 +16,9 @@ public enum PushRelationTypeEnum {
     PACS(505L, "疾病相关辅助检查项目"),
     DRUG(506L, "疾病相关药物治疗"),
     OPERATION(507L, "疾病相关手术治疗"),
-    DIFFDIAGNOSE(508L, "疾病相关鉴别诊断");
+    DIFFDIAGNOSE(508L, "疾病相关鉴别诊断"),
+    SCALE(509L, "疾病相关量表"),
+    NURSE(510L, "疾病相关护理");
 
     @Setter
     private long key;

+ 3 - 3
src/main/java/com/diagbot/enums/RedisEnum.java

@@ -22,9 +22,9 @@ public enum RedisEnum implements KeyedNamed {
     diseaseType(2, "diseaseType:"),
     allRule(10, "allRule:"),
     allBaseDiagnose(11, "allBaseDiagnose"),
-    hospitalPushType(12, "hospitalPushType"),
-    pushVersion(13, "pushVersion"),
-    hospitalId_(14, "hospitalId_");
+    pushModel(13, "pushModel"),
+    hospitalId_(14, "hospitalId_"),
+    deptPush(15, "deptPush");
 
     @Setter
     private int key;

+ 29 - 14
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -3,13 +3,13 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.PushNewServiceClient;
 import com.diagbot.dto.PushReloadDTO;
+import com.diagbot.entity.SysDeptPush;
 import com.diagbot.entity.TranHospitalInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
-import com.diagbot.util.StringUtil;
 import org.apache.commons.collections4.map.LinkedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
@@ -39,6 +39,8 @@ public class CacheFacade {
     TranHospitalInfoFacade tranHospitalInfoFacade;
     @Autowired
     PushNewServiceClient pushNewServiceClient;
+    @Autowired
+    DeptPushFacade deptPushFacade;
 
     /**
      * 清除缓存信息
@@ -145,32 +147,45 @@ public class CacheFacade {
     }
 
     /**
-     * 加载大数据推送类型【push_mode】和推送版本【remark】【tran_hospital_info】
+     * 加载大数据推送类型
      */
-    public void loadHostipalPush() {
-        // 删除
-        redisUtil.delete(RedisEnum.hospitalPushType.getName());
-        redisUtil.delete(RedisEnum.pushVersion.getName());
+    public void loadPushModel() {
+        redisUtil.delete("pushVersion"); // 删除脏数据
+        redisUtil.delete(RedisEnum.pushModel.getName());
 
         // 加载
         List<TranHospitalInfo> hospitalList = tranHospitalInfoFacade.list(new QueryWrapper<TranHospitalInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
         );
         if (ListUtil.isNotEmpty(hospitalList)) {
-            // 推送类型
-            redisUtil.putHashMap(RedisEnum.hospitalPushType.getName(),
-                    hospitalList.stream().collect(Collectors.toMap(k -> String.valueOf(k.getId()), v -> String.valueOf(v.getPushMode()), (v1, v2) -> (v2))));
-
             // 推送版本
             Map<String, Object> versionMap = new LinkedMap<>();
             for (TranHospitalInfo hospitalInfo : hospitalList) {
-                if (StringUtil.isNotBlank(hospitalInfo.getRemark()) && "old".equals(hospitalInfo.getRemark())) {
-                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), "old");
+                if (hospitalInfo.getPushMode() != null) {
+                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), hospitalInfo.getPushMode());
                 } else {
-                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), "new");
+                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), 0);
                 }
             }
-            redisUtil.putHashMap(RedisEnum.pushVersion.getName(), versionMap);
+            redisUtil.putHashMap(RedisEnum.pushModel.getName(), versionMap);
+        }
+    }
+
+    /**
+     * 加载标准科室和推送类型的映射关系【sys_dept_push】
+     */
+    public void loadDeptPush() {
+        // 删除
+        redisUtil.delete(RedisEnum.deptPush.getName());
+
+        // 加载
+        List<SysDeptPush> deptPushList = deptPushFacade.list(new QueryWrapper<SysDeptPush>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+        );
+        if (ListUtil.isNotEmpty(deptPushList)) {
+            // 推送类型
+            redisUtil.putHashMap(RedisEnum.deptPush.getName(),
+                    deptPushList.stream().collect(Collectors.toMap(k -> k.getDeptName(), v -> v.getPush(), (v1, v2) -> (v2))));
         }
     }
 }

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

@@ -0,0 +1,14 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.SysDeptPushServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/11/19 15:21
+ */
+@Component
+public class DeptPushFacade extends SysDeptPushServiceImpl {
+
+}

+ 10 - 2
src/main/java/com/diagbot/facade/MedRetrievalFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.dto.AnesthesiaInfoDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.DiseaseInfoDTO;
 import com.diagbot.dto.DrugInfoDTO;
@@ -60,7 +61,7 @@ public class MedRetrievalFacade {
         List<IndexDTO> indexList = Lists.newLinkedList();
 
         /**
-         * 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候
+         * 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉
          */
         switch (retrievalVO.getType()) {
             case 1:
@@ -180,7 +181,14 @@ public class MedRetrievalFacade {
                     retrievalDTO.setTcmsyndromeNames(BeanUtil.listCopyTo(indexList, TcmsyndromeInfoDTO.class));
                 }
                 break;
-
+            case 14:
+                medRetrievalVO.setTypeId(LexiconEnum.Anesthesia.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Anesthesia.getKey());
+                indexList = klConceptFacade.index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setAnesthesiaInfonames(BeanUtil.listCopyTo(indexList, AnesthesiaInfoDTO.class));
+                }
+                break;
         }
         return retrievalDTO;
     }

+ 4 - 0
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -447,6 +447,10 @@ public class NeoFacade {
                 neoPushDTO.setDifferentialDis(items.get(PushRelationTypeEnum.DIFFDIAGNOSE.getKey())
                         .stream().map(x -> NeoUtil.updatePushInfo(x)).collect(Collectors.toList()));
             }
+            if (ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.SCALE.getKey()))) {
+                neoPushDTO.setScales(items.get(PushRelationTypeEnum.SCALE.getKey())
+                        .stream().map(x -> NeoUtil.updatePushInfo(x)).collect(Collectors.toList()));
+            }
         }
         return neoPushDTO;
     }

+ 35 - 16
src/main/java/com/diagbot/facade/PushFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.diagbot.biz.push.entity.Item;
 import com.diagbot.client.PushNewServiceClient;
 import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
@@ -7,7 +8,6 @@ import com.diagbot.dto.PushNewDTO;
 import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.DiagnoseTypeEnum;
-import com.diagbot.enums.DiseasePushTypeEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -66,19 +66,36 @@ public class PushFacade {
      * @return
      */
     public PushDTO pushFac(PushVO pushVO) {
-        String pushVersion = redisUtil.getByKeyAndField(RedisEnum.pushVersion.getName(),
+        // 获取pushMode
+        Integer pushModel = redisUtil.getByKeyAndField(RedisEnum.pushModel.getName(),
                 RedisEnum.hospitalId_.getName() + pushVO.getHospitalId());
-        if (StringUtil.isNotBlank(pushVersion) && "old".equals(pushVersion)) {
-            // 使用5.0推送
-            return processAggreate(pushVO);
-        } else {
-            // 使用新版推送
-            return pushNewFac(pushVO);
+        switch (pushModel) {
+            case 0:  // 使用新版推送
+                return pushNewFac(pushVO, "0");
+            case 1: // 使用5.0推送
+                return processAggreate(pushVO);
+            case 2:  // 走科室对应的模型,如果找不到,使用5.0推理
+                List<Item> deptList = pushVO.getDept();
+                String modelType = "0";
+                if (ListUtil.isNotEmpty(deptList)) {
+                    if (StringUtil.isNotBlank(deptList.get(0).getUniqueName())) {
+                        modelType = redisUtil.getByKeyAndField(RedisEnum.deptPush.getName(),
+                                deptList.get(0).getUniqueName());
+                    }
+                }
+                if (modelType == null || "0".equals(modelType)) {
+                    return processAggreate(pushVO);
+                } else {
+                    return pushNewFac(pushVO, modelType);
+                }
+            default: // 默认使用新版推送
+                return pushNewFac(pushVO, "0");
         }
     }
 
     /**
      * 5.0 推送总入口
+     *
      * @param pushVo
      * @return
      */
@@ -88,7 +105,8 @@ public class PushFacade {
             pushVo.setAgeNum(CoreUtil.convertAge(pushVo.getAge()));
         }
         PushDTO pushDTO = new PushDTO();
-        Integer pushMode = tranHospitalInfoFacade.getPushMode(pushVo.getHospitalId());
+        pushDTO = this.pushFacIcss(pushVo);
+        /*Integer pushMode = tranHospitalInfoFacade.getPushMode(pushVo.getHospitalId());
         //全科推送,走5.0
         if (pushMode.equals(DiseasePushTypeEnum.gp.getKey())) {
             pushDTO = this.pushFacIcss(pushVo);
@@ -97,7 +115,7 @@ public class PushFacade {
             //pushDTO = this.pushFac(pushVo);
             // 2021/2/22 同老楼确认专科也走5.0
             pushDTO = this.pushFacIcss(pushVo);
-        }
+        }*/
 
         return pushDTO;
     }
@@ -123,7 +141,7 @@ public class PushFacade {
      * @param
      * @return
      */
-    public PushDTO pushNewFac(PushVO pushVo) {
+    public PushDTO pushNewFac(PushVO pushVo, String modelType) {
         PushDTO pushDTO = new PushDTO();
         Map<String, Object> debug = new LinkedHashMap<>();
         debug.put("大数据推送地址", pushUrl);
@@ -149,7 +167,7 @@ public class PushFacade {
             try {
                 Map<String, Object> invokeParams = new HashMap<>();
                 invokeParams.put("wordCrfDTO", wordCrfDTO);
-                invokeParams.put("pushNewVO", generatePushVo(wordCrfDTO));
+                invokeParams.put("pushNewVO", generatePushVo(wordCrfDTO, modelType));
                 pushDTO = DataFacade.get("pushAll", invokeParams, PushDTO.class);
             } catch (Exception e) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推送服务出错" + e.getMessage());
@@ -190,6 +208,7 @@ public class PushFacade {
 
     /**
      * 诊断去重、合并处理
+     *
      * @param pushDTO
      */
     public void dealDisease(PushDTO pushDTO, WordCrfDTO wordCrfDTO, int length, boolean hasDiseaseFlag) {
@@ -257,17 +276,17 @@ public class PushFacade {
      * 生成新版推送入参
      *
      * @param wordCrfDTO
+     * @param modelType  模型类型
      * @return
      */
-    public PushNewVO generatePushVo(WordCrfDTO wordCrfDTO) {
+    public PushNewVO generatePushVo(WordCrfDTO wordCrfDTO, String modelType) {
         PushNewVO pushNewVO = new PushNewVO();
         pushNewVO.setChief(wordCrfDTO.getChief());
         pushNewVO.setPresent(wordCrfDTO.getSymptom());
         pushNewVO.setAge(wordCrfDTO.getAgeNum());
         pushNewVO.setSex(wordCrfDTO.getSex());
-        String pushType = redisUtil.getByKeyAndField(RedisEnum.hospitalPushType.getName(), String.valueOf(wordCrfDTO.getHospitalId()));
-        if (StringUtil.isNotBlank(pushType)) {
-            pushNewVO.setHospitalType(pushType);
+        if (StringUtil.isNotBlank(modelType)) {
+            pushNewVO.setHospitalType(modelType);
         }
         return pushNewVO;
     }

+ 16 - 0
src/main/java/com/diagbot/mapper/SysDeptPushMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.SysDeptPush;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 标准科室和推送模型映射 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-05-20
+ */
+public interface SysDeptPushMapper extends BaseMapper<SysDeptPush> {
+
+}

+ 30 - 1
src/main/java/com/diagbot/process/PushProcess.java

@@ -193,6 +193,13 @@ public class PushProcess {
                         return pushBaseDTO;
                     }).collect(Collectors.toList()));
                 }
+                if (ruleTypeList.contains("13") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.NURSE.getKey()))) {
+                    pushDTO.setNurse(items.get(PushRelationTypeEnum.NURSE.getKey()).stream().map(x -> {
+                        PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                        pushBaseDTO.setName(x);
+                        return pushBaseDTO;
+                    }).collect(Collectors.toList()));
+                }
             }
         }
         //        if (reverseInfoByDisName != null) {
@@ -430,7 +437,7 @@ public class PushProcess {
             if (featureType.contains("9")) {
                 relationType.add(RelationshipEnum.R507.getKey()); // 手术
             }
-            if (featureType.contains("12")) {
+            if (featureType.contains("13")) {
                 relationType.add(RelationshipEnum.R510.getKey()); // 护理
             }
             reverseVO.setRelationType(relationType);
@@ -932,6 +939,16 @@ public class PushProcess {
                 }
             }
         }
+        // 量表
+        if (ruleTypeList.contains("12")) {
+            if (ListUtil.isNotEmpty(reversePush.getScales())) {
+                List<String> scales = reversePush.getScales().stream().map(x -> x.getName()).collect(Collectors.toList());
+                if (scales.size() > 0) {
+                    List<PushBaseDTO> filterpacs = getPackagePushBaseDTO(scales);
+                    pushDTO.setScale(filterpacs.subList(0, filterpacs.size() >= length ? length : filterpacs.size()));
+                }
+            }
+        }
 
     }
 
@@ -947,5 +964,17 @@ public class PushProcess {
                 }).collect(Collectors.toList());
         return symptomPush;
     }
+    private List<PushBaseDTO> getPackagePushBaseDTO(List<String> symptoms) {
+        List<PushBaseDTO> symptomPush = new ArrayList<>();
+        if(ListUtil.isNotEmpty(symptoms)){
+            symptomPush = symptoms.stream().map(x ->{
+                PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                pushBaseDTO.setName(x);
+                return pushBaseDTO;
+            }).collect(Collectors.toList());
+        }
+
+        return symptomPush;
+    }
 }
 

+ 16 - 0
src/main/java/com/diagbot/service/SysDeptPushService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.SysDeptPush;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 标准科室和推送模型映射 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-05-20
+ */
+public interface SysDeptPushService extends IService<SysDeptPush> {
+
+}

+ 22 - 0
src/main/java/com/diagbot/service/impl/SysDeptPushServiceImpl.java

@@ -0,0 +1,22 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.diagbot.entity.SysDeptPush;
+import com.diagbot.mapper.SysDeptPushMapper;
+import com.diagbot.service.SysDeptPushService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 标准科室和推送模型映射 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-05-20
+ */
+@Service
+@DS("cdss")
+public class SysDeptPushServiceImpl extends ServiceImpl<SysDeptPushMapper, SysDeptPush> implements SysDeptPushService {
+
+}

+ 1 - 1
src/main/java/com/diagbot/vo/PushNewVO.java

@@ -9,7 +9,7 @@ import lombok.Data;
  */
 @Data
 public class PushNewVO {
-    private String hospitalType = "0"; // 医院类型, 0:全科,1:妇幼,2:精神
+    private String hospitalType = "0"; // 模型类型, 0:全科、妇幼、精神,1:精神
     private Double age; // 年龄
     private Integer sex; // 性别
     private String chief; // 主诉

+ 16 - 6
src/main/java/com/diagbot/web/CacheController.java

@@ -119,12 +119,22 @@ public class CacheController {
         }
     }
 
-    @ApiOperation(value = "加载大数据推送类型【字段:push_mode】和推送版本【字段:remark】[by:zhoutg]",
-            notes = "表:tran_hospital_info,【remark】字段:old表示使用原5.0推理,其他值:新版推理")
-    @PostMapping("/loadHostipalPush")
-    @SysLogger("loadHostipalPush")
-    public RespDTO<Boolean> loadHostipalPush() {
-        cacheFacade.loadHostipalPush();
+    @ApiOperation(value = "加载推送类型[by:zhoutg]",
+            notes = "表:tran_hospital_info,字段:push_mode")
+    @PostMapping("/loadPushModel")
+    @SysLogger("loadPushModel")
+    public RespDTO<Boolean> loadPushModel() {
+        cacheFacade.loadPushModel();
         return RespDTO.onSuc(true);
     }
+
+    @ApiOperation(value = "加载标准科室和推送类型的映射关系【sys_dept_push】",
+            notes = "")
+    @PostMapping("/loadDeptPush")
+    @SysLogger("loadDeptPush")
+    public RespDTO<Boolean> loadDeptPush() {
+        cacheFacade.loadDeptPush();
+        return RespDTO.onSuc(true);
+    }
+
 }

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

@@ -39,7 +39,7 @@ public class RetrievalController {
 
 
     @ApiOperation(value = "术语检索[zhaops]",
-            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候 <br>" +
+            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉 <br>" +
                     "inputStr: 检索内容<br>" +
                     "sex: 性别:1-男、2-女、3-通用 <br>" +
                     "age: 年龄<br>")

+ 1 - 1
src/main/resources/mapper/KlRelationMapper.xml

@@ -89,7 +89,7 @@
                         AND t1.id = t2.start_id
                         AND t3.id = t2.end_id
                         AND t2.id = t4.t_relation_id
-                        AND t2.relation_id IN (501,502,503,504,505,506,507,508)
+                        AND t2.relation_id IN (501,502,503,504,505,506,507,508,509,510)
                         AND t1.lib_name = #{diseaseName}
                         AND t1.`status` = 1
                         AND t3.`status` = 1

+ 18 - 0
src/main/resources/mapper/SysDeptPushMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.SysDeptPushMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.SysDeptPush">
+        <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="dept_name" property="deptName" />
+        <result column="push" property="push" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 2 - 2
src/test/java/com/diagbot/CodeGeneration.java

@@ -49,14 +49,14 @@ public class CodeGeneration {
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
         dsc.setPassword("lantone");
-        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/med_2021?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/cdss?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
         mpg.setDataSource(dsc);
 
         // 策略配置
         StrategyConfig strategy = new StrategyConfig();
         // strategy.setTablePrefix(new String[] { "demo_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "kl_diagnose","kl_diagnose_base","kl_diagnose_condition"}); // 需要生成的表
+        strategy.setInclude(new String[] { "sys_dept_push"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);

+ 91 - 0
src/test/java/com/diagbot/PrintUtil.java

@@ -0,0 +1,91 @@
+package com.diagbot;
+
+import com.diagbot.util.StringUtil;
+import com.google.common.collect.Lists;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 打印类的属性名和注释
+ * @author: zhoutg
+ * @time: 2021/5/18 14:48
+ */
+public class PrintUtil {
+
+    /**
+     * 输入字段名和注释
+     *
+     * @param path
+     */
+    public static void print(String path) {
+        List<String> list = Lists.newArrayList();
+        StringBuffer sb = new StringBuffer();
+        try {
+            BufferedReader br = new BufferedReader(
+                    new InputStreamReader(
+                            new FileInputStream(path), "UTF-8"));
+            String line = "";
+            while ((line = br.readLine()) != null) {
+                list.add(line);
+                sb.append(line.trim());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        String text = sb.toString();
+        // 截取有效内容
+        if (sb.indexOf("serialVersionUID = 1L;") >= 0) {
+            text = sb.substring(sb.indexOf("serialVersionUID = 1L;") + 22);
+        } else {
+            text = sb.substring(sb.indexOf("{") + 1);
+        }
+        List<String> stringList = Lists.newArrayList(text.split(";"));
+        Map<String, String> map = new LinkedHashMap<>();
+        String key = "";
+        String value = "";
+        for (String s : stringList) {
+            try {
+                if (s.indexOf("/*** ") >= 0) {
+                    value = s.substring(s.indexOf("/***") + 4, s.indexOf("*/")).trim();
+                } else if (s.indexOf("//") >= 0) {
+                    value = s.substring(s.indexOf("//") + 2, s.indexOf("private")).trim();
+                }
+                int index = s.indexOf("=");
+                if (index >= 0) { // 包含“=”,例如:// 科室列表private List<Long> deptList = Lists.newLinkedList()
+                    StringBuffer keySb = new StringBuffer();
+                    boolean insertflag = false; // 是否有效字符插入
+                    for (int i = index - 1; i >= 0; i--) {
+                        char ch = s.charAt(i);
+                        if (insertflag && StringUtil.isBlank(String.valueOf(ch))) {
+                            break;
+                        }
+                        if (StringUtil.isNotBlank(String.valueOf(ch))) {
+                            keySb.append(ch);
+                            insertflag = true;
+                        }
+                    }
+                    keySb.reverse();// 反转
+                    key = keySb.toString();
+                } else {    // 不包含“=”,例如: /*** 英文名称*/private String enName;
+                    key = s.substring(s.lastIndexOf(" ")).trim();
+                }
+                map.put(key, value);
+            } catch (Exception e) {
+                // 捕获异常不处理
+            }
+        }
+        for (String property : map.keySet()) {
+            System.out.println(property + ":" + map.get(property) + "");
+        }
+    }
+
+    public static void main(String[] args) {
+        String path = "D:\\diagbot\\diagbotcloud\\cdssman-service\\src\\main\\java\\com\\diagbot\\vo\\klSymptomVO.java";
+        print(path);
+    }
+}