<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %>
<%@ include file="/WEB-INF/jspf/confirmJsp.jspf" %>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>个人收藏</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv=X-UA-Compatible IE=EmulateIE7>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${path}/static/js/html5shiv.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/respond.min.js"></script>
    <![endif]-->
    <script>
        var path = "${path}";
    </script>
    <style type="text/css">
        /**搜索区*/
        .mainDiv{
            background-color: #fff;
        }
        .searchDiv{
            padding-top:5px;
            height:30px;
        }
        .searchDiv1{
            margin-top: 10px;
            margin-left: 14px;
            height:30px;
        }
        /**查询按钮组*/
        .btnsDiv{
            height:30px;
            text-align: right;
            padding-top:5px;
            margin-right: 25px;
        }
        .btns{
            margin-left: 1%;
        }
        .typeBtn{
            margin-left: 10%;
        }
        .dateSearchDiv{
            width:40%;
        }
        .dateSearchInput{
            width:37%;
            margin-left:3%;
        }
        .dateLabelDiv{
            width: 20%;
            text-align: right;
        }
        /*搜索区域*/
        .searchInput{
            width:250px;
        }
        /*搜索区域labelDiv*/
        .searchElement{
            width: 31%;
        }
        /*搜索区域inputDiv*/
        .searchInputElement{
            width: 69%;
        }
        .labelDiv{
            padding-top:4%;
            margin-left: 2%;
        }
        /**搜索按钮div*/
        .searchBtnDiv{
            float:left;
            margin-left: 20px;
            height:15px;
        }
        #tableDiv{
            margin-left:15px;
        }
        /***模态1*/
        .line1{
            float:left;
            width:1px;
            height:100%;
            background: darkgray;
        }
        .addTypeDiv{
            margin:2%;
        }
        .typeDiv{
            margin-top:15%;
        }
        .typeDiv1{
            padding-top:13%;
        }
        .typeLabelDiv{
            text-align: right;
            width:30%;
        }
        .typeInputDiv{
            width:50%;
        }
        .typeBtnDiv{
            padding-top: 17%;
            padding-left: 38%;
        }
        .collectDiv{
            margin-top:1%;
        }
        /**级联病案号内容*/
        .mouseOver{
            background-color: #708090;
            color:#FFFAFA;
        }
        .mouseOut{
            background-color: #FFFAFA;
            color:#000000;
        }
        /*模态框头*/
        .modal-header{
            background-color: #199ED8;
            text-align: center;
        }
    </style>
</head>
<body>
<input type="hidden" id="roleId" value="${CURRENT_USER.roleId}">
<input type="hidden" id="checks">
<div class="main">
    <div class="headDiv">
        <div class="headSpanDiv">
            <span class="headspan">
                个人收藏
            </span>
        </div>
    </div>
    <div class="mainDiv">
        <!--搜索区-->
        <div class="searchDiv">
            <div class="searchInput left" style="margin-left: 13px;">
                <div class="searchElement left">
                    <label class="labelDiv">收藏人：</label>
                </div>
                <div class="searchInputElement left">
                    <input type="text" class="form-control input-sm" id="creater" maxlength="16">
                </div>
            </div>
            <div class="dateSearchDiv left">
                <div class="dateLabelDiv left">
                    <label class="labelDiv">收藏日期：</label>
                </div>
                <div class="dateSearchInput left">
                    <input type="text" class="form-control input-sm" id="startTime1" placeholder="开始时间" maxlength="10" autocomplete="off">
                </div>
                <div class="dateSearchInput left">
                    <input type="text" class="form-control input-sm" id="endTime1" placeholder="结束时间" maxlength="10" autocomplete="off">
                </div>
            </div>
            <div class="searchInput left">
                <div class="searchElement left">
                    <label class="labelDiv">病案号：</label>
                </div>
                <div class="searchInputElement left">
                    <input type="text" class="form-control input-sm" id="inpatientNoSearch" maxlength="16">
                </div>
            </div>
        </div>
        <div class="searchDiv1">
            <div class="searchInput left">
                <div class="searchElement left">
                    <label class="labelDiv">患者姓名：</label>
                </div>
                <div class="searchInputElement left">
                    <input type="text" class="form-control input-sm" id="searchName" maxlength="16">
                </div>
            </div>
            <div class="searchInput left">
                <div class="searchElement left">
                    <label class="labelDiv">住院次数：</label>
                </div>
                <div class="searchInputElement left">
                    <input type="number" class="form-control input-sm" min="1" id="admissTimesSearch" oninput="if(value.length>4)value=value.slice(0,4)">
                </div>
            </div>
            <div class="searchInput left" style="margin-left: 13px">
                <div class="searchElement left">
                    <label class="labelDiv">收藏类别：</label>
                </div>
                <div class="searchInputElement left">
                    <select class="form-control input-sm" id="collectType">
                        <option value="">请选择</option>
                        <c:forEach items="${collectTypes}" var="collectType">
                            <option value="${collectType.id}">${collectType.collectTypeName}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="searchBtnDiv">
                <button type="button" class="btn btn-sm btn-primary" onclick="refreshTable()">查询</button>
            </div>
        </div>
        <!--数据表格-->
        <div class="btnsDiv">
            <shiro:hasPermission name="/collect/addCollectType">
                <button type="button" class="btn btn-sm btn-info btns"  data-toggle="modal" data-target="#myModal1">收藏类别</button>
            </shiro:hasPermission>
            <shiro:hasPermission name="/collect/addCollect">
                <button type="button" class="btn btn-sm btn-warning btns" onclick="addCollect()" data-toggle="modal" data-target="#myModal2">  +  增加</button>
            </shiro:hasPermission>
            <shiro:hasPermission name="/collect/exportExcel">
                <button type="button" class="btn btn-sm btn-primary btns" onclick="exportExcel()"><i class="fa fa-reply"></i>导出</button>
            </shiro:hasPermission>
        </div>
        <div id="tableDiv" class="tableDiv">
            <table id="mytab" class="table text-nowrap table-bordered">
            </table>
        </div>
    </div>
