소스 검색

湘雅异常修改

shiyue 3 년 전
부모
커밋
9b550f7008

+ 30 - 15
src/main/java/com/diagbot/facade/ViewFacade.java

@@ -100,39 +100,54 @@ public class ViewFacade {
         String pacsSql = "select * from CHECK_LIST where repDate >= '" + DateUtil.yesterdayFormate() + "' and behospitalNum is not null";
         String infoSql = "select * from admission_pat_regist where leaveHospitalDate >= '" + DateUtil.yesterdayFormate() + "'";
         String infoBeSql = "select * from admission_pat_regist where behospitalDate >= '" + DateUtil.yesterdayFormate() + "'";
-
         try {
-            Long startTime = System.currentTimeMillis();
             //更新前一天出院的入院登记信息
             this.getInfo(infoSql);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(出院时间的入院登记)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //更新前一天入院的入院登记信息
             this.getInfo(infoBeSql);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(入院时间的入院登记)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //得到全部的科室信息并添加修改
             this.getDeptInfo(deptSql);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(科室)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //获取医生信息并修改添加
             aBasDoctorInfoFacade.executeDoctorPast();
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(医生)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //得到前一天的医嘱信息并添加修改
             this.getDoctorAdvice(doctorAdviceSql);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(医嘱)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //得到前一天的化验信息和相应的化验结果并添加修改
             this.getLisInfo(lisSql);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(化验)失败", "", "", DateUtil.now().toString(), e.getMessage());
+        }
 
+        try {
             //得到前一天的检查信息和相应的检查结果并添加修改
             this.getPacsInfo(pacsSql);
-
-            Long startTime2 = System.currentTimeMillis();
-
-            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据成功", "", "所用时间" + (startTime2 - startTime), DateUtil.now().toString(), "");
-
         } catch (Exception e) {
-            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据失败", "", "", DateUtil.now().toString(), e.getMessage());
-
+            aMedAbnormalInfoFacade.saveAbnormalInfo("每天拉去历史数据(检查)失败", "", "", "", e.getMessage());
         }
-
     }
 
     /**
@@ -167,8 +182,8 @@ public class ViewFacade {
      * @param
      */
     public String executeOldDataOne(OldInfoVo oldInfoVo) {
-        try{
-            String behospitalCode=oldInfoVo.getBehospitalCode();
+        try {
+            String behospitalCode = oldInfoVo.getBehospitalCode();
             //分割住院号与住院次数
             String hospitalCode = behospitalCode.substring(0, behospitalCode.indexOf("_"));
             String hospitalNum = behospitalCode.substring(hospitalCode.length() + 1, behospitalCode.length());
@@ -178,7 +193,7 @@ public class ViewFacade {
             this.a(behospitalInfoList);
 
             return "true";
-        }catch (Exception e){
+        } catch (Exception e) {
             return e.getMessage();
         }
 
@@ -249,7 +264,7 @@ public class ViewFacade {
                     analyzeRunVO.setHospitalId(Long.valueOf("35"));
                     analyzeRunVO.setBehospitalCode(behospitalCode);
                     behospitalInfoFacade.analyzeApi(analyzeRunVO);
-                }catch (Exception e){
+                } catch (Exception e) {
                     aMedAbnormalInfoFacade.saveAbnormalInfo("历史数据拉取完评分异常", "", "", JSON.toJSONString(s), e.getMessage());
                 }
             });
@@ -621,7 +636,7 @@ public class ViewFacade {
                     aMedicalRecordFacade.remove(new QueryWrapper<MedicalRecord>()
                             .eq("behospital_code", code)
                             .eq("hospital_id", Long.valueOf("35")));
-                    OldInfoVo oldInfoV =new OldInfoVo();
+                    OldInfoVo oldInfoV = new OldInfoVo();
                     oldInfoV.setBehospitalCode(code);
                     this.executeOldDataOne(oldInfoV);
                     aMedAbnormalInfoFacade.saveAbnormalInfo("补传数据成功", code, "视图文书数量为" + count, "本地数量为" + myCount, "");

+ 39 - 30
src/main/java/com/diagbot/facade/data/ABasDoctorInfoFacade.java

@@ -33,77 +33,86 @@ public class ABasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
      * 同步历史数据
      */
     public void executeDoctorPast() {
-        String sql="select * from doctor_hos";
+        String sql = "select * from doctor_hos";
         List<BasDoctorInfo> basDeptInfoList = tzDBConn.getDoctorInfo(sql);
         execute(basDeptInfoList);
 
     }
+
     /**
      * 同步前一天医生信息
      */
     public void executeDoctor() {
-        String sql="select * from gi_userinfo";
+        String sql = "select * from gi_userinfo";
 //        List<BasDoctorInfo> basDeptInfoList = tzDBConn.getBasDoctorInfo(sql);
 //        execute(basDeptInfoList);
     }
+
     /**
      * 从接口接收医生信息
+     *
      * @param list
      * @return
      */
     public RespDTO<List<ABasDoctorInfoDTO>> executeDoctor(List<ABasDoctorInfoVO> list) {
         try {
-            if(list!=null && list.size()>0){
-                List<BasDoctorInfo> basDoctorInfoList=Lists.newArrayList();
-                basDoctorInfoList=BeanUtil.listCopyTo(list,BasDoctorInfo.class);
+            if (list != null && list.size() > 0) {
+                List<BasDoctorInfo> basDoctorInfoList = Lists.newArrayList();
+                basDoctorInfoList = BeanUtil.listCopyTo(list, BasDoctorInfo.class);
                 //循环验证数据有效性
-                for (BasDoctorInfo basDoctorInfo:basDoctorInfoList) {
-                    if("".equals(basDoctorInfo.getDoctorId())) {
+                for (BasDoctorInfo basDoctorInfo : basDoctorInfoList) {
+                    if ("".equals(basDoctorInfo.getDoctorId())) {
                         return RespDTO.onError("请输入医生编码!");
-                    }else if(basDoctorInfo.getHospitalId()==null){
+                    } else if (basDoctorInfo.getHospitalId() == null) {
                         return RespDTO.onError("请输入医院编码!");
                     }
                 }
                 execute(basDoctorInfoList);
 
-                if(logSwitch){
-                    basDoctorInfoList.forEach(s->{
-                        aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-正常","", JSON.toJSONString(list),"","");
+                if (logSwitch) {
+                    basDoctorInfoList.forEach(s -> {
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-正常", "", JSON.toJSONString(list), "", "");
                     });
                 }
                 return RespDTO.onSuc("操作正常!");
-            }else{
+            } else {
                 return RespDTO.onError("未接收到数据!");
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-异常","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("医生信息-异常", "", JSON.toJSONString(list), "", e.getMessage());
             return RespDTO.onError("数据处理异常,详情查看日志表");
         }
     }
 
-    public void execute(List<BasDoctorInfo> basDoctorInfoList){
-        List<BasDoctorInfo> addE=Lists.newArrayList();
-        List<BasDoctorInfo> updateE=Lists.newArrayList();
+    public void execute(List<BasDoctorInfo> basDoctorInfoList) {
+        List<BasDoctorInfo> addE = Lists.newArrayList();
+        List<BasDoctorInfo> updateE = Lists.newArrayList();
         basDoctorInfoList.stream().forEach(s -> {
-            BasDoctorInfo basDoctorInfo =this.baseMapper.selectOne(new QueryWrapper<BasDoctorInfo>()
-                    .eq("doctor_id", s.getDoctorId()));
-            if (basDoctorInfo != null) {
-                s.setGmtModified(new Date());
-                QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("doctor_id",s.getDoctorId());
-                this.update(s,queryWrapper);
+            try {
+                BasDoctorInfo basDoctorInfo = this.baseMapper.selectOne(new QueryWrapper<BasDoctorInfo>()
+                        .eq("doctor_id", s.getDoctorId())
+                        .eq("hospital_id", s.getHospitalId()));
+                if (basDoctorInfo != null) {
+                    s.setGmtModified(new Date());
+                    QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("doctor_id", s.getDoctorId())
+                            .eq("hospital_id", s.getHospitalId());
+                    this.update(s, queryWrapper);
 //                updateE.add(s);
-            } else {
-                s.setGmtCreate(new Date());
-                this.save(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    this.save(s);
 //                addE.add(s);
+                }
+            } catch (Exception e) {
+                aMedAbnormalInfoFacade.saveAbnormalInfo("保存医生信息失败", s.getDoctorId(), JSON.toJSONString(s), "", e.getMessage());
             }
         });
-        if(updateE.size()>0){
+        if (updateE.size() > 0) {
             basDoctorInfoService.updateBatchByKey(updateE);
         }
-        if(addE.size()>0){
+        if (addE.size() > 0) {
             basDoctorInfoService.saveBatch(addE);
         }
     }

+ 32 - 24
src/main/java/com/diagbot/facade/data/ABehospitalInfoFacade.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.ABehospitalInfoDTO;
 import com.diagbot.entity.BehospitalInfo;
+import com.diagbot.entity.MedPacsResult;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.entity.QcType;
 import com.diagbot.enums.IsDeleteEnum;
@@ -130,33 +131,40 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
         List<BehospitalInfo> addE = Lists.newLinkedList();
         List<BehospitalInfo> updateE = Lists.newLinkedList();
         behospitalInfoList.stream().forEach(s -> {
-            s.setIsDeleted("N");
-            if (null != s.getLeaveHospitalDate()){
-                s.setIsPlacefile("1");
-            }
-            if (StringUtils.isNotEmpty(s.getDoctorName())){
-                s.setDoctorId(aHomePageFacade.getDoctorId(s.getDoctorName()));
-            }
-            BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>()
-                    .eq("behospital_code", s.getBehospitalCode())
-                    .eq("hospital_id", s.getHospitalId()));
+            try {
+                s.setIsDeleted("N");
+                if (null != s.getLeaveHospitalDate()){
+                    s.setIsPlacefile("1");
+                }
+                if (StringUtils.isNotEmpty(s.getDoctorName())){
+                    s.setDoctorId(aHomePageFacade.getDoctorId(s.getDoctorName()));
+                }
+                BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>()
+                        .eq("behospital_code", s.getBehospitalCode())
+                        .eq("hospital_id", s.getHospitalId()));
 //                    .eq("is_deleted",IsDeleteEnum.N), false);
-            if (behospitalInfo != null) {
-                s.setGmtModified(new Date());
-                s.setQcTypeId(initQcTypeId(s));
-                updateE.add(s);
-            } else {
-                s.setGmtCreate(new Date());
-                s.setQcTypeId(initQcTypeId(s));
-                addE.add(s);
+                if (behospitalInfo != null) {
+                    s.setGmtModified(new Date());
+                    s.setQcTypeId(initQcTypeId(s));
+                    UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
+                    updateWrapper.eq("behospital_code", s.getBehospitalCode())
+                            .eq("hospital_id", s.getHospitalId());
+                    this.update(s, updateWrapper);
+                } else {
+                    s.setGmtCreate(new Date());
+                    s.setQcTypeId(initQcTypeId(s));
+                    this.save(s);
+                }
+            }catch (Exception e){
+                aMedAbnormalInfoFacade.saveAbnormalInfo("保存入院登记信息失败", s.getBehospitalCode(), JSON.toJSONString(s),"", e.getMessage());
             }
         });
-        if(addE.size()>0){
-            behospitalInfoService.saveBatch(addE);
-        }
-        if(updateE.size()>0){
-            behospitalInfoService.updateBatchByKey(updateE);
-        }
+//        if(addE.size()>0){
+//            behospitalInfoService.saveBatch(addE);
+//        }
+//        if(updateE.size()>0){
+//            behospitalInfoService.updateBatchByKey(updateE);
+//        }
     }
 
     /**