Jelajahi Sumber

Merge branch 'dev' of humingfen/patient-co-management into dev

huangwenjie 7 tahun lalu
induk
melakukan
735d93b60d

+ 54 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/taskRule_list.jsp

@ -0,0 +1,54 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/22 0019
  Time: 下午 5:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../head/page_head.jsp" %>
    <title>健康任务积分规则管理</title>
</head>
<body>
<div id="div_wrapper">
    <!-- 检索条件 -->
    <div class="m-taskRule-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
        <div class="m-form-group f-mt10">
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_name" placeholder="请输入规则名称" class="f-ml10" data-attr-scan="name"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_type" placeholder="请输入规则类型" class="f-ml10" data-attr-scan="type"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_period" placeholder="请输入周期性" class="f-ml10" data-attr-scan="period"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_status" placeholder="请输入是否有效" class="f-ml10" data-attr-scan="status"/>
            </div>
            <sec:authorize url="/admin/task/list">
                <div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>查询</span>
                </div>
            </sec:authorize>
            <sec:authorize url="/admin/task/create">
                <div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>新增</span>
                </div>
            </sec:authorize>
        </div>
    </div>
    <!-- 列表 -->
    <div id="div_taskRule_list">
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp" %>
<%@ include file="taskRule_list_js.jsp" %>
</html>

+ 244 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/taskRule_list_js.jsp