</div>
<!-- 模态框1（Modal）收藏类别 -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <input type="hidden" id="currentTypeId">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <font size="30">&times;</font>
                </button>
                <h4 class="modal-title" style="font-weight: bold">
                    收藏类别信息
                </h4>
            </div>
            <div class="modal-body" style="height:500px">
                <div class="treeDiv left"  style="width:29%;height:100%">
                    <input type="text" id="key" value="" class="form-control input-sm"
                           placeholder="类别名称" style="width:90%"/><br/>
                    <div class="zTreeDemo">
                        <ul id="ztree" class="ztree"></ul>
                    </div>
                </div>
                <div class="line1"></div>
                <div class="contentDiv left" style="width:70%;height:100%">
                    <div class="addTypeDiv">
                        <button type="button" class="btn btn-sm btn-primary right" onclick="resetCollectType()">添加</button>
                    </div>
                    <form id="form1">
                        <div id="collectTypeDiv" style="display: none">
                            <input type="hidden" name="formToken" id="formToken">
                            <input type="hidden" id="collectTypeId" name="id">
                            <input type="hidden" value="0" name="parentId">
                            <div class="typeDiv">
                                <div class="typeLabelDiv left">
                                    <label class="labelDiv">类别标志：</label>
                                </div>
                                <div class="typeInputDiv left">
                                    <input type="text" class="form-control input-sm" name="collectTypeFlag" id="collectTypeFlag" maxlength="25">
                                </div>
                            </div>
                            <div class="typeDiv1">
                                <div class="typeLabelDiv left">
                                    <label class="labelDiv">类别名称：</label>
                                </div>
                                <div class="typeInputDiv left">
                                    <input type="text" class="form-control input-sm" name="collectTypeName" id="collectTypeName" maxlength="25">
                                </div>
                            </div>
                            <div class="typeBtnDiv">
                                <shiro:hasPermission name="/collect/addCollectType">
                                    <button type="button" class="btn btn-sm btn-primary left typeBtn" onclick="saveCollectType()">保存</button>
                                </shiro:hasPermission>
                                <shiro:hasPermission name="/collect/deleteCollectType">
                                    <button type="button" class="btn btn-sm btn-danger left typeBtn" onclick="deleteCollectType()">删除</button>
                                </shiro:hasPermission>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 模态框2（Modal）添加收藏 -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabe2" aria-hidden="true">
    <div class="modal-dialog" id="modalDialog2">
        <div class="modal-content" style="width:80%">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <font size="30">&times;</font>
                </button>
                <h4 class="modal-title" style="font-weight: bold">
                    收藏内容
                </h4>
            </div>
            <div class="modal-body" style="height:490px">
                <form class="form-horizontal" id="form2">
                    <input type="hidden" name="formToken" id="formToken1">
                    <input type="hidden" id="collectId" name="id">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">标题：</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control input-sm input" name="title" id="title" maxlength="25">
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">收藏时间：</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control input-sm  input" readonly name="collectTime" id="collectTime">
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">收藏类别：</label>
                            <div class="col-sm-7">
                                <select class="form-control input-sm input" id="parentId" name="parentId">
                                    <c:forEach items="${collectTypes}" var="collectType">
                                        <option value="${collectType.id}">${collectType.collectTypeName}</option>
                                    </c:forEach>
                                </select>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">内容：</label>
                            <div class="col-sm-7">
                                <textarea class="form-control input-sm input" id="content" name="content" maxlength="250"></textarea>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <shiro:hasPermission name="/collect/addCollect">
                            <button type="button" class="btn btn-sm btn-primary typeBtn" onclick="saveCollect()">保存</button>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="/collect/deleteCollect">
                            <button type="button" class="btn btn-sm btn-default typeBtn" onclick="clearCollect()">清空</button>
                        </shiro:hasPermission>
                    </div>
                    <div class="row collectDiv">
                        <div class="form-group">
                            <label class="col-sm-4 control-label collectLabel">病案号：</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control input-sm  input" name="inpatientNo" id="inpatientNo" onkeyup="getInpatientNoContents('inpatientNo')" onfocus="getInpatientNoContents('inpatientNo')" onblur="clearContent('inpatientNo')" maxlength="16">
                                <div id="inpatientNoDiv">
                                    <table id="inpatientNoContent_table" bgcolor="#FFFAFA" border="0"
                                           cellspacing="0" cellpadding="0">
                                        <tbody id="inpatientNoContent"> </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row collectDiv">
                        <div class="form-group">
                            <label class="col-sm-4 control-label collectLabel">患者姓名：</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control input-sm  input" name="name" id="name" onkeyup="getNameContents('name')" onfocus="getNameContents('name')" onblur="clearContent('name')" maxlength="16">
                                <div id="nameDiv">
                                    <table id="nameContent_table" bgcolor="#FFFAFA" border="0"
                                           cellspacing="0" cellpadding="0">
                                        <tbody id="nameContent"> </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row collectDiv">
                        <div class="form-group">
                            <label class="col-sm-4 control-label collectLabel">住院次数：</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control input-sm  input" min="1" name="admissTimes" id="admissTimes" oninput="if(value.length>4)value=value.slice(0,4)">
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label collectLabel">出院日期：</label>
                            <div class="col-sm-7">
                                <div class="col-sm-5" style="padding: 0!important"><input type="text" class="form-control input-sm input" id="startTime2" name="startTime2" autocomplete="off"></div>
                                <div class="col-sm-1">-</div>
                                <div class="col-sm-5" style="padding: 0!important"><input type="text" class="form-control input-sm input"  id="endTime2" name="endTime2" autocomplete="off"></div>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                </form>
                <div style="text-align: center;" id="approveDiv">
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 模态框3（Modal）申请借阅 -->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <font size="30">&times;</font>
                </button>
                <h4 class="modal-title">
                    申请信息
                </h4>
            </div>
            <div class="modal-body">
                <!--通过审批且未过期的patientId集合-->
                <form class="form-horizontal" id="form3">
                    <input type="hidden" id="inpatientNo1" name="inpatientNo">
                    <input type="hidden" name="formToken" id="formToken2">
                    <input type="hidden" id="patientId" name="patientId">
                    <input type="hidden" id="applyState" name="applyState">
                    <input type="hidden" id="approveId" name="id">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">有效时间：</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control input" id="effeTime" name="effeTime" maxlength="10" autocomplete="off">
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">申请天数：</label>
                            <div class="col-sm-7">
                                <input type="number" class="form-control input" id="effeDays" name="effeDays" oninput="if(value.length>3)value=value.slice(0,3)">
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">申请类型：</label>
                            <div class="col-sm-7">
                                <select class="form-control input" name="applyType" id="applyType"></select>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">申请理由：</label>
                            <div class="col-sm-7">
                                <textarea class="form-control input" id="applyReason" name="applyReason" maxlength="250"></textarea>
                            </div>
                            <div class="col-sm-1"></div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
                <button type="button" class="btn btn-primary" onclick="save()">
                    暂时保存
                </button>
                <button type="button" class="btn btn-primary" onclick="add()">
                    确认提交
                </button>
            </div>
        </div>
    </div>
