Преглед изворни кода

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

wangfeng пре 5 година
родитељ
комит
45e71a7a16

+ 28 - 12
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -136,7 +136,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         moduleInfo.setType(addModulInfoVO.getType());
         moduleInfo.setModuleType(addModulInfoVO.getModuleType());
         //当添加为科室专用模板或者慢病模板时添加关联id
-        if (addModulInfoVO.getModuleType().intValue() == 1 || addModulInfoVO.getModuleType().intValue() == 2) {
+        if (addModulInfoVO.getModuleType().intValue() == 1
+                || addModulInfoVO.getModuleType().intValue() == 2) {
             moduleInfo.setRelationId(addModulInfoVO.getRelationId());
         }
         this.save(moduleInfo);
@@ -233,7 +234,9 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             moduleInfoQueryWrapper.eq("relation_id", getModuleInfoVO.getRelationId());
         }
         List<ModuleInfo> moduleInfoList = this.list(moduleInfoQueryWrapper);
-        List<Long> moduleIdList = moduleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
+        List<Long> moduleIdList
+                = moduleInfoList.stream()
+                .map(m -> m.getId()).collect(Collectors.toList());
         //给ModuleInfoDTO设值
         List<ModuleInfoDTO> moduleInfoDTOList = new ArrayList<>();
         if (ListUtil.isNotEmpty(moduleIdList)) {
@@ -290,14 +293,16 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         //获取科室名称
         ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
         conceptTypeVO.setType(1);
-        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList
+                = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
         RespDTOUtil.respNGDeal(deptInfoList, "获取科室信息失败");
         Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream()
                 .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
         //获取疾病名称
         conceptTypeVO = new ConceptTypeVO();
         conceptTypeVO.setType(3);
-        RespDTO<List<ConceptBaseDTO>> disInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTO<List<ConceptBaseDTO>> disInfoList
+                = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
         RespDTOUtil.respNGDeal(disInfoList, "获取疾病信息失败");
         Map<Long, ConceptBaseDTO> disInfoMap = disInfoList.data.stream()
                 .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
@@ -370,7 +375,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             //如果是辅检,调用knowledgeman获取辅检信息
             ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
             conceptTypeVO.setType(2);
-            RespDTO<List<ConceptBaseDTO>> pacsCeptInfo = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+            RespDTO<List<ConceptBaseDTO>> pacsCeptInfo
+                    = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
             Map<Long, ConceptBaseDTO> pacsCeptMap = pacsCeptInfo.data.stream()
                     .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
             //循环给出参赋值
@@ -455,14 +461,16 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         //获取科室名称
         ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
         conceptTypeVO.setType(1);
-        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList
+                = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
         RespDTOUtil.respNGDeal(deptInfoList, "获取科室信息失败");
         Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream()
                 .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
         //获取疾病名称
         conceptTypeVO = new ConceptTypeVO();
         conceptTypeVO.setType(3);
-        RespDTO<List<ConceptBaseDTO>> disInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTO<List<ConceptBaseDTO>> disInfoList
+                = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
         RespDTOUtil.respNGDeal(disInfoList, "获取疾病信息失败");
         Map<Long, ConceptBaseDTO> disInfoMap = disInfoList.data.stream()
                 .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
@@ -548,11 +556,14 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         deptType.setType(1);
         RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(deptType);
         RespDTOUtil.respNGDeal(deptInfoList, "获取科室信息失败");
-        if (getAllDeptAndDisInfoVO.getModuleType() != null && getAllDeptAndDisInfoVO.getModuleType().intValue() == 1) {
+        if (getAllDeptAndDisInfoVO.getModuleType() != null
+                && getAllDeptAndDisInfoVO.getModuleType().intValue() == 1) {
             //过滤添加过得科室
             List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),
                     getAllDeptAndDisInfoVO.getType());
-            List<Long> deptIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
+            List<Long> deptIds = moduleInfoList.stream()
+                    .map(ModuleInfo::getRelationId)
+                    .collect(Collectors.toList());
             Iterator<ConceptBaseDTO> deptIterator = deptInfoList.data.iterator();
             for (Long deptId : deptIds) {
                 while (deptIterator.hasNext()) {
@@ -573,7 +584,9 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
                 && getAllDeptAndDisInfoVO.getModuleType().intValue() == 2) {//过滤添加过得疾病
             List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),
                     getAllDeptAndDisInfoVO.getType());
-            List<Long> disIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
+            List<Long> disIds = moduleInfoList.stream()
+                    .map(ModuleInfo::getRelationId)
+                    .collect(Collectors.toList());
             Iterator<ConceptBaseDTO> disIterator = disTypes.data.iterator();
             for (Long disId : disIds) {
                 while (disIterator.hasNext()) {
@@ -619,7 +632,9 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("question_id", getQuestiongAndModuleRelationsVO.getQuestionId()));
         if (ListUtil.isNotEmpty(moduleDetails)) {
-            List<Long> moduleIds = moduleDetails.stream().map(row -> row.getModuleId()).collect(Collectors.toList());
+            List<Long> moduleIds = moduleDetails.stream()
+                    .map(row -> row.getModuleId())
+                    .collect(Collectors.toList());
             List<String> moduleNames = this.list(new QueryWrapper<ModuleInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .in("id", moduleIds))
@@ -641,7 +656,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             }
         }
         titalMsg.append("该标签已关联父级:").append(questionMsg).append("<br/>").append(errMsg);*/
-        GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelationsDTO = new GetQuestiongAndModuleRelationsDTO();
+        GetQuestiongAndModuleRelationsDTO getQuestiongAndModuleRelationsDTO
+                = new GetQuestiongAndModuleRelationsDTO();
         getQuestiongAndModuleRelationsDTO.setRelationInfos(errMsg);
         return getQuestiongAndModuleRelationsDTO;
     }

