Browse Source

保存评分结果接口后续内容加异常处理,不抛出异常

zhanghang 3 years ago
parent
commit
145c9b8437
1 changed files with 70 additions and 62 deletions
  1. 70 62
      src/main/java/com/diagbot/facade/QcresultInfoFacade.java

+ 70 - 62
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -269,60 +269,64 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 qcresultDetailAdd.setModifier(useId.toString());
                 qcresultDetailAdd.setQcresultInfoId(newId);
                 qcresultDetailServiceImpl.save(qcresultDetailAdd);
-                //发送质控人员新增人工缺陷到his系统
-                SentEntryRecordDTO sentEntryRecordDTO = new SentEntryRecordDTO();
-                BeanUtil.copyProperties(qcresultDetailAdd, sentEntryRecordDTO);
-                MedCheckInfo medCheckInfo = medCheckInfoFacade.lambdaQuery()
-                        .eq(MedCheckInfo::getBehospitalCode, sentEntryRecordDTO.getBehospitalCode())
-                        .eq(MedCheckInfo::getHospitalId, qcresultDetailAdd.getHospitalId())
-                        //  .eq(MedCheckInfo::getStatus, 1)
-                        .in(MedCheckInfo::getCheckType, Arrays.asList(0, 2))
-                        .eq(MedCheckInfo::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if (null != medCheckInfo) {
-                    sentEntryRecordDTO.setCheckName(medCheckInfo.getCheckName());
-                    sentEntryRecordDTO.setCheckTime(medCheckInfo.getCheckTime());
-                }
-                SysUser sysUser = sysUserFacade.lambdaQuery()
-                        .eq(SysUser::getId, medCheckInfo.getCheckId())
-                        .eq(SysUser::getStatus, 1)
-                        .eq(SysUser::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if (null != sysUser) {
-                    sentEntryRecordDTO.setCheckId(sysUser.getUsername());
-                }
-                QcCasesEntry qcCasesEntry = qcCasesEntryFacade.lambdaQuery()
-                        .eq(QcCasesEntry::getId, qcresultDetailAdd.getCasesEntryId())
-                        .eq(QcCasesEntry::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if (null != qcCasesEntry) {
-                    QcMode qcMode = qcModeFacade.lambdaQuery()
-                            .eq(QcMode::getId, qcCasesEntry.getModeId())
-                            .eq(QcMode::getIsDeleted, IsDeleteEnum.N.getKey()).one();
+                try {
+                    //发送质控人员新增人工缺陷到his系统
+                    SentEntryRecordDTO sentEntryRecordDTO = new SentEntryRecordDTO();
+                    BeanUtil.copyProperties(qcresultDetailAdd, sentEntryRecordDTO);
+                    MedCheckInfo medCheckInfo = medCheckInfoFacade.lambdaQuery()
+                            .eq(MedCheckInfo::getBehospitalCode, sentEntryRecordDTO.getBehospitalCode())
+                            .eq(MedCheckInfo::getHospitalId, qcresultDetailAdd.getHospitalId())
+                            //  .eq(MedCheckInfo::getStatus, 1)
+                            .in(MedCheckInfo::getCheckType, Arrays.asList(0, 2))
+                            .eq(MedCheckInfo::getIsDeleted, IsDeleteEnum.N.getKey()).one();
+                    if (null != medCheckInfo) {
+                        sentEntryRecordDTO.setCheckName(medCheckInfo.getCheckName());
+                        sentEntryRecordDTO.setCheckTime(medCheckInfo.getCheckTime());
+                    }
+                    SysUser sysUser = sysUserFacade.lambdaQuery()
+                            .eq(SysUser::getId, medCheckInfo.getCheckId())
+                            .eq(SysUser::getStatus, 1)
+                            .eq(SysUser::getIsDeleted, IsDeleteEnum.N.getKey()).one();
+                    if (null != sysUser) {
+                        sentEntryRecordDTO.setCheckId(sysUser.getUsername());
+                    }
+                    QcCasesEntry qcCasesEntry = qcCasesEntryFacade.lambdaQuery()
+                            .eq(QcCasesEntry::getId, qcresultDetailAdd.getCasesEntryId())
+                            .eq(QcCasesEntry::getIsDeleted, IsDeleteEnum.N.getKey()).one();
                     if (null != qcCasesEntry) {
-                        sentEntryRecordDTO.setModeName(qcMode.getName());
+                        QcMode qcMode = qcModeFacade.lambdaQuery()
+                                .eq(QcMode::getId, qcCasesEntry.getModeId())
+                                .eq(QcMode::getIsDeleted, IsDeleteEnum.N.getKey()).one();
+                        if (null != qcCasesEntry) {
+                            sentEntryRecordDTO.setModeName(qcMode.getName());
+                        }
                     }
-                }
-                //获取患者的科室id
-                BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
-                        .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
-                        .eq("is_deleted", IsDeleteEnum.N.getKey()));
-                if (null != behospitalInfo) {
-                    sentEntryRecordDTO.setDeptId(behospitalInfo.getBehDeptId());
-                }
-                //根据his新增相应的数据
-                try {
-                    //根据behospitalCode截取patientId和visitId
-                    String patientId = sentEntryRecordDTO.getBehospitalCode().split("_")[0];
-                    String visitId = sentEntryRecordDTO.getBehospitalCode().split("_")[1];
-                    //获取on_line表中的医生姓名
-                    String sql = "select * from doctor_hos where user_id = (select request_doctor_id from mr_on_line where patient ='" +
-                            patientId + "' and visit_id= '" + visitId + "' and status='0') and dept_code= '" + sentEntryRecordDTO.getDeptId() + "'";
-                    List<String> doctorNames = tzDBConnForHis.getdoctorName(sql);
-                    if (doctorNames != null && doctorNames.size() > 0) {
-                        sentEntryRecordDTO.setDoctorName(doctorNames.get(0));
+                    //获取患者的科室id
+                    BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
+                            .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
+                            .eq("is_deleted", IsDeleteEnum.N.getKey()));
+                    if (null != behospitalInfo) {
+                        sentEntryRecordDTO.setDeptId(behospitalInfo.getBehDeptId());
                     }
-                    Integer i = tzDBConnForHis.setQcMessAge(sentEntryRecordDTO);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), e.getMessage());
+                    //根据his新增相应的数据
+                    try {
+                        //根据behospitalCode截取patientId和visitId
+                        String patientId = sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+                        String visitId = sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+                        //获取on_line表中的医生姓名
+                        String sql = "select * from doctor_hos where user_id = (select request_doctor_id from mr_on_line where patient ='" +
+                                patientId + "' and visit_id= '" + visitId + "' and status='0') and dept_code= '" + sentEntryRecordDTO.getDeptId() + "'";
+                        List<String> doctorNames = tzDBConnForHis.getdoctorName(sql);
+                        if (doctorNames != null && doctorNames.size() > 0) {
+                            sentEntryRecordDTO.setDoctorName(doctorNames.get(0));
+                        }
+                        Integer i = tzDBConnForHis.setQcMessAge(sentEntryRecordDTO);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), e.getMessage());
+                    }
+                }catch (Exception e){
+
                 }
 
                 break;
