瀏覽代碼

Merge branch 'develop' into dev/mrman20200117_init

gaodm 5 年之前
父節點
當前提交
318e6ce2c2
共有 73 個文件被更改,包括 9629 次插入72 次删除
  1. 41 0
      aipt-service/src/main/java/com/diagbot/client/AINeoServiceClient.java
  2. 49 0
      aipt-service/src/main/java/com/diagbot/client/hystrix/AINeoServiceHystrix.java
  3. 3 0
      aipt-service/src/main/java/com/diagbot/dto/FeatureConceptDTO.java
  4. 20 0
      aipt-service/src/main/java/com/diagbot/dto/FeatureDTO.java
  5. 25 10
      aipt-service/src/main/java/com/diagbot/facade/FeatureFacade.java
  6. 75 0
      aipt-service/src/main/java/com/diagbot/facade/FeatureV2Facade.java
  7. 91 0
      aipt-service/src/main/java/com/diagbot/facade/PushV2Facade.java
  8. 12 1
      aipt-service/src/main/java/com/diagbot/mapper/ConceptMapper.java
  9. 10 0
      aipt-service/src/main/java/com/diagbot/service/ConceptService.java
  10. 12 0
      aipt-service/src/main/java/com/diagbot/service/impl/ConceptServiceImpl.java
  11. 18 0
      aipt-service/src/main/java/com/diagbot/vo/ConceptNameVO.java
  12. 15 0
      aipt-service/src/main/java/com/diagbot/vo/NLPVO.java
  13. 37 0
      aipt-service/src/main/java/com/diagbot/web/FeatureV2Controller.java
  14. 44 0
      aipt-service/src/main/java/com/diagbot/web/PushV2Controller.java
  15. 25 0
      aipt-service/src/main/resources/mapper/ConceptMapper.xml
  16. 18 0
      common/src/main/java/com/diagbot/biz/push/entity/FeatureRateV2.java
  17. 16 0
      common/src/main/java/com/diagbot/biz/push/entity/FeatureRateWithExplainV2.java
  18. 26 0
      common/src/main/java/com/diagbot/biz/push/entity/ResponseDataV2.java
  19. 25 0
      common/src/main/java/com/diagbot/biz/push/entity/ResponseDataWithExplainV2.java
  20. 5 1
      config-server/src/main/resources/shared/aipt-service-dev.yml
  21. 5 1
      config-server/src/main/resources/shared/aipt-service-local.yml
  22. 5 1
      config-server/src/main/resources/shared/aipt-service-pre.yml
  23. 5 1
      config-server/src/main/resources/shared/aipt-service-pro.yml
  24. 5 1
      config-server/src/main/resources/shared/aipt-service-test.yml
  25. 24 3
      config-server/src/main/resources/shared/application-dev.yml
  26. 24 3
      config-server/src/main/resources/shared/application-local.yml
  27. 24 3
      config-server/src/main/resources/shared/application-pre.yml
  28. 24 3
      config-server/src/main/resources/shared/application-pro.yml
  29. 24 3
      config-server/src/main/resources/shared/application-test.yml
  30. 3 0
      docs/035.20190409智能分诊执行脚本/tran_alter.sql
  31. 8132 0
      docs/035.20200420邵逸夫智能分诊数据追加脚本/init_tran.sql
  32. 1 1
      ltkg-service/src/main/resources/mapper/KgMapper.xml
  33. 99 1
      prec-service/src/main/java/com/diagbot/facade/QuestionFacade.java
  34. 18 0
      prec-service/src/main/java/com/diagbot/vo/QuestionNameVO.java
  35. 20 0
      prec-service/src/main/java/com/diagbot/vo/QuestionNamesVO.java
  36. 24 2
      prec-service/src/main/java/com/diagbot/web/QuestionInfoController.java
  37. 5 0
      tran-service/src/main/java/com/diagbot/dto/DiseaseDeptDTO.java
  38. 14 0
      tran-service/src/main/java/com/diagbot/entity/DiseaseDept.java
  39. 9 0
      tran-service/src/main/java/com/diagbot/entity/InquiryTriage.java
  40. 10 0
      tran-service/src/main/java/com/diagbot/entity/OptInfo.java
  41. 8 0
      tran-service/src/main/java/com/diagbot/facade/DiseaseDeptFacade.java
  42. 2 0
      tran-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java
  43. 1 0
      tran-service/src/main/java/com/diagbot/facade/OptInfoFacade.java
  44. 4 0
      tran-service/src/main/java/com/diagbot/vo/HospitalVO.java
  45. 2 0
      tran-service/src/main/java/com/diagbot/vo/OptHospPageVO.java
  46. 2 0
      tran-service/src/main/java/com/diagbot/vo/OptHospVO.java
  47. 2 0
      tran-service/src/main/java/com/diagbot/vo/OptVO.java
  48. 3 0
      tran-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java
  49. 1 0
      tran-service/src/main/resources/mapper/InquiryTriageMapper.xml
  50. 19 0
      tran-service/src/main/resources/mapper/OptInfoMapper.xml
  51. 30 0
      triage-service/src/main/java/com/diagbot/client/AiptServiceClient.java
  52. 40 0
      triage-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java
  53. 26 0
      triage-service/src/main/java/com/diagbot/dto/ConceptPushDTO.java
  54. 5 0
      triage-service/src/main/java/com/diagbot/dto/DiseaseDeptDTO.java
  55. 2 1
      triage-service/src/main/java/com/diagbot/dto/FeatureConceptDTO.java
  56. 18 0
      triage-service/src/main/java/com/diagbot/dto/FeatureDTO.java
  57. 17 0
      triage-service/src/main/java/com/diagbot/dto/PushDTO.java
  58. 1 0
      triage-service/src/main/java/com/diagbot/dto/SYFDiseaseDeptDTO.java
  59. 1 0
      triage-service/src/main/java/com/diagbot/dto/SYFFeatureDTO.java
  60. 7 31
      triage-service/src/main/java/com/diagbot/facade/AIFacade.java
  61. 204 0
      triage-service/src/main/java/com/diagbot/facade/AIV2Facade.java
  62. 49 0
      triage-service/src/main/java/com/diagbot/facade/AssembleFacade.java
  63. 14 0
      triage-service/src/main/java/com/diagbot/facade/FeatureFacade.java
  64. 4 1
      triage-service/src/main/java/com/diagbot/vo/AIVO.java
  65. 3 0
      triage-service/src/main/java/com/diagbot/vo/HospitalVO.java
  66. 15 0
      triage-service/src/main/java/com/diagbot/vo/NLPVO.java
  67. 2 0
      triage-service/src/main/java/com/diagbot/vo/OptHospPageVO.java
  68. 2 0
      triage-service/src/main/java/com/diagbot/vo/OptHospVO.java
  69. 2 0
      triage-service/src/main/java/com/diagbot/vo/OptVO.java
  70. 3 0
      triage-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java
  71. 23 4
      triage-service/src/main/java/com/diagbot/web/AIController.java
  72. 38 0
      triage-service/src/main/java/com/diagbot/web/FeatureController.java
  73. 37 0
      triage-service/src/main/java/com/diagbot/web/FeatureV2Controller.java

+ 41 - 0
aipt-service/src/main/java/com/diagbot/client/AINeoServiceClient.java

