Browse Source

评价列表开发完成

hurugang 3 years ago
parent
commit
fd7c25fa0c

+ 15 - 0
src/main/java/cn/hnthyy/thmz/controller/NavigationController.java

@@ -1113,4 +1113,19 @@ public class NavigationController {
         }
         return "mz/hs_jc";
     }
+
+
+    /**
+     * 评价列表
+     *
+     * @return
+     */
+    @RequestMapping("/evaluation-list")
+    public String evaluationList(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/evaluation-list")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/evaluation_list";
+    }
 }

+ 80 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/EvaluationController.java

@@ -4,10 +4,12 @@ import cn.hnthyy.thmz.Utils.HttpUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.thmz.Evaluate;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.enums.EvaluateEnum;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.thmz.EvaluationService;
-import cn.hnthyy.thmz.service.thmz.WindowsService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -26,7 +29,7 @@ public class EvaluationController {
     @Autowired
     private EvaluationService evaluationService;
     @Autowired
-    private WindowsService windowsService;
+    private MzPatientMiService mzPatientMiService;
 
 //    /**
 //     * 评价器欢迎页面跳转到主页面成功后的回调
@@ -155,4 +158,79 @@ public class EvaluationController {
         }
     }
 
+
+
+    /**
+     * 获取评价列表
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getEvaluateList", method = {RequestMethod.POST})
+    public Map<String, Object> getEvaluateList(@RequestBody Evaluate evaluate) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(evaluate==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询参数不能为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(evaluate.getCommonParams())) {
+                evaluate.setCommonParams(null);
+            } else {
+                evaluate.setCommonParams("%" + evaluate.getCommonParams() + "%");
+            }
+
+            if (StringUtils.isBlank(evaluate.getBeginDate())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询记录失败,开始日期参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(evaluate.getEndDate())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询记录失败,结束日期参数为空");
+                return resultMap;
+            }
+            if (evaluate.getPageSize() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询记录失败,每页显示条数参数为空");
+                return resultMap;
+            }
+            if (evaluate.getOffset() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询记录失败,当前所在页参数为空");
+                return resultMap;
+            }
+            Integer total = evaluationService.queryCountEvaluate(evaluate);
+            if(total==0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "未查询到评价列表信息");
+                return resultMap;
+            }
+            List<Evaluate> evaluateList = evaluationService.queryEvaluateWithPage(evaluate);
+            if(evaluateList!=null && evaluateList.size()>0){
+                for (Evaluate el:evaluateList){
+                    EvaluateEnum evaluateEnum= EvaluateEnum.geteEvaluateByCode(el.getEvaluate());
+                    el.setEvaluateName(evaluateEnum==null?"":evaluateEnum.name);
+                    MzPatientMi mzPatientMi= mzPatientMiService.queryByPatientId(el.getPatientId());
+                    if(mzPatientMi==null){
+                        continue;
+                    }
+                    el.setMzPatientMi(mzPatientMi);
+                }
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取评价列表成功");
+            resultMap.put("total", total);
+            resultMap.put("data", evaluateList);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "系统出错,请联系管理员");
+            log.error("系统异常,错误信息{}", e);
+            return resultMap;
+        }
+    }
+
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Evaluate.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.entity.thmz;
 
 import java.io.Serializable;
 
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.enums.EvaluateEnum;
 import cn.hnthyy.thmz.vo.PageParams;
 import lombok.Data;
@@ -64,4 +65,13 @@ public class Evaluate extends PageParams implements Serializable {
 	 */
 	private String commonParams;
 
+	/**
+	 * 页面回显数据
+	 */
+	private MzPatientMi mzPatientMi;
+	/**
+	 * 评价描述
+	 */
+	private String evaluateName;
+
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/enums/EvaluateEnum.java