@ -0,0 +1,244 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
    (function ($, win) {
        $(function () {
            /* ************************** 变量定义 ******************************** */
            // 通用工具类库
            var Util = $.Util;
            var taskRule = null;
            var master = null;
            var isFirstPage = false;
            /* *************************** 函数定义 ******************************* */
            function pageInit() {
                taskRule.init();
                master.init();
            }
            function reloadGrid(params) {
                if (isFirstPage) {
                    this.grid.options.newPage = 1;
                }
                this.grid.setOptions({parms: params});
                this.grid.loadData(true);
            }
            /* *************************** 模块初始化 ***************************** */
            taskRule = {
                $element: $('.m-taskRule-area'),
                $searchBtn: $('#btn_search'),
                $addBtn: $('#btn_add'),
                $name: $("#inp_name"),//规则标题
                $type: $("#inp_type"),//规则类型
                $period: $("#inp_period"),//周期
                $status: $("#inp_status"),//状态
                init: function () {
                    this.$element.show();
                    this.$element.attrScan();
                    window.form = this.$element;
                    this.$name.ligerTextBox({width: 200});
                    this.typeBox = this.$type.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '手动', id: 'NORMAL'},
                            {text: '自动', id: 'AUTO'},
                        ]
                    });
                    this.periodBox =this.$period.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '一次性', id: '1'},
                            {text: '周期性', id: '0'},
                        ]
                    });
                    this.statusBox = this.$status.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '有效', id: '1'},
                            {text: '失效', id: '0'},
                        ]
                    });
                    this.bindEvents();
                },
                bindEvents: function () {
                    var self = this;
                    self.$searchBtn.click(function () {
                        master.grid.options.newPage = 1;
                        master.reloadGrid();
                    });
                    self.$addBtn.click(function () {
                        $.publish("taskRule:info:create", [0]);
                    });
                }
            };
            master = {
                taskRuleInfoDialog: null,
                grid: null,
                init: function () {
                    this.grid = $("#div_taskRule_list").ligerGrid($.LigerGridEx.config({
                        url: ctx + '/admin/taskRule/list',
                        parms: {"taskRule": JSON.stringify(taskRule.$element.Fields.getValues())},
                        ajaxHeader: ajaxHeaderName,
                        ajaxHeaderValue: ajaxHeaderValue,
                        columns: [
                            {display: 'id', name: 'id', hide: true},
                            {display: '规则名称', name: 'name', width: '10%', align: "left"},
                            {display: '规则描述', name: 'description', width: '10%', align: "left"},
                            {display: '积分', name: 'integrate', width: '10%', align: "left"},
                            {
                                display: '交易类型', name: 'tradeDirection', width: '10%', align: "left",
                                render: function (row) {
                                    if(row.tradeDirection == 1) {
                                        return "增"
                                    }
                                    if(row.tradeDirection == -1) {
                                        return "减"
                                    }
                                    if(row.tradeDirection == 0) {
                                        return "清零"
                                    }
                                }
                            },
                            {
                                display: '规则类型', name: 'type', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.type == "NORMAL") {
                                        return "手动"
                                    }
                                    if (row.type == "AUTO") {
                                        return "自动"
                                    }
                                }
                            },
                            {display: 'Java反射类路径', name: 'javaClassPath', width: '10%', align: "left"},
                            {
                                display: '周期', name: 'period', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.period == 1) {
                                        return "一次性"
                                    }
                                    if (row.period == 0) {
                                        return "周期性"
                                    }
                                }
                            },
                            {
                                display: '状态', name: 'status', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.status == 1) {
                                        return "有效"
                                    }
                                    if (row.status == 0) {
                                        return "失效"
                                    }
                                }
                            },
                            {
                                display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
                                render: function (row) {
                                    var html = '';
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:view", row.id) + '">查看</a>';
                                    <sec:authorize url="/admin/taskRule/update">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:edit", row.id) + '">编辑</a>';
                                    </sec:authorize>
                                    <%--<sec:authorize url="/admin/taskRule/delete">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "taskRule:info:del", row.id) + '">删除</a>';
                                    </sec:authorize>--%>
                                    return html;
                                }
                            }
                        ],
                    }));
                    // 自适应宽度
                    this.grid.adjustToWidth();
                    this.bindEvents();
                },
                reloadGrid: function (msg) {
                    taskRule.$element.attrScan();
                    var values = taskRule.$element.Fields.getValues();
                    values.type = taskRule.typeBox.getValue();
                    values.period = taskRule.periodBox.getValue();
                    values.status = taskRule.statusBox.getValue();
                    reloadGrid.call(this,{"taskRule":JSON.stringify(values)});
                },
                delRecord: function (id, code) {
                    var self = this;
                    $.ajax({
                        url: ctx + "/admin/taskRule/delete",
                        data: {"id": id},
                        method: "post",
                        dataType: "json",
                        success: function (result) {
                            if (result.status == '200') {
                                window.reloadMasterGrid(result.msg);
                            } else {
                                $.Notice.error(result.msg);
                            }
                        },
                        error: function (data) {
                            $.Notice.error("系统异常,请联系管理员!");
                        }
                    })
                },
                bindEvents: function () {
                    var self = this;
                    $.subscribe('taskRule:info:view', function (event, id) {
                        var title = '查看信息';
                        self.deviceInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "view"},
                            title: title,
                            url: ctx + '/admin/taskRule/infoInit'
                        })
                    });
                    $.subscribe('taskRule:info:edit', function (event, id) {
                        var title = '编辑信息';
                        self.taskRuleInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "edit"},
                            title: title,
                            url: ctx + '/admin/taskRule/infoInit'
                        })
                    });
                    $.subscribe('taskRule:info:create', function (event) {
                        var title = '新增活动';
                        self.taskRuleInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"type": "create"},
                            title: title,
                            url: ctx + '/admin/taskRule/init'
                        })
                    });
                    $.subscribe('taskRule:info:del', function (event, id, code) {
                        $.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
                            if (yes) {
                                self.delRecord(id, code);
                            }
                        });
                    })
                }
            };
            /* ************************* Dialog页面回调接口 ************************** */
            win.reloadMasterGrid = function (msg) {
                if (isNoEmpty(msg)) {
                    $.Notice.success(msg);
                }
                master.reloadGrid(msg);
            };
            win.closeTaskRuleInfoDialog = function () {
                master.taskRuleInfoDialog.close();
            };
            /* *************************** 页面初始化 **************************** */
            pageInit();
        });
    })(jQuery, window);
</script>

+ 83 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/taskRule_modify.jsp

@ -0,0 +1,83 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/22
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <%@ include file="../head/page_head.jsp"%>
    <title>任务详情</title>
    <style type="text/css">
        .m-form-group label.label_title{width: 100px}
    </style>