@@ -0,0 +1,41 @@
+package com.diagbot.client;
+
+import com.diagbot.biz.push.entity.ResponseDataV2;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.SearchData;
+import com.diagbot.client.hystrix.AINeoServiceHystrix;
+import com.diagbot.dto.FeatureDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.NLPVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/16 16:27
+ */
+@FeignClient(name = "AINeo", url = "${aineo.server.address}", fallback = AINeoServiceHystrix.class)
+public interface AINeoServiceClient {
+
+    /**
+     * 推理
+     *
+     * @param searchData
+     * @return
+     */
+    @PostMapping(value = "/api/push")
+    Response<ResponseDataV2> push(@RequestBody SearchData searchData);
+
+    /**
+     * 特征词提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    @PostMapping(value = "/api/extract")
+    RespDTO<List<FeatureDTO>> extract(@RequestBody NLPVO nlpvo);
+}

+ 49 - 0
aipt-service/src/main/java/com/diagbot/client/hystrix/AINeoServiceHystrix.java

@@ -0,0 +1,49 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.biz.push.entity.ResponseDataV2;
+import com.diagbot.client.AINeoServiceClient;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.SearchData;
+import com.diagbot.dto.FeatureDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.NLPVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/16 16:27
+ */
+@Component
+@Slf4j
+public class AINeoServiceHystrix implements AINeoServiceClient {
+
+    /**
+     * 推理
+     *
+     * @param searchData
+     * @return
+     */
+    @Override
+    public Response<ResponseDataV2> push(@RequestBody SearchData searchData) {
+        log.error("【hystrix】调用{}异常", "push");
+        return null;
+    }
+
+    /**
+     * 特征词提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    @Override
+    public RespDTO<List<FeatureDTO>> extract(@RequestBody NLPVO nlpvo) {
+        log.error("【hystrix】调用{}异常", "extract");
+        return null;
+    }
+}

+ 3 - 0
aipt-service/src/main/java/com/diagbot/dto/FeatureConceptDTO.java

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 package com.diagbot.dto;
 
 
+import com.diagbot.annotation.CryptField;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 
 
@@ -14,4 +15,6 @@ public class FeatureConceptDTO extends ConceptBaseDTO {
     private Integer libType;
     private Integer libType;
     private Integer type;
     private Integer type;
     private Integer chronicLabel; //是否慢病复诊标志
     private Integer chronicLabel; //是否慢病复诊标志
+    @CryptField
+    private String origin;
 }
 }

+ 20 - 0
aipt-service/src/main/java/com/diagbot/dto/FeatureDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import com.diagbot.annotation.CryptField;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 13:42
+ */
+@Getter
+@Setter
+public class FeatureDTO {
+    private Long conceptId;
+    @CryptField
+    private String standard;
+    private Integer type;
+    private String origin;
+}

+ 25 - 10
aipt-service/src/main/java/com/diagbot/facade/FeatureFacade.java

@@ -1,12 +1,12 @@
 package com.diagbot.facade;
 package com.diagbot.facade;
 
 
 import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.FeatureConceptDTO;
-import com.diagbot.entity.Concept;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.exception.CommonException;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamConvertUtil;
 import com.diagbot.util.ParamConvertUtil;
+import com.diagbot.vo.ConceptNameVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
@@ -41,24 +41,39 @@ public class FeatureFacade {
 
 
         Map<Integer, List<FeatureConceptDTO>> symptomMap
         Map<Integer, List<FeatureConceptDTO>> symptomMap
                 = EntityUtil.makeEntityListMap(symptomFeatureList, "libType");
                 = EntityUtil.makeEntityListMap(symptomFeatureList, "libType");
-        Map<Integer, Map<String, Long>> map = new LinkedHashMap<>();
+        Map<Integer, Map<String, FeatureConceptDTO>> map = new LinkedHashMap<>();
         for (Map.Entry<Integer, List<FeatureConceptDTO>> entry : symptomMap.entrySet()) {
         for (Map.Entry<Integer, List<FeatureConceptDTO>> entry : symptomMap.entrySet()) {
-            List<Concept> concepts
-                    = conceptFacade.getListByNamesAndType(entry.getValue()
+            List<String> names = entry.getValue()
                     .stream()
                     .stream()
                     .map(i -> i.getName())
                     .map(i -> i.getName())
-                    .collect(Collectors.toList()), entry.getKey());
-            Map<String, Long> conceptMap
-                    = EntityUtil.makeMapWithKeyValue(concepts, "libName", "id");
+                    .collect(Collectors.toList());
+            ConceptNameVO conceptNameVO = new ConceptNameVO();
+            conceptNameVO.setNames(names);
+            conceptNameVO.setType(entry.getKey());
+            List<FeatureConceptDTO> featureConcepts = conceptFacade.getFeatureConcept(conceptNameVO);
+            Map<String, FeatureConceptDTO> conceptMap
+                    = EntityUtil.makeEntityMap(featureConcepts, "origin");
             map.put(entry.getKey(), conceptMap);
             map.put(entry.getKey(), conceptMap);
         }
         }
 
 
         for (FeatureConceptDTO featureConceptDTO : symptomFeatureList) {
         for (FeatureConceptDTO featureConceptDTO : symptomFeatureList) {
             if (null != featureConceptDTO.getLibType()) {
             if (null != featureConceptDTO.getLibType()) {
                 featureConceptDTO.setType(ParamConvertUtil.libConvert2Concept(featureConceptDTO.getLibType()));
                 featureConceptDTO.setType(ParamConvertUtil.libConvert2Concept(featureConceptDTO.getLibType()));
-                featureConceptDTO.setConceptId(map
-                        .get(featureConceptDTO.getLibType())
-                        .get(featureConceptDTO.getName()));
+                if (map.containsKey(featureConceptDTO.getLibType())
+                        && map.get(featureConceptDTO.getLibType()).containsKey(featureConceptDTO.getName())) {
+                    featureConceptDTO.setConceptId(map
+                            .get(featureConceptDTO.getLibType())
+                            .get(featureConceptDTO.getName())
+                            .getConceptId());
+                    featureConceptDTO.setOrigin(map
+                            .get(featureConceptDTO.getLibType())
+                            .get(featureConceptDTO.getName())
+                            .getOrigin());
+                    featureConceptDTO.setName(map
+                            .get(featureConceptDTO.getLibType())
+                            .get(featureConceptDTO.getName())
+                            .getName());
+                }
             }
             }
         }
         }
         return symptomFeatureList;
         return symptomFeatureList;

+ 75 - 0
aipt-service/src/main/java/com/diagbot/facade/FeatureV2Facade.java

@@ -0,0 +1,75 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.AINeoServiceClient;
+import com.diagbot.dto.FeatureDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.Concept;
+import com.diagbot.enums.LexiconTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.NLPVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 13:46
+ */
+@Component
+public class FeatureV2Facade {
+    @Autowired
+    private AINeoServiceClient aiNeoServiceClient;
+    @Autowired
+    private ConceptFacade conceptFacade;
+
+    /**
+     * 特征词提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    public List<FeatureDTO> extract(NLPVO nlpvo) {
+        RespDTO<List<FeatureDTO>> respDTO = aiNeoServiceClient.extract(nlpvo);
+        RespDTOUtil.respNGDealCover(respDTO, "特征词提取失败");
+        return respDTO.data;
+    }
+
+    /**
+     * 症状特征词提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    public List<FeatureDTO> symptomFeatureV2(NLPVO nlpvo) {
+        List<FeatureDTO> featureList = extract(nlpvo);
+        if (ListUtil.isNotEmpty(featureList)) {
+            List<FeatureDTO> symptoms = featureList
+                    .stream()
+                    .filter(i -> i.getType().equals(1))
+                    .collect(Collectors.toList());
+            List<String> names = symptoms
+                    .stream()
+                    .map(i -> i.getStandard())
+                    .collect(Collectors.toList());
+            List<Concept> concepts = conceptFacade.getListByNamesAndType(names, LexiconTypeEnum.SYMPTOM.getKey());
+            Map<String, Long> conceptMap
+                    = EntityUtil.makeMapWithKeyValue(concepts, "libName", "id");
+            symptoms.forEach(symptom -> {
+                if (conceptMap.containsKey(symptom.getStandard())) {
+                    symptom.setConceptId(conceptMap.get(symptom.getStandard()));
+                }
+            });
+            return symptoms;
+        } else {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "未提取到症状特征");
+        }
+    }
+}

+ 91 - 0
aipt-service/src/main/java/com/diagbot/facade/PushV2Facade.java

@@ -0,0 +1,91 @@
+package com.diagbot.facade;
+
+import com.diagbot.biz.push.entity.FeatureRate;
+import com.diagbot.biz.push.entity.FeatureRateV2;
+import com.diagbot.biz.push.entity.FeatureRateWithExplain;
+import com.diagbot.biz.push.entity.FeatureRateWithExplainV2;
+import com.diagbot.biz.push.entity.ResponseData;
+import com.diagbot.biz.push.entity.ResponseDataV2;
+import com.diagbot.biz.push.entity.ResponseDataWithExplain;
+import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
+import com.diagbot.biz.push.vo.SearchVO;
+import com.diagbot.client.AINeoServiceClient;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.bean.SearchData;
+import com.diagbot.entity.KlSymptom;
+import com.diagbot.enums.LexiconTypeEnum;
+import com.diagbot.enums.SysTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/16 16:32
+ */
+@Component
+public class PushV2Facade {
+    @Autowired
+    private AINeoServiceClient aiNeoServiceClient;
+    @Autowired
+    private AssembleFacade assembleFacade;
+    @Autowired
+    private ConceptFacade conceptFacade;
+
+    /**
+     * 大数据原始推理结果
+     *
+     * @param searchVO
+     * @return
+     */
+    public ResponseDataV2 originalPush(SearchVO searchVO) {
+        SearchData searchData = assembleFacade.assembleData(searchVO);
+        Response<ResponseDataV2> res = aiNeoServiceClient.push(searchData);
+        if (res == null || res.getData() == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "AI没有返回结果");
+        }
+        return res.getData();
+    }
+
+    /**
+     * 推理结果带名词解释
+     *
+     * @param searchVO
+     * @return
+     */
+    public ResponseDataWithExplainV2 pushWithExplain(SearchVO searchVO) {
+        ResponseDataWithExplainV2 responseData = new ResponseDataWithExplainV2();
+        ResponseDataV2 data = this.originalPush(searchVO);
+        List<FeatureRateV2> symptom = data.getSymptom();
+        if (ListUtil.isNotEmpty(symptom)
+                && (searchVO.getSysType().equals(SysTypeEnum.PREC_SERVICE.getKey())
+                || searchVO.getSysType().equals(SysTypeEnum.TRIAGE_SERVICE.getKey()))) {
+            List<String> names = symptom.stream().map(item -> item.getFeatureName()).collect(Collectors.toList());
+            Map<String, KlSymptom> klSymptomMap
+                    = conceptFacade.getSymptomWithExplain(names, LexiconTypeEnum.SYMPTOM.getKey());
+            List<FeatureRateWithExplainV2> featureRateWithExplains
+                    = BeanUtil.listCopyTo(symptom, FeatureRateWithExplainV2.class);
+            if (klSymptomMap != null) {
+                for (FeatureRateWithExplainV2 featureRateWithExplain : featureRateWithExplains) {
+                    if (klSymptomMap.containsKey(featureRateWithExplain.getFeatureName())) {
+                        featureRateWithExplain
+                                .setDescription(klSymptomMap.get(featureRateWithExplain.getFeatureName()).getDescription());
+                        featureRateWithExplain
+                                .setExplains(klSymptomMap.get(featureRateWithExplain.getFeatureName()).getExplains());
+                    }
+                }
+            }
+            responseData.setSymptom(featureRateWithExplains);
+        }
+        responseData.setDis(data.getDis());
+        return responseData;
+    }
+}

+ 12 - 1
aipt-service/src/main/java/com/diagbot/mapper/ConceptMapper.java

@@ -5,11 +5,13 @@ import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.ConceptWithOrderRes;
+import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptFindVO;
+import com.diagbot.vo.ConceptNameVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 
 
 import java.util.List;
 import java.util.List;
@@ -60,9 +62,18 @@ public interface ConceptMapper extends BaseMapper<Concept> {
 
 
     /**
     /**
      * 获得诊断依据问题词的标准词
      * 获得诊断依据问题词的标准词
+     *
      * @return
      * @return
      */
      */
     List<String> getStandWord();
     List<String> getStandWord();
 
 
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
-}
+
+    /**
+     * 特征词提取相关
+     *
+     * @param conceptNameVO
+     * @return
+     */
+    public List<FeatureConceptDTO> getFeatureConcept(ConceptNameVO conceptNameVO);
+}

+ 10 - 0
aipt-service/src/main/java/com/diagbot/service/ConceptService.java

@@ -5,11 +5,13 @@ import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.ConceptWithOrderRes;
+import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptFindVO;
+import com.diagbot.vo.ConceptNameVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 
 
 import java.util.List;
 import java.util.List;
@@ -74,4 +76,12 @@ public interface ConceptService extends IService<Concept> {
      */
      */
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO);
 
 
+    /**
+     * 特征词提取相关
+     *
+     * @param conceptNameVO
+     * @return
+     */
+    public List<FeatureConceptDTO> getFeatureConcept(ConceptNameVO conceptNameVO);
+
 }
 }

+ 12 - 0
aipt-service/src/main/java/com/diagbot/service/impl/ConceptServiceImpl.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.dto.ConceptWithOrderRes;
+import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.entity.wrapper.ConceptWrapper;
@@ -13,6 +14,7 @@ import com.diagbot.service.ConceptService;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptFindVO;
+import com.diagbot.vo.ConceptNameVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -103,4 +105,14 @@ public class ConceptServiceImpl extends ServiceImpl<ConceptMapper, Concept> impl
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO) {
     public List<ConceptBaseDTO> indexConcept(ConceptBaseVO conceptBaseVO) {
         return baseMapper.indexConcept(conceptBaseVO);
         return baseMapper.indexConcept(conceptBaseVO);
     }
     }
+
+    /**
+     * 特征词提取相关
+     *
+     * @param conceptNameVO
+     * @return
+     */
+    public List<FeatureConceptDTO> getFeatureConcept(ConceptNameVO conceptNameVO){
+        return baseMapper.getFeatureConcept(conceptNameVO);
+    }
 }
 }

+ 18 - 0
aipt-service/src/main/java/com/diagbot/vo/ConceptNameVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/28 13:11
+ */
+@Getter
+@Setter
+public class ConceptNameVO {
+    private List<String> names;
+    private Integer type;
+}

+ 15 - 0
aipt-service/src/main/java/com/diagbot/vo/NLPVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 13:41
+ */
+@Getter
+@Setter
+public class NLPVO {
+    private String text;
+}

+ 37 - 0
aipt-service/src/main/java/com/diagbot/web/FeatureV2Controller.java

@@ -0,0 +1,37 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.FeatureDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.FeatureV2Facade;
+import com.diagbot.vo.NLPVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 13:49
+ */
+@RestController
+@RequestMapping("/featureV2")
+@Api(value = "文本特征词提取V2相关API", tags = { "文本特征词提取V2相关API" })
+public class FeatureV2Controller {
+    @Autowired
+    private FeatureV2Facade featureV2Facade;
+
+    @ApiOperation(value = "知识库标准化-症状特征词提取", notes = "")
+    @PostMapping("/symptomFeatureV2")
+    @SysLogger("symptomFeatureV2")
+    public RespDTO<List<FeatureDTO>> symptomFeatureV2(@RequestBody NLPVO nlpvo) {
+        List<FeatureDTO> data = featureV2Facade.symptomFeatureV2(nlpvo);
+        return RespDTO.onSuc(data);
+    }
+}

