<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>患者信息页</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body>
<!--<body background="/static/layui/患者.jpg" style=" background-repeat:no-repeat ;background-size:100% 100%;
background-attachment: fixed;">-->
<div align="center">
    <br>
    <a href="start">返回导航页</a>
    <p><font size="5" face="arial" color="red">患者相关信息</font></p>
    <br>
    <br>
    <table id='tabledemo' lay-filter="test">
        <thead>
        <tr>
            <th lay-data="{field:'shenfenzhenghao', width:100}">身份证号</th>
            <th lay-data="{field:'xingming', width:100}">姓名</th>
            <th lay-data="{field:'xingbie', width:80, sort:true}">性别</th>
            <th lay-data="{field:'nianling', width:80, sort:true}">年龄</th>
            <th lay-data="{field:'jiguan', width:80, sort:true}">籍贯</th>
            <th lay-data="{field:'huanzhehao', width:80, sort:true}">患者号</th>
            <th lay-data="{field:'fangjianweizhi', width:80, sort:true}">房间位置</th>
            <th lay-data="{field:'ruyuanshijian', width:80, sort:true}">入院时间</th>
            <th lay-data="{field:'jiashulianxitianhua', width:80, sort:true}">家属联系方式</th>
            <th lay-data="{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo'}">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for item in huanzhe_list %}
            <tr>
                <td>{{ item.shenfenzhenghao }}</td>
                <td>{{ item.xingming  }}</td>
                <td>{{ item.xingbie }}</td>
                <td>{{ item.nianling }}</td>
                <td>{{ item.jiguan  }}</td>
                <td>{{ item.huanzhehao }}</td>
                <td>{{ item.fangjianweizhi }}</td>
                <td>{{ item.ruyuanshijian  }}</td>
                <td>{{ item.jiashulianxitianhua }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="add">添加</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>


<script src="/static/layui/layui.js"></script>
<script>

    layui.use('table', function () {
        var table = layui.table;

//转换静态表格
        table.init('test', {
            height: 1000,
            width: 600//设置高度
            , limit: 100
        });
        table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            var data = obj.data //获得当前行数据
                , layEvent = obj.event; //获得 lay-event 对应的值
            if (layEvent === 'detail') {
                layer.msg('查看操作');
            } else if (layEvent === 'del') {
                layer.confirm('真的删除行么', function (index) {
                    location.href = '/delete_gen?type=huanzhe&id=' + data.shenfenzhenghao;
                });
            } else if (layEvent === 'edit') {
                location.href = '/update_gen?type=huanzhe&id=' + data.shenfenzhenghao;
            } else if (layEvent === 'add') {
                location.href = '/insert_device?type=huanzhe&id=' + data.shenfenzhenghao ;
            }
        });
    });
    //监听行工具事件


</script>
</body>
</html>