Explorar o código

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

# Conflicts:
#	icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java
#	icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java
wangyu %!s(int64=6) %!d(string=hai) anos
pai
achega
ae3026d1a1
Modificáronse 24 ficheiros con 361 adicións e 250 borrados
  1. 39 2
      aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  2. 31 0
      aipt-service/src/main/java/com/diagbot/facade/EvaluationFacade.java
  3. 1 0
      aipt-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java
  4. 23 0
      aipt-service/src/main/java/com/diagbot/vo/ConceptExistVO.java
  5. 1 1
      aipt-service/src/main/java/com/diagbot/vo/EvaluationdiseaseNameVO.java
  6. 17 0
      aipt-service/src/main/java/com/diagbot/web/ConceptController.java
  7. 0 1
      aipt-service/src/main/resources/mapper/IndexConfigMapper.xml
  8. 9 0
      icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java
  9. 23 0
      icss-service/src/main/java/com/diagbot/client/bean/ConceptExistVO.java
  10. 13 0
      icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java
  11. 22 26
      icss-service/src/main/java/com/diagbot/facade/PushFacade.java
  12. 0 0
      icss-service/src/main/java/com/diagbot/vo/EvaluationDiseaseNameVO.java
  13. 0 1
      icss-service/src/main/java/com/diagbot/vo/PushVO.java
  14. 0 43
      icssman-service/src/main/java/com/diagbot/client/KLMServiceClient.java
  15. 21 1
      icssman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java
  16. 0 49
      icssman-service/src/main/java/com/diagbot/client/hystrix/KLMServiceHystrix.java
  17. 28 1
      icssman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java
  18. 2 2
      icssman-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  19. 20 17
      icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java
  20. 89 84
      knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java
  21. 3 3
      knowledgeman-service/src/main/java/com/diagbot/vo/ConceptExistVO.java
  22. 1 1
      knowledgeman-service/src/main/java/com/diagbot/web/CommonConceptController.java
  23. 15 16
      knowledgeman-service/src/main/resources/mapper/ConceptMapper.xml
  24. 3 2
      knowledgeman-service/src/main/resources/mapper/LibraryInfoMapper.xml

+ 39 - 2
aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -16,6 +16,7 @@ import com.diagbot.service.impl.ConceptServiceImpl;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamConvertUtil;
 import com.diagbot.vo.ConceptBaseVO;
+import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptUsualVO;
 import com.diagbot.vo.RetrievalVO;
@@ -116,12 +117,48 @@ public class ConceptFacade extends ConceptServiceImpl {
     public List<Concept> getListByNamesAndType(List<String> nameList, Integer libType) {
         QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
         conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .in("lib_name", nameList)
-                .eq("lib_type", libType);
+                .in("lib_name", nameList);
+        if (libType != null) {
+            conceptQueryWrapper.eq("lib_type", libType);
+        }
         List<Concept> list = this.list(conceptQueryWrapper);
         return list;
     }
 
+
+    /**
+     * 根据名称和类型获取概念列表Map
+     *
+     * @param conceptExistVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO) {
+        // 入参验证
+        if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
+        }
+
+        if (conceptExistVO.getType() != null) {
+            Integer libType = ParamConvertUtil.conceptConvert2Lib(conceptExistVO.getType());
+            if (libType == null) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
+            }
+            conceptExistVO.setLibType(libType);
+        }
+
+        //获取结构
+        List<Concept> concepts
+                = this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
+
+        //出参封装
+        Map<String, Long> map = new HashMap<>();
+        if (ListUtil.isNotEmpty(concepts)) {
+            map = concepts.stream().collect(Collectors.toMap(r -> r.getLibName(), r -> r.getId()));
+        }
+        return map;
+    }
+
+
     /**
      * 获取常用标签
      *

+ 31 - 0
aipt-service/src/main/java/com/diagbot/facade/EvaluationFacade.java

@@ -1,8 +1,39 @@
 package com.diagbot.facade;
 
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.dto.EvaluationDTO;
 import com.diagbot.service.impl.EvaluationServiceImpl;
+import com.diagbot.vo.EvaluationdiseaseNameVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+import java.util.Map;
+
 @Component
 public class EvaluationFacade extends EvaluationServiceImpl {
+
+	@Autowired
+	PushFacade pushFacade;
+
+	/**
+	 * 获取管理与评估模板接口
+	 *
+	 * @param evaluationdiseaseNameVO
+	 * @return
+	 */
+	public List<EvaluationDTO> getEvaluationModule(EvaluationdiseaseNameVO evaluationdiseaseNameVO) {
+
+		List<EvaluationDTO> evaluationList = getEvaluationModule(evaluationdiseaseNameVO);
+
+		Map<String, JSONObject> jsonobject = pushFacade.getManagementEvaluationContent(evaluationdiseaseNameVO);
+		for (String key : jsonobject.keySet()) {
+			for (EvaluationDTO evaluadata : evaluationList) {
+				if (key.equals(evaluadata.getRegionName())) {
+					evaluadata.setData(jsonobject.get(key));
+				}
+			}
+		}
+		return evaluationList;
+	}
 }

