Преглед изворни кода

湘雅核查消息推送代码更新

wangsy пре 3 година
родитељ
комит
8b96a6bc68
1 измењених фајлова са 103 додато и 14 уклоњено
  1. 103 14
      src/main/java/com/diagbot/facade/QcresultInfoFacade.java

+ 103 - 14
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -1,33 +1,27 @@
 package com.diagbot.facade;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.AlgorithmDTO;
-import com.diagbot.dto.AnalyzeDTO;
-import com.diagbot.dto.QcCasesHistoryDTO;
-import com.diagbot.dto.QcResultDTO;
-import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.entity.MedQcresultCases;
-import com.diagbot.entity.QcresultDetail;
-import com.diagbot.entity.QcresultInfo;
+import com.diagbot.dto.*;
+import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.facade.data.AHomePageFacade;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
 import com.diagbot.service.impl.MedQcresultCasesServiceImpl;
 import com.diagbot.service.impl.QcresultDetailServiceImpl;
 import com.diagbot.service.impl.QcresultInfoServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.StringUtil;
-import com.diagbot.util.SysUserUtils;
+import com.diagbot.util.*;
 import com.diagbot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -46,10 +40,22 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
     @Autowired
     private BehospitalInfoFacade behospitalInfoFacade;
     @Autowired
+    private AHomePageFacade aHomePageFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Autowired
     private MedCheckInfoFacade medCheckInfoFacade;
     @Autowired
     @Qualifier("medQcresultCasesServiceImpl")
     private MedQcresultCasesServiceImpl medQcresultCasesService;
+    @Autowired
+    private QcCasesEntryFacade qcCasesEntryFacade;
+    @Autowired
+    private QcModeFacade qcModeFacade;
+    @Autowired
+    private SysUserFacade sysUserFacade;
+
+    private TZDBConnForHis tzDBConnForHis = new TZDBConnForHis();
 
     /**
      * 修改评分结果信息
@@ -263,6 +269,62 @@ 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();
+                    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));
+                    }
+                    Integer i = tzDBConnForHis.setQcMessAge(sentEntryRecordDTO);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), e.getMessage());
+                }
+
                 break;
             case 2:
                 //删除条目
@@ -273,6 +335,20 @@ 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());
+
+                }
                 //修改条目
                 qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                         .eq("id", algorithmVO.getOptResultAlgVO().getId())
@@ -290,6 +366,18 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 );
                 break;
             case 4:
+                //发送质控人员删除人工缺陷到his系统
+                QcresultDetail deleteQcDetail = qcresultDetailServiceImpl.getOne(new QueryWrapper<QcresultDetail>()
+                        .eq("id", algorithmVO.getOptResultAlgVO().getId()));
+                SentEntryRecordDTO deleteEntryRecordDTO = new SentEntryRecordDTO();
+                deleteEntryRecordDTO.setMsg(deleteQcDetail.getMsg());
+                deleteEntryRecordDTO.setBehospitalCode(analyzeVO.getBehospitalCode());
+                try {
+                    Integer i = tzDBConnForHis.DeleteQcMessAge(deleteEntryRecordDTO);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员删除人工缺陷到his系统失败", "", "", JSON.toJSONString(deleteEntryRecordDTO), e.getMessage());
+                }
                 //获取病历核查人员id,该操作只能是核查员操作
 //                Long checkId = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
 //                        .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -417,10 +505,11 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
 
     /**
      * 历史评分
+     *
      * @param historyAnalyzePageVO
      * @return
      */
-    public IPage<QcCasesHistoryDTO> getMedQcresultResultList(HistoryAnalyzePageVO historyAnalyzePageVO){
+    public IPage<QcCasesHistoryDTO> getMedQcresultResultList(HistoryAnalyzePageVO historyAnalyzePageVO) {
         return getMedQcresultResult(historyAnalyzePageVO);
     }
 }