Browse Source

检查结果回报

xiaochan 1 year ago
parent
commit
645670c02c

+ 2 - 1
src/main/java/thyyxxk/webserver/constants/Message.java

@@ -27,7 +27,8 @@ public enum Message {
      * 患者危急值
      */
     critical_value("criticalValue"),
-    EMR_RULE("emrRule");
+    EMR_RULE("emrRule"),
+    CHECK_THE_CALLBACKS("checkTheCallbacks");
 
     private final String name;
 

+ 7 - 1
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/JianYanJianChaController.java

@@ -21,7 +21,7 @@ import java.util.Map;
  * @author xc
  * @date 2022-02-11 09:09
  */
-@RequestMapping("/jianYanJianChaShenQing")
+@RequestMapping(path = {"/jianYanJianChaShenQing", "/checkTheCallbacks"})
 @RestController
 public class JianYanJianChaController {
     private final JianYanJianChaShenQingService server;
@@ -175,5 +175,11 @@ public class JianYanJianChaController {
         return server.getAncillaryInformation(patNo, times);
     }
 
+    @PostMapping("/push")
+    @PassToken
+    public ResultVo<String> checkTheCallbacks(@RequestBody @Validated CheckTheCallbacks param) {
+        return server.checkTheCallbacks(param);
+    }
+
 
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/CheckTheCallbackDao.java

@@ -0,0 +1,11 @@
+package thyyxxk.webserver.dao.his.zhuyuanyisheng;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.CheckTheCallbacks;
+
+@Mapper
+public interface CheckTheCallbackDao extends BaseMapper<CheckTheCallbacks> {
+
+
+}

+ 142 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/jianyanjiancha/CheckTheCallbacks.java

@@ -0,0 +1,142 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+@Data
+@TableName("t_check_data")
+public class CheckTheCallbacks {
+
+    /**
+     * 申请单号
+     */
+    @NotNull(message = "申请单号不能为空")
+    @TableId(type = IdType.NONE, value = "req_no")
+    private Integer reqNo;
+
+    /**
+     * 患者姓名
+     */
+    @NotEmpty(message = "患者姓名不能为空")
+    @NotBlank(message = "患者姓名不能为空")
+    private String patientName;
+
+    /**
+     * 患者性别
+     */
+    @TableField(exist = false)
+    private String patientSex;
+
+    /**
+     * 患者年龄
+     */
+    @TableField(exist = false)
+    private String patientAge;
+
+    /**
+     * 影像号
+     */
+    @NotNull(message = "影像号不能为空")
+    @NotBlank(message = "影像号不能为空")
+    private String patientUid;
+
+    /**
+     * 住院号/门诊号
+     */
+    @NotNull(message = "住院号/门诊号,不能为空")
+    @NotBlank(message = "住院号/门诊号,不能为空")
+    private String patNo;
+
+    /**
+     * 住院次数/门诊次数
+     */
+    @NotNull(message = "住院次数/门诊次数,不能为空")
+    private Integer times;
+
+    /**
+     * 检查部位
+     */
+    @NotNull(message = "检查部位,不能为空")
+    @NotBlank(message = "检查部位,不能为空")
+    private String examinEparts;
+
+    /**
+     * 检查科室编码
+     */
+    @NotNull(message = "检查科室编码,不能为空")
+    @NotBlank(message = "检查科室编码,不能为空")
+    private String roomCode;
+
+    @TableField(exist = false)
+    private String roomName;
+
+    /**
+     * 检查所见
+     */
+    @NotNull(message = "检查所见,不能为空")
+    @NotBlank(message = "检查所见,不能为空")
+    private String examinationSee;
+
+    /**
+     * 检查结论
+     */
+    @NotNull(message = "检查结论,不能为空")
+    @NotBlank(message = "检查结论,不能为空")
+    private String examinationreSult;
+
+    /**
+     * 报告医生编码
+     */
+    @NotNull(message = "报告医生编码,不能为空")
+    @NotBlank(message = "报告医生编码,不能为空")
+    private String doctorCode;
+
+    @TableField(exist = false)
+    private String doctorName;
+
+    /**
+     * 审核医生编码
+     */
+    @NotNull(message = "审核医生编码,不能为空")
+    @NotBlank(message = "审核医生编码,不能为空")
+    private String checkDoctorCode;
+
+    @TableField(exist = false)
+    private String checkDoctorName;
+
+    /**
+     * 审核时间
+     */
+    @NotNull(message = "审核时间,不能为空")
+    private Date checkTime;
+
+    /**
+     * 报告时间
+     */
+    @NotNull(message = "报告时间,不能为空")
+    private Date reportTime;
+
+    /**
+     * 病人来源 (1-住院, 2-门诊)
+     */
+    @NotNull(message = "病人来源 (1-住院, 2-门诊),不能为空")
+    private Integer patientFrom;
+
+    @NotNull(message = "申请医生编码,不能为空")
+    @NotBlank(message = "申请医生编码,不能为空")
+    @TableField(exist = false)
+    private String reqDoctor;
+
+    @NotNull(message = "申请医生编码,不能为空")
+    @NotBlank(message = "申请医生编码,不能为空")
+    @TableField(exist = false)
+    private String reqName;
+}

+ 46 - 7
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/JianYanJianChaShenQingService.java

@@ -1,36 +1,35 @@
 package thyyxxk.webserver.service.zhuyuanyisheng;
 
-import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.annotation.Pointcut;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
+import thyyxxk.webserver.constants.Message;
+import thyyxxk.webserver.dao.his.zhuyuanyisheng.CheckTheCallbackDao;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.JianYanJianChaDao;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.login.UserInfo;
+import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.*;
 import thyyxxk.webserver.entity.zhuyuanyisheng.query.ChaXunJianChaHeJianYan;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.PatientTemp;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
 import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
-import java.nio.channels.NonWritableChannelException;
+import java.security.cert.TrustAnchor;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -49,12 +48,16 @@ public class JianYanJianChaShenQingService {
     private final PublicServer publicServer;
     private final YiZhuLuRuDao yiZhuLuRuDao;
     private final RedisLikeService realtimeService;
+    private final CheckTheCallbackDao checkTheCallbackDao;
+    private final WebSocketService webSocketService;
 
-    public JianYanJianChaShenQingService(JianYanJianChaDao dao, PublicServer publicServer, YiZhuLuRuDao yiZhuLuRuDao, RedisLikeService realtimeService) {
+    public JianYanJianChaShenQingService(JianYanJianChaDao dao, PublicServer publicServer, YiZhuLuRuDao yiZhuLuRuDao, RedisLikeService realtimeService, CheckTheCallbackDao checkTheCallbackDao, WebSocketService webSocketService) {
         this.dao = dao;
         this.publicServer = publicServer;
         this.yiZhuLuRuDao = yiZhuLuRuDao;
         this.realtimeService = realtimeService;
+        this.checkTheCallbackDao = checkTheCallbackDao;
+        this.webSocketService = webSocketService;
     }
 
     /*-------------------------------------------------------------- 下面是检查的逻辑 -----------------------------------------------------------------------------------------------------*/
@@ -688,6 +691,42 @@ public class JianYanJianChaShenQingService {
         return ResultVoUtil.success(dao.getAncillaryInformation(patNo, times));
     }
 
+    public ResultVo<String> checkTheCallbacks(CheckTheCallbacks param) {
+        QueryWrapper<CheckTheCallbacks> queryWrapper = new QueryWrapper<>();
+
+        queryWrapper.eq("req_no", param.getReqNo())
+                .eq("patient_from", param.getPatientFrom());
+
+        boolean exist = checkTheCallbackDao.selectCount(queryWrapper) > 0;
+
+        try {
+            if (exist) {
+                checkTheCallbackDao.update(param, queryWrapper);
+            } else {
+                checkTheCallbackDao.insert(param);
+            }
+        } catch (Exception e) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "数据库执行错误:" + e.getMessage());
+        }
+
+        final CheckTheCallbacks temp = new CheckTheCallbacks() {{
+            setPatientName(param.getPatientName());
+            setReportTime(param.getReportTime());
+            setReqNo(param.getReqNo());
+            setReqName(param.getReqName());
+            setCheckDoctorName(param.getCheckDoctorName());
+        }};
+
+        JSONObject js = new JSONObject() {{
+            put("data", temp);
+            put("isAdd", !exist);
+        }};
+
+        SocketMsg.sendMessageByUserCode(param.getReqDoctor().trim(), Message.CHECK_THE_CALLBACKS, js);
+
+        return ResultVoUtil.success(exist ? "更新成功。" : "回传成功。");
+    }
+
 
 }
 

+ 23 - 2
src/main/java/thyyxxk/webserver/utils/SocketMsg.java

@@ -2,7 +2,11 @@ package thyyxxk.webserver.utils;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.Forest;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 import thyyxxk.webserver.constants.Message;
+import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
 
 import java.util.Map;
 
@@ -10,9 +14,26 @@ import java.util.Map;
 /**
  * 发送系统消息
  *
- * @author Administrator
+ * @author 肖蟾
  */
+@Component
 public class SocketMsg {
+    private static String SOCKET_URL;
+    @Value("${forest.variables.socketCenter}")
+    public void setUrl(String key) {
+        SocketMsg.SOCKET_URL = key;
+    }
+
+    public static void sendMessageByUserCode(String code, Message messageName, JSONObject js) {
+        String body = socketVo(messageName, js);
+        ApiMessageBody apiMessageBody = new ApiMessageBody(code, body);
+        Forest.post(SOCKET_URL + "/sendMessageByUserCode")
+                .async()
+                .addHeader("Content-Type", "application/json")
+                .addBody(apiMessageBody)
+                .execute();
+    }
+
 
     public static String socketVo(Message messageName, JSONObject map) {
         JSONObject msg = new JSONObject();
@@ -25,7 +46,7 @@ public class SocketMsg {
         JSONObject msg = new JSONObject();
         msg.put("name", messageName.getName());
         msg.put("message", map);
-        return JSON.toJSONStringWithDateFormat(msg,DateUtil.DEFAULT_PATTERN);
+        return JSON.toJSONStringWithDateFormat(msg, DateUtil.DEFAULT_PATTERN);
     }
 
 

+ 3 - 3
src/main/resources/application-dev.yml

@@ -81,9 +81,9 @@ spring:
 forest:
   timeout: 0
   read-timeout: 0
-  log-enabled: false
-  log-request: false
-  log-response-status: false
+  log-enabled: true
+  log-request: true
+  log-response-status: true
   variables:
     socketCenter: http://localhost:8707/socketApi
 

+ 1 - 0
src/main/resources/application.yml

@@ -123,3 +123,4 @@ si-injury-systm-url: http://localhost:2000/siInjury
 #logging:
 #  level:
 #    thyyxxk.webserver.dao: debug
+