</div>
<script>
    $(function(){
        $("td").click(function(event){
            //td中已经有了input,则不需要响应点击事件
            if($(this).children("input").length > 0)
                return false;
            var tdObj = $(this);
            var preText = tdObj.html();
            //得到当前文本内容
            var inputObj = $("<input type='text' />");
            //创建一个文本框元素
            tdObj.html(""); //清空td中的所有元素
            inputObj
                .width(tdObj.width())
                //设置文本框宽度与td相同
                .height(tdObj.height())
                .css({border:"0px",fontSize:"17px",font:"宋体"})
                .val(preText)
                .appendTo(tdObj)
                //把创建的文本框插入到tdObj子节点的最后
                .trigger("focus")
                //用trigger方法触发事件
                .trigger("select");
            inputObj.keyup(function(event){
                if(13 == event.which)
                //用户按下回车
                {
                    var text = $(this).val();
                    tdObj.html(text);
                }
                else if(27 == event.which)
                //ESC键
                {
                    tdObj.html(preText);
                }
            });
            //已进入编辑状态后，不再处理click事件
            inputObj.click(function(){
                return false;
            });
        });
    });
</script>
<script src="${path}/static/js/approveManage/collection/collectManage174.js?t=2022-01-14"></script>
<script src="${path}/static/js/approveManage/approveList/approveDateCommmomMethod.js"></script>
<script src="${path}/static/js/approveManage/approveList/approveSaveCommomMethodBlood.js"></script>
<script src="${path}/static/js/dateUtil.js"></script>
</body>
</html>