+ 1 - 0
aipt-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -9,6 +9,7 @@ import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.GetTopPatientInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.Concept;
+import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.ConceptBaseVO;
 import com.diagbot.vo.GetTopPatientInfoVO;

+ 23 - 0
aipt-service/src/main/java/com/diagbot/vo/ConceptExistVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/5/6 18:50
+ */
+@Getter
+@Setter
+public class ConceptExistVO {
+    @ApiModelProperty(value = "名称列表")
+    private List<String> nameList;
+    @ApiModelProperty(value = "类型")
+    private Integer type;
+    @ApiModelProperty(hidden = true)
+    private Integer libType;
+}

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

@@ -11,7 +11,7 @@ import lombok.Setter;
  */
 @Setter
 @Getter
-public class EvaluationdiseaseNameVO {
+public class EvaluationdiseaseNameVO extends SearchVo{
 
 	private String diseaseName;
 	

+ 17 - 0
aipt-service/src/main/java/com/diagbot/web/ConceptController.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConceptFacade;
 import com.diagbot.util.ParamConvertUtil;
 import com.diagbot.vo.ConceptBaseVO;
+import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptUsualVO;
 import com.diagbot.vo.RetrievalVO;
@@ -95,4 +96,20 @@ public class ConceptController {
         List<ConceptRetrievalDTO> data = conceptFacade.retrivelConceptInfo(retrievalVO);
         return RespDTO.onSuc(data);
     }
+
+
+    /**
+     * 根据名称和类型获取概念列表Map
+     *
+     * @param conceptExistVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    @ApiOperation(value = "知识库标准化-根据名称和类型获取概念列表Map[by:zhoutg]",
+            notes = "nameList: 名称列表<br>" +
+                    "type: 类型")
+    @PostMapping("/getConceptMapByNameAndType")
+    @SysLogger("getConceptMapByNameAndType")
+    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
+        return RespDTO.onSuc(conceptFacade.getConceptMap(conceptExistVO));
+    }
 }

+ 0 - 1
aipt-service/src/main/resources/mapper/IndexConfigMapper.xml

@@ -28,7 +28,6 @@
 		LEFT JOIN kl_concept b ON a.concept_id = b.id and  b.is_deleted ="N"
 		LEFT JOIN kl_concept c ON a.disease_id = c.id and  c.is_deleted ="N"
 		WHERE a.is_deleted ="N"
-		and b.lib_type = 46
 		and c.lib_type = 18
 		<if test="indexConfig.diseaseName != ''">
 		AND c.lib_name =  #{indexConfig.diseaseName}

+ 9 - 0
icss-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -163,6 +163,15 @@ public interface AiptServiceClient {
     @PostMapping("/disType/verifyDisType")
     RespDTO<Boolean> verifyDisType(@Valid @RequestBody DisTypeVO disTypeVO);
 
+    /**
+     * 根据名称和类型获取概念列表Map
+     *
+     * @param conceptExistVO
+     * @return
+     */
+    @PostMapping("/concept/getConceptMapByNameAndType")
+    RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO);
+
     /**
      * 标签检索
      *

+ 23 - 0
icss-service/src/main/java/com/diagbot/client/bean/ConceptExistVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.client.bean;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/5/6 18:50
+ */
+@Getter
+@Setter
+public class ConceptExistVO {
+    @ApiModelProperty(value = "名称列表")
+    private List<String> nameList;
+    @ApiModelProperty(value = "类型")
+    private Integer type;
+    @ApiModelProperty(hidden = true)
+    private Integer libType;
+}

+ 13 - 0
icss-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -3,6 +3,7 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.bean.CalculateData;
 import com.diagbot.client.bean.ConceptBaseVO;
+import com.diagbot.client.bean.ConceptExistVO;
 import com.diagbot.client.bean.DisTypeVO;
 import com.diagbot.client.bean.GdbResponse;
 import com.diagbot.client.bean.ResponseData;
@@ -209,6 +210,18 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
     }
 