@@ -28,7 +28,7 @@ public enum EvaluateEnum {
      * @param code
      * @return
      */
-    public static EvaluateEnum geteEvaluateByCode(String code){
+    public static EvaluateEnum geteEvaluateByCode(Integer code){
         List<EvaluateEnum> evaluateEnums= Arrays.asList(values());
         for (EvaluateEnum evaluateEnum:evaluateEnums){
             if(evaluateEnum.code.equals(code)){

+ 0 - 12
src/main/java/cn/hnthyy/thmz/mapper/thmz/EvaluateMapper.java

@@ -34,12 +34,6 @@ public interface EvaluateMapper {
             "<when test='endDate!=null'>" +
             " and evaluate_time  <![CDATA[<=]]>#{endDate}" +
             "</when>" +
-            "<when test='patientId!=null'>" +
-            " and patient_id = #{patientId}" +
-            "</when>" +
-            "<when test='userIdCode!=null'>" +
-            " and user_id_code = #{userIdCode}" +
-            "</when>" +
             "<when test='commonParams!=null'>" +
             " and (patient_name like #{commonParams} or patient_id like #{commonParams} or user_id_code like #{commonParams} or user_name like #{commonParams})" +
             "</when>" +
@@ -62,12 +56,6 @@ public interface EvaluateMapper {
             "<when test='endDate!=null'>" +
             " and evaluate_time  <![CDATA[<=]]>#{endDate}" +
             "</when>" +
-            "<when test='patientId!=null'>" +
-            " and patient_id = #{patientId}" +
-            "</when>" +
-            "<when test='userIdCode!=null'>" +
-            " and user_id_code = #{userIdCode}" +
-            "</when>" +
             "<when test='commonParams!=null'>" +
             " and (patient_name like #{commonParams} or patient_id like #{commonParams} or user_id_code like #{commonParams} or user_name like #{commonParams})" +
             "</when>" +

+ 177 - 0
src/main/resources/static/js/mz/evaluation_list.js

@@ -0,0 +1,177 @@
+//@ sourceURL=evaluation_list.js
+$(function () {
+    daterangepicker(initEvaluateList);
+    //重置查询参数
+    $('#btn_clean').click(function () {
+        $("#commonParams").val(null);
+        $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
+        initEvaluateList();
+    });
+    //初始化页面上面的按钮事件
+    $("#btn_excel").click(function (t) {
+        exportExcel();
+    });
+
+});
+
+/**
+ * 获取时间选择器的时间数组
+ * @returns {string[]}
+ */
+function getRePortRangeArr() {
+    var rePortRange = $('#reportrange span').html();
+    var rePortRangeArr = rePortRange.split(" - ");
+    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
+    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
+    return rePortRangeArr;
+}
+
+
+/**
+ * 获取混检人主体列表
+ */
+function initEvaluateList() {
+    $('#tb_table').bootstrapTable("destroy");
+    $('#tb_table').bootstrapTable({
+        url: '/thmz/getEvaluateList',         //请求后台的URL(*)
+        method: 'post',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "desc",                   //排序方式
+        queryParams: queryParams,           //传递参数(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 5,                       //每页的记录行数(*)
+        pageList: [10, 15, 25, 50, 100, 1000, 2000],        //可供选择的每页的行数(*)
+        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        strictSearch: true,
+        showColumns: false,                  //是否显示所有的列
+        showRefresh: false,                  //是否显示刷新按钮
+        minimumCountColumns: 2,             //最少允许的列数
+        clickToSelect: true,                //是否启用点击选中行
+        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
+        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
+        cardView: false,                    //是否显示详细视图
+        detailView: false,
+        //rowStyle:rowStyle,//通过自定义函数设置行样式
+        ajaxOptions: {
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token")
+            }
+        },
+        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('');
+            //     }
+            // },
+            {
+                field: 'patientId',
+                title: '门诊病人ID',
+                align: "center",
+                valign: 'middle'
+                // ,
+                // formatter: function (value, row, index) {
+                //     return "<span>ID:" + value +"</span>";
+                // }
+            }, {
+                field: 'patientName',
+                title: '患者姓名',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'userIdCode',
+                title: '被评价人编码',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'userName',
+                title: '被评价人姓名',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'evaluateName',
+                title: '评价描述',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if (row.evaluate <= 1) {
+                        return "<span style='color: green'>" + value + "</span>";
+                    } else if (row.evaluate <= 3) {
+                        return "<span style='color: blue'>" + value + "</span>";
+                    } else {
+                        return "<span style='color: red'>" + value + "</span>";
+                    }
+                }
+            }
+            , {
+                field: 'evaluateTime',
+                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) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var ress = eval(res);
+            if (ress.code == -1) {
+                if (ress.message != null && ress.message != '') {
+                    errorMesage(ress);
+                }
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+            return {
+                "total": ress.total,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+    });
+}
+
+
+/**
+ * 构建列表查询参数
+ * @param params
+ * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
+ */
+function queryParams(params) {
+    var rePortRangeArr = getRePortRangeArr();
+    var temp = {   //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
+        commonParams: $("#commonParams").val(),
+        beginDate: rePortRangeArr[0],
+        endDate: rePortRangeArr[1],
+        pageSize: params.limit,   //页面大小
+        offset: params.offset
+    };
+    return temp;
+}
+
+/**
+ * 导出excel
+ */
+function exportExcel() {
+    var table2excel = new Table2Excel();
+// 传入你的tableId即可导出
+    table2excel.export($('#tb_table'), "评价列表");
+}

+ 53 - 0
src/main/resources/templates/mz/evaluation_list.html

@@ -0,0 +1,53 @@
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/bootstrap-select.css"/>
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/daterangepicker.css"/>
+<link rel="stylesheet" href="/thmz/css/custom.min.css">
+<script src="/thmz/js/dependent/bootstrap-select.js"></script>
+<script src="/thmz/js/common/map-util.js"></script>
+<script src="/thmz/js/dependent/daterangepicker.js"></script>
+<script src="/thmz/js/common/date-util.js"></script>
+<script src="/thmz/js/excel/table2excel.js"></script>
+<script src="/thmz/js/mz/evaluation_list.js"></script>
+<title>评价列表</title>
+<!-- 打印的样式-->
+<style media="print">
+    @page {
+        size: auto;
+        margin: 0mm;
+    }
+</style>
+<div class="row" style="height: calc(100% - 60px);overflow-y: auto;">
+    <div class="col-md-12 col-sm-12 col-xs-12">
+        <div class="x_panel">
+            <div class="panel-body">
+                <form id="formSearch" class="form-horizontal" autocomplete="off">
+                    <div class="form-group" style="margin-top:15px">
+                        <label class="control-label col-sm-1" for="commonParams" style="width: 12%;">通用参数</label>
+                        <div class="col-md-4 col-sm-4 col-xs-12" style="float: left;">
+                            <input type="text" class="form-control" id="commonParams" onchange="initEvaluateList()" placeholder="患者姓名/门诊ID/被评价人姓名/编码">
+                        </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"
+                                 style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc;">
+                                <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
+                                <span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
+                            </div>
+                        </div>
+                        <button type="button" style="margin-left:5px;width: 4%;" id="btn_clean" class="btn btn-primary"
+                                title="重置"><i class="fa fa-rotate-left"></i>
+                        </button>
+                        <button type="button"  id="btn_excel" class="btn btn-primary"
+                                title="导出EXCEL"><i class="fa fa-file-excel-o"></i>
+                        </button>
+                    </div>
+                </form>
+            </div>
+        </div>
+        <table id="tb_table"></table>
+    </div>
+</div>
+
+
+