Browse Source

危机值优化

lihong 1 year ago
parent
commit
c76dc35f93

+ 52 - 34
src/main/java/cn/hnthyy/thmz/controller/mz/CriticalValueController.java

@@ -1,21 +1,35 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.AssertUtil;
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.CriticalMessage;
 import cn.hnthyy.thmz.entity.thmz.CriticalValue;
 import cn.hnthyy.thmz.entity.thmz.User;
-import cn.hnthyy.thmz.entity.thmz.UserRoleRelation;
-import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.service.his.mz.CriticalMessageService;
 import cn.hnthyy.thmz.service.thmz.CriticalValueService;
 import cn.hnthyy.thmz.service.thmz.UserRoleRelationService;
+import cn.hnthyy.thmz.service.thmz.UserService;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -23,8 +37,10 @@ import java.util.Map;
 public class CriticalValueController {
     @Autowired
     private CriticalValueService criticalValueService;
-    @Autowired
-    private UserRoleRelationService userRoleRelationService;
+    @Resource
+    private CriticalMessageService service;
+    @Resource
+    private UserService userService;
 
     /**
      * 获取危急值列表
@@ -41,26 +57,6 @@ public class CriticalValueController {
                 resultMap.put("message", "查询参数不能为空");
                 return resultMap;
             }
-            if (StringUtils.isBlank(criticalValue.getCommonParams())) {
-                criticalValue.setCommonParams(null);
-            } else {
-                criticalValue.setCommonParams("%" + criticalValue.getCommonParams() + "%");
-            }
-            User tokenUser = TokenUtil.getUser(httpServletRequest);
-            List<UserRoleRelation> userRoleRelationList=userRoleRelationService.queryByUserId(tokenUser.getId());
-            //超级管理员可以看所有的数据
-            boolean isAdmin = false;
-            if(userRoleRelationList!=null && userRoleRelationList.size()>0){
-                for(UserRoleRelation userRoleRelation:userRoleRelationList){
-                    if(userRoleRelation!=null && userRoleRelation.getRoleId()==1){
-                        isAdmin=true;
-                        break;
-                    }
-                }
-            }
-            if(!isAdmin){
-                criticalValue.setEmployeeCodes("%" + tokenUser.getUserCode() + "%");
-            }
             if (StringUtils.isBlank(criticalValue.getBeginDate())) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "查询记录失败,开始日期参数为空");
@@ -81,17 +77,24 @@ public class CriticalValueController {
                 resultMap.put("message", "查询记录失败,当前所在页参数为空");
                 return resultMap;
             }
-            Integer total = criticalValueService.queryCountCriticalValue(criticalValue);
-            if(total==0){
-                resultMap.put("code", -1);
-                resultMap.put("message", "未查询到危急值信息");
-                return resultMap;
+            Page<CriticalMessage> page = new Page<>(criticalValue.getOffset()/criticalValue.getPageSize()+1,criticalValue.getPageSize());
+            QueryWrapper queryWrapper = new QueryWrapper();
+            queryWrapper.ge("create_time", criticalValue.getBeginDate());
+            queryWrapper.le( "create_time", criticalValue.getEndDate());
+            queryWrapper.like(StrUtil.isNotBlank(criticalValue.getCommonParams()), "pat_no", criticalValue.getCommonParams());
+            Page<CriticalMessage> data = service.page(page, queryWrapper);
+            if(CollUtil.isNotEmpty(data.getRecords())){
+                for(CriticalMessage item :data.getRecords()){
+                    if(StrUtil.isNotBlank(item.getHandleStaff())){
+                        User user = userService.queryUserByUserIdCode(item.getHandleStaff());
+                        item.setHandleStaff(user ==null ? "" : user.getUserName());
+                    }
+                }
             }
-            List<CriticalValue> criticalValueList = criticalValueService.queryCriticalValueWithPage(criticalValue);
             resultMap.put("code", 0);
             resultMap.put("message", "获取危急值列表成功");
-            resultMap.put("total", total);
-            resultMap.put("data", criticalValueList);
+            resultMap.put("total", data.getTotal());
+            resultMap.put("data", data.getRecords());
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
@@ -102,6 +105,21 @@ public class CriticalValueController {
         }
     }
 
+    @UserLoginToken
+    @PostMapping("/dealCriticalMessage")
+    public R dealCriticalMessage(@RequestBody Map<String,Object> param) {
+        Integer id = Convert.toInt(param.get("id"));
+        AssertUtil.isNotBlank(id,"id 不能为空");
+        CriticalMessage criticalMessage = CriticalMessage.builder()
+                .id(id)
+                .handleStaff(TokenUtil.getUser().getUserIdCode())
+                .handleTime(new Date())
+                .build();
+        service.updateById(criticalMessage);
+        return R.ok();
+    }
+
+
     /**
      * 根据ID查询危急值
      *

+ 100 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/CriticalMessage.java

@@ -0,0 +1,100 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 危急值(TCriticalMessage)表实体类
+ *
+ * @author lihong
+ * @since 2024-02-23 10:01:15
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@TableName("t_critical_message")
+public class CriticalMessage extends Model<CriticalMessage> {
+    @TableId(type=IdType.AUTO)
+    private Integer id;
+
+     /**
+     * 患者住院/门诊号
+     */     
+    private String patNo;
+     /**
+     * 消息ID
+     */     
+    private String msgId;
+          
+    private String msgType;
+          
+    private String sourceCode;
+     /**
+     * 来源科室
+     */     
+    private String sourceName;
+     /**
+     * 目标科室编码
+     */     
+    private String targetDeptCode;
+     /**
+     * 目标科室名称
+     */     
+    private String targetDeptName;
+     /**
+     * 危急值内容
+     */     
+    private String content;
+     /**
+     * 生成时间
+     */     
+    private Date createTime;
+     /**
+     * 患者类型(住院/门诊)
+     */     
+    private String patientType;
+     /**
+     * 来源类型(检查/检验)
+     */     
+    private String inspectionType;
+     /**
+     * 状态
+     */     
+    private String state;
+     /**
+     * 推送到医生企业微信的时间
+     */     
+    private Date sendTime;
+     /**
+     * 医生处理时间
+     */     
+    private Date handleTime;
+     /**
+     * 处理人
+     */     
+    private String handleStaff;
+
+
+
+    /**
+     * 获取主键值
+     *
+     * @return 主键值
+     */
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+    }
+

