Browse Source

通过病历号进行病历数据块对比、补录前先判断病历是否存在

songxinlu 3 năm trước cách đây
mục cha
commit
bb785011e3

+ 15 - 36
daqe-center/src/main/java/com/lantone/daqe/facade/BlockLossManagementFacade.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.google.common.collect.Lists;
 import com.lantone.common.dto.GetOperationLogDTO;
 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.EntityUtil;
@@ -117,6 +118,11 @@ public class BlockLossManagementFacade {
             hospitalId = SysUserUtils.getCurrentHospitalId();
             principleId = SysUserUtils.getCurrentPrincipleId();
         }
+        //获取his对应的数据
+        List<HisMedicalRecordDTO> hisMedicalRecords = getHisMedicalRecords(dataCompareVO);
+        if (ListUtil.isEmpty(hisMedicalRecords) && StringUtil.isNotBlank(dataCompareVO.getBehospitalCode())) {
+            Asserts.fail("未查询到该患者信息");
+        }
 
 
         //====1.删除当前时间段的对比记录(未核查的)
@@ -190,8 +196,7 @@ public class BlockLossManagementFacade {
         //====2.某时间的数据对比
         //=====2.1获取数据
 
-        //获取his对应的数据
-        List<HisMedicalRecordDTO> hisMedicalRecords = getHisMedicalRecords(dataCompareVO);
+
         Map<String, HisMedicalRecordDTO> hisMedicalRecordMap = EntityUtil.makeEntityMap(hisMedicalRecords, "behospitalCode");
 
         //获取操作记录数据
@@ -298,17 +303,17 @@ public class BlockLossManagementFacade {
                 updateWrapper.set("gmt_modified", DateUtil.now())
                         .set("modifier", finalPrincipleId != null ? finalPrincipleId + "" : "0")
                         .notIn("is_audited", LossIsAuditedEnum.NOT_AUDITED.getKey())
-                        .eq(StringUtil.isNotBlank(data.getRecId()),"rec_id",data.getRecId())
+                        .eq(StringUtil.isNotBlank(data.getRecId()), "rec_id", data.getRecId())
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("behospital_code",data.getBehospitalCode())
+                        .eq("behospital_code", data.getBehospitalCode())
                         .ge(dataCompareVO.getStartDate() != null && StringUtil.isBlank(dataCompareVO.getBehospitalCode()), "behospital_date", dataCompareVO.getStartDate())
                         .le(dataCompareVO.getEndDate() != null && StringUtil.isBlank(dataCompareVO.getBehospitalCode()), "behospital_date", dataCompareVO.getEndDate())
                         .eq(finalHospitalId != null, "hospital_id", finalHospitalId);
                 //更新病案首页或文书
-                if(StringUtil.isNotBlank(data.getRecId())){
+                if (StringUtil.isNotBlank(data.getRecId())) {
                     updateWrapper.notIn("loss_type", LossTypeEnum.CODE_LOSS.getKey());
-                }else {//更新病历
-                    updateWrapper.eq("loss_type",LossTypeEnum.CODE_LOSS.getKey());
+                } else {//更新病历
+                    updateWrapper.eq("loss_type", LossTypeEnum.CODE_LOSS.getKey());
                 }
                 blocklossResultFacade.update(updateWrapper);
             });
@@ -503,7 +508,7 @@ public class BlockLossManagementFacade {
         //查询已恢复的
         List<String> medCode = behospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
                 .select("DISTINCT behospital_code")
-                .in("behospital_code",lossCodes)
+                .in("behospital_code", lossCodes)
                 .eq(hospitalId != null, "hospital_id", hospitalId)
                 .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(BehospitalInfo::getBehospitalCode).collect(Collectors.toList());
         //去除已恢复得到已丢失的
@@ -733,7 +738,7 @@ public class BlockLossManagementFacade {
      */
     private List<HisMedicalRecordDTO> getHisMedicalRecords(DataCompareVO dataCompareVO) {
         //技术服务部接口 /balance/data/getDataCount
-//        return hisDataService.getDataCount(dataCompareVO).getData();
+        //        return hisDataService.getDataCount(dataCompareVO).getData();
         //###模拟
         return hisDataManagementFacade.getHisMedicalRecords(dataCompareVO);
     }
@@ -852,37 +857,11 @@ public class BlockLossManagementFacade {
      */
     private Integer getHisDataCount(BlockLossTypeGatherVO blockLossTypeGatherVO) {
         //获取his数量
-//        return  hisDataService.getCount(blockLossTypeGatherVO).getData();
+        //        return  hisDataService.getCount(blockLossTypeGatherVO).getData();
         //模拟his
         return hisDataManagementFacade.gethisDataCount(blockLossTypeGatherVO);
     }
 
-    /**
-     * 获取这段时间内his的数据量
-     *
-     * @param hisMedicalRecords
-     * @Return java.lang.Integer
-     */
-    private Integer getHisMedicalRecordsCount(List<HisMedicalRecordDTO> hisMedicalRecords) {
-
-        AtomicReference<Integer> num = new AtomicReference<>(0);
-        if (ListUtil.isNotEmpty(hisMedicalRecords)) {
-            hisMedicalRecords.stream().forEach(hisMedicalRecordDTO -> {
-                //病历+1
-                num.getAndSet(num.get() + 1);
-                //病案首页+1
-                if (StringUtil.isNotEmpty(hisMedicalRecordDTO.getHomePageId())) {
-                    num.getAndSet(num.get() + 1);
-                }
-                //文书
-                if (ListUtil.isNotEmpty(hisMedicalRecordDTO.getHisRecs())) {
-                    num.getAndSet(num.get() + hisMedicalRecordDTO.getHisRecs().size());
-                }
-
-            });
-        }
-        return num.get();
-    }
 
     /**
      * 数据补录

+ 3 - 0
daqe-center/src/main/java/com/lantone/daqe/facade/HisDataManagementFacade.java

@@ -79,6 +79,9 @@ public class HisDataManagementFacade {
                 .ge(dataRepariVO.getStartDate() != null && StringUtil.isBlank(dataRepariVO.getBehospitalCode()), "behospital_date", dataRepariVO.getStartDate())
                 .le(dataRepariVO.getEndDate() != null && StringUtil.isBlank(dataRepariVO.getBehospitalCode()), "behospital_date", dataRepariVO.getEndDate())
                 .eq(StringUtil.isNotBlank(dataRepariVO.getBehospitalCode()), "behospital_code", dataRepariVO.getBehospitalCode()));
+        if (ListUtil.isEmpty(hisBehospitalInfos) && StringUtil.isNotBlank(dataRepariVO.getBehospitalCode())) {
+            Asserts.fail("未查询到该患者信息");
+        }
         //通过病历获取病案首页和文书
         if (ListUtil.isEmpty(hisBehospitalInfos)) {
             return true;