+ 44 - 0
aipt-service/src/main/java/com/diagbot/web/PushV2Controller.java

@@ -0,0 +1,44 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.biz.push.entity.ResponseData;
+import com.diagbot.biz.push.entity.ResponseDataV2;
+import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
+import com.diagbot.biz.push.vo.SearchVO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.PushV2Facade;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/16 16:34
+ */
+@RestController
+@RequestMapping("/pushV2")
+@Api(value = "推理V2相关API", tags = { "知识库标准化-推理V2相关API" })
+public class PushV2Controller {
+    @Autowired
+    private PushV2Facade pushV2Facade;
+
+    @PostMapping("/originalPush")
+    @SysLogger("originalPush")
+    public RespDTO<ResponseDataV2> originalPush(@Valid @RequestBody SearchVO searchVO) {
+        ResponseDataV2 data = pushV2Facade.originalPush(searchVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @PostMapping("/pushWithExplainV2")
+    @SysLogger("pushWithExplainV2")
+    public RespDTO<ResponseDataWithExplainV2> pushWithExplainV2(@Valid @RequestBody SearchVO searchVO) {
+        ResponseDataWithExplainV2 data = pushV2Facade.pushWithExplain(searchVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 25 - 0
aipt-service/src/main/resources/mapper/ConceptMapper.xml

@@ -1288,4 +1288,29 @@
         and a.type_id = #{libType} and b.lib_type = #{libType}
         and a.type_id = #{libType} and b.lib_type = #{libType}
     </select>
     </select>
 
 
+
+    <select id="getFeatureConcept" resultType="com.diagbot.dto.FeatureConceptDTO" parameterType="com.diagbot.vo.ConceptNameVO">
+        SELECT
+        a.NAME AS origin,
+        b.lib_name AS NAME,
+        b.id AS conceptId,
+        b.lib_type AS libType
+        FROM
+        kl_library_info a,
+        kl_concept b
+        WHERE
+        a.concept_id = b.id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        <if test="type!=null and type !=''">
+            AND a.type_id = #{type}
+            AND b.lib_type = #{type}
+        </if>
+        <if test="names!=null and names.size>0">
+            AND a.name IN
+            <foreach collection="names" item="name" open="(" close=")" separator=",">
+                #{name}
+            </foreach>
+        </if>
+    </select>
 </mapper>
 </mapper>

+ 18 - 0
common/src/main/java/com/diagbot/biz/push/entity/FeatureRateV2.java

@@ -0,0 +1,18 @@
+package com.diagbot.biz.push.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 10:19
+ */
+@Getter
+@Setter
+public class FeatureRateV2 extends FeatureRate {
+    /**
+     * 诊断分类
+     */
+    private String bigClass;
+}

+ 16 - 0
common/src/main/java/com/diagbot/biz/push/entity/FeatureRateWithExplainV2.java

@@ -0,0 +1,16 @@
+package com.diagbot.biz.push.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 10:24
+ */
+@Getter
+@Setter
+public class FeatureRateWithExplainV2 extends FeatureRateV2 {
+    private String description;
+    private String explains;
+}

+ 26 - 0
common/src/main/java/com/diagbot/biz/push/entity/ResponseDataV2.java

@@ -0,0 +1,26 @@
+package com.diagbot.biz.push.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 10:13
+ */
+@Getter
+@Setter
+public class ResponseDataV2 {
+    /**
+     * 症状
+     */
+    private List<FeatureRateV2> symptom = new ArrayList<>(10);
+
+    /**
+     * 诊断
+     */
+    private List<FeatureRateV2> dis = new ArrayList<>(10);
+}

+ 25 - 0
common/src/main/java/com/diagbot/biz/push/entity/ResponseDataWithExplainV2.java

@@ -0,0 +1,25 @@
+package com.diagbot.biz.push.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 10:25
+ */
+@Getter
+@Setter
+public class ResponseDataWithExplainV2 {
+    /**
+     * 症状
+     */
+    private List<FeatureRateWithExplainV2> symptom = new ArrayList<>(10);
+    /**
+     * 诊断
+     */
+    private List<FeatureRateV2> dis = new ArrayList<>(10);
+}

+ 5 - 1
config-server/src/main/resources/shared/aipt-service-dev.yml

@@ -103,4 +103,8 @@ ai:
 
 
 nlp:
 nlp:
   server:
   server:
-    address: http://192.168.2.234:5002
+    address: http://192.168.2.234:5002
+
+aineo:
+  server:
+    address: http://192.168.2.234:8888

+ 5 - 1
config-server/src/main/resources/shared/aipt-service-local.yml

@@ -103,4 +103,8 @@ ai:
 
 
 nlp:
 nlp:
   server:
   server:
-    address: http://192.168.2.234:5002
+    address: http://192.168.2.234:5002
+
+aineo:
+  server:
+    address: http://192.168.2.234:8888

+ 5 - 1
config-server/src/main/resources/shared/aipt-service-pre.yml

@@ -103,4 +103,8 @@ ai:
 
 
 nlp:
 nlp:
   server:
   server:
-    address: http://192.168.2.186:5002
+    address: http://192.168.2.186:5002
+
+aineo:
+  server:
+    address: http://192.168.3.150:8888

+ 5 - 1
config-server/src/main/resources/shared/aipt-service-pro.yml

@@ -103,4 +103,8 @@ ai:
 
 
 nlp:
 nlp:
   server:
   server:
-    address: http://192.168.2.123:5002
+    address: http://192.168.2.123:5002
+
+aineo:
+  server:
+    address: http://192.168.2.123:8888

+ 5 - 1
config-server/src/main/resources/shared/aipt-service-test.yml

@@ -103,4 +103,8 @@ ai:
 
 
 nlp:
 nlp:
   server:
   server:
-    address: http://192.168.2.241:5002
+    address: http://192.168.2.241:5002
+
+aineo:
+  server:
+    address: http://192.168.3.150:8888

+ 24 - 3
config-server/src/main/resources/shared/application-dev.yml

@@ -3,10 +3,20 @@
 #    org.springframework.security: INFO
 #    org.springframework.security: INFO
 
 
 hystrix:
 hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
   command:
   command:
     default:
     default:
       execution:
       execution:
+        timeout:
+          enabled: true
         isolation:
         isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
           thread:
           thread:
             timeoutInMilliseconds: 20000
             timeoutInMilliseconds: 20000
 
 
@@ -16,6 +26,20 @@ ribbon:
   MaxAutoRetries: 0
   MaxAutoRetries: 0
   MaxAutoRetriesNextServer: 1
   MaxAutoRetriesNextServer: 1
 
 
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
 eureka:
 eureka:
   instance:
   instance:
     prefer-ip-address: true #使用IP注册
     prefer-ip-address: true #使用IP注册
@@ -50,9 +74,6 @@ management:
   endpoint:
   endpoint:
     health:
     health:
       show-details: always
       show-details: always
-feign:
-  hystrix:
-    enabled: true
 
 
 spring:
 spring:
   #消息总线
   #消息总线

+ 24 - 3
config-server/src/main/resources/shared/application-local.yml

@@ -3,10 +3,20 @@
 #    org.springframework.security: INFO
 #    org.springframework.security: INFO
 
 
 hystrix:
 hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
   command:
   command:
     default:
     default:
       execution:
       execution:
+        timeout:
+          enabled: true
         isolation:
         isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
           thread:
           thread:
             timeoutInMilliseconds: 20000
             timeoutInMilliseconds: 20000
 
 
@@ -16,6 +26,20 @@ ribbon:
   MaxAutoRetries: 0
   MaxAutoRetries: 0
   MaxAutoRetriesNextServer: 1
   MaxAutoRetriesNextServer: 1
 
 
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
 eureka:
 eureka:
   instance:
   instance:
     prefer-ip-address: true #使用IP注册
     prefer-ip-address: true #使用IP注册
@@ -50,9 +74,6 @@ management:
   endpoint:
   endpoint:
     health:
     health:
       show-details: always
       show-details: always
-feign:
-  hystrix:
-    enabled: true
 
 
 spring:
 spring:
   #消息总线
   #消息总线

+ 24 - 3
config-server/src/main/resources/shared/application-pre.yml

@@ -3,10 +3,20 @@
 #    org.springframework.security: INFO
 #    org.springframework.security: INFO
 
 
 hystrix:
 hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
   command:
   command:
     default:
     default:
       execution:
       execution:
+        timeout:
+          enabled: true
         isolation:
         isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
           thread:
           thread:
             timeoutInMilliseconds: 20000
             timeoutInMilliseconds: 20000
 
 
@@ -16,6 +26,20 @@ ribbon:
   MaxAutoRetries: 0
   MaxAutoRetries: 0
   MaxAutoRetriesNextServer: 1
   MaxAutoRetriesNextServer: 1
 
 
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
 eureka:
 eureka:
   instance:
   instance:
     prefer-ip-address: true #使用IP注册
     prefer-ip-address: true #使用IP注册
@@ -50,9 +74,6 @@ management:
   endpoint:
   endpoint:
     health:
     health:
       show-details: always
       show-details: always
-feign:
-  hystrix:
-    enabled: true
 
 
 spring:
 spring:
   #消息总线
   #消息总线

+ 24 - 3
config-server/src/main/resources/shared/application-pro.yml

@@ -3,10 +3,20 @@
 #    org.springframework.security: INFO
 #    org.springframework.security: INFO
 
 
 hystrix:
 hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
   command:
   command:
     default:
     default:
       execution:
       execution:
+        timeout:
+          enabled: true
         isolation:
         isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
           thread:
           thread:
             timeoutInMilliseconds: 20000
             timeoutInMilliseconds: 20000
 
 
@@ -16,6 +26,20 @@ ribbon:
   MaxAutoRetries: 0
   MaxAutoRetries: 0
   MaxAutoRetriesNextServer: 1
   MaxAutoRetriesNextServer: 1
 
 
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
 eureka:
 eureka:
   instance:
   instance:
     prefer-ip-address: true #使用IP注册
     prefer-ip-address: true #使用IP注册
@@ -50,9 +74,6 @@ management:
   endpoint:
   endpoint:
     health:
     health:
       show-details: always
       show-details: always
-feign:
-  hystrix:
-    enabled: true
 
 
 spring:
 spring:
   #消息总线
   #消息总线

+ 24 - 3
config-server/src/main/resources/shared/application-test.yml

@@ -3,10 +3,20 @@
 #    org.springframework.security: INFO
 #    org.springframework.security: INFO
 
 
 hystrix:
 hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
   command:
   command:
     default:
     default:
       execution:
       execution:
+        timeout:
+          enabled: true
         isolation:
         isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
           thread:
           thread:
             timeoutInMilliseconds: 20000
             timeoutInMilliseconds: 20000
 
 
@@ -16,6 +26,20 @@ ribbon:
   MaxAutoRetries: 0
   MaxAutoRetries: 0
   MaxAutoRetriesNextServer: 1
   MaxAutoRetriesNextServer: 1
 
 
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
 eureka:
 eureka:
   instance:
   instance:
     prefer-ip-address: true #使用IP注册
     prefer-ip-address: true #使用IP注册
@@ -50,9 +74,6 @@ management:
   endpoint:
   endpoint:
     health:
     health:
       show-details: always
       show-details: always
-feign:
-  hystrix:
-    enabled: true
 
 
 spring:
 spring:
   #消息总线
   #消息总线

+ 3 - 0
docs/035.20190409智能分诊执行脚本/tran_alter.sql

@@ -0,0 +1,3 @@
+use `sys-tran`;
+ALTER TABLE `sys-tran`.`tran_opt_info` ADD COLUMN `way_type` INT(11) NULL COMMENT '1咨询医生2预约挂号3去挂号' AFTER `opt_type`;
+ALTER TABLE `sys-tran`.`tran_inquiry_triage` CHANGE `id_type` `id_type` TINYINT(4) DEFAULT 0 NOT NULL COMMENT '1咨询医生2预约挂号3结果页去挂号4非结果去挂号', ADD COLUMN `correlation` VARCHAR(255) NOT NULL COMMENT '相关情况' AFTER `symptom`;

文件差異過大導致無法顯示
+ 8132 - 0
docs/035.20200420邵逸夫智能分诊数据追加脚本/init_tran.sql


+ 1 - 1
ltkg-service/src/main/resources/mapper/KgMapper.xml

@@ -38,7 +38,7 @@
     <select id="getGraph" parameterType='com.diagbot.vo.KgQueryVO' resultMap="GraphResultMap">
     <select id="getGraph" parameterType='com.diagbot.vo.KgQueryVO' resultMap="GraphResultMap">
         MATCH (n:${labelName})-[r]->(m)
         MATCH (n:${labelName})-[r]->(m)
         where n.name = #{inputStr}
         where n.name = #{inputStr}
-        OPTIONAL MATCH p=(m)-[]->(o) where head(Labels(m)) in ["diagnose","symptom"]
+        OPTIONAL MATCH p=(m)-[]->(o) where head(Labels(m)) in ["疾病","症状","药品通用名"]
         RETURN head(Labels(n)) as sLabel,n.name as sName,Type (r) as rType, head(Labels(m)) as eLabel,m.name as eName, count(p) as pCount
         RETURN head(Labels(n)) as sLabel,n.name as sName,Type (r) as rType, head(Labels(m)) as eLabel,m.name as eName, count(p) as pCount
         ORDER BY rType
         ORDER BY rType
         LIMIT 100
         LIMIT 100

+ 99 - 1
prec-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -6,18 +6,25 @@ import com.diagbot.entity.QuestionDetail;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 import com.diagbot.entity.wrapper.QuestionInfoWrapper;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.QuestionInfoServiceImpl;
 import com.diagbot.service.impl.QuestionInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.QuestionIds2VO;
 import com.diagbot.vo.QuestionIds2VO;
+import com.diagbot.vo.QuestionNameVO;
+import com.diagbot.vo.QuestionNamesVO;
 import com.diagbot.vo.QuestionVO;
 import com.diagbot.vo.QuestionVO;
+import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -105,6 +112,98 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
         return res;
         return res;
     }
     }
 
 
+    /**
+     * 根据名称获取标签
+     *
+     * @param questionNameVO
+     * @return
+     */
+    public QuestionDTO getByName(QuestionNameVO questionNameVO) {
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        List<Integer> sexTypeList = Lists.newArrayList();
+        sexTypeList.add(questionNameVO.getSexType());
+        if (!questionNameVO.getSexType().equals(3)) {
+            sexTypeList.add(3);
+        }
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in(ListUtil.isNotEmpty(sexTypeList), "sex_type", sexTypeList)
+                .apply("({0} between age_begin and age_end)", questionNameVO.getAge())
+                .eq("type", questionNameVO.getType())
+                .eq("tag_type", 4)
+                .eq("tag_name", questionNameVO.getName());
+        QuestionInfo questionInfo = this.getOne(questionInfoQueryWrapper);
+        if (questionInfo != null) {
+            QuestionVO questionVO = new QuestionVO();
+            questionVO.setId(questionInfo.getId());
+            questionVO.setSexType(questionNameVO.getSexType());
+            questionVO.setAge(questionNameVO.getAge());
+            QuestionDTO questionDTO = this.getById(questionVO);
+            return questionDTO;
+        } else {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "症状问题不存在!");
+        }
+    }
+
+    /**
+     * 根据名称批量获取标签
+     *
+     * @param questionNamesVO
+     * @return
+     */
+    public Map<String, Object> getByNames(QuestionNamesVO questionNamesVO) {
+        Map<String, Object> retMap = new LinkedHashMap<>();
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        List<Integer> sexTypeList = Lists.newArrayList();
+        sexTypeList.add(questionNamesVO.getSexType());
+        if (!questionNamesVO.getSexType().equals(3)) {
+            sexTypeList.add(3);
+        }
+        if (ListUtil.isEmpty(questionNamesVO.getNames())) {
+            return retMap;
+        }
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in(ListUtil.isNotEmpty(sexTypeList), "sex_type", sexTypeList)
+                .apply("({0} between age_begin and age_end)", questionNamesVO.getAge())
+                .eq("type", questionNamesVO.getType())
+                .eq("tag_type", 4)
+                .in(ListUtil.isNotEmpty(questionNamesVO.getNames()), "tag_name", questionNamesVO.getNames());
+        List<QuestionInfo> questionInfoList = this.list(questionInfoQueryWrapper);
+
+        if (ListUtil.isEmpty(questionInfoList)) {
+            return  retMap;
+        }
+
+        //同名的只保留第一个
+        Map<String, Long> nameMap = new LinkedHashMap<>();
+        Iterator<QuestionInfo> iterator = questionInfoList.iterator();
+        while (iterator.hasNext()) {
+            QuestionInfo next = iterator.next();
+            if (nameMap.containsKey(next.getTagName())) {
+                iterator.remove();
+            } else {
+                nameMap.put(next.getTagName(), next.getId());
+            }
+        }
+        if (null == nameMap) {
+            return null;
+        }
+        QuestionIds2VO questionIds2VO = new QuestionIds2VO();
+        questionIds2VO.setIds(new LinkedList<>(nameMap.values()));
+        questionIds2VO.setSexType(questionNamesVO.getSexType());
+        questionIds2VO.setAge(questionNamesVO.getAge());
+
+        Map<Long, Object> questionMap = this.getByIds(questionIds2VO);
+
+        if (questionMap != null) {
+            nameMap.entrySet().forEach(entry -> {
+                if (questionMap.containsKey(entry.getValue())) {
+                    retMap.put(entry.getKey(), questionMap.get(entry.getValue()));
+                }
+            });
+        }
+        return retMap;
+    }
+
 
 
     /**
     /**
      * 查询多个id返回标签内容
      * 查询多个id返回标签内容
@@ -223,5 +322,4 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
         mappIds.addAll(list);
         mappIds.addAll(list);
         return EntityUtil.makeEntityListMap(questionMapping1, "parentQuestion");
         return EntityUtil.makeEntityListMap(questionMapping1, "parentQuestion");
     }
     }
-
 }
 }

+ 18 - 0
prec-service/src/main/java/com/diagbot/vo/QuestionNameVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/9 15:57
+ */
+@Getter
+@Setter
+public class QuestionNameVO {
+    private String name;
+    private Integer sexType;
+    private Integer age;
+    private Integer type;
+}

+ 20 - 0
prec-service/src/main/java/com/diagbot/vo/QuestionNamesVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/10 13:50
+ */
+@Getter
+@Setter
+public class QuestionNamesVO {
+    private List<String> names;
+    private Integer sexType;
+    private Integer age;
+    private Integer type;
+}

+ 24 - 2
prec-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -4,6 +4,8 @@ import com.diagbot.dto.QuestionDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.QuestionFacade;
 import com.diagbot.facade.QuestionFacade;
 import com.diagbot.vo.QuestionIds2VO;
 import com.diagbot.vo.QuestionIds2VO;
+import com.diagbot.vo.QuestionNameVO;
+import com.diagbot.vo.QuestionNamesVO;
 import com.diagbot.vo.QuestionVO;
 import com.diagbot.vo.QuestionVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -42,6 +44,28 @@ public class QuestionInfoController {
         return RespDTO.onSuc(data);
         return RespDTO.onSuc(data);
     }
     }
 
 
+    @ApiOperation(value = "智能预问诊-根据参数返回标签内容[by:zhaops]",
+            notes = "name: 标签名称<br>" +
+                    "sexType:性别,1:男,2:女<br>" +
+                    "type:标签类型,1:症状 3:其他史 51:诊疗情况 52:补充 <br>" +
+                    "age:年龄")
+    @PostMapping("/getByName")
+    public RespDTO<QuestionDTO> getByName(@RequestBody QuestionNameVO questionNameVO) {
+        QuestionDTO data = questionFacade.getByName(questionNameVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "智能预问诊-根据参数返回标签内容[by:zhaops]",
+            notes = "name: 标签名称<br>" +
+                    "sexType:性别,1:男,2:女<br>" +
+                    "type:标签类型,1:症状 3:其他史 51:诊疗情况 52:补充 <br>" +
+                    "age:年龄")
+    @PostMapping("/getByNames")
+    public RespDTO<Map<String, Object>> getByNames(@RequestBody QuestionNamesVO questionNamesVO) {
+        Map<String, Object> data = questionFacade.getByNames(questionNamesVO);
+        return RespDTO.onSuc(data);
+    }
+
 
 
     @ApiOperation(value = "智能预问诊-查询多个id优化[by:zhoutg]",
     @ApiOperation(value = "智能预问诊-查询多个id优化[by:zhoutg]",
             notes = "ids: 多个questionId<br>" +
             notes = "ids: 多个questionId<br>" +
@@ -52,6 +76,4 @@ public class QuestionInfoController {
         Map<Long, Object> data = questionFacade.getByIds(questionIds2VO);
         Map<Long, Object> data = questionFacade.getByIds(questionIds2VO);
         return RespDTO.onSuc(data);
         return RespDTO.onSuc(data);
     }
     }
-
-
 }
 }

+ 5 - 0
tran-service/src/main/java/com/diagbot/dto/DiseaseDeptDTO.java

@@ -60,4 +60,9 @@ public class DiseaseDeptDTO {
      * 医院科室地址
      * 医院科室地址
      */
      */
     private String url;
     private String url;
+
+    /**
+     * 建议
+     */
+    private String suggestion;
 }
 }