+ 15 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/CriticalMessageMapper.java

@@ -0,0 +1,15 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.CriticalMessage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 危急值(TCriticalMessage)表数据库访问层
+ *
+ * @author lihong
+ * @since 2024-02-23 09:53:11
+ */
+public interface CriticalMessageMapper extends BaseMapper<CriticalMessage> {
+
+}
+

+ 15 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/CriticalMessageService.java

@@ -0,0 +1,15 @@
+package cn.hnthyy.thmz.service.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.CriticalMessage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 危急值(TCriticalMessage)表服务接口
+ *
+ * @author lihong
+ * @since 2024-02-23 09:53:12
+ */
+public interface CriticalMessageService extends IService<CriticalMessage> {
+
+}
+

+ 19 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/CriticalMessageServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.hnthyy.thmz.service.impl.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.CriticalMessage;
+import cn.hnthyy.thmz.mapper.his.mz.CriticalMessageMapper;
+import cn.hnthyy.thmz.service.his.mz.CriticalMessageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 危急值(TCriticalMessage)表服务实现类
+ *
+ * @author lihong
+ * @since 2024-02-23 09:53:13
+ */
+@Service("tCriticalMessageService")
+public class CriticalMessageServiceImpl extends ServiceImpl<CriticalMessageMapper, CriticalMessage> implements CriticalMessageService {
+
+}
+

+ 52 - 10
src/main/resources/static/js/mz/critical_value_list.js

@@ -64,16 +64,25 @@ function initCriticalValueList() {
             }
         },
         columns: [
-            // {
-            //     title: '操作',
-            //     field: 'op',
-            //     align: "center",
-            //     valign: 'middle',
-            //     formatter: function (value, row, index) {
-            //         var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="showPatientModal(\'' + row.parentPatientId + '\')">被检人列表<i class="fa fa-area-chart" style="margin-left: 10px;"></i></button>';
-            //         return [str].join('');
-            //     }
-            // },
+            {
+                title: '操作',
+                field: 'op',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    var str = ''
+                    if(!stringNotBlank(row.handleStaff)){
+                        str = '<button type="button" class="btn btn-primary  btn-sm" onclick="dealCriticalMessage(\'' + row.id + '\')">处理</button>';
+                    }
+                    return str;
+                }
+            },
+            {
+                field: 'patNo',
+                title: '住院号',
+                align: "center",
+                valign: 'middle'
+            },
             {
                 field: 'content',
                 title: '危急值',
@@ -91,7 +100,26 @@ function initCriticalValueList() {
                     }
                     return format(value, "yyyy-MM-dd HH:mm:ss");
                 }
+            },
+            {
+                field: 'handleStaff',
+                title: '处理人',
+                align: "center",
+                valign: 'middle'
+            },
+            {
+                field: 'handleTime',
+                title: '处理时间',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if (value == null || value == "") {
+                        return "";
+                    }
+                    return format(value, "yyyy-MM-dd HH:mm:ss");
+                }
             }
+
         ],
         responseHandler: function (res) {
             if (res == '401' || res == 401) {
@@ -116,6 +144,20 @@ function initCriticalValueList() {
     });
 }
 
+//处理危机消息
+function dealCriticalMessage(id) {
+   postAjaxJsonHttpRequst("/thmz/dealCriticalMessage",{id:id},true,function (res) {
+        if(res.code == 0){
+            successMesageSimaple(res.message)
+            initCriticalValueList()
+        }else {
+            errorMesage(res);
+        }
+   })
+
+
+}
+
 
 /**
  * 构建列表查询参数

+ 3 - 3
src/main/resources/templates/mz/critical_value_list.html

@@ -20,12 +20,12 @@
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off" onsubmit="return">
                     <div class="form-group" style="margin-top:15px">
-                        <label class="control-label col-sm-1" for="commonParams" style="width: 12%;">患者住院号/姓名</label>
+                        <label class="control-label col-sm-1" for="commonParams" style="width: 12%;">患者住院号</label>
                         <div class="col-md-2 col-sm-2 col-xs-12" style="width: 15%;float: left;">
-                            <input type="text" class="form-control" id="commonParams" onchange="initCriticalValueList()" placeholder="患者住院号/姓名">
+                            <input type="text" class="form-control" id="commonParams" onchange="initCriticalValueList()" placeholder="患者住院号">
                         </div>
                         <label class="control-label col-md-1 col-sm-1 col-xs-12" for="reportrange" style="width: 75px;">
-                            混采时间
+                            发生时间
                         </label>
                         <div class="col-md-2 col-sm-2 col-xs-12" style="width: 220px;">
                             <div id="reportrange" class="pull-left"