</head>
<body>
<div id="div_taskRule_info_form" data-role-form class="m-form-inline f-mt20 f-ml30" data-role-form>
    <input type="hidden" id="inp_id" value='${id}' data-attr-scan="id"/>
    <input type="hidden" id="type" value='${type}'/>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">规则名称</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_name" class="required useTitle f-w240 validate-special-char"  required-title="规则名称不能为空"  data-attr-scan="name"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">规则描述</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_description" class="f-w240 validate-special-char"  data-attr-scan="description"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">积分</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_integrate" class="required useTitle ajax f-w240 validate-special-char"  required-title="积分不能为空" data-attr-scan="integrate"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">交易类型</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_tradeDirection" class="required useTitle ajax f-w240 validate-special-char" required-title="交易类型不能为空" data-attr-scan="tradeDirection"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">规则类型</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_type" class="required useTitle ajax f-w240 validate-special-char" required-title="规则类型不能为空" data-attr-scan="type"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">java反射类路径</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_javaClassPath" class="f-w240 validate-special-char"  data-attr-scan="javaClassPath"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">周期</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_period" class="f-w240 validate-special-char"   data-attr-scan="period"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">状态</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_status" class="f-w240 validate-special-char" data-attr-scan="status"/>
        </div>
    </div>
    <div class="m-form-group f-pa" id="btn_save_close" style="right: 10px;bottom: 0;">
        <div class="m-form-control">
            <input type="button" value="保存" id="btn_save" class="l-button u-btn u-btn-primary u-btn-large f-ib f-vam" />
            <div id="btn_cancel" class="l-button u-btn u-btn-cancel u-btn-large f-ib f-vam" >
                <span>关闭</span>
            </div>
        </div>
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp"%>
<%@ include file="taskRule_modify_js.jsp" %>
<%--<script src="${ctx}/static/js/device/device_modify.js"></script>--%>
</html>

+ 155 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/taskRule_modify_js.jsp

@ -0,0 +1,155 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
    (function ($, win) {
        $(function () {
            var Util = $.Util;
            var type = $('#type').val();
            var id = $('#inp_id').val();
            var taskRuleInfo = "";
            var jValidation = $.jValidation;
            function pageInit() {
                taskRuleInfo.init();
                if(type != "create") {
                    taskRuleInfo.initForm();
                }
                taskRuleInfo.bindEvents();
            }
            taskRuleInfo = {
                //变量
                $form: $("#div_taskRule_info_form"),
                init: function () {
                    _this = this;
                    this.$form.attrScan();
                    $("#inp_name").ligerTextBox({width: 240})//规则名称
                    $("#inp_description").ligerTextBox({width: 240})//规则描述
                    $("#inp_integrate").ligerTextBox({width: 240})//积分
                    $("#inp_javaClassPath").ligerTextBox({width: 240})//java反射性路径
                    _this.tradeDirectionBox = $("#inp_tradeDirection").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '增', id: '1'},
                            {text: '减', id: '-1'},
                            {text: '清零', id: '0'},
                        ]
                    });//交易类型
                    _this.typeBox = $("#inp_type").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '手动', id: 'NORMAL'},
                            {text: '自动', id: 'AUTO'},
                        ]
                    });//规则类型
                    _this.periodBox = $("#inp_period").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '一次性', id: '1'},
                            {text: '周期性', id: '0'},
                        ]
                    })//周期
                    _this.statusBox = $("#inp_status").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '有效', id: '1'},
                            {text: '失效', id: '0'},
                        ]
                    })//状态
                },
                initForm: function () {
                    _this = this;
                    //修改、查看
                    $.ajax({
                        url: ctx + "/admin/taskRule/findById",
                        method: "post",
                        dataType: "json",
                        async: false,
                        data: {id: id},
                        success: function (result) {
                            if (result.status == '200') {
                                var data = result.data.detailModelList[0];
                                _this.$form.Fields.fillValues({
                                    name: data.name,
                                    description: data.description,
                                    integrate: data.integrate,
                                    javaClassPath: data.javaClassPath,
                                });
                                //填值
                                _this.typeBox.selectValue(data.type);
                                _this.periodBox.selectValue(data.period);
                                _this.statusBox.selectValue(data.status);
                                _this.tradeDirectionBox.selectValue(data.tradeDirection);
                            } else {
                                $.Notice.error(result.msg);
                            }
                        },
                        error: function (data) {
                            $.Notice.error("系统异常,请联系管理员!");
                        }
                    });
                    if (type == "view") {
                        _this.$form.addClass("m-form-readonly"); //表单只读
                        $(".essential").addClass("XXXtest");
                        $(".essential").removeClass("essential");
                        $("#btn_save_close").css("display", "none");
                    } else {
                        this.$form.removeClass("m-form-readonly");
                        $("#btn_save_close").css("display", "block");
                        $(".XXXtest").addClass("essential");
                    }
                    this.$form.show();
                },
                //绑定事件
                bindEvents: function () {
                    var validator = new jValidation.Validation(this.$form, {
                        immediate: true, onSubmit: false,
                        onElementValidateForAjax: function (elm) {
                        }
                    });
                    var self = this;
                    $("#btn_save").click(function () {
                        var values = self.$form.Fields.getValues();
                        values.type = self.typeBox.getValue();
                        values.status = self.statusBox.getValue();
                        values.period = self.periodBox.getValue();
                        values.tradeDirection = self.tradeDirectionBox.getValue();
                        if (!validator.validate()) {
                            return;
                        }
                        update(values);
                    });
                    function update(values) {
                        var dataModel = $.DataModel.init();
                        var url = "update";
                        if (type == "create") {
                            url = "create";
                        }
                        dataModel.updateRemote(ctx + "/admin/taskRule/" + url, {
                            data: {jsonData: JSON.stringify(values)},
                            success: function (data) {
                                if (data.status == 200) {
                                    parent.window.reloadMasterGrid(data.msg);
                                    parent.window.closeTaskRuleInfoDialog();
                                } else {
                                    $.Notice.error(data.msg);
                                }
                            }
                        });
                    }
                    $("#btn_cancel").click(function () {
                        parent.window.closeTaskRuleInfoDialog();
                    });
                },
            }
            pageInit();
        });
    })(jQuery, window)