+    /**
+     * 根据名称和类型获取概念列表Map
+     *
+     * @param conceptExistVO
+     * @return
+     */
+    @Override
+    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO) {
+        log.error("【hystrix】调用{}异常", "getConceptMapByNameAndType");
+        return null;
+    }
+
     @Override
     public RespDTO<List<ConceptRetrievalDTO>> retrivelConceptInfo(@Valid RetrievalVO retrievalVO) {
         log.error("【hystrix】调用{}异常", "retrivelConceptInfo");

+ 22 - 26
icss-service/src/main/java/com/diagbot/facade/PushFacade.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.client.bean.ConceptBaseVO;
+import com.diagbot.client.bean.ConceptExistVO;
 import com.diagbot.client.bean.FeatureRate;
 import com.diagbot.client.bean.GdbResponse;
 import com.diagbot.client.bean.ResponseData;
@@ -63,8 +64,6 @@ public class PushFacade {
     @Autowired
     private QuestionFacade questionFacade;
     @Autowired
-    private DeptInfoFacade deptInfoFacade;
-    @Autowired
     private DeptVitalFacade deptVitalFacade;
     @Autowired
     private TreatmentFacade treatmentFacade;
@@ -73,10 +72,6 @@ public class PushFacade {
     @Autowired
     private DisTypeFacade disTypeFacade;
     @Autowired
-    private ScaleContentFacade scaleContentFacade;
-    @Autowired
-    private EvaluationModuleMappingFacade evaluationModuleMappingFacade;
-    @Autowired
     private TranServiceClient tranServiceClient;
     @Autowired
     private AiptServiceClient aiptServiceClient;
@@ -182,6 +177,8 @@ public class PushFacade {
                 //公表项转套餐项
                 Map<String, List<String>> lisMapping = lisMappingFacade.getLisMappingByUniqueName();
                 List<String> nameList = Lists.newLinkedList();
+                Map<String, Long> lisMap = new LinkedHashMap<>();
+                List<ConceptPushDTO> lisDTO = Lists.newLinkedList();
                 for (ConceptPushDTO lab : labs) {
                     if (ListUtil.isNotEmpty(lisMapping.get(lab.getName()))) {
                         //匹配出多个套餐项默认取第一个
@@ -192,7 +189,25 @@ public class PushFacade {
                         nameList.add(name);
                     }
                 }
-                List<ConceptPushDTO> lisDTO = Lists.newLinkedList();
+                if (ListUtil.isNotEmpty(nameList)) {
+                    ConceptExistVO conceptExistVO = new ConceptExistVO();
+                    conceptExistVO.setNameList(nameList);
+                    conceptExistVO.setType(ConceptTypeEnum.Lis.getKey());
+                    RespDTO<Map<String, Long>> respDTO = aiptServiceClient.getConceptMapByNameAndType(conceptExistVO);
+                    if (RespDTOUtil.respIsOK(respDTO)) {
+                        lisMap = respDTO.data;
+                    }
+                }
+                for (Map.Entry<String, Long> entry : lisMap.entrySet()) {
+                    ConceptPushDTO conceptPushDTO = new ConceptPushDTO();
+                    conceptPushDTO.setConceptId(entry.getValue());
+                    conceptPushDTO.setName(entry.getKey());
+                    conceptPushDTO.setLibType(ConceptTypeEnum.Lis.getKey());
+                    lisDTO.add(conceptPushDTO);
+                }
+                if (ListUtil.isNotEmpty(lisDTO)) {
+                    lisDTO = addQuestionId(lisDTO, ConceptTypeEnum.Lis.getKey());
+                }
                 pushDTO.setLab(lisDTO);
             }
         }
@@ -208,25 +223,6 @@ public class PushFacade {
         if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.MedicalIndication.getKey()))) {
             pushDTO.setMedicalIndications(data.getMedicalIndications());
         }
-        //量表内容 featuretype=21
-        /*if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Scale.getKey()))) {
-            Map<String, Object> scale = scale(aiSearchData);
-            String scaleContent = "";
-            if (scale != null && scale.size() > 0) {
-                scaleContent = JSON.toJSONString(scale);
-            }
-            List<ScaleContent> scaleContentList = scaleContentFacade.getContent(pushVO.getScaleId(), scaleContent);
-            pushDTO.setScale(scaleContentList);
-        }*/
-
-        //管理评估 featuretype=11 && disType=1(慢病)
-        /*if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.ManagementEvaluation.getKey()))) {
-            Map<String, JSONObject> managementEvaluation = data.getManagementEvaluation();
-            if (pushVO.getDisType().equals(DisTypeEnum.CHRONIC.getKey())) {
-                List<EvaluationDTO> evaluationModule = evaluationModuleMappingFacade.getEvaluationModule(pushVO.getDiseaseId(), managementEvaluation);
-                pushDTO.setEvaluationModule(evaluationModule);
-            }
-        }*/
         return pushDTO;
     }
 

