gaodm il y a 5 ans
Parent
commit
e2b72cc3da

+ 39 - 18
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -225,7 +225,8 @@ public class ConceptFacade extends ConceptServiceImpl {
     public List<GetAllForRelationDTO> getAllForRelation(GetAllForRelationVO getAllForRelationVO) {
         List<GetAllForRelationDTO> retList = Lists.newArrayList();
 
-        if (StringUtil.isNotBlank(getAllForRelationVO.getName()) || getAllForRelationVO.getTypeId() != null) {
+        if (StringUtil.isNotBlank(getAllForRelationVO.getName())
+                || getAllForRelationVO.getTypeId() != null) {
             QueryWrapper<Concept> conceptQe = new QueryWrapper<>();
             conceptQe.eq("is_deleted", IsDeleteEnum.N.getKey());
             conceptQe.like(StringUtil.isNotBlank(getAllForRelationVO.getName()),
@@ -249,7 +250,9 @@ public class ConceptFacade extends ConceptServiceImpl {
                     if (getAllForRelationVO.getRelationTypeId() != null) {
                         QueryWrapper<Concept> conceptQe1 = new QueryWrapper<>();
                         conceptQe1.eq("lib_type", getAllForRelationVO.getRelationTypeId());
-                        relationConceptIdList = list(conceptQe1).stream().map(i -> i.getId()).collect(Collectors.toList());
+                        relationConceptIdList = list(conceptQe1)
+                                .stream()
+                                .map(i -> i.getId()).collect(Collectors.toList());
                     }
                     if (getAllForRelationVO.getRelationConceptId() != null) {
                         relationConceptIdList.add(getAllForRelationVO.getRelationConceptId());
@@ -469,9 +472,11 @@ public class ConceptFacade extends ConceptServiceImpl {
         });
 
         getConceptInfoDTO.setLibName(getConceptInfoDetailDTOList.stream()
-                .filter(i -> i.getIsConcept() != null && i.getIsConcept() == 1).collect(Collectors.toList()));
+                .filter(i -> i.getIsConcept() != null && i.getIsConcept() == 1)
+                .collect(Collectors.toList()));
         getConceptInfoDTO.setOtherNames(getConceptInfoDetailDTOList.stream()
-                .filter(i -> i.getIsConcept() == null || i.getIsConcept() == 0).collect(Collectors.toList()));
+                .filter(i -> i.getIsConcept() == null || i.getIsConcept() == 0)
+                .collect(Collectors.toList()));
 
         Lexicon lexicon = lexiconFacade.getById(concept.getLibType());
         getConceptInfoDTO.setIsHasCommon(lexicon.getIsHasCommon());
@@ -517,32 +522,38 @@ public class ConceptFacade extends ConceptServiceImpl {
         for (AddConceptInfoDetailVO i : addConceptInfoVO.getDetailList()) {
             if (i.getName().matches(regEx)) {
                 //throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "无法输入纯数字或者纯字符,请输入正确数据!");
-                throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "无法输入纯数字,请输入正确数据!");
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        lineNumStr + "无法输入纯数字,请输入正确数据!");
             }
         }
 
         if (addConceptInfoVO.getMaxAge() < addConceptInfoVO.getMinAge()) {
-            throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "症状发生的最小年龄大于症状发生的最大年龄!");
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    lineNumStr + "症状发生的最小年龄大于症状发生的最大年龄!");
         }
 
         if (addConceptInfoVO.getDetailList().stream().distinct().count() != addConceptInfoVO.getDetailList().size()) {
-            throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "存在重复数据!");
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    lineNumStr + "存在重复数据!");
         }
 
         List<AddConceptInfoDetailVO> addConceptInfoDetailVOMainList = addConceptInfoVO.getDetailList()
                 .stream().filter(i -> i.getIsConcept() == 1).collect(Collectors.toList());
         if (addConceptInfoDetailVOMainList.size() == 0) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, lineNumStr + "无标准术语!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                    lineNumStr + "无标准术语!");
         }
         if (addConceptInfoDetailVOMainList.size() > 1) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, lineNumStr + "标准术语只能有一个!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
+                    lineNumStr + "标准术语只能有一个!");
         }
 
         QueryWrapper<Lexicon> lexiconQe = new QueryWrapper<>();
         lexiconQe.eq("name", addConceptInfoVO.getType());
         Lexicon lexicon = lexiconFacade.getOne(lexiconQe, false);
         if (lexicon == null) {
-            throw new CommonException(CommonErrorCode.NOT_EXISTS, lineNumStr + "数据有误,该类型信息在数据库中不存在!");
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    lineNumStr + "数据有误,该类型信息在数据库中不存在!");
         }
 
         List<LibraryInfo> saveOrUpdateLibraryInfoList = new ArrayList<>();
