From d6c989a5d9122e5cf969dd640a92b8e12caf8aa6 Mon Sep 17 00:00:00 2001
From: zhaoxiaohao <279049017@qq.com>
Date: Thu, 22 Apr 2021 11:18:28 +0800
Subject: [PATCH] Merge branch 'dev' of ssh://192.168.2.240:29418/kidgrow-microservices-platform into dev

---
 kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html |  551 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 376 insertions(+), 175 deletions(-)

diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html
index 8196658..27ae8b8 100644
--- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html
+++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/hospital.html
@@ -8,221 +8,422 @@
     </div>
     <div class="layui-card-body">
         <div class="layui-form toolbar">
-            <input id="app-edit-search" class="layui-input search-input" type="text" placeholder="请输入标题" />&emsp;
-            <input type="text" class="layui-input search-input" id="test1"> 至 <input type="text"
-                class="layui-input search-input" id="test2"> &emsp;
-            <select id="role_clients" placeholder="选择一个应用" lay-filter="role_clients">
-                <option value="">-请选择-</option>
+            <select id="province" placeholder="省份" lay-filter="province">
             </select>
-            <button id="app-btn-search" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
+            <select id="city" placeholder="市" lay-filter="city">
+                <option value="">选择市</option>
+            </select>
+            <select id="areas" placeholder="区县" lay-filter="areas">
+                <option value="">选择区县</option>
+            </select>
+            <select id="isscreen" placeholder="选择筛查状态" lay-filter="isscreen">
+                <option value="">-是否筛查-</option>
+                <option value="1">-是-</option>
+                <option value="0">-否-</option>
+            </select>
+            <select id="ispay" placeholder="支付功能" lay-filter="ispay">
+                <option value="">-支付功能-</option>
+                <option value="1">-已开通-</option>
+                <option value="0">-未开通-</option>
+            </select>
+            <input id="hosName" class="layui-input search-input" type="text" autocomplete="off" placeholder="按医院名" />
+            <button id="hospita-btn-search" class="layui-btn icon-btn"><i class="layui-icon permissions"
+                    permissions="hospital-get">&#xe615;</i>搜索</button>&emsp;
+            <button id="hospital-btn-add" class="layui-btn icon-btn"><i class="layui-icon permissions"
+                    permissions="hospital-save"></i>添加医院/科室</button>
         </div>
 
         <!-- 数据表格 -->
-        <table class="layui-table" id="app-table" lay-filter="app-table"></table>
+        <table class="layui-table" id="hospital-table" lay-filter="hospital-table"></table>
     </div>
 </div>
 
 <!-- 表格操作列 -->
 <script type="text/html" id="businessRecords-table-bar">
-    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看详情</a>
+    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="productdetail-List">套餐</a>
+    <a class="layui-btn layui-btn-xs permissions" permissions="product-rechage" lay-event="pay">充值</a>
+    <a class="layui-btn layui-btn-xs layui-btn-normal" permissions="product-pay" lay-event="userpay">支付</a>
+    <a class="layui-btn layui-btn-xs layui-btn-normal" permissions="product-pay" lay-event="health">运功处方</a>
+    <a class="layui-btn layui-btn-primary layui-btn-xs permissions" permissions="hospital-save" lay-event="edit">修改</a>
+    <a class="layui-btn layui-btn-danger layui-btn-xs permissions" permissions="hospital-del" lay-event="del">删除</a>
 </script>
-
-<!-- 表单弹窗 -->
-<script type="text/html" id="app-model">
-    <form id="app-form" lay-filter="app-form" class="layui-form model-form">
-        <input name="id" type="hidden"/>
-        <div class="layui-form-item">
-            <label class="layui-form-label">记录标题</label>
-            <div class="layui-input-block">
-                <input name="recordTitle" disabled="true" type="text" class="layui-input" maxlength="20"
-                       lay-verify="required" required/>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">操作人姓名</label>
-            <div class="layui-input-block">
-                <input name="userName" disabled="true" placeholder="请输入应用名称" type="text" class="layui-input" maxlength="20"/>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">应用名称</label>
-            <div class="layui-input-block">
-                <input name="appName" disabled="true" type="text" class="layui-input" maxlength="20"
-                       lay-verify="required" required />
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">ip</label>
-            <div class="layui-input-block">
-                <input name="recordIp" disabled="true" type="text" class="layui-input" maxlength="20"/>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">业务操作记录</label>
-            <div class="layui-input-block">
-                <input name="recordDetail" disabled="true" type="text" class="layui-input" maxlength="20"/>
-            </div>
-        </div>
-        <div class="layui-form-item model-form-footer">
-            <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">确定</button>
-        </div>
-    </form>
+<!-- 表格状态列 -->
+<script type="text/html" id="hospital-tpl-state">
+    <input type="checkbox" lay-filter="hospital-tpl-state" value="{{d.hospitalId}}" value2="{{d.departmentId}}"
+        lay-skin="switch" lay-text="启用|禁用" {{d.enabled==true?'checked':''}} />
 </script>