+ 14 - 0
tran-service/src/main/java/com/diagbot/entity/DiseaseDept.java

@@ -103,6 +103,11 @@ public class DiseaseDept implements Serializable {
      */
      */
     private String url;
     private String url;
 
 
+    /**
+     * 建议
+     */
+    private String suggestion;
+
     /**
     /**
      * 备注
      * 备注
      */
      */
@@ -252,6 +257,14 @@ public class DiseaseDept implements Serializable {
         this.url = url;
         this.url = url;
     }
     }
 
 
+    public String getSuggestion() {
+        return suggestion;
+    }
+
+    public void setSuggestion(String suggestion) {
+        this.suggestion = suggestion;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "DiseaseDept{" +
         return "DiseaseDept{" +
@@ -272,6 +285,7 @@ public class DiseaseDept implements Serializable {
                 ", deptCode=" + deptCode +
                 ", deptCode=" + deptCode +
                 ", status=" + status +
                 ", status=" + status +
                 ", url=" + url +
                 ", url=" + url +
+                ", suggestion=" + suggestion +
                 ", remark=" + remark +
                 ", remark=" + remark +
                 "}";
                 "}";
     }
     }

+ 9 - 0
tran-service/src/main/java/com/diagbot/entity/InquiryTriage.java

@@ -101,11 +101,20 @@ public class InquiryTriage implements Serializable {
      */
      */
     private String disDept;
     private String disDept;
 
 
+    private String correlation;
     /**
     /**
      * 备注
      * 备注
      */
      */
     private String remark;
     private String remark;
 
 
+    public String getCorrelation() {
+        return correlation;
+    }
+
+    public void setCorrelation(String correlation) {
+        this.correlation = correlation;
+    }
+
     public Long getId() {
     public Long getId() {
         return id;
         return id;
     }
     }

+ 10 - 0
tran-service/src/main/java/com/diagbot/entity/OptInfo.java

@@ -76,6 +76,16 @@ public class OptInfo implements Serializable {
      */
      */
     private String remark;
     private String remark;
 
 
+    private Integer wayType;
+
+    public Integer getWayType() {
+        return wayType;
+    }
+
+    public void setWayType(Integer wayType) {
+        this.wayType = wayType;
+    }
+
     public Long getId() {
     public Long getId() {
         return id;
         return id;
     }
     }

+ 8 - 0
tran-service/src/main/java/com/diagbot/facade/DiseaseDeptFacade.java

@@ -8,10 +8,12 @@ import com.diagbot.enums.StatusEnum;
 import com.diagbot.service.impl.DiseaseDeptServiceImpl;
 import com.diagbot.service.impl.DiseaseDeptServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.DiseaseDeptVO;
 import com.diagbot.vo.DiseaseDeptVO;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * @Description:
  * @Description:
@@ -34,6 +36,12 @@ public class DiseaseDeptFacade extends DiseaseDeptServiceImpl {
                 .eq("hospital_code", diseaseDeptVO.getHospitalCode())
                 .eq("hospital_code", diseaseDeptVO.getHospitalCode())
                 .in(ListUtil.isNotEmpty(diseaseDeptVO.getConceptNames()), "concept_dis_name", diseaseDeptVO.getConceptNames());
                 .in(ListUtil.isNotEmpty(diseaseDeptVO.getConceptNames()), "concept_dis_name", diseaseDeptVO.getConceptNames());
         List<DiseaseDept> diseaseDeptList = this.list(queryWrapper);
         List<DiseaseDept> diseaseDeptList = this.list(queryWrapper);
+        //过滤科室为空的数据和诊断分类为空的数据
+        diseaseDeptList = diseaseDeptList
+                .stream()
+                .filter(i -> StringUtil.isNotBlank(i.getDeptName()))
+                .filter(i -> StringUtil.isNotBlank(i.getDiseaseName()))
+                .collect(Collectors.toList());
         List<DiseaseDeptDTO> diseaseDeptDTOList = BeanUtil.listCopyTo(diseaseDeptList, DiseaseDeptDTO.class);
         List<DiseaseDeptDTO> diseaseDeptDTOList = BeanUtil.listCopyTo(diseaseDeptList, DiseaseDeptDTO.class);
         return diseaseDeptDTOList;
         return diseaseDeptDTOList;
     }
     }

+ 2 - 0
tran-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java

@@ -80,6 +80,7 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
         HospitalVO hospitalVO = new HospitalVO();
         HospitalVO hospitalVO = new HospitalVO();
         hospitalVO.setHospitalCode(saveInquiryVO.getHospitalCode());
         hospitalVO.setHospitalCode(saveInquiryVO.getHospitalCode());
         hospitalVO.setSysType(saveInquiryVO.getSysType());
         hospitalVO.setSysType(saveInquiryVO.getSysType());
+        hospitalVO.setWayType(saveInquiryVO.getIdType());
         // 保存记录表
         // 保存记录表
         optInfoFacade.saveOptOnfo(hospitalVO, "2");
         optInfoFacade.saveOptOnfo(hospitalVO, "2");
         //邵逸夫医院 分诊对接纳里时,返回科室编码
         //邵逸夫医院 分诊对接纳里时,返回科室编码
@@ -207,6 +208,7 @@ public class InquiryTriageFacade extends InquiryTriageServiceImpl {
         body.put("patSex", saveInquiryVO.getPatSex());
         body.put("patSex", saveInquiryVO.getPatSex());
         body.put("idType", saveInquiryVO.getIdType());
         body.put("idType", saveInquiryVO.getIdType());
         body.put("symptom", saveInquiryVO.getSymptom());
         body.put("symptom", saveInquiryVO.getSymptom());
+        body.put("correlation", saveInquiryVO.getCorrelation());
         body.put("supplement", saveInquiryVO.getSupplement());
         body.put("supplement", saveInquiryVO.getSupplement());
 
 
         bodyList.add(body);
         bodyList.add(body);

+ 1 - 0
tran-service/src/main/java/com/diagbot/facade/OptInfoFacade.java

@@ -48,6 +48,7 @@ public class OptInfoFacade extends OptInfoServiceImpl {
         optInfo.setHospitalCode(StringUtil.isNotBlank(hospitalVO.getHospitalCode()) ? hospitalVO.getHospitalCode() : "朗通通用");
         optInfo.setHospitalCode(StringUtil.isNotBlank(hospitalVO.getHospitalCode()) ? hospitalVO.getHospitalCode() : "朗通通用");
         optInfo.setOptType(optType);
         optInfo.setOptType(optType);
         optInfo.setSysType(hospitalVO.getSysType());
         optInfo.setSysType(hospitalVO.getSysType());
+        optInfo.setWayType(hospitalVO.getWayType());
         Boolean res = this.save(optInfo);
         Boolean res = this.save(optInfo);
         return res;
         return res;
     }
     }

+ 4 - 0
tran-service/src/main/java/com/diagbot/vo/HospitalVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 package com.diagbot.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 
 
@@ -17,4 +18,7 @@ public class HospitalVO {
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      */
      */
     private Integer sysType;
     private Integer sysType;
+
+    @ApiModelProperty(hidden = true)
+    private Integer wayType;
 }
 }