+ 14 - 10
knowledgeman-service/src/main/java/com/diagbot/facade/MultContactFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.service.impl.RelationServiceImpl;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.OnlyByRootListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -38,16 +39,19 @@ public class MultContactFacade extends RelationServiceImpl {
 
         if (ListUtil.isNotEmpty(ipage.getRecords())) {
             List<String> userIds = ipage.getRecords()
-					.stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
-            RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
-            RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
-
-            ipage.getRecords().forEach(i -> {
-                i.setOperName(respDTO.data.get(i.getOperName()));
-                i.setLibType(LexiconTypeEnum.getName(i.getLibTypeId().intValue()));
-                i.setLibNameType(i.getLibName() + "(" + i.getLibType() + ")");
-
-            });
+                    .stream().filter(i -> StringUtil.isNotBlank(i.getOperName()))
+                    .map(i -> i.getOperName()).distinct().collect(Collectors.toList());
+
+            if (ListUtil.isNotEmpty(userIds)) {
+                RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
+                RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
+
+                ipage.getRecords().forEach(i -> {
+                    i.setOperName(respDTO.data.get(i.getOperName()));
+                    i.setLibType(LexiconTypeEnum.getName(i.getLibTypeId().intValue()));
+                    i.setLibNameType(i.getLibName() + "(" + i.getLibType() + ")");
+                });
+            }
         }
 
         return ipage;

+ 7 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/OnlyByRootListVO.java

@@ -41,6 +41,13 @@ public class OnlyByRootListVO extends Page {
     @ApiModelProperty(value="关系类型id")
     private Long relationId;
 
+    /**
+     * 仅有根时是否列出,1-是,0-否
+     */
+    @ApiModelProperty(value="仅有根时是否列出,1-是,0-否")
+    private Integer isOnlyHasRoot = 1;
+
+
     
     
 }

+ 46 - 2
knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

@@ -143,7 +143,7 @@
     </select>
     
     <select id="onlyByRootList" resultType="com.diagbot.dto.OnlyByRootListDTO">
-    	SELECT
+    	<!--SELECT
 		c.id AS conceptId,
 		c.lib_name AS libName,
 		c.lib_type AS libTypeId,
@@ -171,7 +171,51 @@
 		LEFT JOIN kl_relation_order e ON a.id=e.t_relation_id
 		WHERE b.end_id IS NULL
 		GROUP BY c.id
-		ORDER BY operTime DESC
+		ORDER BY operTime DESC-->
+		SELECT
+			t2.id AS conceptId,
+			t2.lib_name AS libName,
+			t2.lib_type AS libTypeId,
+			GROUP_CONCAT(t3.lib_name ORDER BY t1.order_no ASC) AS otherNames,
+			t1.modifier AS operName,
+			t1.gmt_modified AS operTime,
+			t1.is_deleted AS isDeleted
+		FROM
+		(
+		SELECT
+		a.*,c.order_no
+		FROM
+		(SELECT id,is_deleted,gmt_modified,modifier,start_id,end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') a
+		LEFT JOIN
+		(SELECT end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') b
+		ON a.start_id=b.end_id
+		LEFT JOIN kl_relation_order c ON a.id=c.t_relation_id
+		WHERE b.end_id IS NULL
+		) t1
+		<if test="isOnlyHasRoot==1">
+			RIGHT
+		</if>
+		JOIN
+		(
+		SELECT id,lib_name,lib_type
+		FROM kl_concept
+		WHERE is_deleted='N'
+		AND lib_type in
+		<foreach collection="startTypeIds" open="(" close=")" separator="," item="startTypeId">
+			#{startTypeId}
+		</foreach>
+		<if test="name!=null and name!=''">
+			AND lib_name LIKE CONCAT("%",#{name},"%")
+		</if>
+		) t2
+		ON t1.start_id=t2.id
+		<if test="isOnlyHasRoot==1">
+			LEFT
+		</if>
+		JOIN
+		kl_concept t3 ON t1.end_id=t3.id
+		GROUP BY t2.id
+		ORDER BY t1.gmt_modified DESC,t2.id DESC
     </select>
     
     

+ 16 - 10
precman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -90,19 +90,25 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
                 textList.add(addModuleDetailVO.getText());
             }
         }
-        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("tag_type", TagTypeEnum.T8.getKey())
-                .eq("type", addModuleInfoVO.getTextType())
-                .in("name", textList);
-        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
         //将标签id放入map
         Map<String, Long> questionIdMap = new HashMap<>();
-        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModuleDetail()) {
-            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
-                questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+        if(ListUtil.isNotEmpty(textList)){
+            QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("tag_type", TagTypeEnum.T8.getKey())
+                    .eq("type", addModuleInfoVO.getTextType())
+                    .in("name", textList);
+            List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
+            for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModuleDetail()) {
+                if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                    questionIdMap = questionInfoList.stream()
+                            .collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+                }
             }
         }