</script>

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_list_js.jsp

@ -225,7 +225,7 @@
                }
                master.reloadGrid(msg);
            };
            win.closetaskInfoDialog = function () {
            win.closeTaskInfoDialog = function () {
                master.taskInfoDialog.close();
            };
            /* *************************** 页面初始化 **************************** */

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_modify_js.jsp

@ -177,7 +177,7 @@
                            success: function (data) {
                                if (data.status == 200) {
                                    parent.window.reloadMasterGrid(data.msg);
                                    parent.window.closetaskInfoDialog();
                                    parent.window.closeTaskInfoDialog();
                                } else {
                                    $.Notice.error(data.msg);
                                }
@ -186,7 +186,7 @@
                    }
                    $("#btn_cancel").click(function () {
                        parent.window.closetaskInfoDialog();
                        parent.window.closeTaskInfoDialog();
                    });
                },
            }

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp

@ -134,6 +134,9 @@
                            <sec:authorize url="/admin/task/initial">
                                <li><a href="javascript:locationMenu('task');">任务管理</a></li>
                            </sec:authorize>
							<sec:authorize url="/admin/taskRule/initial">
								<li><a href="javascript:locationMenu('taskRule');">任务积分规则管理</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/healthBank/center">
						</ul>
					</div>

+ 1 - 0
patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js

@ -25,6 +25,7 @@ var menu = {
    //健康银行管理
    "activity": "/admin/activity/initial",//健康活动管理页面
    "task": "/admin/task/initial",//健康任务管理页面
    "taskRule": "/admin/taskRule/initial",//健康任务积分规则管理页面
    //数据统计
    "static": "/admin/static/center",//数据统计

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -431,6 +431,6 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    int hasSignCount(String idcard);
    //根据patient查找有效签约的hospital
    @Query("select a.hospital from SignFamily a where a.patient = ?1 and (a.status = 1 or a.status = 2)")
    @Query("select a.hospital from SignFamily a where a.patient = ?1")
    String getHospital(String patient);
}