Kaynağa Gözat

优化代码99999

wangfeng 4 yıl önce
ebeveyn
işleme
5cb71db1af

+ 39 - 18
cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -158,6 +158,11 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             klConceptPare.setLibName(klConceptSaveVO.getLibName());
             klConceptPare.setLibType(klConceptSaveVO.getLibType());
             klConceptPare.setStatus(klConceptSaveVO.getStatus());
+            klConceptPare.setLibId(klConceptSaveVO.getLibId());
+            klConceptPare.setCreator(UserUtils.getCurrentPrincipleID());
+            klConceptPare.setModifier(UserUtils.getCurrentPrincipleID());
+            klConceptPare.setGmtCreate(now);
+            klConceptPare.setGmtModified(now);
             res = save(klConceptPare);
             if (res) {
                 //2.再把标准词d的conceptId保存到kl_library_info表 生成libId,
@@ -168,12 +173,16 @@ public class KlConceptFacade extends KlConceptServiceImpl {
                 klLibraryInfoSub.setSpell(klConceptSaveVO.getSpell());
                 klLibraryInfoSub.setIsConcept(klConceptSaveVO.getIsConcept());
                 klLibraryInfoSub.setRemark(klConceptSaveVO.getRemark());
+                klLibraryInfoSub.setCreator(UserUtils.getCurrentPrincipleID());
+                klLibraryInfoSub.setModifier(UserUtils.getCurrentPrincipleID());
+                klLibraryInfoSub.setGmtCreate(now);
+                klLibraryInfoSub.setGmtModified(now);
                 res = klLibraryInfoFacade.save(klLibraryInfoSub);
                 if (res) {
                     //3.最后更新回concept表里得lid_id字段
                     UpdateWrapper<KlConcept> klConceptQuerySub = new UpdateWrapper<>();
                     klConceptQuerySub.eq("is_deleted", IsDeleteEnum.N.getKey())
-                            .eq("id", klConceptSaveVO.getConceptId())
+                            .eq("id", conceptId)
                             .set("lib_Id", klLibraryInfoSub.getId());
                     res = update(new KlConcept(), klConceptQuerySub);
                 }
@@ -185,35 +194,47 @@ public class KlConceptFacade extends KlConceptServiceImpl {
                 conceptCommon.setMaxAge(klConceptSaveVO.getMaxAge());
                 conceptCommon.setMinAge(klConceptSaveVO.getMinAge());
                 conceptCommon.setConceptId(klConceptPare.getId());
+                conceptCommon.setCreator(UserUtils.getCurrentPrincipleID());
+                conceptCommon.setModifier(UserUtils.getCurrentPrincipleID());
+                conceptCommon.setGmtCreate(now);
+                conceptCommon.setGmtModified(now);
                 klConceptCommonService.save(conceptCommon);
             }
             //更新kl_disease
             KlDisease kllDiseaseSub = new KlDisease();
             kllDiseaseSub.setConceptId(klConceptPare.getId());
             kllDiseaseSub.setGmtModified(now);
-            kllDiseaseSub.setModifier(UserUtils.getCurrentPrincipleID());
             kllDiseaseSub.setIcd10Code(klConceptSaveVO.getIcdCode());
+            kllDiseaseSub.setCreator(UserUtils.getCurrentPrincipleID());
+            kllDiseaseSub.setModifier(UserUtils.getCurrentPrincipleID());
+            kllDiseaseSub.setGmtCreate(now);
+            kllDiseaseSub.setGmtModified(now);
             res = klDiseaseFacade.saveOrUpdate(kllDiseaseSub);
             //更新kl_lis
             KlLis klLisSub = new KlLis();
             klLisSub.setConceptId(klConceptPare.getId());
-            klLisSub.setGmtModified(now);
-            klLisSub.setModifier(UserUtils.getCurrentPrincipleID());
             klLisSub.setMinValue(klConceptSaveVO.getMinVal());
             klLisSub.setMaxValue(klConceptSaveVO.getMaxVal());
             klLisSub.setType(klConceptSaveVO.getScopeType());
+            klLisSub.setCreator(UserUtils.getCurrentPrincipleID());
+            klLisSub.setModifier(UserUtils.getCurrentPrincipleID());
+            klLisSub.setGmtCreate(now);
+            klLisSub.setGmtModified(now);
             res = klLisService.saveOrUpdate(klLisSub);
-            //增加
+            //增加同义词
             List<KlConceptSaveSubVO> klConceptSub = klConceptSaveVO.getKlConceptSub();
-            for (KlConceptSaveSubVO subVO : klConceptSub) {
-                if (subVO.getLibId() == null) {
+            if (ListUtil.isNotEmpty(klConceptSub)) {
+                for (KlConceptSaveSubVO subVO : klConceptSub) {
+                    if (subVO.getLibId() == null) {
 
-                    klLibraryInfoFacade.checkLibraryInfoData(subVO);
+                        klLibraryInfoFacade.checkLibraryInfoData(subVO);
 
-                    res = klLibraryInfoFacade.savekLibraryInfoData(subVO);
+                        res = klLibraryInfoFacade.savekLibraryInfoData(subVO);
+                    }
                 }
             }
 
+
         }
         return res;
     }
@@ -235,8 +256,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
                 .set("gmt_modified", now)
                 .set("modifier", UserUtils.getCurrentPrincipleID())
                 .set("name", klConceptSaveVO.getLibName())
-                .set("spell", klConceptSaveVO.getLibName())
-                .set("remark", klConceptSaveVO.getLibName());
+                .set("spell", klConceptSaveVO.getSpell())
+                .set("remark", klConceptSaveVO.getRemark());
 
         res = klLibraryInfoFacade.update(new KlLibraryInfo(), klLibraryInfoQuerySub);
         //更新kl_concept_common表
@@ -313,19 +334,19 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         return retList;
     }
 
-    public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO){
+    public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
         List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
         String name = searchConceptVO.getName();
         Integer libType = searchConceptVO.getLibType();
         List<Long> excludedConceptIds = searchConceptVO.getExcludedConceptIds();
-        if(StringUtils.isNotBlank(name) && libType != null ){
+        if (StringUtils.isNotBlank(name) && libType != null) {
             List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
-            .like(StringUtil.isNotBlank(name),"lib_name",name.trim())
-            .eq("lib_type",libType)
-            .notIn(ListUtil.isNotEmpty(excludedConceptIds),"id",excludedConceptIds));
-            if(ListUtil.isNotEmpty(conceptList)){
-                getAllForRelationDTOS = conceptList.stream().map(x ->{
+                    .like(StringUtil.isNotBlank(name), "lib_name", name.trim())
+                    .eq("lib_type", libType)
+                    .notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds));
+            if (ListUtil.isNotEmpty(conceptList)) {
+                getAllForRelationDTOS = conceptList.stream().map(x -> {
                     GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
                     getAllForRelationDTO.setConceptNameType(x.getLibName());
                     getAllForRelationDTO.setConceptName(x.getLibName());

+ 9 - 1
cdssman-service/src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java

@@ -6,9 +6,13 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KlLibraryInfoServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.UserUtils;
 import com.diagbot.vo.KlConceptSaveSubVO;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
+
 /**
  * @author wangfeng
  * @Description:
@@ -40,13 +44,17 @@ public class KlLibraryInfoFacade extends KlLibraryInfoServiceImpl {
      * @return
      */
     public  Boolean savekLibraryInfoData(KlConceptSaveSubVO subVO){
-
+        Date now = DateUtil.now();
         KlLibraryInfo klLibraryInfoSub = new KlLibraryInfo();
         klLibraryInfoSub.setConceptId(subVO.getConceptId());
         klLibraryInfoSub.setName(subVO.getSynonymName());
         klLibraryInfoSub.setSpell(subVO.getSpell());
         klLibraryInfoSub.setIsConcept(subVO.getIsConcept());
         klLibraryInfoSub.setRemark(subVO.getRemark());
+        klLibraryInfoSub.setCreator(UserUtils.getCurrentPrincipleID());
+        klLibraryInfoSub.setModifier(UserUtils.getCurrentPrincipleID());
+        klLibraryInfoSub.setGmtCreate(now);
+        klLibraryInfoSub.setGmtModified(now);
         return this.save(klLibraryInfoSub);
     }
 }

+ 1 - 0
cdssman-service/src/main/java/com/diagbot/vo/KlConceptSaveVO.java

@@ -3,6 +3,7 @@ package com.diagbot.vo;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**