+ 2 - 0
tran-service/src/main/java/com/diagbot/vo/OptHospPageVO.java

@@ -36,4 +36,6 @@ public class OptHospPageVO extends Page {
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      */
      */
     private Integer sysType;
     private Integer sysType;
+
+    private Integer wayType;
 }
 }

+ 2 - 0
tran-service/src/main/java/com/diagbot/vo/OptHospVO.java

@@ -32,4 +32,6 @@ public class OptHospVO {
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      */
      */
     private Integer sysType;
     private Integer sysType;
+
+    private Integer wayType;
 }
 }

+ 2 - 0
tran-service/src/main/java/com/diagbot/vo/OptVO.java

@@ -32,4 +32,6 @@ public class OptVO {
     private Integer sysType;
     private Integer sysType;
     //医院名称列表
     //医院名称列表
     private List<String> hospitalCodeList;
     private List<String> hospitalCodeList;
+
+    private Integer wayType;
 }
 }

+ 3 - 0
tran-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -61,4 +61,7 @@ public class SaveInquiryTriageVO {
 
 
     @ApiModelProperty(value = "用户Id")
     @ApiModelProperty(value = "用户Id")
     private String mpiId;
     private String mpiId;
+
+    @ApiModelProperty(value = "相关情况")
+    private String correlation;
 }
 }

+ 1 - 0
tran-service/src/main/resources/mapper/InquiryTriageMapper.xml

@@ -18,6 +18,7 @@
         <result column="id_type" property="idType" />
         <result column="id_type" property="idType" />
         <result column="id_num" property="idNum" />
         <result column="id_num" property="idNum" />
         <result column="symptom" property="symptom" />
         <result column="symptom" property="symptom" />
+        <result column="correlation" property="correlation" />
         <result column="supplement" property="supplement" />
         <result column="supplement" property="supplement" />
         <result column="dis_dept" property="disDept" />
         <result column="dis_dept" property="disDept" />
         <result column="remark" property="remark" />
         <result column="remark" property="remark" />

+ 19 - 0
tran-service/src/main/resources/mapper/OptInfoMapper.xml

@@ -14,6 +14,7 @@
         <result column="hospital_code" property="hospitalCode" />
         <result column="hospital_code" property="hospitalCode" />
         <result column="ip" property="ip" />
         <result column="ip" property="ip" />
         <result column="opt_type" property="optType" />
         <result column="opt_type" property="optType" />
+        <result column="way_type" property="wayType" />
         <result column="remark" property="remark" />
         <result column="remark" property="remark" />
     </resultMap>
     </resultMap>
     <select id="getPV" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.PVDTO">
     <select id="getPV" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.PVDTO">
@@ -136,6 +137,9 @@
         tran_opt_info
         tran_opt_info
         WHERE
         WHERE
         opt_type = 2
         opt_type = 2
+        <if test="wayType != null and wayType != ''">
+            AND way_type = #{wayType}
+        </if>
         <if test="hospitalCode != null and hospitalCode != ''">
         <if test="hospitalCode != null and hospitalCode != ''">
             AND hospital_code = #{hospitalCode}
             AND hospital_code = #{hospitalCode}
         </if>
         </if>
@@ -167,6 +171,9 @@
         tran_opt_info
         tran_opt_info
         WHERE
         WHERE
         opt_type = 2
         opt_type = 2
+        <if test="wayType != null and wayType != ''">
+            AND way_type = #{wayType}
+        </if>
         <if test="hospitalCode != null and hospitalCode != ''">
         <if test="hospitalCode != null and hospitalCode != ''">
             AND hospital_code = #{hospitalCode}
             AND hospital_code = #{hospitalCode}
         </if>
         </if>
@@ -327,6 +334,9 @@
         tran_opt_info
         tran_opt_info
         WHERE
         WHERE
         opt_type = 2
         opt_type = 2
+        <if test="wayType != null and wayType != ''">
+            AND way_type = #{wayType}
+        </if>
         <if test="hospitalCode != null and hospitalCode != ''">
         <if test="hospitalCode != null and hospitalCode != ''">
             AND hospital_code = #{hospitalCode}
             AND hospital_code = #{hospitalCode}
         </if>
         </if>
@@ -364,6 +374,9 @@
         tran_opt_info
         tran_opt_info
         WHERE
         WHERE
         opt_type = 2
         opt_type = 2
+        <if test="wayType != null and wayType != ''">
+            AND way_type = #{wayType}
+        </if>
         <if test="hospitalCode != null and hospitalCode != ''">
         <if test="hospitalCode != null and hospitalCode != ''">
             AND hospital_code = #{hospitalCode}
             AND hospital_code = #{hospitalCode}
         </if>
         </if>
@@ -428,6 +441,9 @@
         tran_opt_info
         tran_opt_info
         WHERE
         WHERE
         opt_type = 2
         opt_type = 2
+        <if test="wayType != null and wayType != ''">
+            AND way_type = #{wayType}
+        </if>
         <if test="startDate!=null">
         <if test="startDate!=null">
             AND gmt_create &gt;= #{startDate}
             AND gmt_create &gt;= #{startDate}
         </if>
         </if>
@@ -523,6 +539,9 @@
                 tran_opt_info
                 tran_opt_info
                 WHERE
                 WHERE
                 opt_type = 2
                 opt_type = 2
+                <if test="wayType != null and wayType != ''">
+                    AND way_type = #{wayType}
+                </if>
                 <if test="startDate!=null">
                 <if test="startDate!=null">
                     AND gmt_create &gt;= #{startDate}
                     AND gmt_create &gt;= #{startDate}
                 </if>
                 </if>

+ 30 - 0
triage-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -2,17 +2,20 @@ package com.diagbot.client;
 
 
 import com.diagbot.biz.push.entity.ResponseData;
 import com.diagbot.biz.push.entity.ResponseData;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
+import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
 import com.diagbot.biz.push.vo.SearchVO;
 import com.diagbot.biz.push.vo.SearchVO;
 import com.diagbot.client.hystrix.AiptServiceHystrix;
 import com.diagbot.client.hystrix.AiptServiceHystrix;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalExtDTO;
 import com.diagbot.dto.ConceptRetrievalExtDTO;
 import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.FeatureConceptDTO;
