Browse Source

Merge branch 'dev/20220420_v2.5.0个性化版_湘雅人工质控缺陷反馈' into debug

songxinlu 3 years ago
parent
commit
5f8e7a737d

+ 52 - 2
src/main/java/com/diagbot/facade/MedDefectFeedbackFacade.java

@@ -2,13 +2,13 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.GetDefectDeptDTO;
 import com.diagbot.dto.GetDefectModeDTO;
 import com.diagbot.dto.GetMedDefectFeedbackPageDTO;
 import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.entity.MedDefectFeedback;
-import com.diagbot.entity.MedQcresultInfo;
 import com.diagbot.entity.QcresultDetail;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.entity.SysUser;
@@ -17,7 +17,6 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.facade.his.FeedbackHosFacade;
 import com.diagbot.service.impl.MedDefectFeedbackServiceImpl;
-import com.diagbot.service.impl.MedQcresultInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
@@ -31,7 +30,9 @@ import com.diagbot.vo.his.FeedbackHosVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -51,6 +52,9 @@ public class MedDefectFeedbackFacade extends MedDefectFeedbackServiceImpl {
     private QcresultDetailFacade qcresultDetailFacade;
     @Autowired
     private FeedbackHosFacade feedbackHosFacade;
+    @Autowired
+    private MedDefectFeedbackServiceImpl medDefectFeedbackServiceImpl;
+
 
 
     /**
@@ -244,7 +248,53 @@ public class MedDefectFeedbackFacade extends MedDefectFeedbackServiceImpl {
      * @return:
      */
     public Page<GetMedDefectFeedbackPageDTO> getMedDefectFeedbackPage(GetMedDefectFeedbackPageVO getMedDefectFeedbackPageVO) {
+        //更新待确认状态
+        updateStatus();
         Page<GetMedDefectFeedbackPageDTO> medDefectFeedbackPage = this.baseMapper.getMedDefectFeedbackPage(getMedDefectFeedbackPageVO);
         return medDefectFeedbackPage;
     }
+
+    /**
+     * 更新待确认状态
+     *
+     * @param
+     * @Return void
+     */
+    private void updateStatus() {
+        try {
+            //1.获取待确认的反馈缺陷id
+            List<Long> ids = this.list(new QueryWrapper<MedDefectFeedback>()
+                 .eq("hospital_id",SysUserUtils.getCurrentHospitalID())
+                 .eq("status","0")
+                 .eq("is_deleted",IsDeleteEnum.N.getKey())).stream()
+                 .map(MedDefectFeedback::getId).collect(Collectors.toList());
+
+            if(ListUtil.isNotEmpty(ids)){
+                String strIds = Optional.of(ids).orElseGet(ArrayList::new).stream().map(String::valueOf).collect(Collectors.joining(","));
+                FeedbackHosVO search = new FeedbackHosVO();
+                search.setIds(strIds);
+                //2.查his对应反馈缺陷的最新状态
+                List<FeedbackHosVO> out = feedbackHosFacade.statusQuery(search).data;
+                if(ListUtil.isNotEmpty(out)){
+                    List<MedDefectFeedback> updates = new ArrayList<>();
+                    out.stream().forEach(feedbackHosVO -> {
+                        //获取his已确认的
+                        if("1".equals(feedbackHosVO.getMsgStatus())){
+                            MedDefectFeedback entity = new MedDefectFeedback();
+                            entity.setId(feedbackHosVO.getId());
+                            entity.setStatus(feedbackHosVO.getMsgStatus());
+                            updates.add(entity);
+                        }
+                    });
+                    //3.更新自己库中状态
+                    if(ListUtil.isNotEmpty(updates)){
+                        medDefectFeedbackServiceImpl.updateBatchById(updates);
+                    }
+                }
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
 }

+ 17 - 0
src/main/java/com/diagbot/facade/his/FeedbackHosFacade.java

@@ -4,9 +4,15 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.util.PushFeedbackConn;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.his.FeedbackHosVO;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
 @Component
 @Slf4j
 public class FeedbackHosFacade {
@@ -36,4 +42,15 @@ public class FeedbackHosFacade {
             return RespDTO.onError("推送缺陷反馈失败,请联系维护人员!!!");
         }
     }
+
+    public RespDTO<List<FeedbackHosVO>> statusQuery(FeedbackHosVO feedbackHosVO){
+        try{
+            //List<FeedbackHosVO>
+            List<FeedbackHosVO> statusList=conn.statusQuery(feedbackHosVO);
+            return RespDTO.onSuc(statusList);
+        }catch (Exception e){
+            return RespDTO.onError("获取状态异常!!");
+        }
+
+    }
 }

+ 27 - 0
src/main/java/com/diagbot/util/PushFeedbackConn.java

@@ -1,8 +1,11 @@
 package com.diagbot.util;
 
+import com.diagbot.entity.BasDoctorInfo;
 import com.diagbot.vo.his.FeedbackHosVO;
+import com.google.common.collect.Lists;
 
 import java.sql.*;
+import java.util.List;
 import java.util.ResourceBundle;
 
 public class PushFeedbackConn {
@@ -239,4 +242,28 @@ public class PushFeedbackConn {
 
     }
 
+    public List<FeedbackHosVO> statusQuery(FeedbackHosVO feedbackHosVO){
+        List<FeedbackHosVO> statusList= Lists.newLinkedList();
+        try {
+            connection = getConnection();
+            connection.setAutoCommit(false);//事物开始
+            String sql =" select DETAIL_CODE,MSG_STATUS from MEDICAL_QC_MSG ";
+            sql+=" where DETAIL_CODE in("+feedbackHosVO.getIds()+")";
+            rs =this.Query(sql, null);
+            while(rs.next()){
+                FeedbackHosVO hosVO=new FeedbackHosVO();
+                hosVO.setId(Long.valueOf(rs.getString("DETAIL_CODE")));
+                hosVO.setMsgStatus(rs.getString("MSG_STATUS"));
+
+                statusList.add(hosVO);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            close();
+        }
+        return statusList;
+    }
+
 }

+ 5 - 0
src/main/java/com/diagbot/vo/his/FeedbackHosVO.java

@@ -3,10 +3,13 @@ package com.diagbot.vo.his;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 @Data
 public class FeedbackHosVO {
 
+    private String ids;
+
     private Long id;
     /**
      * 操作类型 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复
@@ -77,4 +80,6 @@ public class FeedbackHosVO {
      * 抄送人姓名集合
      */
     private String ccNames;
+
+    private String msgStatus;
 }

+ 6 - 0
src/main/java/com/diagbot/web/DataViewController.java

@@ -52,6 +52,12 @@ public class DataViewController {
         return feedbackHosFacade.pushFeedback(feedbackHosVO);
     }
 
+    @ApiOperation(value = "从HIS获取待确认缺陷状态")
+    @PostMapping("/statusQuery")
+    @SysLogger("statusQuery")
+    public RespDTO<List<FeedbackHosVO>> statusQuery(@RequestBody FeedbackHosVO feedbackHosVO){
+        return feedbackHosFacade.statusQuery(feedbackHosVO);
+    }
 
 
 }