icss-service/src/main/java/com/diagbot/vo/EvaluationdiseaseNameVO.java → icss-service/src/main/java/com/diagbot/vo/EvaluationDiseaseNameVO.java


+ 0 - 1
icss-service/src/main/java/com/diagbot/vo/PushVO.java

@@ -18,7 +18,6 @@ public class PushVO  extends PushBaseVO {
     private String diseaseName;
     private Long patientId;   //病人id
     private String scaleName; //量表名称
-    //private Long scaleId;     //量表id
     private Integer disType;  //0-普通病(默认不填),1-慢病,2-急诊
     private List<AdverseReaction> adverseReactions; //不良反应
     private String indications;   //推理指标

+ 0 - 43
icssman-service/src/main/java/com/diagbot/client/KLMServiceClient.java

@@ -1,43 +0,0 @@
-package com.diagbot.client;
-
-import com.diagbot.dto.ConceptBaseDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.vo.ConceptSearchVO;
-import com.diagbot.vo.ConceptTypeVO;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @Description: 调用知识库维护服务
- * @author: gaodm
- * @time: 2018/8/6 9:52
- */
-@FeignClient(value = "icssman-service", fallback = KLMServiceClient.class)
-public interface KLMServiceClient {
-	/**
-	 * 根据概念Id列表获取概念列表Map
-	 *
-	 * @param conceptSearchVO 搜索参数
-	 * @return 术语id和术语 Map
-	 */
-	@PostMapping("/concept/getConceptMap")
-	RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO);
-
-	/**
-	 * 根据类型获取术语列表(科室、辅检、慢病)
-	 *
-	 * @param conceptTypeVO 类型 type: 1:科室、2:辅检、3:慢病
-	 * @return 术语列表
-	 */
-	@PostMapping("/concept/getConceptListByType")
-	RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO);
-    
-}
-
-
-

+ 21 - 1
icssman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java

@@ -4,6 +4,8 @@ import com.diagbot.client.hystrix.KnowledgemanServiceHystrix;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.vo.ConceptExistVO;
+import com.diagbot.vo.ConceptSearchVO;
+import com.diagbot.vo.ConceptTypeVO;
 import com.diagbot.vo.IndexVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -24,5 +26,23 @@ public interface KnowledgemanServiceClient {
     RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO);
 
     @PostMapping("/commonconcept/getConceptMapByNameAndType")
-    RespDTO<Map<String, Long>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
+    RespDTO<Map<String, List<Integer>>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
+
+    /**
+     * 根据概念Id列表获取概念列表Map
+     *
+     * @param conceptSearchVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    @PostMapping("/concept/getConceptMap")
+    RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO);
+
+    /**
+     * 根据类型获取术语列表(科室、辅检、慢病)
+     *
+     * @param conceptTypeVO 类型 type: 1:科室、2:辅检、3:慢病
+     * @return 术语列表
+     */
+    @PostMapping("/concept/getConceptListByType")
+    RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO);
 }

+ 0 - 49
icssman-service/src/main/java/com/diagbot/client/hystrix/KLMServiceHystrix.java