+import com.diagbot.dto.FeatureDTO;
 import com.diagbot.dto.PartSymptomDTO;
 import com.diagbot.dto.PartSymptomDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UsualDTO;
 import com.diagbot.dto.UsualDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptUsualVO;
 import com.diagbot.vo.ConceptUsualVO;
+import com.diagbot.vo.NLPVO;
 import com.diagbot.vo.PartSymptomVO;
 import com.diagbot.vo.PartSymptomVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.VersionVO;
 import com.diagbot.vo.VersionVO;
@@ -76,6 +79,15 @@ public interface AiptServiceClient {
     @PostMapping(value = "/clinicaldata/processData")
     @PostMapping(value = "/clinicaldata/processData")
     RespDTO<ResponseData> aiptData(@RequestBody SearchVO searchVO);
     RespDTO<ResponseData> aiptData(@RequestBody SearchVO searchVO);
 
 
+    /**
+     * 推理返回大数据原始结果
+     *
+     * @param searchVO
+     * @return
+     */
+    @PostMapping(value = "/pushV2/originalPush")
+    RespDTO<ResponseData> originalPush(@Valid @RequestBody SearchVO searchVO);
+
     /**
     /**
      * 推理带名词解释
      * 推理带名词解释
      *
      *
@@ -85,6 +97,15 @@ public interface AiptServiceClient {
     @PostMapping(value = "/push/pushWithExplain")
     @PostMapping(value = "/push/pushWithExplain")
     RespDTO<ResponseDataWithExplain> pushWithExplain(@Valid @RequestBody SearchVO searchVO);
     RespDTO<ResponseDataWithExplain> pushWithExplain(@Valid @RequestBody SearchVO searchVO);
 
 
+    /**
+     * 推理带名词解释
+     *
+     * @param searchVO
+     * @return
+     */
+    @PostMapping(value = "/pushV2/pushWithExplainV2")
+    RespDTO<ResponseDataWithExplainV2> pushWithExplainV2(@Valid @RequestBody SearchVO searchVO);
+
     /**
     /**
      * 获取版本信息
      * 获取版本信息
      */
      */
@@ -99,4 +120,13 @@ public interface AiptServiceClient {
      */
      */
     @PostMapping(value = "/feature/symptomFeature")
     @PostMapping(value = "/feature/symptomFeature")
     RespDTO<List<FeatureConceptDTO>> symptomFeature(@RequestParam("text") String text);
     RespDTO<List<FeatureConceptDTO>> symptomFeature(@RequestParam("text") String text);
+
+    /**
+     * 症状特征提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    @PostMapping(value = "/featureV2/symptomFeatureV2")
+    RespDTO<List<FeatureDTO>> symptomFeatureV2(@RequestBody NLPVO nlpvo);
 }
 }

+ 40 - 0
triage-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -2,22 +2,26 @@ package com.diagbot.client.hystrix;
 
 
 import com.diagbot.biz.push.entity.ResponseData;
 import com.diagbot.biz.push.entity.ResponseData;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
+import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
 import com.diagbot.biz.push.vo.SearchVO;
 import com.diagbot.biz.push.vo.SearchVO;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.ConceptRetrievalExtDTO;
 import com.diagbot.dto.ConceptRetrievalExtDTO;
 import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.FeatureConceptDTO;
+import com.diagbot.dto.FeatureDTO;
 import com.diagbot.dto.PartSymptomDTO;
 import com.diagbot.dto.PartSymptomDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UsualDTO;
 import com.diagbot.dto.UsualDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptUsualVO;
 import com.diagbot.vo.ConceptUsualVO;
+import com.diagbot.vo.NLPVO;
 import com.diagbot.vo.PartSymptomVO;
 import com.diagbot.vo.PartSymptomVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.VersionVO;
 import com.diagbot.vo.VersionVO;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 
 
@@ -68,6 +72,18 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 推理返回大数据原始结果
+     *
+     * @param searchVO
+     * @return
+     */
+    @Override
+    public RespDTO<ResponseData> originalPush(@Valid @RequestBody SearchVO searchVO) {
+        log.error("【hystrix】调用{}异常", "originalPush");
+        return null;
+    }
+
     /**
     /**
      * 推理带名词解释
      * 推理带名词解释
      *
      *
@@ -80,6 +96,18 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 推理带名词解释
+     *
+     * @param searchVO
+     * @return
+     */
+    @Override
+    public RespDTO<ResponseDataWithExplainV2> pushWithExplainV2(@Valid @RequestBody SearchVO searchVO) {
+        log.error("【hystrix】调用{}异常", "pushWithExplainV2");
+        return null;
+    }
+
     /**
     /**
      * 获取版本信息
      * 获取版本信息
      */
      */
@@ -101,4 +129,16 @@ public class AiptServiceHystrix implements AiptServiceClient {
         log.error("【hystrix】调用{}异常", "symptomFeature");
         log.error("【hystrix】调用{}异常", "symptomFeature");
         return null;
         return null;
     }
     }
+
+    /**
+     * 症状特征提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    @Override
+    public RespDTO<List<FeatureDTO>> symptomFeatureV2(@RequestBody NLPVO nlpvo) {
+        log.error("【hystrix】调用{}异常", "symptomFeatureV2");
+        return null;
+    }
 }
 }

+ 26 - 0
triage-service/src/main/java/com/diagbot/dto/ConceptPushDTO.java

@@ -0,0 +1,26 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:推理返回标签(概念)
+ * @Author:zhaops
+ * @time: 2019/5/7 20:06
+ */
+@Getter
+@Setter
+public class ConceptPushDTO {
+    private Long conceptId; // 概念id
+    private String name;    //界面名称(医生端名称)
+    private String tagName; //系统名称(术语名称)
+    private Integer libType;  //词性
+    private Long id;
+    private Integer type;
+    //客户端界面描述
+    private String description;
+    //是否详细阐述
+    private Integer hasExplain = 0;
+    //详细阐述
+    private String explains;
+}

+ 5 - 0
triage-service/src/main/java/com/diagbot/dto/DiseaseDeptDTO.java

@@ -60,4 +60,9 @@ public class DiseaseDeptDTO {
      * 医院科室地址
      * 医院科室地址
      */
      */
     private String url;
     private String url;
+
+    /**
+     * 建议
+     */
+    private String suggestion;
 }
 }

+ 2 - 1
triage-service/src/main/java/com/diagbot/dto/FeatureConceptDTO.java

@@ -14,5 +14,6 @@ public class FeatureConceptDTO extends ConceptBaseDTO {
     private Integer libType;
     private Integer libType;
     private Integer type;
     private Integer type;
     private Long id;
     private Long id;
-    private Integer chronicLabel;//是否慢病复诊标志
+    //private Integer chronicLabel;//是否慢病复诊标志
+    private String origin;
 }
 }

+ 18 - 0
triage-service/src/main/java/com/diagbot/dto/FeatureDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 13:42
+ */
+@Getter
+@Setter
+public class FeatureDTO {
+    private Long conceptId;
+    private String standard;
+    private Integer type;
+    private String origin;
+}

+ 17 - 0
triage-service/src/main/java/com/diagbot/dto/PushDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/30 15:35
+ */
+@Getter
+@Setter
+public class PushDTO {
+    private List<ConceptPushDTO> symptom;
+}

+ 1 - 0
triage-service/src/main/java/com/diagbot/dto/SYFDiseaseDeptDTO.java

@@ -22,4 +22,5 @@ public class SYFDiseaseDeptDTO {
     private String subDeptCode;
     private String subDeptCode;
     private List<String> diseaseNames;
     private List<String> diseaseNames;
     //private List<SYFFeatureDTO> features;
     //private List<SYFFeatureDTO> features;
+    private String suggestion;
 }
 }

+ 1 - 0
triage-service/src/main/java/com/diagbot/dto/SYFFeatureDTO.java

@@ -25,4 +25,5 @@ public class SYFFeatureDTO {
     private String deptCode;
     private String deptCode;
     private String subDeptCode;
     private String subDeptCode;
     private String url;
     private String url;
+    private String suggestion;
 }
 }

+ 7 - 31
triage-service/src/main/java/com/diagbot/facade/AIFacade.java

@@ -3,7 +3,6 @@ package com.diagbot.facade;
 import com.diagbot.biz.push.entity.FeatureRate;
 import com.diagbot.biz.push.entity.FeatureRate;
 import com.diagbot.biz.push.entity.FeatureRateWithExplain;
 import com.diagbot.biz.push.entity.FeatureRateWithExplain;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
 import com.diagbot.biz.push.entity.ResponseDataWithExplain;
-import com.diagbot.biz.push.vo.SearchVO;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.AIDTO;
 import com.diagbot.dto.AIDTO;
@@ -16,7 +15,6 @@ import com.diagbot.dto.SYFDTO;
 import com.diagbot.dto.SYFDeptDTO;
 import com.diagbot.dto.SYFDeptDTO;
 import com.diagbot.dto.SYFDiseaseDeptDTO;
 import com.diagbot.dto.SYFDiseaseDeptDTO;
 import com.diagbot.dto.SYFFeatureDTO;
 import com.diagbot.dto.SYFFeatureDTO;
