Browse Source

解决处方模板保存失败

hurugang 3 years ago
parent
commit
770c478f0d

+ 11 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/NoticeServiceImpl.java

@@ -1,9 +1,12 @@
 package cn.hnthyy.thmz.service.impl.thmz;
 
+import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.thmz.Notice;
 import cn.hnthyy.thmz.entity.thmz.NoticeSink;
 import cn.hnthyy.thmz.mapper.thmz.NoticeMapper;
 import cn.hnthyy.thmz.mapper.thmz.NoticeSinkMapper;
+import cn.hnthyy.thmz.service.his.mz.EmployeeService;
+import cn.hnthyy.thmz.service.thmz.MessageService;
 import cn.hnthyy.thmz.service.thmz.NoticeService;
 import cn.hnthyy.thmz.socket.NoticeWebSocket;
 import org.json.JSONObject;
@@ -26,6 +29,10 @@ public class NoticeServiceImpl implements NoticeService {
     private NoticeSinkMapper noticeSinkMapper;
     @Autowired
     private NoticeWebSocket noticeWebSocket;
+    @Autowired
+    private MessageService messageService;
+    @Autowired
+    private EmployeeService employeeService;
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
@@ -43,6 +50,10 @@ public class NoticeServiceImpl implements NoticeService {
                 noticeSink.setTargetUserId(targetUserId);
                 noticeSinkMapper.insertNoticeSink(noticeSink);
                 noticeWebSocket.appointSending(targetUserId,JSONObject.valueToString(notice));
+                Employee employee= employeeService.queryByUserCode(targetUserId);
+                if(employee!=null){
+                    messageService.sendWxMessage(employee.getCodeRs(),notice.getNoticeContent());
+                }
             }
         }
         return num;

+ 46 - 1
src/main/resources/otherSource/thyy_mz_system.sql

@@ -598,4 +598,49 @@ CREATE TABLE `t_turn_to_consultation`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
 
-SET FOREIGN_KEY_CHECKS = 1;
+SET FOREIGN_KEY_CHECKS = 1;
+
+
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for t_notice
+-- ----------------------------
+DROP TABLE IF EXISTS `t_notice`;
+CREATE TABLE `t_notice`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `notice_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '通知内容',
+  `notice_type` int(1) NOT NULL COMMENT '通知类型 1 -系统通知 2 -业务消息',
+  `send_user_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发送用户编码  系统消息是空',
+  `send_time` datetime(0) NOT NULL COMMENT '发送时间',
+  `notice_status` int(1) NOT NULL DEFAULT 0 COMMENT '消息状态 0 有效  1 失效',
+  `update_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修改人ID',
+  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通知消息表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
+
+
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for t_notice_sink
+-- ----------------------------
+DROP TABLE IF EXISTS `t_notice_sink`;
+CREATE TABLE `t_notice_sink`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `notice_id` bigint(20) NOT NULL COMMENT '消息id',
+  `target_user_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '接收人编码',
+  `notice_reading_status` int(1) NOT NULL DEFAULT 0 COMMENT '消息阅读状态 0 未读  1 已读',
+  `read_time` datetime(0) NULL DEFAULT NULL COMMENT '消息读取时间',
+  PRIMARY KEY (`id`) USING BTREE,
+  INDEX `target_user_id_index`(`target_user_id`) USING BTREE COMMENT '接收人编码索引',
+  INDEX `notice_reading _status_index`(`notice_reading_status`) USING BTREE COMMENT '消息状态索引'
+) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 28 - 25
src/main/resources/static/js/mz/clinic.js