-
-
+<!-- 套餐详情 -->
+<script type="text/html" id="productDetail">
+    <table class="layui-table" id="productDetail-table" lay-filter="productDetail-table"></table>
+</script>
 <script>
-    layui.use(['form', 'table', 'laydate', 'util', 'config', 'admin'], function () {
+    layui.use(['form', 'table', 'laydate', 'util', 'config', 'admin', 'autocomplete', 'area'], function () {
         var form = layui.form;
         var table = layui.table;
         var config = layui.config;
         var layer = layui.layer;
         var util = layui.util;
         var admin = layui.admin;
-
-        // 获取应用列表
-        // layer.load(2);
-        admin.req('api-user/users/findAll', {}, function (data) {
-            layer.closeAll('loading');
-            if (0 === data.code) {
-                let selected = false;
-                clientsAll = data.data;
-                $.each(data.data, function (index, item) {
-                    if (config.clientId === item.clientId) {
-                        selected = true;
-                    } else {
-                        selected = false;
-                    }
-                    //往下拉菜单里添加元素
-                    $('#role_clients').append(new Option(item.username, item.id, false, selected));
-                })
-                form.render();
-            } else {
-                layer.msg(data.msg, { icon: 2, time: 500 });
-            }
-        }, 'Post');
-
-        //时间格式
-        var laydate = layui.laydate;
-        //执行一个laydate实例
-        laydate.render({
-            elem: '#test1' //指定元素
-        });
-        laydate.render({
-            elem: '#test2' //指定元素
-        });
+        var area = layui.area;
 
         // 渲染表格
         table.render({
-            elem: '#app-table',
+            elem: '#hospital-table',
             url: config.base_server + 'api-user/syshospital',
             method: 'GET',
-            headers: { 'Authorization': 'Bearer ' + config.getToken().access_token },
+            headers: {
+                'Authorization': 'Bearer ' + config.getToken().access_token
+            },
             page: true,
-            cols: [[
-                { type: 'numbers' },
-                { field: 'hospitalName', width: 180, sort: true, title: '医院名称' },
-                { field: 'hospitalTypeName', width: 200, sort: true, title: '科室' },
-                { field: 'serverUserName', width: 180, sort: true, title: '联系人' },
-                { field: 'hospitalTel', width: 300, sort: true, title: '联系方式' },
-                { field: 'time', width: 300, sort: true, title: '服务到期时间' },
-                { field: 'enabled', width: 300, sort: true, title: '状态' ,templet:function (d) {
-                        return d.hospitalState==0?"试用":"正式"
-                    }},
-                { field: 'isScreen', width: 300, sort: true, title: '筛查',templet:function (d) {
-                        return d.isScreen?"是":"否"
-                    } },
-                { field: 'createTime', width: 300, sort: true, title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd')}}</div>" },
-                { field: 'id', width: 250, align: 'center', toolbar: '#businessRecords-table-bar', sort: true, title: '操作' },// 0就诊数据 1筛查
-            ]]
+            cols: [
+                [
+                   
+                    {
+                        field: 'hospitalName',
+                        width: "10%",
+                        title: '医院名称',
+                        fixed: 'left'
+                    },
+                    {
+                        field: 'departmentName',
+                        width: "6%",
+                        title: '科室/部门',
+                        fixed: 'left'
+                    },
+                    {
+                        field: 'hospitalId',width: '12%',title: '医院编号',
+                    },
+                    {
+                        field: 'hospitalArea',
+                        width: "10%",
+                        title: '所在地区',
+                        templet: function (d) {
+                            return ((d.hospitalProvince == null) ? "" : d.hospitalProvince) +
+                                " " +
+                                ((d.hospitalCity == null) ? "" : d.hospitalCity) + " " +
+                                ((d.hospitalArea == null) ? "" : d.hospitalArea)
+                        }
+                    },
+                    {
+                        field: 'hospitalLink',
+                        width: "7%",
+                        title: '联系人'
+                    },
+                    {
+                        field: 'hospitalTel',
+                        width: "8%",
+                        title: '联系方式'
+                    },
+                    {
+                        field: 'departmentLink',
+                        width: "6%",
+                        title: '科室联系人'
+                    },
+                    {
+                        field: 'departmentTel',
+                        width: "8%",
+                        title: '科室联系方式'
+                    },
+                    {
+                        field: 'orderType', width: 80,  title: '状态', templet: function (d) {
+                            if(d.orderType==null){
+                                return "";
+                            }
+                            return d.orderType ? "正式" : "试用"
+                        }
+                    },
+                    {
+                        field: 'isScreen',
+                        width: "4%",
+                        title: '筛查',
+                        templet: function (d) {
+                            return d.isScreen ? "是" : "否"
+                        }
+                    },
+                    // { field: 'isAnswer', width: 80,  title: '医答',templet:function (d) {
+                    //     return d.isScreen?"是":"否"
+                    // } },
+                    {
+                        field: 'serverUserName',
+                        width: "6%",
+                        title: '服务人员'
+                    },
+                    {
+                        field: 'createTime',
+                        width: "10%",
+                        title: '创建时间',
+                        templet: function (d) {
+                            return new Date(d.createTime).dateFormat("yyyy-MM-dd hh:mm");
+                        }
+                    },
+                    {
+                        field: 'enabled',
+                        width: "7%",
+                        templet: '#hospital-tpl-state',
+                        title: '状态',
+                        align: 'center',
+                        fixed: 'right'
+                    },
+                    {
+                        // field: 'hospitalId',
+                        width: "20%",
+                        align: 'center',
+                        toolbar: '#businessRecords-table-bar',
+                        title: '操作',
+                        fixed: 'right'
+                    }
+                ]
+            ],
+            done: function (res) {
+                permissionsInput(res, config);
+            }
         });
-
+        //省份数据加载
+        area.areaData("#province", 1, "", "");
         // 工具条点击事件
-        table.on('tool(app-table)', function (obj) {
+        table.on('tool(hospital-table)', function (obj) {
             var data = obj.data;
             var layEvent = obj.event;
-            if (layEvent === 'detail') { // 查看详情
-                showEditModel(data);
+            if (layEvent === 'del') {
+                layer.confirm('确定要删除科室数据吗?', function (i) {
+                    layer.load(2);
+                    var whereModel = {
+                        id: obj.data.hospitalId,
+                        departmentId: obj.data.departmentId
+                    };
+                    admin.req('api-user/syshospital/delete', whereModel, function (data) {
+                        layer.closeAll('loading');
+                        layer.msg(data.msg, {
+                            icon: 1,
+                            time: 2000
+                        }, function () {
+                            $('#hospita-btn-search').click();
+                        });
+                        obj.del();
+                    }, 'GET');
+                });
+            } else if (layEvent === "edit") {
+                //修改
+                admin.putTempData("t_hospital", data);
+                showEditModel("edit");
+            } else if (layEvent === "pay") {
+                //充值
+                admin.putTempData("t_hospital", data);
+                admin.popupCenter({
+                    title: '医院科室充值',
+                    path: 'pages/opration/recharge.html',
+                    area: '1200px',
+                    offset: '0px',
+                    finish: function () {
+                        $('#hospita-btn-search').click();
+                    }
+                });
+            }
+            else if(layEvent==="productdetail-List")
+            {
+                productdetailShow(obj);
+            }
+            else if (layEvent === "userpay") {
+                //充值
+                admin.putTempData("t_hospital", data);
+                admin.popupCenter({
+                    title: '单次支付功能',
+                    path: 'pages/opration/hospital_pay.html',
+                    area: '500px',
+                    offset: '50px',
+                    finish: function () {
+                        $('#hospita-btn-search').click();
+                    }
+                });
+            } else if(layEvent=="health"){
+                //运动处方服务
+                admin.putTempData("t_hospital", data);
+                admin.popupCenter({
+                    title: '运动处方服务',
+                    path: 'pages/opration/hospital_health.html',
+                    area: '500px',
+                    offset: '50px',
+                    finish: function () {
+                        $('#hospita-btn-search').click();
+                    }
+                });
             }
         });
-
         // 搜索按钮点击事件
-        $('#app-btn-search').click(function () {
-            var userId = $('#role_clients').val();
-            var key = $('#app-edit-search').val();
-            var startTime = $('#test1').val();
-            var endTime = $('#test2').val();
-            if (startTime != null && endTime != null) {
-                var flag = compareDate(startTime, endTime);
-                if (!flag) {
-                    layer.msg('结束时间不得小于开始时间');
-                    return;
-                }
-            }
+        $('#hospita-btn-search').click(function () {
+            var isscreen = $('#isscreen').val();
+            var isanswer = $('#isanswer').val();
+            var ispay = $('#ispay').val();
+            var hospitalstate = $('#hospitalstate').val();
+            var hospitalName = $('#hosName').val();
 
-            table.reload('app-table', { where: { recordTitle: key, startTime: startTime, endTime: endTime, userId: userId } });
-        });
-        //比较日期大小
-        function compareDate(logintime, logouttime) {
-            var arys1 = new Array();
-            var arys2 = new Array();
-            if (logintime != null && logouttime != null) {
-                arys1 = logintime.split('-');
-                var logindate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]);
-                arys2 = logouttime.split('-');
-                var logoutdate = new Date(arys2[0], parseInt(arys2[1] - 1), arys2[2]);
-                if (logindate > logoutdate) {
-                    return false;
-                } else {
-                    return true;
+            var hospitalProvince = ($("#province").val() != "") ? $('#province option:selected')
+            .text() : "";
+            var hospitalCity = ($("#city").val() != "") ? $('#city option:selected').text() : "";
+            var hospitalArea = ($("#areas").val() != "") ? $('#areas option:selected').text() : "";
+
+            var whereModel = {
+                isScreen: isscreen,
+                isAnswer: isanswer,
+                isPay: ispay,
+                hospitalState: hospitalstate,
+                hospitalName: hospitalName,
+                hospitalProvince: hospitalProvince,
+                hospitalCity: hospitalCity,
+                hospitalArea: hospitalArea,
+                // page: 1,
+            };
+            table.reload('hospital-table', {
+                where: whereModel,
+                page: {
+                    curr: 1 
                 }
-            }
-        }
-        // 导出
-        $('#app-btn-export').click(function () {
-            var url = config.base_server + 'api-user/dataneed/export';
-            var xhr = new XMLHttpRequest();
-            xhr.open('POST', url, true);
-            xhr.responseType = "blob";
-            xhr.setRequestHeader("client_type", "DESKTOP_WEB");
-            xhr.setRequestHeader("Authorization", "Bearer " + config.getToken().access_token);
-            xhr.onload = function () {
-                if (this.status == 200) {
-                    var fileName = "user.xlsx";
-                    var blob = this.response;
-                    var a = document.createElement('a');
-                    a.innerHTML = fileName;
-                    // 指定生成的文件名
-                    a.download = fileName;
-                    a.href = URL.createObjectURL(blob);
-                    document.body.appendChild(a);
-                    var evt = document.createEvent("MouseEvents");
-                    evt.initEvent("click", false, false);
-                    a.dispatchEvent(evt);
-                    document.body.removeChild(a);
-                }
-            }
-            xhr.send();
+            });
         });
 
         // // 显示编辑弹窗
         var showEditModel = function (data) {
+            admin.popupCenter({
+                title: (strUtil.isEmpty(data)) ? '添加医院/科室' : '编辑医院/科室',
+                path: 'pages/opration/hospital_form_base.html',
+                area: '900px',
+                    offset: '0px',
+                finish: function () {
+                    $('#hospita-btn-search').click();
+                }
+            });
+        };
+
+        //装载市区数据
+        form.on("select(province)", function (data) {
+            area.areasClear("#areas", 3);
+            area.areaData("#city", 2, data.value, "");
+        });
+
+        //装载区县数据
+        form.on("select(city)", function (data) {
+            area.areaData("#areas", 3, data.value, "");
+        });
+        // 修改状态
+        form.on('switch(hospital-tpl-state)', function (obj) {
+            layer.load(2);
+            admin.req('api-user/syshospital/updateEnabled', {
+                id: obj.elem.value,
+                departmentId: obj.elem.getAttribute("value2"),
+                enabled: obj.elem.checked ? true : false
+            }, function (data) {
+                layer.closeAll('loading');
+                if (data.code == 0) {
+                    layer.msg(data.msg, {
+                        icon: 1,
+                        time: 2000
+                    });
+                } else {
+                    layer.msg(data.msg, {
+                        icon: 2,
+                        time: 2000
+                    });
+                    $(obj.elem).prop('checked', !obj.elem.checked);
+                    form.render('checkbox');
+                }
+            }, 'GET');
+        });
+        // 添加按钮点击事件
+        $('#hospital-btn-add').click(function () {
+            admin.putTempData("t_hospital", "");
+            showEditModel();
+        });
+        // 套餐按钮点击事件
+        var productdetailShow=function (obj) {
+            var data = obj.data;
             layer.open({
                 type: 1,
-                title: '查看详情',
-                area: '450px',
-                offset: '120px',
-                content: $('#app-model').html(),
+                title: data.hospitalName + '-' + data.departmentName + ' 所有套餐',
+                area: '1200px',
+                offset: '100px',
+                content: $('#productDetail').html(),
                 success: function () {
-                    $('#app-form')[0].reset();
-                    $('#app-form').attr('method', 'POST');
-                    if (data) {
-                        $("input[name='clientId']").attr('disabled', true);
-                        $("input[name='clientId']").attr('class', "layui-input layui-disabled");
-                        $("input[name='webServerRedirectUri']").attr('disabled', true);
-                        $("input[name='webServerRedirectUri']").attr('class', "layui-input layui-disabled");
-                        form.val('app-form', data);
-                        // $('#app-form').attr('method', 'POST');
-                    }
+                    table.render({
+                        elem: '#productDetail-table',
+                        url: config.base_server +
+                            'api-opration/productorderdetail/alldetail',
+                        method: 'GET',
+                        where: {
+                            'hospitalId': data.hospitalId,
+                            'departmentId': data.departmentId,
+                            'enabled': true
+                        },
+                        headers: {
+                            'Authorization': 'Bearer ' + config.getToken().access_token
+                        },
+                        page: true,
+                        limit: 10,
+                        limits: [5, 10],
+                        cols: [
+                            [{
+                                    field: 'proName',
+                                    width: 300,
+                                    title: '产品名称'
+                                },
+                                {
+                                    field: 'ailightCount',
+                                    width: 150,
+                                    title: '读片量(剩余)'
+                                },
+                                {
+                                    field: 'ailightCount',
+                                    width: 150,
+                                    title: '读片使用量',
+                                    templet: function (d) {
+                                        return d.orderAilightCount-d.ailightCount;
+                                    }
+                                },
+                                {
+                                    field: 'recordCount',
+                                    width: 150,
+                                    title: '报告量(剩余)'
+                                },
+                                {
+                                    field: 'isShare',
+                                    width: 100,
+                                    title: '是否共享',
+                                    templet: function (d) {
+                                        if (d.isShare)
+                                            return '共享'
+                                        else
+                                            return '私有'
+                                    }
+                                },
+                                {
+                                    field: 'proBegintime',
+                                    width: 150,
+                                    title: '开始时间',
+                                    templet: function (d) {
+                                        return new Date(d.proBegintime)
+                                            .dateFormat("yyyy/MM/dd hh:mm:ss");
+                                    }
+                                },
+                                {
+                                    field: 'proEndtime',
+                                    width: 180,
+                                    title: '结束时间',
+                                    templet: function (d) {
+                                        var dateTime=new Date(d.proEndtime);
+                                         dateTime=dateTime.setDate(dateTime.getDate()-1);
+                                        dateTime=new Date(dateTime);
+                                        return dateTime
+                                            .dateFormat("yyyy/MM/dd")+" 24:00:00";
+                                    }
+                                },
+                                {
+                                    field: 'createTime',
+                                    width: 160,
+                                    sort: true,
+                                    title: '创建时间'
+                                }
+                            ]
+                        ]
+                    });
                 }
             });
         };

--
Gitblit v1.8.0