-import com.diagbot.enums.SysTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.exception.CommonException;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.BeanUtil;
@@ -56,6 +54,8 @@ public class AIFacade {
     private TranServiceClient tranServiceClient;
     private TranServiceClient tranServiceClient;
     @Autowired
     @Autowired
     private FeatureFacade featureFacade;
     private FeatureFacade featureFacade;
+    @Autowired
+    private AssembleFacade assembleFacade;
 
 
     /**
     /**
      * 调用ai接口业务逻辑
      * 调用ai接口业务逻辑
@@ -64,7 +64,7 @@ public class AIFacade {
      * @return AI接口返回结果
      * @return AI接口返回结果
      */
      */
     public AIDTO push(AIVO aivo, String type) {
     public AIDTO push(AIVO aivo, String type) {
-        RespDTO<ResponseDataWithExplain> res = aiptServiceClient.pushWithExplain(assembleData(aivo, type));
+        RespDTO<ResponseDataWithExplain> res = aiptServiceClient.pushWithExplain(assembleFacade.assembleData(aivo, type));
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         AIDTO aidto = new AIDTO();
         AIDTO aidto = new AIDTO();
         switch (type) {
         switch (type) {
@@ -193,7 +193,7 @@ public class AIFacade {
         List<FeatureConceptDTO> featureConceptDTOList = featureFacade.getSymptomFeature(aivo.getSymptom());
         List<FeatureConceptDTO> featureConceptDTOList = featureFacade.getSymptomFeature(aivo.getSymptom());
         Integer symptomSize = ListUtil.isEmpty(featureConceptDTOList) ? 0 : featureConceptDTOList.size();
         Integer symptomSize = ListUtil.isEmpty(featureConceptDTOList) ? 0 : featureConceptDTOList.size();
 
 
-        RespDTO<ResponseDataWithExplain> res = aiptServiceClient.pushWithExplain(assembleData(aivo, type));
+        RespDTO<ResponseDataWithExplain> res = aiptServiceClient.pushWithExplain(assembleFacade.assembleData(aivo, type));
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         SYFDTO syfdto = new SYFDTO();
         SYFDTO syfdto = new SYFDTO();
 
 
@@ -225,6 +225,7 @@ public class AIFacade {
                     featureRateDTO.setDiseaseName(ddList.get(0).getDiseaseName());
                     featureRateDTO.setDiseaseName(ddList.get(0).getDiseaseName());
                     featureRateDTO.setDeptCode(ddList.get(0).getDeptCode());
                     featureRateDTO.setDeptCode(ddList.get(0).getDeptCode());
                     featureRateDTO.setSubDeptCode(ddList.get(0).getSubDeptCode());
                     featureRateDTO.setSubDeptCode(ddList.get(0).getSubDeptCode());
+                    featureRateDTO.setSuggestion(ddList.get(0).getSuggestion());
                     if (StringUtil.isNotBlank(ddList.get(0).getSubDeptName())
                     if (StringUtil.isNotBlank(ddList.get(0).getSubDeptName())
                             && (!ddList.get(0).getDeptName().equals(ddList.get(0).getSubDeptName()))) {
                             && (!ddList.get(0).getDeptName().equals(ddList.get(0).getSubDeptName()))) {
                         featureRateDTO
                         featureRateDTO
@@ -321,6 +322,7 @@ public class AIFacade {
                         //syfDiseaseDeptDTO.setUrl(entry.getValue().get(0).getUrl());
                         //syfDiseaseDeptDTO.setUrl(entry.getValue().get(0).getUrl());
                         syfDiseaseDeptDTO.setDeptCode(entry.getValue().get(0).getDeptCode());
                         syfDiseaseDeptDTO.setDeptCode(entry.getValue().get(0).getDeptCode());
                         syfDiseaseDeptDTO.setSubDeptCode(entry.getValue().get(0).getSubDeptCode());
                         syfDiseaseDeptDTO.setSubDeptCode(entry.getValue().get(0).getSubDeptCode());
+                        syfDiseaseDeptDTO.setSuggestion(entry.getValue().get(0).getSuggestion());
                         //syfDiseaseDeptDTO.setFeatures(entry.getValue());
                         //syfDiseaseDeptDTO.setFeatures(entry.getValue());
                         syfDiseaseDeptDTO.setDiseaseNames(entry.getValue()
                         syfDiseaseDeptDTO.setDiseaseNames(entry.getValue()
                                 .stream()
                                 .stream()
@@ -473,6 +475,7 @@ public class AIFacade {
                 //syfDiseaseDeptDTO.setUrl(syfFeatureDTO.getUrl());
                 //syfDiseaseDeptDTO.setUrl(syfFeatureDTO.getUrl());
                 syfDiseaseDeptDTO.setDeptCode(syfFeatureDTO.getDeptCode());
                 syfDiseaseDeptDTO.setDeptCode(syfFeatureDTO.getDeptCode());
                 syfDiseaseDeptDTO.setSubDeptCode(syfFeatureDTO.getSubDeptCode());
                 syfDiseaseDeptDTO.setSubDeptCode(syfFeatureDTO.getSubDeptCode());
+                syfDiseaseDeptDTO.setSuggestion(syfFeatureDTO.getSuggestion());
                 List<SYFFeatureDTO> features = Lists.newLinkedList();
                 List<SYFFeatureDTO> features = Lists.newLinkedList();
                 if (syfFeatureMap.containsKey(syfFeatureDTO.getConcatDept())) {
                 if (syfFeatureMap.containsKey(syfFeatureDTO.getConcatDept())) {
                     features = syfFeatureMap.get(syfFeatureDTO.getConcatDept());
                     features = syfFeatureMap.get(syfFeatureDTO.getConcatDept());
@@ -537,31 +540,4 @@ public class AIFacade {
         }
         }
         return items;
         return items;
     }
     }
-
-    private SearchVO assembleData(AIVO aivo, String type) {
-        SearchVO searchVO = new SearchVO();
-        searchVO.setAge(aivo.getAge());
-        searchVO.setHosCode(aivo.getHospitalCode());
-        searchVO.setSymptom(aivo.getSymptom());
-        switch (aivo.getSex()) {
-            case 1:
-            case 2:
-                searchVO.setSex(aivo.getSex());
-                break;
-            default:
-                throw new CommonException(CommonErrorCode.PARAM_ERROR, "不能输入男女以外的性别");
-        }
-        searchVO.setFeatureType(type);
-        searchVO.setSysCode("1");
-        switch (type) {
-            case "1":
-                searchVO.setLength(10);
-                break;
-            case "7":
-                searchVO.setLength(10);
-                break;
-        }
-        searchVO.setSysType(SysTypeEnum.TRIAGE_SERVICE.getKey());
-        return searchVO;
-    }
 }
 }

+ 204 - 0
triage-service/src/main/java/com/diagbot/facade/AIV2Facade.java

@@ -0,0 +1,204 @@
+package com.diagbot.facade;
+
+import com.diagbot.biz.push.entity.FeatureRateV2;
+import com.diagbot.biz.push.entity.FeatureRateWithExplainV2;
+import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
+import com.diagbot.client.AiptServiceClient;
+import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.ConceptPushDTO;
+import com.diagbot.dto.DiseaseDeptDTO;
+import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SYFDTO;
+import com.diagbot.dto.SYFDeptDTO;
+import com.diagbot.dto.SYFDiseaseDeptDTO;
+import com.diagbot.dto.SYFFeatureDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.FastJsonUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.AIVO;
+import com.diagbot.vo.DiseaseDeptVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/16 17:45
+ */
+@Component
+public class AIV2Facade {
+    @Autowired
+    private AiptServiceClient aiptServiceClient;
+    @Autowired
+    private TranServiceClient tranServiceClient;
+    @Autowired
+    private AssembleFacade assembleFacade;
+
+
+    /**
+     * 症状推理
+     *
+     * @param aivo
+     * @param type
+     * @return
+     */
+    public PushDTO pushSymptomForSYFV2(AIVO aivo, String type) {
+        RespDTO<ResponseDataWithExplainV2> res
+                = aiptServiceClient.pushWithExplainV2(assembleFacade.assembleData(aivo, type));
+        RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
+        PushDTO pushDTO = new PushDTO();
+
+        List<FeatureRateWithExplainV2> symptom = res.data.getSymptom();
+        if (ListUtil.isNotEmpty(symptom)) {
+            List<ConceptPushDTO> conceptPushDTOList = Lists.newLinkedList();
+            symptom.forEach(item -> {
+                ConceptPushDTO conceptPushDTO = new ConceptPushDTO();
+                conceptPushDTO.setName(item.getFeatureName());
+                conceptPushDTO.setTagName(item.getFeatureName());
+                conceptPushDTO.setLibType(1);
+                conceptPushDTO.setType(1);
+                conceptPushDTO.setDescription(item.getDescription());
+                conceptPushDTO.setExplains(item.getExplains());
+                conceptPushDTOList.add(conceptPushDTO);
+            });
+            pushDTO.setSymptom(conceptPushDTOList);
+        }
+        return pushDTO;
+    }
+
+
+    /**
+     * 邵逸夫诊断推理
+     *
+     * @param aivo
+     * @param type
+     * @return
+     */
+    public SYFDTO pushDisForSYFV2(AIVO aivo, String type) {
+        if (StringUtil.isBlank(aivo.getHospitalCode())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入医院编码");
+        }
+        RespDTO<ResponseDataWithExplainV2> res
+                = aiptServiceClient.pushWithExplainV2(assembleFacade.assembleData(aivo, type));
+        RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
+        SYFDTO syfdto = new SYFDTO();
+
+        List<SYFDiseaseDeptDTO> items = Lists.newLinkedList();
+        List<FeatureRateV2> dis = res.data.getDis();
+        if (ListUtil.isNotEmpty(dis)) {
+            Map<String, List<SYFFeatureDTO>> disFeatureMap = new LinkedHashMap<>();
+            List<SYFFeatureDTO> disDTO = BeanUtil.listCopyTo(dis, SYFFeatureDTO.class);
+
+            //关联邵逸夫医院映射
+            DiseaseDeptVO diseaseDeptVO = new DiseaseDeptVO();
+            diseaseDeptVO.setHospitalCode(aivo.getHospitalCode());
+            List<String> disNames = dis.stream().map(i -> i.getFeatureName()).collect(Collectors.toList());
+            diseaseDeptVO.setConceptNames(disNames);
+            RespDTO<List<DiseaseDeptDTO>> diseaseDeptDTORes
+                    = tranServiceClient.getDiseaseDeptByConceptNames(diseaseDeptVO);
+            RespDTOUtil.respNGDealCover(diseaseDeptDTORes, "诊断科室映射关系未维护");
+            List<DiseaseDeptDTO> diseaseDeptDTOList = diseaseDeptDTORes.data;
+            Map<String, List<DiseaseDeptDTO>> diseaseDeptMap
+                    = EntityUtil.makeEntityListMap(diseaseDeptDTOList, "conceptDisName");
+            //诊断分类
+            for (SYFFeatureDTO featureRateDTO : disDTO) {
+                //关联外部诊断科室
+                if (diseaseDeptMap != null
+                        && ListUtil.isNotEmpty(diseaseDeptMap.get(featureRateDTO.getFeatureName()))) {
+                    List<DiseaseDeptDTO> ddList = diseaseDeptMap.get(featureRateDTO.getFeatureName());
+                    featureRateDTO.setDeptName(ddList.get(0).getDeptName());
+                    featureRateDTO.setSubDeptName(ddList.get(0).getSubDeptName());
+                    featureRateDTO.setDiseaseName(ddList.get(0).getDiseaseName());
+                    featureRateDTO.setSuggestion(ddList.get(0).getSuggestion());
+                    featureRateDTO.setDeptCode(ddList.get(0).getDeptCode());
+                    featureRateDTO.setSubDeptCode(ddList.get(0).getSubDeptCode());
+                    if (StringUtil.isNotBlank(ddList.get(0).getSubDeptName())
+                            && (!ddList.get(0).getDeptName().equals(ddList.get(0).getSubDeptName()))) {
+                        featureRateDTO
+                                .setConcatDept(ddList.get(0).getDeptName() + "-" + ddList.get(0).getSubDeptName());
+                    } else {
+                        featureRateDTO.setConcatDept(ddList.get(0).getDeptName());
+                    }
+                    featureRateDTO.setUrl(ddList.get(0).getUrl());
+                } else {
+                    featureRateDTO.setDiseaseName(featureRateDTO.getFeatureName());
+                }
+                if (StringUtil.isBlank(featureRateDTO.getDesc())) {
+                    featureRateDTO.setDesc("{\"可能诊断\":\"\"}");
+                }
+                Map<String, Object> descMap = FastJsonUtils.getJsonToMap(featureRateDTO.getDesc());
+                for (String disClass : descMap.keySet()) {
+                    List<SYFFeatureDTO> featureRateDTOList = Lists.newLinkedList();
+                    if (disFeatureMap.get(disClass) != null) {
+                        featureRateDTOList = disFeatureMap.get(disClass);
+                    }
+                    featureRateDTOList.add(featureRateDTO);
+                    disFeatureMap.put(disClass, featureRateDTOList);
+                }
+            }
+
+            //仅分析确诊、拟诊、可能诊断,其他类型(如:警惕)不参与分诊推理
+            List<SYFFeatureDTO> featureRateList = Lists.newLinkedList();
+            if (disFeatureMap.containsKey("确诊")) {
+                featureRateList.addAll(disFeatureMap.get("确诊"));
+            } else if (disFeatureMap.containsKey("拟诊")) {
+                featureRateList.addAll(disFeatureMap.get("拟诊"));
+            } else if (disFeatureMap.containsKey("可能诊断")) {
+                featureRateList.addAll(disFeatureMap.get("可能诊断"));
+            }
+
+            if (ListUtil.isEmpty(featureRateList)) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推理结果为空");
+            }
+
+            //过滤科室为空的数据
+            featureRateList = featureRateList
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getConcatDept()))
+                    .collect(Collectors.toList());
+
+            List<SYFFeatureDTO> syfFeatureDTOList = featureRateList
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getConcatDept()))
+                    .limit(2)
+                    .collect(Collectors.toList());
+            Map<String, List<SYFFeatureDTO>> featureMap
+                    = EntityUtil.makeEntityListMap(syfFeatureDTOList, "concatDept");
+            for (Map.Entry<String, List<SYFFeatureDTO>> entry : featureMap.entrySet()) {
+                SYFDiseaseDeptDTO item = new SYFDiseaseDeptDTO();
+                BeanUtil.copyProperties(entry.getValue().get(0), item);
+                item.setDiseaseNames(entry.getValue()
+                        .stream()
+                        .map(i -> i.getDiseaseName())
+                        .distinct()
+                        .collect(Collectors.toList()));
+                item.setDept(entry.getKey());
+                items.add(item);
+            }
+        }
+        //按大科室分组展示
+        Map<String, List<SYFDiseaseDeptDTO>> itemMap = EntityUtil.makeEntityListMap(items, "deptName");
+        List<SYFDeptDTO> syfDeptDTOList = Lists.newLinkedList();
+        itemMap.entrySet().forEach(item -> {
+            SYFDeptDTO syfDeptDTO = new SYFDeptDTO();
+            syfDeptDTO.setDeptName(item.getKey());
+            syfDeptDTO.setDeptCode(item.getValue().get(0).getDeptCode());
+            syfDeptDTO.setDiseaseDept(item.getValue());
+            syfDeptDTOList.add(syfDeptDTO);
+        });
+        syfdto.setDiseaseDept(syfDeptDTOList);
+        return syfdto;
+    }
+}

+ 49 - 0
triage-service/src/main/java/com/diagbot/facade/AssembleFacade.java

@@ -0,0 +1,49 @@
+package com.diagbot.facade;
+
+import com.diagbot.biz.push.vo.SearchVO;
+import com.diagbot.enums.SysTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.AIVO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/17 11:27
+ */
+@Component
+public class AssembleFacade {
+
+    public SearchVO assembleData(AIVO aivo, String type) {
+        if (StringUtil.isNotBlank(aivo.getHosCode())
+                && StringUtil.isBlank(aivo.getHospitalCode())) {
+            aivo.setHospitalCode(aivo.getHosCode());
+        }
+        SearchVO searchVO = new SearchVO();
+        searchVO.setAge(aivo.getAge());
+        searchVO.setHosCode(aivo.getHospitalCode());
+        searchVO.setSymptom(aivo.getSymptom());
+        switch (aivo.getSex()) {
+            case 1:
+            case 2:
+                searchVO.setSex(aivo.getSex());
+                break;
+            default:
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "不能输入男女以外的性别");
+        }
+        searchVO.setFeatureType(type);
+        searchVO.setSysCode("1");
+        switch (type) {
+            case "1":
+                searchVO.setLength(10);
+                break;
+            case "7":
+                searchVO.setLength(10);
+                break;
+        }
+        searchVO.setSysType(SysTypeEnum.TRIAGE_SERVICE.getKey());
+        return searchVO;
+    }
+}

+ 14 - 0
triage-service/src/main/java/com/diagbot/facade/FeatureFacade.java

@@ -2,9 +2,11 @@ package com.diagbot.facade;
 
 
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.dto.FeatureConceptDTO;
 import com.diagbot.dto.FeatureConceptDTO;
+import com.diagbot.dto.FeatureDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.NLPVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
@@ -40,4 +42,16 @@ public class FeatureFacade {
         }
         }
         return symptomFeatureList;
         return symptomFeatureList;
     }
     }
+
+    /**
+     * 新版知识库症状特征词提取
+     *
+     * @param nlpvo
+     * @return
+     */
+    public List<FeatureDTO> getSymptomFeatureV2(NLPVO nlpvo) {
+        RespDTO<List<FeatureDTO>> respDTO = aiptServiceClient.symptomFeatureV2(nlpvo);
+        RespDTOUtil.respNGDealCover(respDTO, "症状特征词提取失败");
+        return respDTO.data;
+    }
 }
 }