+
         QuestionInfo addquestionInfo = null;
         List<QuestionInfo> addQuestionInfoList = new ArrayList<>();
         List<String> textExistList = new ArrayList<>();
@@ -131,7 +137,7 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
         questionInfoService.saveBatch(addQuestionInfoList);
         //查询自定义标签的id
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper1 = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+        questionInfoQueryWrapper1.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("type", addModuleInfoVO.getTextType())
                 .eq("tag_type", TagTypeEnum.T8.getKey());
         List<QuestionInfo> questionInfoList1 = questionFacade.list(questionInfoQueryWrapper1);

+ 10 - 4
precman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -255,7 +255,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             conceptTypeVO.setType(1);
             RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
             RespDTOUtil.respNGDeal(deptInfoList, "获取科室信息失败");
-            Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
+            Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream()
+                    .collect(Collectors.toMap(ConceptBaseDTO::getConceptId, conceptBaseDTO -> conceptBaseDTO));
             //获取模板类型
             BeanUtil.copyProperties(moduleInfo, getModuleInfoOneDTO);
             //获取模板类型名称
@@ -265,7 +266,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
                     .eq("return_type", 1)
                     .orderByDesc("order_no");
             List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
-            Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal, dictionaryInfo -> dictionaryInfo));
+            Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream()
+                    .collect(Collectors.toMap(DictionaryInfo::getVal, dictionaryInfo -> dictionaryInfo));
             if (null != dictionaryInfoMap.get(getModuleInfoOneDTO.getType())) {
                 getModuleInfoOneDTO.setAscriptionName(dictionaryInfoMap.get(getModuleInfoOneDTO.getType()).getName());
             }
@@ -283,8 +285,12 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
                     .eq("module_id", getModuleInfoOneVO.getModuleId())
                     .orderByAsc("order_no");
             List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(moduleDetailQueryWrapper);
-            List<Long> questionIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getQuestionId()).collect(Collectors.toList());
-            List<Long> moduleIdList = moduleDetailList.stream().map(moduleDetail -> moduleDetail.getRelationModule()).collect(Collectors.toList());
+            List<Long> questionIdList = moduleDetailList.stream()
+                    .map(moduleDetail -> moduleDetail.getQuestionId())
+                    .collect(Collectors.toList());
+            List<Long> moduleIdList = moduleDetailList.stream()
+                    .map(moduleDetail -> moduleDetail.getRelationModule())
+                    .collect(Collectors.toList());
             //获取标签信息
             Map<Long, QuestionInfo> questionInfoMap = new HashMap<>();
             if (ListUtil.isNotEmpty(questionIdList)) {