@@ -1,49 +0,0 @@
-package com.diagbot.client.hystrix;
-
-import com.diagbot.client.KLMServiceClient;
-import com.diagbot.dto.ConceptBaseDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.vo.ConceptSearchVO;
-import com.diagbot.vo.ConceptTypeVO;
-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;
-import java.util.Map;
-
-
-/**
- * @Description: 调用知识库维护服务
- * @author: gaodm
- * @time: 2018/8/6 9:52
- */
-@Component
-@Slf4j
-public class KLMServiceHystrix implements KLMServiceClient {
-
-    /**
-     * 根据概念Id列表获取概念列表Map
-     *
-     * @param conceptSearchVO 搜索参数
-     * @return 术语id和术语 Map
-     */
-    @Override
-    public RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO) {
-        log.error("【hystrix】调用{}异常", "getConceptMap");
-        return null;
-    }
-
-    /**
-     * 根据类型获取术语列表(科室、辅检、慢病)
-     *
-     * @param conceptTypeVO 类型
-     * @return 术语列表
-     */
-    public RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO){
-        log.error("【hystrix】调用{}异常", "getConceptListByType");
-        return null;
-    }
-
-}

+ 28 - 1
icssman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java

@@ -4,9 +4,12 @@ import com.diagbot.client.KnowledgemanServiceClient;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.vo.ConceptExistVO;
+import com.diagbot.vo.ConceptSearchVO;
+import com.diagbot.vo.ConceptTypeVO;
 import com.diagbot.vo.IndexVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 import java.util.Map;
@@ -27,8 +30,32 @@ public class KnowledgemanServiceHystrix implements KnowledgemanServiceClient {
     }
 
     @Override
-    public RespDTO<Map<String, Long>> getConceptMap(ConceptExistVO conceptExistVO) {
+    public RespDTO<Map<String, List<Integer>>> getConceptMap(ConceptExistVO conceptExistVO) {
         log.error("【hystrix】调用{}异常", "getConceptMap");
         return null;
     }
+
+    /**
+     * 根据概念Id列表获取概念列表Map
+     *
+     * @param conceptSearchVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    @Override
+    public RespDTO<Map<Long, String>> getConceptMap(@RequestBody ConceptSearchVO conceptSearchVO) {
+        log.error("【hystrix】调用{}异常", "getConceptMap");
+        return null;
+    }
+
+    /**
+     * 根据类型获取术语列表(科室、辅检、慢病)
+     *
+     * @param conceptTypeVO 类型
+     * @return 术语列表
+     */
+    public RespDTO<List<ConceptBaseDTO>> getConceptListByType(@RequestBody ConceptTypeVO conceptTypeVO){
+        log.error("【hystrix】调用{}异常", "getConceptListByType");
+        return null;
+    }
+
 }

+ 2 - 2
icssman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -31,8 +31,8 @@ public class ConceptFacade extends DisTypeServiceImpl {
     }
 
 
-    public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO){
-        RespDTO<Map<String, Long>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
+    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO){
+        RespDTO<Map<String, List<Integer>>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
         RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
         return res.data;
     }

+ 20 - 17
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -39,8 +39,10 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.DeleteQuestionVO;
 import com.diagbot.vo.GetQuestionIdsByTypeVO;
 import com.diagbot.vo.GetQuestionInfoVO;
@@ -436,23 +438,24 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             bean.setModifier(mapRespDTO.data.get(bean.getModifier()));
         }
 
