Просмотр исходного кода

Merge branch 'dev/20220228_v3.0.1通用版_渠道管理第一期' into debug

zhanghang 3 лет назад
Родитель
Сommit
4fbfc2989b

+ 42 - 0
daqe-center/src/main/java/com/lantone/daqe/enums/DataSaveUrlEnum.java

@@ -0,0 +1,42 @@
+package com.lantone.daqe.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 数据保存url注解
+ * @author: songxl
+ * @time: 2022/3/4 16:03
+ */
+public enum DataSaveUrlEnum {
+    BEHOSPITAL_INFO("save/saveBehospitalCode", "病历数据"),
+    HOME_PAGE("save/saveHomePages", "病案首页"),
+    MEDICAL_RECORD("save/saveRecs", "文书记录");
+
+    @Getter
+    @Setter
+    private String key;
+
+    @Getter
+    @Setter
+    private String name;
+
+    DataSaveUrlEnum(String key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static DataSaveUrlEnum getEnum(String key) {
+        for (DataSaveUrlEnum item : DataSaveUrlEnum.values()) {
+            if (item.key.equals(key)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(String key) {
+        DataSaveUrlEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+}

+ 11 - 9
daqe-center/src/main/java/com/lantone/daqe/facade/BlockLossManagementFacade.java

@@ -25,6 +25,7 @@ import com.lantone.daqe.entity.BlocklossResult;
 import com.lantone.daqe.entity.HomePage;
 import com.lantone.daqe.entity.MedicalRecord;
 import com.lantone.daqe.entity.MedicalRecordContent;
+import com.lantone.daqe.enums.DataSaveUrlEnum;
 import com.lantone.daqe.enums.LossStatusEnum;
 import com.lantone.daqe.enums.LossTypeEnum;
 import com.lantone.daqe.enums.LossWayEnum;
@@ -136,7 +137,7 @@ public class BlockLossManagementFacade {
 
         //获取操作记录数据
         //病历数据
-        dataCompareVO.setOperationUrl("save/saveBehospitalCode");
+        dataCompareVO.setOperationUrl(DataSaveUrlEnum.BEHOSPITAL_INFO.getKey());
         List<GetOperationLogDTO> behospitalCodeLogs = getOperationLogs(dataCompareVO);
         //病案首页数据
         List<GetOperationLogDTO> homePageLogs = new ArrayList<>();
@@ -151,10 +152,10 @@ public class BlockLossManagementFacade {
             logCodes = behospitalCodeLogs.stream().map(GetOperationLogDTO::getBehospitalCode).collect(Collectors.toList());
             dataCompareVO.setBehospitalCodes(logCodes);
             //病案首页数据
-            dataCompareVO.setOperationUrl("save/saveHomePages");
+            dataCompareVO.setOperationUrl(DataSaveUrlEnum.HOME_PAGE.getKey());
             homePageLogs = removeRepeat(getOperationLogs(dataCompareVO), "homePageId");
             //文书数据
-            dataCompareVO.setOperationUrl("save/saveRecs");
+            dataCompareVO.setOperationUrl(DataSaveUrlEnum.MEDICAL_RECORD.getKey());
             recLogs = removeRepeat(getOperationLogs(dataCompareVO), "recTitle");
         }
 
@@ -624,9 +625,9 @@ public class BlockLossManagementFacade {
      * @Return com.lantone.daqe.dto.BlockLossTypeGatherDTO
      */
     public BlockLossTypeGatherDTO blockLossTypeGather(BlockLossTypeGatherVO blockLossTypeGatherVO) {
-        blockLossTypeGatherVO.setOperationUrls(Lists.newArrayList("save/saveBehospitalCode",
-                "save/saveHomePages",
-                "save/saveRecs"));
+        blockLossTypeGatherVO.setOperationUrls(Lists.newArrayList(DataSaveUrlEnum.BEHOSPITAL_INFO.getKey(),
+                DataSaveUrlEnum.HOME_PAGE.getKey(),
+                DataSaveUrlEnum.MEDICAL_RECORD.getKey()));
 
         DataCompareVO dataCompareVO = new DataCompareVO();
         dataCompareVO.setStartDate(blockLossTypeGatherVO.getStartDate());
@@ -640,7 +641,7 @@ public class BlockLossManagementFacade {
 
         //获取该时间段的日志数量
         //病历数据
-        dataCompareVO.setOperationUrl("save/saveBehospitalCode");
+        dataCompareVO.setOperationUrl(DataSaveUrlEnum.BEHOSPITAL_INFO.getKey());
         List<GetOperationLogDTO> behospitalCodeLogs = getOperationLogs(dataCompareVO);
         //病案首页数据
         List<GetOperationLogDTO> homePageLogs = new ArrayList<>();
@@ -651,10 +652,10 @@ public class BlockLossManagementFacade {
             List<String> logCodes = behospitalCodeLogs.stream().map(GetOperationLogDTO::getBehospitalCode).collect(Collectors.toList());
             dataCompareVO.setBehospitalCodes(logCodes);
             //病案首页数据
-            dataCompareVO.setOperationUrl("save/saveHomePages");
+            dataCompareVO.setOperationUrl(DataSaveUrlEnum.HOME_PAGE.getKey());
             homePageLogs = getOperationLogs(dataCompareVO);
             //文书数据
-            dataCompareVO.setOperationUrl("save/saveRecs");
+            dataCompareVO.setOperationUrl(DataSaveUrlEnum.MEDICAL_RECORD.getKey());
             recLogs = getOperationLogs(dataCompareVO);
             Integer logNum = logCodes.size() + homePageLogs.size() + recLogs.size();
             blockLossTypeGatherDTO.setLogNum(logNum);
@@ -662,6 +663,7 @@ public class BlockLossManagementFacade {
 
         //获取该时间段的实际数量
         List<String> codes = behospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", SysUserUtils.getCurrentHospitalId() != null ? SysUserUtils.getCurrentHospitalId() : 0)
                 .ge(blockLossTypeGatherVO.getStartDate() != null, "behospital_date", blockLossTypeGatherVO.getStartDate())
                 .le(blockLossTypeGatherVO.getEndDate() != null, "behospital_date", blockLossTypeGatherVO.getEndDate()))

+ 29 - 14
daqe-center/src/main/java/com/lantone/daqe/facade/RegularManagementFacade.java

@@ -8,6 +8,7 @@ import com.lantone.common.enums.IsDeleteEnum;
 import com.lantone.common.exception.Asserts;
 import com.lantone.common.util.BeanUtil;
 import com.lantone.common.util.DateUtil;
+import com.lantone.common.util.ListUtil;
 import com.lantone.common.util.SysUserUtils;
 import com.lantone.daqe.dto.GetRegularPageDTO;
 import com.lantone.daqe.entity.ColumnVerify;
@@ -27,6 +28,9 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Description: 正则式维护-业务处理类
  * @author: songxl
@@ -93,25 +97,17 @@ public class RegularManagementFacade {
         regularInfo.setModifier(SysUserUtils.getCurrentPrinciple() == null ? "0" : SysUserUtils.getCurrentPrinciple());
         regularInfo.setGmtModified(DateUtil.now());
         //修改表字段的正则式校验结果表中的正则式
+        //先获取正则维护关联表id
+        List<Long> regularMappingIdList = getRegularMappingId(upRegularByIdVO.getId());
         if (regularInfoFacade.updateById(regularInfo)) {
-            if(regularResultFacade.update(new UpdateWrapper<RegularResult>()
-                    .eq(upRegularByIdVO.getHospitalId() != null, "hospital_id", upRegularByIdVO.getHospitalId())
-                    .eq("regular_id", upRegularByIdVO.getId())
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .set("regular_name", upRegularByIdVO.getName())
-                    .set("regular_val", upRegularByIdVO.getVal())
-                    .set("modifier", SysUserUtils.getCurrentPrinciple() == null ? "0" : SysUserUtils.getCurrentPrinciple())
-                    .set("gmt_modified", DateUtil.now())
-                    .set("regular_des", upRegularByIdVO.getDescription()))){
                 return columnVerifyFacade.update(new UpdateWrapper<ColumnVerify>()
-                        .eq("verify_id", upRegularByIdVO.getId())
+                        .in("verify_id", regularMappingIdList)
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("type", ColumnVerifyTypeEnum.REGULAR_TYPE.getKey())
                         .set("verify_val", upRegularByIdVO.getName())
                         .set("modifier", SysUserUtils.getCurrentPrinciple() == null ? "0" : SysUserUtils.getCurrentPrinciple())
                         .set("gmt_modified", DateUtil.now()));
             }
-            }
         return false;
     }
 
@@ -147,12 +143,14 @@ public class RegularManagementFacade {
         regularInfo.setGmtModified(DateUtil.now());
         regularInfo.setIsDeleted(IsDeleteEnum.Y.getKey());
         if (regularInfoFacade.updateById(regularInfo)) {
+            //先获取正则维护关联表id
+            List<Long> regularMappingIdList = getRegularMappingId(id);
             //删除表字段的实际值与正则式关联关系
             if(regularMappingFacade.remove(new UpdateWrapper<RegularMapping>()
                     .eq("regular_id", id)
                     .eq("is_deleted", IsDeleteEnum.N.getKey()))){
                 return columnVerifyFacade.remove(new UpdateWrapper<ColumnVerify>()
-                        .eq("verify_id", id)
+                        .in("verify_id", regularMappingIdList)
                         .eq("type", ColumnVerifyTypeEnum.REGULAR_TYPE.getKey())
                         .eq("is_deleted", IsDeleteEnum.N.getKey()));
             }
@@ -168,6 +166,23 @@ public class RegularManagementFacade {
         }
         return false;
     }
-
-
+    /**
+     *  根据正则id获取正则维护表id集合
+     *
+     * @param id
+     * @return: 正则维护表id集合
+     */
+    public List<Long> getRegularMappingId(Long id){
+        List<Long> regularMappingIdList = new ArrayList<>();
+        List<RegularMapping> regularMappingList = regularMappingFacade.getBaseMapper().selectList(new QueryWrapper<RegularMapping>()
+                .eq("regular_id", id)
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+        );
+        if(ListUtil.isNotEmpty(regularMappingList)) {
+            for (RegularMapping regularMapping : regularMappingList) {
+                regularMappingIdList.add(regularMapping.getId());
+            }
+        }
+        return regularMappingIdList;
+    }
 }