@@ -1209,8 +1209,6 @@ function clearUser(flag) {
     $("#patientAge").html("");
     $("#patientGender").html("");
     $("#patientId").text(null);
-    $("#transferTreatment").css("display", "none");
-    $("#consultation").css("display", "none");
     $("#editUser").css("display", "none");
     $("#clearUser").css("display", "none");
     $("#fetchSpcSlwinfo").css("display", "none");
@@ -1220,6 +1218,8 @@ function clearUser(flag) {
     $("#first").next().click();
     $("#patientHisData").text("");
     if (flag) {
+        $("#transferTreatment").css("display", "none");
+        $("#consultation").css("display", "none");
         $("#mzfzSerialNoInClick").val(null);
         $("#mzfzReqTypeNoInClick").val(null);
         $("#turnToConsultationIdInClick").val(null);
@@ -1582,7 +1582,7 @@ function clinicalReception(patientId, serialNo, reqType) {
             $("#confirmPrescriptionButton").off("click").on("click", function (t) {
                 $("#messagePrescriptionModal").modal("hide");
                 //先保存目前接诊信息,再切换就诊人
-                var jsonData = getParamsForpPrescription();
+                var jsonData = getParamsForpPrescription(1);
                 $.ajax({
                     type: "POST",
                     url: '/thmz/savePrescription',
@@ -1780,13 +1780,13 @@ function fetchSpcSlwinfo() {
  * @param reqType 号表类别
  */
 function realClinicalReception(patientId, serialNo, reqType) {
-   var turnToConsultationIdInClick=$("#turnToConsultationIdInClick").val();
-   if(turnToConsultationIdInClick==null || turnToConsultationIdInClick=="null"){
-       turnToConsultationIdInClick=0;
-   }
+    var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
+    if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
+        turnToConsultationIdInClick = 0;
+    }
     $.ajax({
         type: "GET",
-        url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo+"&turnToConsultationId="+turnToConsultationIdInClick,
+        url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -4409,7 +4409,7 @@ function calculateTotalAmount() {
     $("div.alert ").each(function (index, obj) {
         $(obj).remove();
     });
-    var jsonData = getParamsForpPrescription();
+    var jsonData = getParamsForpPrescription(3);
     $.ajax({
         type: "POST",
         url: '/thmz/getAmountForTempPrescription',
@@ -7101,9 +7101,10 @@ function zTreeOnClick(event, treeId, treeNode) {
 
 /**
  * 构建处方参数
+ * @param type 1 保存处方 2 保存模板 3 计算金额
  * @returns {any}
  */
-function getParamsForpPrescription() {
+function getParamsForpPrescription(type) {
     var codes = $("#diagnoseValue").val();
     var icdCode = null;
     if (codes != null && codes.length > 0) {
@@ -7125,7 +7126,9 @@ function getParamsForpPrescription() {
     jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
     jsonData.icdCode = icdCode;
     jsonData.serialNo = $("#mzfzSerialNoInClick").val();
-    jsonData.turnToConsultationId=$("#turnToConsultationIdInClick").val();
+    if (type == 1) {
+        jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
+    }
     jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
     jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
     jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
@@ -7295,7 +7298,7 @@ function savePrescription() {
     $("#messageButton").off("click").on("click", function (t) {
         //$("#messageModal").modal("hide");
         $("#messageButton").attr("disabled", true);
-        var jsonData = getParamsForpPrescription();
+        var jsonData = getParamsForpPrescription(1);
         $.ajax({
             type: "POST",
             url: '/thmz/savePrescription',
@@ -7361,7 +7364,7 @@ function saveapidAccepts() {
     $("#messageContent").html("确认保存医疗范文吗?");
     $("#messageButton").off("click").on("click", function (t) {
         $("#messageModal").modal("hide");
-        var jsonData = getParamsForpPrescription();
+        var jsonData = getParamsForpPrescription(2);
         $.ajax({
             type: "POST",
             url: '/thmz/saveTemplate',
@@ -7473,7 +7476,7 @@ function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
         $("#confirmPrescriptionButton").off("click").on("click", function (t) {
             $("#messagePrescriptionModal").modal("hide");
             //先保存目前接诊信息,再切换就诊人
-            var jsonData = getParamsForpPrescription();
+            var jsonData = getParamsForpPrescription(1);
             $.ajax({
                 type: "POST",
                 url: '/thmz/savePrescription',
@@ -7638,7 +7641,7 @@ function repeatAcceptsConfirm(patientId, times, clnicId) {
         $("#confirmPrescriptionButton").off("click").on("click", function (t) {
             $("#messagePrescriptionModal").modal("hide");
             //先保存目前接诊信息,再切换就诊人
-            var jsonData = getParamsForpPrescription();
+            var jsonData = getParamsForpPrescription(1);
             $.ajax({
                 type: "POST",
                 url: '/thmz/savePrescription',
@@ -10057,7 +10060,7 @@ function consultation() {
 
             $.ajax({
                 type: "GET",
-                url: '/thmz/getUnConsultation?serialNo='+$("#mzfzSerialNoInClick").val(),
+                url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
                 dataType: "json",
                 headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
                 success: function (res) {
@@ -10065,8 +10068,8 @@ function consultation() {
                         window.location.href = '/thmz/login/view'
                         return;
                     }
-                    var data=res.data;
-                    if(data!=null && data.length>0){
+                    var data = res.data;
+                    if (data != null && data.length > 0) {
                         $('#consultationDept').selectpicker('val', data);
                         $('#consultationDept').selectpicker('refresh');
                     }
@@ -10107,13 +10110,13 @@ function setTurnToConsultation() {
     if (opType == 2 || opType == "2") {
         title = "确认提交本次会诊操作吗?";
         var consultationDept = $("#consultationDept").val();
-        if(consultationDept!=null && consultationDept.length>0){
-            targetDeptNo=null;
-            for(var i=0;i<consultationDept.length;i++){
-                if(targetDeptNo==null){
-                    targetDeptNo=consultationDept[i];
-                }else {
-                    targetDeptNo+=","+consultationDept[i];
+        if (consultationDept != null && consultationDept.length > 0) {
+            targetDeptNo = null;
+            for (var i = 0; i < consultationDept.length; i++) {
+                if (targetDeptNo == null) {
+                    targetDeptNo = consultationDept[i];
+                } else {
+                    targetDeptNo += "," + consultationDept[i];
                 }
             }
         }