-        //TODO 待修改
-//        List<String> nameList = res.getRecords().stream().map(row -> row.getTagName()).collect(Collectors.toList());
-//        ConceptExistVO conceptExistVO = new ConceptExistVO();
-//        conceptExistVO.setNameList(nameList);
-//        conceptExistVO.setType(res.getRecords().get(0).getType());
-//        try {
-//            RespDTO<Map<String, Long>> resMap = knowledgemanServiceClient.getConceptMap(conceptExistVO);
-//            RespDTOUtil.respNGDeal(resMap, "远程调用根据名称和类型获取概念列表失败");
-//            Map<String, Long> map = resMap.data;
-//            for (QuestionPageDTO bean :  res.getRecords()) {
-//                if(map.get(bean.getTagName()) != null) {
-//                    bean.setExist(true);
-//                }
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
+        List<String> nameList = res.getRecords().stream().map(row -> row.getTagName()).collect(Collectors.toList());
+        ConceptExistVO conceptExistVO = new ConceptExistVO();
+        conceptExistVO.setNameList(nameList);
+        try {
+            RespDTO<Map<String, List<Integer>>> resMap = knowledgemanServiceClient.getConceptMap(conceptExistVO);
+            RespDTOUtil.respNGDeal(resMap, "远程调用根据名称和类型获取概念列表失败");
+            Map<String, List<Integer>> map = resMap.data;
+            for (QuestionPageDTO bean : res.getRecords()) {
+                List<Integer> list = map.get(bean.getTagName());
+                if (ListUtil.isNotEmpty(list)) {
+                    if (list.contains(bean.getType())) {
+                        bean.setExist(true);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return res;
     }
 

+ 89 - 84
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -48,9 +48,11 @@ import com.diagbot.service.LibraryInfoService;
 import com.diagbot.service.impl.ConceptServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.IntegerUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamConvertUtil;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddConceptInfoDetailVO;
@@ -162,14 +164,11 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @return
      */
     public IPage<GetAllInformationDTO> getAllInformation(GetAllInformationVO getAllInformationVO) {
-        IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
+    	IPage<GetAllInformationDTO> ipage = libraryinfoFacade.getAllInformation(getAllInformationVO);
         if (ipage.getRecords().size() > 0) {
             List<String> ids = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
             RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
-            if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
-                throw new CommonException(CommonErrorCode.RPC_ERROR,
-                        "获取用户信息失败");
-            }
+            RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
             ipage.getRecords().forEach(i -> {
                 i.setOperName(respDTO.data.get(i.getOperName()));
             });
@@ -262,27 +261,27 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @return libName-标准术语,otherNames-同义词
      */
     public GetConceptInfoDTO getConceptInfoDetail(GetConceptInfoDetailVO getConceptInfoDetailVO) {
-    	GetConceptInfoDTO getConceptInfoDTO = new GetConceptInfoDTO();
-    	
+        GetConceptInfoDTO getConceptInfoDTO = new GetConceptInfoDTO();
+
         QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
         libraryInfoQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
         List<LibraryInfo> libraryInfoList = libraryinfoFacade.list(libraryInfoQe);
-        
+
         getConceptInfoDTO.setLibName(BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() != null && i.getIsConcept() == 1).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
         getConceptInfoDTO.setOtherNames(BeanUtil.listCopyTo(libraryInfoList.stream().filter(i -> i.getIsConcept() == null || i.getIsConcept() == 0).collect(Collectors.toList()), GetConceptInfoDetailDTO.class));
 
         Integer isHasCommon = lexiconFacade.getById(libraryInfoList.get(0).getTypeId()).getIsHasCommon();
-        if(isHasCommon==1){
-        	QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
+        if (isHasCommon == 1) {
+            QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
             conceptCommonQe.eq("concept_id", getConceptInfoDetailVO.getConceptId());
             ConceptCommon conceptCommon = conceptCommonFacade.getOne(conceptCommonQe);
-            if(conceptCommon!=null){
-            	getConceptInfoDTO.setSexType(conceptCommon.getSexType());
-            	getConceptInfoDTO.setMinAge(conceptCommon.getMinAge());
-            	getConceptInfoDTO.setMaxAge(conceptCommon.getMaxAge());
+            if (conceptCommon != null) {
+                getConceptInfoDTO.setSexType(conceptCommon.getSexType());
+                getConceptInfoDTO.setMinAge(conceptCommon.getMinAge());
+                getConceptInfoDTO.setMaxAge(conceptCommon.getMaxAge());
             }
         }
-        
+
         return getConceptInfoDTO;
     }
 
@@ -430,17 +429,17 @@ public class ConceptFacade extends ConceptServiceImpl {
         concept.setGmtModified(now);
         concept.setModifier(currentUser);
         updateById(concept);
-        
-        if(lexicon.getIsHasCommon()==1){
-        	QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
+
+        if (lexicon.getIsHasCommon() == 1) {
+            QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
             conceptCommonQe.eq("concept_id", conceptId);
             ConceptCommon conceptCommon = conceptCommonFacade.getOne(conceptCommonQe);
-            if(conceptCommon==null){
-            	conceptCommon = new ConceptCommon();
+            if (conceptCommon == null) {
+                conceptCommon = new ConceptCommon();
             }
-            
+
             BeanUtil.copyProperties(addConceptInfoVO, conceptCommon);
-            
+
             conceptCommonFacade.saveOrUpdate(conceptCommon);
         }
 
@@ -683,8 +682,8 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @return 术语列表
      */
     public List<ConceptBaseDTO> getConceptListByType(ConceptTypeVO conceptTypeVO) {
-        if(null == conceptTypeVO
-                || IntegerUtil.isNull(conceptTypeVO.getType())){
+        if (null == conceptTypeVO
+                || IntegerUtil.isNull(conceptTypeVO.getType())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "类型不能为空");
         }
         List<ConceptBaseDTO> res = ListUtil.newArrayList();
@@ -752,65 +751,71 @@ public class ConceptFacade extends ConceptServiceImpl {
     }
 
 
+    /**
+     * 根据名称和类型获取概念列表Map
+     *
+     * @param conceptExistVO 搜索参数
+     * @return 术语id和术语 Map
+     */
+    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO) {
+        // 入参验证
+        if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
+        }
+
+        if (conceptExistVO.getType() != null) {
+            Integer libType = ParamConvertUtil.conceptConvert2Lib(conceptExistVO.getType());
+            if (libType == null) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
+            }
+            conceptExistVO.setLibType(libType);
+        }
 
-	/**
-	 * 根据名称和类型获取概念列表Map
-	 *
-	 * @param conceptExistVO 搜索参数
-	 * @return 术语id和术语 Map
-	 */
-	public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO) {
-		//入参验证
-		if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
-			throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
-		}
-
-		if (conceptExistVO.getType() == null) {
-			throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "类型不能为空");
-		}
-		Integer libType = ParamConvertUtil.conceptConvert2Lib(conceptExistVO.getType());
-		if(libType == null) {
-			throw  new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
-		}
-		conceptExistVO.setLibType(libType);
-		//获取结构
-		List<Concept> concepts
-				= this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
-
-		//出参封装
-		Map<String, Long> map = new HashMap<>();
-		if (ListUtil.isNotEmpty(concepts)) {
-			map = concepts.stream().collect(Collectors.toMap(r -> r.getLibName(), r -> r.getId()));
-		}
-		return map;
-	}
-
-
-
-	/**
-	 * 根据名称和词性获取概念列表
-	 *
-	 * @param nameList
-	 * @param libType
-	 * @return
-	 */
-	public List<Concept> getListByNamesAndType(List<String> nameList, Integer libType) {
-		QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
-		conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-				.in("lib_name", nameList)
-				.eq("lib_type", libType);
-		List<Concept> list = this.list(conceptQueryWrapper);
-		return list;
-	}
-
-
-	public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
-		// 类型转换
-		Integer libType = ParamConvertUtil.conceptConvert2Lib(indexVO.getType());
-		if(libType == null) {
-			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
-		}
-		indexVO.setLibType(libType);
-		return this.index(indexVO);
-	}
+        //获取结构
+        List<Concept> concepts
+                = this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
+        Map<String, List<Concept>> map1 = EntityUtil.makeEntityListMap(concepts, "libName");
+        Map<String, List<Integer>> typeMap = new HashMap<>();
+        for(String key : map1.keySet()) {
+            List<Concept> list = map1.get(key);
+            List<Integer> typeList = new ArrayList<>();
+            if (ListUtil.isNotEmpty(list)) {
+                for (Concept c : list) {
+                    typeList.add(ParamConvertUtil.libConvert2Concept(c.getLibType().intValue()));
+                }
+                typeMap.put(key, typeList);
+            }
+        }
+        return typeMap;
+    }
+
+
+    /**
+     * 根据名称和词性获取概念列表
+     *
+     * @param nameList
+     * @param libType
+     * @return
+     */
+    public List<Concept> getListByNamesAndType(List<String> nameList, Integer libType) {
+        QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
+        conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("lib_name", nameList);
+        if (libType != null) {
+            conceptQueryWrapper.eq("lib_type", libType);
+        }
+        List<Concept> list = this.list(conceptQueryWrapper);
+        return list;
+    }
+
+
+    public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
+        // 类型转换
+        Integer libType = ParamConvertUtil.conceptConvert2Lib(indexVO.getType());
+        if (libType == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "类型不匹配");
+        }
+        indexVO.setLibType(libType);
+        return this.index(indexVO);
+    }
 }