+ 4 - 1
triage-service/src/main/java/com/diagbot/vo/AIVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 package com.diagbot.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 
 
@@ -20,6 +21,8 @@ public class AIVO {
     private Integer sex;
     private Integer sex;
     @NotBlank(message = "请输入症状")
     @NotBlank(message = "请输入症状")
     private String symptom;
     private String symptom;
-//    @NotBlank(message = "请输入医院编码")
+    //    @NotBlank(message = "请输入医院编码")
     private String hospitalCode;
     private String hospitalCode;
+    @ApiModelProperty(hidden = true)
+    private String hosCode;
 }
 }

+ 3 - 0
triage-service/src/main/java/com/diagbot/vo/HospitalVO.java

@@ -20,4 +20,7 @@ public class HospitalVO {
      */
      */
     @ApiModelProperty(hidden = true)
     @ApiModelProperty(hidden = true)
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+
+    @ApiModelProperty(hidden = true)
+    private Integer wayType;
 }
 }

+ 15 - 0
triage-service/src/main/java/com/diagbot/vo/NLPVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/22 16:05
+ */
+@Getter
+@Setter
+public class NLPVO {
+    private String text;
+}

+ 2 - 0
triage-service/src/main/java/com/diagbot/vo/OptHospPageVO.java

@@ -35,4 +35,6 @@ public class OptHospPageVO extends Page {
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
      */
      */
     private Integer sysType;
     private Integer sysType;
+
+    private Integer wayType;
 }
 }

+ 2 - 0
triage-service/src/main/java/com/diagbot/vo/OptHospVO.java

@@ -34,4 +34,6 @@ public class OptHospVO {
      */
      */
     @ApiModelProperty(hidden = true)
     @ApiModelProperty(hidden = true)
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+
+    private Integer wayType;
 }
 }

+ 2 - 0
triage-service/src/main/java/com/diagbot/vo/OptVO.java

@@ -34,4 +34,6 @@ public class OptVO {
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
     private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
     //医院名称列表
     //医院名称列表
     private List<String> hospitalCodeList;
     private List<String> hospitalCodeList;
+
+    private Integer wayType;
 }
 }

+ 3 - 0
triage-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -61,4 +61,7 @@ public class SaveInquiryTriageVO {
 
 
     @ApiModelProperty(value = "用户Id")
     @ApiModelProperty(value = "用户Id")
     private String mpiId;
     private String mpiId;
+
+    @ApiModelProperty(value = "相关情况")
+    private String correlation;
 }
 }

+ 23 - 4
triage-service/src/main/java/com/diagbot/web/AIController.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.AIDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SYFDTO;
 import com.diagbot.dto.SYFDTO;
 import com.diagbot.facade.AIFacade;
 import com.diagbot.facade.AIFacade;
+import com.diagbot.facade.AIV2Facade;
 import com.diagbot.vo.AIVO;
 import com.diagbot.vo.AIVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -30,6 +31,8 @@ public class AIController {
 
 
     @Autowired
     @Autowired
     AIFacade aiFacade;
     AIFacade aiFacade;
+    @Autowired
+    AIV2Facade aiv2Facade;
 
 
     /**
     /**
      * 症状推理症状接口
      * 症状推理症状接口
@@ -63,20 +66,36 @@ public class AIController {
         return RespDTO.onSuc(aiFacade.push(aivo, "7"));
         return RespDTO.onSuc(aiFacade.push(aivo, "7"));
     }
     }
 
 
+
+    /**
+     * 症状推理症状接口
+     *
+     * @param aivo ai输入参数
+     * @return 症状相关数据
+     */
+    @ApiOperation(value = "知识库标准化-症状推理症状接口-邵逸夫[by:zhaops]",
+            notes = "age: 年龄(必填)<br>" +
+                    "sex:性别,1:男,2:女(必填)<br>" +
+                    "symptom:症状自然文本描述(必填)")
+    @PostMapping("/pushSymptomForSYF")
+    @SysLogger("pushSymptomForSYF")
+    public RespDTO<AIDTO> pushSymptomForSYF(@RequestBody @Valid AIVO aivo) {
+        return RespDTO.onSuc(aiv2Facade.pushSymptomForSYFV2(aivo, "1"));
+    }
+
     /**
     /**
      * 症状推理症状接口
      * 症状推理症状接口
      *
      *
      * @param aivo ai输入参数
      * @param aivo ai输入参数
      * @return 疾病相关数据
      * @return 疾病相关数据
      */
      */
-    @ApiOperation(value = "知识库标准化-症状推理疾病接口[by:zhaops]",
+    @ApiOperation(value = "知识库标准化-症状推理疾病接口-邵逸夫[by:zhaops]",
             notes = "age: 年龄(必填)<br>" +
             notes = "age: 年龄(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>" +
                     "symptom:症状自然文本描述(必填)")
                     "symptom:症状自然文本描述(必填)")
     @PostMapping("/pushDisForSYF")
     @PostMapping("/pushDisForSYF")
     @SysLogger("pushDisForSYF")
     @SysLogger("pushDisForSYF")
     public RespDTO<SYFDTO> pushDisForSYF(@RequestBody @Valid AIVO aivo) {
     public RespDTO<SYFDTO> pushDisForSYF(@RequestBody @Valid AIVO aivo) {
-        return RespDTO.onSuc(aiFacade.pushDisForSYF(aivo, "7"));
+        return RespDTO.onSuc(aiv2Facade.pushDisForSYFV2(aivo, "7"));
     }
     }
-}
-
+}

+ 38 - 0
triage-service/src/main/java/com/diagbot/web/FeatureController.java

@@ -0,0 +1,38 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.FeatureConceptDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.FeatureFacade;
+import com.diagbot.vo.NLPVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/22 13:12
+ */
+@RestController
+@RequestMapping("/feature")
+@Api(value = "特征词提取相关API", tags = { "特征词提取相关API" })
+public class FeatureController {
+    @Autowired
+    private FeatureFacade featureFacade;
+
+    @ApiOperation(value = "症状文本解析[by:zhaops]",
+            notes = "text: 症状文本描述(必填)<br>")
+    @PostMapping("/getSymptomFeature")
+    @SysLogger("getSymptomFeature")
+    public RespDTO<List<FeatureConceptDTO>> getSymptomFeature(@RequestBody NLPVO nlpvo) {
+        return RespDTO.onSuc(featureFacade.getSymptomFeature(nlpvo.getText()));
+    }
+}

+ 37 - 0
triage-service/src/main/java/com/diagbot/web/FeatureV2Controller.java

@@ -0,0 +1,37 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.FeatureDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.FeatureFacade;
+import com.diagbot.vo.NLPVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/26 16:49
+ */
+@RestController
+@RequestMapping("/featureV2")
+@Api(value = "特征词提取V2相关API", tags = { "特征词提取V2相关API" })
+public class FeatureV2Controller {
+    @Autowired
+    private FeatureFacade featureFacade;
+
+    @ApiOperation(value = "症状文本解析[by:zhaops]",
+            notes = "text: 症状文本描述<br>")
+    @PostMapping("/getSymptomFeatureV2")
+    @SysLogger("getSymptomFeatureV2")
+    public RespDTO<List<FeatureDTO>> getSymptomFeatureV2(@RequestBody NLPVO nlpvo) {
+        return RespDTO.onSuc(featureFacade.getSymptomFeatureV2(nlpvo));
+    }
+}