Переглянути джерело

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

# Conflicts:
#	src/main/resources/bootstrap.yml
songxinlu 3 роки тому
батько
коміт
6956f9ba5c

+ 3 - 0
src/main/java/com/diagbot/dto/GetMedDefectFeedbackPageDTO.java

@@ -39,6 +39,9 @@ public class GetMedDefectFeedbackPageDTO  implements Serializable {
     @ApiModelProperty(value = "患者姓名")
     private String name;
 
+    @ApiModelProperty(value = "病人住院序号")
+    private String behospitalCode;
+
     @ApiModelProperty(value = "模块ID")
     private Long modeId;
 

+ 7 - 1
src/main/java/com/diagbot/facade/MedDefectFeedbackFacade.java

@@ -15,6 +15,7 @@ import com.diagbot.entity.SysUser;
 import com.diagbot.enums.IsDeleteEnum;
 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;
@@ -26,6 +27,7 @@ import com.diagbot.vo.ChangeQcResultVO;
 import com.diagbot.vo.GetMedDefectFeedbackPageVO;
 import com.diagbot.vo.QcresultVO;
 import com.diagbot.vo.UPdDefectBackByIDVO;
+import com.diagbot.vo.his.FeedbackHosVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -47,6 +49,8 @@ public class MedDefectFeedbackFacade extends MedDefectFeedbackServiceImpl {
     private SysUserFacade sysUserFacade;
     @Autowired
     private QcresultDetailFacade qcresultDetailFacade;
+    @Autowired
+    private FeedbackHosFacade feedbackHosFacade;
 
 
     /**
@@ -188,7 +192,9 @@ public class MedDefectFeedbackFacade extends MedDefectFeedbackServiceImpl {
      */
     private void sendToHis(MedDefectFeedback insert) {
         try {
-
+            FeedbackHosVO feedbackHosVO = new FeedbackHosVO();
+            BeanUtil.copyProperties(insert,feedbackHosVO);
+            feedbackHosFacade.pushFeedback(feedbackHosVO);
         } catch (Exception e) {
             e.printStackTrace();
         }

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

@@ -0,0 +1,39 @@
+package com.diagbot.facade.his;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.util.PushFeedbackConn;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.his.FeedbackHosVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class FeedbackHosFacade {
+
+    PushFeedbackConn conn=new PushFeedbackConn();
+
+    public RespDTO pushFeedback(FeedbackHosVO feedbackHosVO){
+        try{
+            if(StringUtil.isEmpty(feedbackHosVO.getBehospitalCode())){
+                return RespDTO.onError("病历号为空");
+            }else if(feedbackHosVO.getId()==null){
+                return RespDTO.onError("病历反馈缺陷ID为空");
+            }
+            if("1".equals(feedbackHosVO.getOperationType())){
+                //修改
+                conn.UpdateQcMessAge(feedbackHosVO);
+            } else if("2".equals(feedbackHosVO.getOperationType())){
+                //his那边物理删除
+                conn.DeleteQcMessAge(feedbackHosVO);
+            } else{
+                //其他情况新增
+                conn.setQcMessAge(feedbackHosVO);
+            }
+            return RespDTO.onSuc("推送缺陷反馈完成!");
+        }catch (Exception e){
+            log.error("=======推送缺陷反馈失败,请联系维护人员==========="+e.getMessage(),new Throwable());
+            return RespDTO.onError("推送缺陷反馈失败,请联系维护人员!!!");
+        }
+    }
+}

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

@@ -0,0 +1,242 @@
+package com.diagbot.util;
+
+import com.diagbot.vo.his.FeedbackHosVO;
+
+import java.sql.*;
+import java.util.ResourceBundle;
+
+public class PushFeedbackConn {
+    private static final String DRIVER = getValue("jdbc.driverClassName1");
+    private static final String URL = getValue("jdbc.url1");
+    private static final String USERNAME = getValue("jdbc.username1");
+    private static final String PASSWORD = getValue("jdbc.password1");
+
+    public static final Long HOSPITAL_ID=Long.valueOf("35");//1:长兴,2:邵逸夫,3:台州市立医院
+
+    private static Connection connection = null;
+    private static PreparedStatement sta = null;
+    private static ResultSet rs = null;
+
+    /**
+     * 读取属性文件中的信息
+     *
+     * @param key
+     * @return
+     */
+    private static String getValue(String key) {
+        // 资源包绑定
+        ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
+        return bundle.getString(key);
+    }
+
+    /**
+     * 加载驱动程序
+     */
+    static {
+        try {
+            Class.forName(DRIVER);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * @return 连接对象
+     */
+    public Connection getConnection() {
+        try {
+            connection = DriverManager.getConnection(URL,USERNAME,PASSWORD);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return connection;
+    }
+
+    /**
+     * @param sql sql语句
+     * @param obj 参数
+     * @return 数据集合
+     */
+    public ResultSet Query(String sql,Object...obj){
+        connection=getConnection();
+        try {
+            sta=connection.prepareStatement(sql);
+            if(obj!=null){
+                for(int i=0;i<obj.length;i++){
+                    sta.setObject(i+1, obj[i]);
+                }
+            }
+            rs=sta.executeQuery();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return rs;
+    }
+
+    /**
+     * 关闭资源
+     */
+    public void close() {
+        try {
+            if (rs != null) {
+                rs.close();
+            }
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (sta != null) {
+                    sta.close();
+                }
+            } catch (SQLException e2) {
+                e2.printStackTrace();
+            } finally {
+                if (connection != null) {
+                    try {
+                        connection.close();
+                    } catch (SQLException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 关闭数据库
+     * @param conn
+     */
+    public void closeConnection(Connection conn){
+        try{
+            if(conn != null){
+                conn.close();
+            }
+        }
+        catch(Exception e){
+            System.out.println("数据库关闭失败");
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 新赠评分插入表中
+     * @return
+     */
+    public Integer setQcMessAge(FeedbackHosVO feedbackHosVO) throws SQLException {
+        try {
+            String patientId=feedbackHosVO.getBehospitalCode().split("_")[0];
+            String visitId=feedbackHosVO.getBehospitalCode().split("_")[1];
+            int re=0;
+            connection = getConnection();
+            connection.setAutoCommit(false);//事物开始
+            PreparedStatement state=connection.prepareStatement("insert into MEDICAL_QC_MSG " +
+                    "(PATIENT_ID,VISIT_ID,DOCTOR_IN_CHARGE,QA_EVENT_TYPE,QC_MSG_CODE,MESSAGE,ISSUED_BY,ISSUED_DATE_TIME,TOPIC_ID,DEPT_STAYED,MSG_STATUS,EXPLAIN_INFO,QCRESULT_DETAI_SCORE,DETAIL_CODE)"+
+                    "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+            state.setString(1, patientId);
+            state.setString(2, visitId);
+            state.setString(3,feedbackHosVO.getSenderName());
+            state.setString(4,feedbackHosVO.getModeName());
+            state.setInt(5,1511);
+            state.setString(6,feedbackHosVO.getQcresultDetailMsg());
+            state.setString(7,"评价质控");
+            state.setString(8, DateUtil.formatDateTime(DateUtil.now()));
+            state.setString(9,feedbackHosVO.getModeName());
+            state.setString(10,feedbackHosVO.getDeptId());
+            state.setInt(11,0);
+            state.setString(12,feedbackHosVO.getExplainInfo());
+            state.setString(13, String.format("%.2f", feedbackHosVO.getQcresultDetaiScore()));
+            state.setString(14,Long.toString(feedbackHosVO.getId()));
+            re = state.executeUpdate();
+            if(re < 0){               //插入失败
+                connection.rollback();      //回滚
+                state.close();
+                closeConnection(connection);
+                return re;
+            }
+            connection.commit();            //插入正常
+            state.close();
+            closeConnection(connection);
+            return re;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }finally {
+            close();
+        }
+
+    }
+
+    /**
+     * 删除评分表中的对应数据
+     * @return
+     */
+    public Integer DeleteQcMessAge(FeedbackHosVO feedbackHosVO) throws SQLException {
+        try {
+            String patientId=feedbackHosVO.getBehospitalCode().split("_")[0];
+            String visitId=feedbackHosVO.getBehospitalCode().split("_")[1];
+            int re=0;
+            connection = getConnection();
+            connection.setAutoCommit(false);//事物开始
+            String sql ="delete from MEDICAL_QC_MSG ";
+            sql+=" where PATIENT_ID = '"+patientId+"' and VISIT_ID = '"+visitId+"' and DETAIL_CODE='"+feedbackHosVO.getId()+"'";
+            PreparedStatement state=connection.prepareStatement(sql);
+            re = state.executeUpdate();
+            if(re < 0){               //删除失败
+                connection.rollback();      //回滚
+                state.close();
+                closeConnection(connection);
+                return re;
+            }
+            connection.commit();            //删除正常
+            state.close();
+            closeConnection(connection);
+            return re;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }finally {
+            close();
+        }
+
+    }
+
+    /**
+     * 修改评分表中对应数据
+     * @return
+     */
+    public Integer UpdateQcMessAge(FeedbackHosVO feedbackHosVO) throws SQLException {
+        try {
+            String patientId=feedbackHosVO.getBehospitalCode().split("_")[0];
+            String visitId=feedbackHosVO.getBehospitalCode().split("_")[1];
+            int re=0;
+            connection = getConnection();
+            connection.setAutoCommit(false);//事物开始
+            String sql =" update MEDICAL_QC_MSG set " +
+                    "MESSAGE = '"+feedbackHosVO.getQcresultDetailMsg()+"'" +
+                    ",EXPLAIN_INFO='"+feedbackHosVO.getExplainInfo()+"'" +
+                    ",QCRESULT_DETAI_SCORE='"+feedbackHosVO.getQcresultDetaiScore()+"'";
+            sql+="where PATIENT_ID = '"+patientId+"' and VISIT_ID = '"+visitId+"' and DETAIL_CODE='"+feedbackHosVO.getId()+"'";
+            PreparedStatement state=connection.prepareStatement(sql);
+            re = state.executeUpdate();
+            if(re < 0){               //修改失败
+                connection.rollback();      //回滚
+                state.close();
+                closeConnection(connection);
+                return re;
+            }
+            connection.commit();            //修改正常
+            state.close();
+            closeConnection(connection);
+            return re;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }finally {
+            close();
+        }
+
+    }
+
+}

+ 3 - 0
src/main/java/com/diagbot/vo/ChangeQcResultVO.java

@@ -6,6 +6,7 @@ import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
@@ -30,9 +31,11 @@ public class ChangeQcResultVO {
     private Integer delStatus;
 
     @ApiModelProperty(value = "模块id")
+    @NotNull(message = "模块id为空")
     private Long modeId;
 
     @ApiModelProperty(value = "模块名称")
+    @NotBlank(message = "模块名称为空")
     private String modeName;
 
     @ApiModelProperty(value = "反馈说明")

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

@@ -0,0 +1,80 @@
+package com.diagbot.vo.his;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class FeedbackHosVO {
+
+    private Long id;
+    /**
+     * 操作类型 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复
+     */
+    private String operationType;
+
+    /**
+     * 发送人编号
+     */
+    private String senderCode;
+
+    /**
+     * 发送人姓名
+     */
+    private String senderName;
+
+    /**
+     * 住院科室ID
+     */
+    private String deptId;
+
+    /**
+     * 住院科室名称
+     */
+    private String deptName;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 模块名称
+     */
+    private String modeName;
+
+    /**
+     * 提示信息
+     */
+    private String qcresultDetailMsg;
+
+    /**
+     * 人工修改分值
+     */
+    private BigDecimal qcresultDetaiScore;
+
+    /**
+     * 反馈说明
+     */
+    private String explainInfo;
+
+    /**
+     * 接收人编号
+     */
+    private String receiverCode;
+
+    /**
+     * 接收人姓名
+     */
+    private String receiverName;
+
+    /**
+     * 抄送人编号集合
+     */
+    private String ccCodes;
+
+    /**
+     * 抄送人姓名集合
+     */
+    private String ccNames;
+}

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

@@ -5,7 +5,9 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.his.DoctorHosDTO;
 import com.diagbot.facade.his.DoctorHosFacade;
+import com.diagbot.facade.his.FeedbackHosFacade;
 import com.diagbot.vo.his.DoctorHosVO;
+import com.diagbot.vo.his.FeedbackHosVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +34,9 @@ public class DataViewController {
     @Autowired
     private DoctorHosFacade doctorHosFacade;
 
+    @Autowired
+    private FeedbackHosFacade feedbackHosFacade;
+
     @ApiOperation(value = "获取HIS医生信息")
     @PostMapping("/getDoctorHos")
     @SysLogger("getDoctorHos")
@@ -39,4 +44,14 @@ public class DataViewController {
         return RespDTO.onSuc(doctorHosFacade.getDoctorInfo(doctorHosVO));
     }
 
+
+    @ApiOperation(value = "推送缺陷反馈到HIS")
+    @PostMapping("/pushFeedback")
+    @SysLogger("pushFeedback")
+    public RespDTO pushFeedback(@RequestBody FeedbackHosVO feedbackHosVO){
+        return feedbackHosFacade.pushFeedback(feedbackHosVO);
+    }
+
+
+
 }

+ 10 - 0
src/main/resources/jdbc.properties

@@ -14,6 +14,16 @@ jdbc.url=jdbc:sqlserver://192.168.100.39\\tzmhemr;DatabaseName=bigemr
 jdbc.username=zjlt
 jdbc.password=zjlt@2020
 
+#jdbc.driverClassName1=oracle.jdbc.OracleDriver
+#jdbc.url1=jdbc:oracle:thin:@132.147.254.5:1521/dbserver
+#jdbc.username1=langtong
+#jdbc.password1=langtong
+
+jdbc.driverClassName1=com.mysql.cj.jdbc.Driver
+jdbc.url1=jdbc:mysql://192.168.2.126:3307/xy_st?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+jdbc.username1=root
+jdbc.password1=Lat0ne@tesT
+
 #\u6570\u636e\u670d\u52a1\u6a21\u5f0f
 remote.address.ver=http://192.18.101.207:2030/index.html
 remote.address.hor=http://192.18.101.207:2030/indexHorizontal.html

+ 23 - 23
src/main/resources/mapper/MedDefectFeedbackMapper.xml

@@ -34,28 +34,28 @@
     <select id="getMedDefectFeedbackPage" resultType="com.diagbot.dto.GetMedDefectFeedbackPageDTO">
         SELECT
         id,
-        dept_name,
-        gmt_modified,
-        mode_name,
-        qcresult_detai_score,
+        dept_name as deptName,
+        gmt_modified as gmtModified,
+        mode_name as modeName,
+        qcresult_detai_score as qcresultDetaiScore,
         modifier,
-        receiver_code,
-        sender_name,
-        is_deleted,
-        mode_id,
-        hospital_id,
+        receiver_code as receiverCode,
+        sender_name as senderName,
+        is_deleted as isDeleted,
+        mode_id as modeId,
+        hospital_id as hospitalId,
         creator,
-        receiver_name,
-        behospital_code,
-        dept_id,
-        gmt_create,
-        sender_code,
-        cases_entry_id,
-        explain_info,
+        receiver_name as receiverName,
+        behospital_code as behospitalCode,
+        dept_id as deptId,
+        gmt_create as gmtCreate,
+        sender_code as senderCode,
+        cases_entry_id as casesEntryId,
+        explain_info as explainInfo,
         name,
-        cc_names,
-        cc_codes,
-        operation_type,
+        cc_names as ccNames,
+        cc_codes as ccCodes,
+        operation_type as operationType,
         CASE WHEN (qcresult_detail_msg is null OR qcresult_detail_msg = '') THEN '-' ELSE qcresult_detail_msg END AS qcresultDetailMsg,
         status
         FROM
@@ -100,8 +100,8 @@
 
     <select id="getDefectDept" resultType="com.diagbot.dto.GetDefectDeptDTO">
         SELECT
-            dept_id,
-            dept_name
+            dept_id as deptId,
+            dept_name as deptName
         FROM
             med_defect_feedback
         WHERE
@@ -112,8 +112,8 @@
 
     <select id="getDefectMode" resultType="com.diagbot.dto.GetDefectModeDTO">
         SELECT
-            mode_id,
-            mode_name
+            mode_id as modeId,
+            mode_name as modeName
         FROM
             med_defect_feedback
         WHERE