+ 3 - 3
knowledgeman-service/src/main/java/com/diagbot/vo/ConceptExistVO.java

@@ -7,9 +7,9 @@ import lombok.Setter;
 import java.util.List;
 
 /**
- * @Description:
- * @author: gaodm
- * @time: 2019/5/6 18:50
+ * @description:
+ * @author: zhoutg
+ * @date: 2019/5/13 9:57
  */
 @Getter
 @Setter

+ 1 - 1
knowledgeman-service/src/main/java/com/diagbot/web/CommonConceptController.java

@@ -45,7 +45,7 @@ public class CommonConceptController {
                     "type: 类型")
     @PostMapping("/getConceptMapByNameAndType")
     @SysLogger("getConceptMapByNameAndType")
-    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
+    public RespDTO<Map<String, List<Integer>>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
         return RespDTO.onSuc(conceptFacade.getConceptMap(conceptExistVO));
     }
 

+ 15 - 16
knowledgeman-service/src/main/resources/mapper/ConceptMapper.xml

@@ -20,34 +20,33 @@
     		conceptName
     	FROM
     	((SELECT
-		b.`name` as conceptName
-		FROM kl_concept a JOIN kl_library_info b ON a.lib_id=b.id
-		WHERE a.is_deleted='N' AND b.type='化验套餐'
-		ORDER BY a.gmt_modified DESC)
+		lib_name as conceptName
+		FROM kl_concept
+		WHERE is_deleted='N' AND lib_type=12
+		ORDER BY gmt_modified DESC)
 		UNION
 		(SELECT
-		conceptName
-		FROM
-		(SELECT
 		CONCAT(t1.conceptName,'-',t3.conceptName) as conceptName
 		FROM
 		(SELECT
-		a.id as conceptId,
-		b.`name` as conceptName
-		FROM kl_concept a JOIN kl_library_info b ON a.lib_id=b.id
-		WHERE a.is_deleted='N' AND b.type='化验套餐') t1
+		id as conceptId,
+		lib_name as conceptName
+		FROM kl_concept
+		WHERE is_deleted='N' AND lib_type=12) t1
 		JOIN
 		kl_relation t2 
 		ON t1.conceptId=t2.end_id 
 		JOIN
 		(SELECT
-		a.id as conceptId,
-		b.`name` as conceptName
-		FROM kl_concept a JOIN kl_library_info b ON a.lib_id=b.id
-		WHERE a.is_deleted='N' AND b.type='化验明细') t3
+		id as conceptId,
+		lib_name as conceptName
+		FROM kl_concept
+		WHERE is_deleted='N' AND lib_type=13) t3
 		ON t2.start_id=t3.conceptId