@@ -335,18 +339,22 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 );
                 break;
             case 3:
-                //发送质控人员修改人工缺陷到his系统
-                SentEntryRecordDTO updateEntryRecordDTO = new SentEntryRecordDTO();
-                BeanUtil.copyProperties(algorithmVO.getOptResultAlgVO(), updateEntryRecordDTO);
-                updateEntryRecordDTO.setBehospitalCode(analyzeVO.getBehospitalCode());
-                QcresultDetail qcresultDetail = qcresultDetailServiceImpl.getOne(new QueryWrapper<QcresultDetail>()
-                        .eq("id", algorithmVO.getOptResultAlgVO().getId()));
-                String oldMsg = qcresultDetail.getMsg();
                 try {
-                    Integer i = tzDBConnForHis.UpdateQcMessAge(updateEntryRecordDTO, oldMsg);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员修改人工缺陷到his系统失败", "", "", JSON.toJSONString(updateEntryRecordDTO), e.getMessage());
+                    //发送质控人员修改人工缺陷到his系统
+                    SentEntryRecordDTO updateEntryRecordDTO = new SentEntryRecordDTO();
+                    BeanUtil.copyProperties(algorithmVO.getOptResultAlgVO(), updateEntryRecordDTO);
+                    updateEntryRecordDTO.setBehospitalCode(analyzeVO.getBehospitalCode());
+                    QcresultDetail qcresultDetail = qcresultDetailServiceImpl.getOne(new QueryWrapper<QcresultDetail>()
+                            .eq("id", algorithmVO.getOptResultAlgVO().getId()));
+                    String oldMsg = qcresultDetail.getMsg();
+                    try {
+                        Integer i = tzDBConnForHis.UpdateQcMessAge(updateEntryRecordDTO, oldMsg);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员修改人工缺陷到his系统失败", "", "", JSON.toJSONString(updateEntryRecordDTO), e.getMessage());
+
+                    }
+                }catch (Exception e){
 
                 }
                 //修改条目