@@ -591,14 +602,18 @@ public class ConceptFacade extends ConceptServiceImpl {
                     if (concept.getIsDeleted().equals("N")) {
                         throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已经建立!");
                     } else {
-                        throw new CommonException(CommonErrorCode.RPC_ERROR, "该数据已经建立且处于已删除状态,可前往列表中恢复该条数据!");
+                        throw new CommonException(CommonErrorCode.RPC_ERROR,
+                                "该数据已经建立且处于已删除状态,可前往列表中恢复该条数据!");
                     }
                 } else if (addConceptInfoVO.getConceptId().intValue() != ckConceptId) {
                     throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "标准术语已被占用!");
                 }
-            } else if (addConceptInfoVO.getLineNum() == null && addConceptInfoVO.getConceptId() == null && concept != null
+            } else if (addConceptInfoVO.getLineNum() == null
+                    && addConceptInfoVO.getConceptId() == null
+                    && concept != null
                     || libraryInfoList.stream().filter(i -> i.getConceptId().intValue() == ckConceptId).count() == 1) {
-                throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "标准术语已作为同义词被占用!");
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        lineNumStr + "标准术语已作为同义词被占用!");
             }
         }
 
@@ -783,7 +798,9 @@ public class ConceptFacade extends ConceptServiceImpl {
                                         && StringUtil.isEmpty(otherNames) && StringUtil.isEmpty(remark)) {
                                     continue;
                                 }
-                                if (StringUtil.isEmpty(libName) || StringUtil.isEmpty(libType) || StringUtil.isEmpty(otherNames)) {
+                                if (StringUtil.isEmpty(libName)
+                                        || StringUtil.isEmpty(libType)
+                                        || StringUtil.isEmpty(otherNames)) {
                                     sbf.append("第" + count + "行数据不完整;").append("<br/>");
                                     continue;
                                 }
@@ -890,7 +907,8 @@ public class ConceptFacade extends ConceptServiceImpl {
         }
 
         if (addConceptInfoVOList.size() > 5000) {
-            throw new CommonException(CommonErrorCode.RPC_ERROR, "当前数据导入失败,单次导入最多可支持5千条数据导入");
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "当前数据导入失败,单次导入最多可支持5千条数据导入");
         }
 
         /****************excel文件中所有术语存在重复提示---名字和类型一样即重复***********************/
@@ -898,7 +916,8 @@ public class ConceptFacade extends ConceptServiceImpl {
         addConceptInfoVOList.forEach(i -> {
             addConceptInfoDetailVOList.addAll(i.getDetailList());
         });
-        Map<String, List<AddConceptInfoDetailVO>> addConceptInfoDetailVOListMap = addConceptInfoDetailVOList.stream()
+        Map<String, List<AddConceptInfoDetailVO>> addConceptInfoDetailVOListMap
+                = addConceptInfoDetailVOList.stream()
                 .collect(Collectors.groupingBy(AddConceptInfoDetailVO::getName));
         for (String key : addConceptInfoDetailVOListMap.keySet()) {
             if (addConceptInfoDetailVOListMap.get(key).size() > 1
@@ -1068,7 +1087,8 @@ public class ConceptFacade extends ConceptServiceImpl {
      */
     private void saveAddConceptInfoVOList(List<AddConceptInfoVO> addConceptInfoVOList) {
         List<Long> conceptIds = addConceptInfoVOList.stream()
-                .filter(i -> i.getConceptId() != null).map(i -> i.getConceptId()).collect(Collectors.toList());
+                .filter(i -> i.getConceptId() != null)
+                .map(i -> i.getConceptId()).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(conceptIds)) {
             QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<>();
             libraryInfoQe.in("concept_id", conceptIds);
@@ -1129,7 +1149,8 @@ public class ConceptFacade extends ConceptServiceImpl {
         }
 
         List<AddConceptInfoVO> disExtConList = addConceptInfoVOList.stream()
-                .filter(i -> i.getConceptId() == null && i.getType().equals(LexiconTypeEnum.DIAGNOSIS.getName()))
+                .filter(i -> i.getConceptId() == null
+                        && i.getType().equals(LexiconTypeEnum.DIAGNOSIS.getName()))
                 .collect(Collectors.toList());
         if (ListUtil.isNotEmpty(disExtConList)) {
             String currentUser = UserUtils.getCurrentPrincipleID();