+		LEFT JOIN kl_relation_order t4
+		ON t2.id=t4.t_relation_id
 		WHERE t2.is_deleted='N' AND t2.relation_id=3
-		ORDER BY t2.gmt_modified DESC) t)) t
+		ORDER BY t4.order_no DESC)) t
 		WHERE 1=1
 		<if test="conceptName!=null and conceptName!=''">
 			and (conceptName LIKE CONCAT('%',#{conceptName},'%'))

+ 3 - 2
knowledgeman-service/src/main/resources/mapper/LibraryInfoMapper.xml

@@ -25,13 +25,14 @@
 		FROM
 		(SELECT
 		a.id as conceptId,
-		GROUP_CONCAT(CASE WHEN a.lib_id=b.id THEN b.`name` ELSE NULL END) AS libName,
-		b.type AS libType,
+		a.lib_name AS libName,
+		c.`name` AS libType,
 		GROUP_CONCAT(b.`name` ORDER BY b.id ASC SEPARATOR '、') as otherNames,
 		a.modifier as operName,
 		a.gmt_modified as operTime,
 		a.is_deleted as isDeleted
 		FROM kl_concept a JOIN kl_library_info b ON a.id=b.concept_id
+		LEFT JOIN kl_lexicon c ON a.lib_type=c.id 
 		GROUP BY a.id) t
 		where 1=1
 		<if test="name!=null and name!=''">