﻿﻿﻿﻿
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<html>
<head>
    <title>在院浏览</title>
    <meta http-equiv="Content-Type"  content="text/html;charset=utf-8">
    <%--<meta name="referrer" content="no-referrer">--%>
    <%--<meta name="referrer" content="never">--%>
    <!-- 解决部分兼容性问题，如果安装了GCF，则使用GCF来渲染页面，如果未安装GCF，则使用最高版本的IE内核进行渲染。 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <!-- 页面按原比例显示 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <%@include file="../../jspf/comm.jspf" %>
    <%@ include file="../../jspf/ztreeCommom.jsp" %>
    <style>
        .modal-header2 {
            height: 30px;
            text-align: center !important;
            vertical-align: middle !important;
            background-color: #3c8dbc !important;
            color: #fff;
            font-size: 16px;
            font-weight: bold;
            padding: 5px 5px 5px 5px !important;
        }

        .modal-footer {
            padding: 5px;
        }

        .divCss {
            margin-top: 5px;
        }

        .divCss2 {
            margin-top: 5px;
            margin-left: 20px;
        }

        .divCss8 {
            margin-top: 5px;
            margin-right: 20px;
        }

        .divCss3 {
            margin-top: -10px;
            margin-left: 20px;
            color: blue;
        }

        .modal-content {
            width: calc(210%); /*width: 1300px;*/
            overflow-x: hidden;
            overflow-y: auto;
        }



        .modal {
            margin-left: -45%;
            overflow-x: auto;
            /*z-index: 1049;*/
        }

        .divCss4 {
            border-top: 1px solid #e5e5e5;
            width: 97.5%;
            margin-top: 10px;
            margin-bottom: 5px;
        }

        .labCss {
            /*color: gainsboro;*/
            color: #c1c3c4;
        }

        .titleCss {
            text-align: left;
            vertical-align: middle;
            background-color: #3c8dbc;
            color: #fff;
            font-size: 19px;
            font-weight: bold;
            height: 30px;
            margin-bottom: 10px;
        }

        .treeBtn1 {
            margin-top: 10px;
            margin-right: 10px;
            width: 42%;
        }

        .treeBtn {
            margin-top: 10px;
            margin-left: 10px;
            margin-right: 10px;
            width: 42%;
        }

        .zTreeDemo {
            height: auto;
            min-height: 350px;
            margin-left: -10px;
        }

        #ztree{
            overflow-x: hidden;
            overflow-y: auto;
            max-height: calc(60vh );
        !important;
        }

        .divCss5 {
            border-left: 2px solid #e5e5e5;
            height: auto;
            min-height: 350px;
        }

        .btnGroupCss {
            text-align: right;
        }

        /* dataTables表头居中 */
        .table > thead:first-child > tr:first-child > th {
            text-align: center !important;
        }

        #assortModal > div > div {
            margin-top: 30%;
            margin-left: 60%;
            width: 500px;
        !important;
        }

       /* #selModal{
            width: calc(210%); !*margin-left:-15%;*!
            height: calc(100vh - 90px);
            overflow: hidden;
             //height: $(window).height() -300,//自定义高度,     //定义表格的高度。
        }

        #selModal .modal-content {
            scroll-y:hidden;
            scroll-x:auto;
        }*/


        #delPdfModal > div > div {
            margin-top: 30%;
            margin-left: 60%;
            width: 400px;
        !important;
        }

        #tsPdfModal > div > div {
            margin-top: 40%;
            margin-left: 70%;
            width: 400px;
        !important;
        }

        #exampleModal > div > div {
            margin-top: 30%;
            margin-left: 70%;
            width: 400px;
        !important;
        }

        .imgDivCss {
            min-height: 400px !important;
        }

        .showImg {
            width: 100%;
            /*height: 100%*/
        }

        .shadeImg {
            height: 100%;
        }

        #delPdfPageModal .modal-header2 {
            width: calc(210%); /*margin-left:-15%;*/
        }

        #delPdfPageModal .modal-content {
            width: calc(210%); /*margin-left:-15%;*/
            height: calc(100vh - 90px);
            overflow: hidden;
        !important;
        }

        #delPdfPageModal2 > div > div {
            margin-top: 20%;
            margin-left: 60%;
            width: 400px;
        !important;
        }

        #maxImg > div > div {
            width: calc(210%);
        }

        #delImgPageModal > div > div {
            width: 400px;
            margin-left: 55%;
            margin-top: 20%;
        }

        /*#delPdfPageModal{
            width: 120%;
        !important;
        }*/

        .img_div{
            overflow-y:auto; overflow-x:hidden; height:calc(75vh);
        !important;
        }

        .img_div2{
            overflow-y:auto; overflow-x:hidden; height:calc(75vh);
        !important;
        }

        #imgDelPageModal .modal-content {
            margin-left: 5%;
            width: calc(200%); /*margin-left:-15%;*/
            height: calc(90vh );
            overflow:hidden;
        !important;
        }

        #mb {
            display: none;
            height: calc(100vh - 0px);
            width: 100%;
            /*position: fixed;*/
            position: absolute;
            z-index: 1200;
            /*height: 1380px;*/
            background: #FFF;
            top: 0;
            left: 0;
            opacity: 0.6;
        }

        #toolbar > div {
            margin-top: 0px;
        !important;
        }

        #arrow {
            color: #fff;
            background: #000;
            width: 20px;
            height: 90px;
            line-height: 90px;
            font-size: 12px;
            font-family: "宋体";
            text-align: center;
            font-weight: bold;
            float: left;
        }

        #infoDiv {
            width: 18%;
            height: 95%;
            float: right;
            overflow-y: hidden;
            overflow-x: hidden;
        !important;
        }

        #imglist {
            overflow-x: hidden;
            overflow-y: auto;
            height: calc(100vh - 37%);
        }

        #pdf_page {
            width: 100%;
            height: 82%;
        !important;
        }

        #mainDiv {
            margin-left: 30px;
            margin-right: 10px;
            height: auto;
        !important;
        }

        #deptDiv {
            height: 18px;
            margin-top: -7px;
        !important;
        }


        #pdfPathVal {
            width: 100%;
            background-color: #eee;
        !important;
        }

        #formInfo {
            margin-top: 20px;
        !important;
        }

        .toolbarCss {
            width:100%;
            margin-right: 20px;
            margin-bottom: 0px;
        !important;
        }

        .fixed-table-toolbar .bs-bars .pull-right {
            height: 20px;
        !important;
        }

        #toolbar2 > div {
            margin-bottom: -10px;
        !important;
        }

        #key {
            width: 70%;
        !important;
        }

        #searchBtn1 {
            width: 20%;
        !important;
        }

        #pathPdf {
            width: 85%;
        !important;
        }

        #flag {
            margin-left: 20px;
        !important;
        }

        #filesUpload {
            margin-top: 20px;
        !important;
        }

        #pdfDiv {
            width: 80%;
            float: left;
            height: calc(100vh - 0px);
        !important;
        }

        .maxBodyCss {
            height: 85%;
        !important;
        }

        /*.panel-primary > .panel-heading{*/
        /*background-color: #3c8dbc;*/
        /*border-color: #3c8dbc;e5e5e5*/
        /*}*/
        .showDelDiv {
            margin-left: 0px;
            border: 1px solid #e5e5e5;
            width: 90%;
            margin-bottom: 5px;
        }

        .showImg2 {
            margin-left: 2%;
            margin-bottom: 2px;
            width: 95%;
            height: 200px;
        }

        .returnPageCls {
            margin-right: 2px;
        }

        #addDelDiv {
            width: 86%;
            background-color: #0b93d5;
            text-align: center;
            color: red;
        }

        .pagePdfCss {
            max-width: 20%;
        }

        #delAllImgBtn {
            width: 35%;
        }

        #refreshBtn {
            height: 34px;
        !important;
        }

        #addPdfPageBtn {
            width: 40%;
        }

        /* #delImgPageModalCss{
             margin-top: 60%;
             width: 70%;
             margin-left: 30%;
         !important;
         } */

        #titleSearch{
            align:left;
            margin-left: 5px;
            height: 34px;
            width:300px;
        !important;
        }

        /*选中行颜色*/
        .fixed-table-container tbody .selected td {
            background-color: #9acfea;
        }
    </style>
</head>

<body>
<div id="mb"></div>
<%--<div class="panel panel-primary">--%>
<%--<div class="panel-heading">--%>
<%--<h3 class="panel-title">在院浏览</h3>--%>
<%--</div>--%>
<%--<div class="panel-body">--%>
<div id="mainDiv">
    <!--搜索-->
    <form id="formInfo" onkeydown="enter()">
        <div class="form-inline">
            <%--<div class="form-group divCss8">--%>
            <%--<label for="id">病案号:</label>--%>
            <%--<input type="text" class="input-sm form-control" id="id" placeholder="请输入病案号">--%>
            <%--</div>--%>
            <div class="form-group divCss8">
                <label for="inpNo">住院号:</label>
                <input type="text" class="input-sm form-control" id="inpNo" placeholder="请输入住院号">
            </div>
            <div class="form-group divCss8">
                <label for="visitId">住院次数:</label>
                <input type="number" class="input-sm form-control" id="visitId" placeholder="请输入次数">
            </div>
            <div class="form-group divCss8">
                <label for="name">姓名:</label>
                <input type="text" class="input-sm form-control" id="name" placeholder="请输入姓名">
            </div>
            <%--<div class="form-group divCss8">--%>
            <%--<label for="name">身份证号:</label>--%>
            <%--<input type="text" class="input-sm form-control" id="idNo" placeholder="请输入身份证号">--%>
            <%--</div>--%>
            <div class="form-group divCss8" id="deptDiv">
                <label>入院科室 :</label>
                <%--<select class="input-sm form-control" id="deptName">--%>
                <%--<option value="">全部</option>--%>
                <%--&lt;%&ndash;<option value="在院">在院</option>&ndash;%&gt;--%>
                <%--&lt;%&ndash;<option value="未归档">未归档</option>&ndash;%&gt;--%>
                <%--&lt;%&ndash;<option value="归档中">归档中</option>&ndash;%&gt;--%>
                <%--&lt;%&ndash;<option value="初审">初审</option>&ndash;%&gt;--%>
                <%--&lt;%&ndash;<option value="已认证">已认证</option>&ndash;%&gt;--%>
                <%--&lt;%&ndash;<option value="已归档">已归档</option>&ndash;%&gt;--%>
                <%--</select>--%>
                <select class="selectpicker bla bla bli" multiple data-live-search="true" name="deptName"
                        id="deptName" title="请输入入院科室" data-actions-box="true" data-deselect-all-text="取消全选" data-select-all-text="全选" data-none-results-text="没找到相应记录{0}">
                    <option value="">全部</option>
                 </select>
            </div>
            <div class="form-group divCss">
                <label>入院日期：</label>
                <div class="input-daterange input-group" id="datepicker">
                    <input type="text" class="input-sm form-control" name="start" id="startDateTo"/>
                    <span class="input-group-addon">-</span>
                    <input type="text" class="input-sm form-control" name="end" id="endDateTo"/>
                </div>
            </div>
            <button type="button" class="btn btn-primary btn-sm divCss" id="searchBtn">查询</button>
            <button type="button" class="btn btn-info btn-sm divCss" id="excelBtn">条件导出</button>
        </div>
    </form>
    <!--数据表格-->
    <table id="table" class="table  text-nowrap table-striped"></table>
    <div id="toolbar" class="btn-group pull-right toolbarCss">
        <div class="columns columns-right btn-group pull-right">
            <div class="btn-group btn-info">
                <select id="sel_exportoption" class="form-control">                
                    <option value="">导出当前页面数据</option>                                   
                    <option value="all">导出全部数据</option>                                 
                    <option value="selected">导出选中数据</option>
                </select>
            </div>
            <button class=" btn btn-success" type="button" id="refreshBtn" name="refresh"
                    aria-label="Refresh"
                    title="Refresh">
                <i class="glyphicon glyphicon-refresh icon-refresh"></i>
            </button>
        </div>
    </div>
</div>
<%--</div>--%>
<%--</div>--%>
<%--<div id="modal">--%>
<%--<div class="mask"></div>--%>
<%--<!-- 这里开始才是真正的内容 -->--%>
<%--<div class="dialog"></div>--%>
<%--</div>--%>
<!-- 模态框3（Modal）查看档案 -->
<div class="modal fade" id="selModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title">
                    病历清单
                </h4>
            </div>
            <div class="modal-body divCss2">
                <!--通过审批且未过期的patientId集合-->
                <form class="form-horizontal" id="form1">
                    <div class="row">
                        <div class="row divCss3">病历信息</div>
                        <div class="row divCss2">
                            <div class="col-sm-5" hidden>
                                病案号：<label id="idLab" class="labCss"></label><label id="assortId" hidden></label>
                            </div>
                            <div class="col-sm-4">
                                住院号：<label id="inLab" class="labCss"></label>
                            </div>

                            <div class="col-sm-4">
                                住院次数：<label id="inTimeLab" class="labCss"></label>
                            </div>
                            <div class="col-sm-3">
                                姓名：<label id="nameLab" class="labCss"></label>
                            </div>
                        </div>
                        <div class="row divCss2">
                            <div class="col-sm-4">
                                <input type="text" id="outDateLab" hidden/>
                                入院科室：<label id="deptToLab" class="labCss"></label>
                            </div>
                            <div class="col-sm-4">
                                入院日期：<label id="inDateLab" class="labCss"></label>
                            </div>
                            <div class="col-sm-4"><input type="text" id="outDeptLab" hidden/>
                                出院科室：<label id="outDeptToLab" class="labCss"></label>
                            </div>
                            <%--<div class="col-sm-3">--%>
                            <%--完整性审核：--%>
                            <%--</div>--%>
                        </div>
                        <div class="row divCss2">
                            <div class="col-sm-4">
                                出院日期：<label id="outDeptDateLab" class="labCss"></label>
                            </div>
                        </div>
                        <%--<div class="row divCss2">--%>
                        <%--&lt;%&ndash;<div class="col-sm-4">&ndash;%&gt;--%>
                        <%--&lt;%&ndash;离院方式：<label id="outHospLab" class="labCss"></label>&ndash;%&gt;--%>
                        <%--&lt;%&ndash;</div>&ndash;%&gt;--%>
                        <%--&lt;%&ndash;<div class="col-sm-5">&ndash;%&gt;--%>
                        <%--&lt;%&ndash;主管医生：<label id="chargeLab" class="labCss"></label>&ndash;%&gt;--%>
                        <%--&lt;%&ndash;</div>&ndash;%&gt;--%>
                        <%--<div class="col-sm-3">--%>
                        <%--</div>--%>
                        <%--</div>--%>
                    </div>
                    <div class="divCss4"></div>
                    <div class="row">
                        <%--<div class="row divCss3 ">病历清单</div>--%>
                        <div class="col-sm-3 divCss2">
                            <div class="row titleCss"></div>
                            <div class="row form-inline">
                                <input type="text" id="key" value="" class="input-sm form-control empty"
                                       placeholder="分段名称"/>
                                <button type="button" class="btn btn-primary btn-sm" id="searchBtn1">查询</button>
                            </div>
                            <div class="row">
                                <button type="button" class="btn  btn-success btn-sm treeBtn1" onclick="expandAll();">
                                    全部展开
                                </button>
                                <button type="button" class="btn  btn-success btn-sm treeBtn" onclick="collapseAll();">
                                    全部收缩
                                </button>
                            </div>
                            <div class="row">
                                <!--树-->
                                <div class="zTreeDemo" id="foo">
                                    <ul id="ztree" class="ztree"></ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-8 divCss5">
                            <div class="row ">
                                <div class="col-sm-3 " style="margin-top: 5px;margin-left: -20px">
                                    <input type="checkbox" id="flag" value="1">只显示作废</input>
                                </div>
                                <div class="col-sm-9 btnGroupCss" >
                                    <button type="button" class="btn btn-danger btn-sm" id="addPdfBtn">添加pdf</button>
                                    <button type="button" class="btn btn-default btn-sm" id="uploadBtn">上传文件</button>
                                    <button type="button" class="btn btn-info btn-sm" id="pdfBtn">查看分段PDF</button>
                                    <button type="button" class="btn btn-success btn-sm" id="pdfBtn2">查看PDF</button>
                                    <%--<button type="button" class="btn btn-primary btn-sm" id="addBtn">添加清单</button>--%>
                                    <button type="button" class="btn btn-warning btn-sm" id="updateStateBtn">选中作废</button>
                                    <button type="button" class="btn btn-primary btn-sm" id="updateStateBtn2">选中使用</button>
                                </div>
                            </div>
                            <div class="row">
                                <!--数据表格-->
                                <table id="table2" class="table  text-nowrap  table-striped"></table>
                                <div id="toolbar2" class="btn-group pull-left toolbarCss">
                                    <div class=" row columns  btn-group pull-right " style="margin-top:0px;">
                                        <div class="row form-inline" >标题:
                                            <input class="input-sm form-control form-inline" type="text" id="titleSearch" name="titleSearch" aria-label="Refresh"
                                                   title="Refresh" placeholder="请输入pdf相关标题"/>
                                            <select class="selectpicker bla bla bli" data-live-search="true" name="sourceSearch" id="sourceSearch" title="来源">
                                            </select>
                                            <button type="button" class="btn btn-primary btn-sm"  id="titleSearchBtn">查询</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 模态框3（Modal）分段信息 -->
<div class="modal fade" id="assortModal" tabindex="2" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title">
                    病历清单详情
                </h4>
            </div>
            <div class="modal-body">
                <!--通过审批且未过期的patientId集合-->
                <%--<form class="form-horizontal" id="logForm">--%>
                <input type="hidden" id="inpId" name="inpId">
                <div class="row divCss8">
                    <div class="form-group"><input id="fileUrlInp" hidden/>
                        <label class="col-sm-3 control-label">标题：</label>
                        <div class="col-sm-7">
                            <input type="text" class="input-sm form-control" id="inpTitle" name="inpTitle">
                        </div>
                    </div>
                </div>
                <div class="row divCss8">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">类型：</label>
                        <div class="col-sm-6">
                            <%--<input type="text" class="input-sm form-control"  id="inpType" name="inpType">--%>
                            <select class="input-sm form-control" id="inpType">

                            </select>
                        </div>
                    </div>
                </div>
                <div class="row divCss8">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">页码：</label>
                        <div class="col-sm-6">
                            <input type="number" class="input-sm form-control" id="pageNumber" name="pageNumber">
                        </div>
                    </div>
                </div>
                <div class="row divCss8">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">来源：</label>
                        <div class="col-sm-6">
                            <input type="text" class="input-sm form-control" readonly id="inpSource" name="inpSource">
                        </div>
                    </div>
                </div>
                <div class="row divCss8">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">状态：</label>
                        <div class="col-sm-3">
                            <select class="input-sm form-control" id="inpFlag" name="inpFlag">
                                <option value="0">使用</option>
                                <option value="1">作废</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row divCss8">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">上传pdf：</label>
                        <div class="col-sm-9">
                            <input type="text" id="pdfPathVal" readonly></input>
                            <%--<a href="javascript:void(0);" target="_self" id="previewFile" style="display:none">预览</a>--%>
                            <div id="upPdfDiv">
                                <form action="path/uploadPDF1" id="formUpload" enctype="multipart/form-data"
                                      method="post">
                                    <input id="addFile" class="inp_file" type="file" accept="application/pdf"
                                           name="addFile"
                                           size="chars">
                                    <%--<iframe id="pdf_page" name="pdf_page" style="width:1500px;height:640px">--%>
                                    <%--</iframe>--%>
                                </form>
                            </div>
                        </div>
                        <%--<div class="col-sm-1"></div>--%>
                    </div>
                </div>
                <%--</form>--%>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary btn-sm" id="saveBtn">保存</button>
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<%--多图片框--%>
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog"
     aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content enterCss">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">手动上传扫描病历（图片上传）</h4>
            </div>
            <div class="modal-body">
                <form id="filesUpload" method="POST" enctype="multipart/form-data">

                    <div class="imgDivCss" id="divImg">
                        <%--<form>--%>
                        <%--<p class="form-group">--%>
                        <%--<h3>Bootstrap File Input Demo1</h3>--%>
                        <%--</p>--%>
                        <%--<input name="uploadFile" type="file" id="uploadFile" multiple class="file-loading"/>--%>
                        <%--</form>--%>
                        <div class="form-inline">
                            <div class="form-group divCss">
                                <label for="inpGl">归类 :</label>
                                <select class="input-sm form-control" id="inpGl">
                                    <option value="非类型">非类型</option>
                                    <option value="">全部</option>
                                    <%--<option value="在院">在院</option>--%>
                                    <%--<option value="未归档">未归档</option>--%>
                                    <%--<option value="归档中">归档中</option>--%>
                                    <%--<option value="初审">初审</option>--%>
                                    <%--<option value="已认证">已认证</option>--%>
                                    <%--<option value="已归档">已归档</option>--%>
                                </select>
                            </div>
                            <button type="button" class="btn btn-primary btn-sm divCss" id="imgBtn">查询</button>
                            <%--<button type="button" class="btn btn-info btn-sm divCss" id="imgsBtn">批量上传</button>--%>
                            <%--<button type="button" class="btn btn-danger btn-sm divCss" id="imgsDelBtn">批量删除</button>--%>
                            <button type="button" class="btn btn-warning btn-sm divCss" id="imgsSaveBtn">保存</button>
                            <a href="javascript:;" class="a-upload btn btn-info btn-sm">
                                <input type="file" name="myFile" id="myFile" multiple="multiple" accept="image/*"
                                       hidden/>选择文件
                            </a>
                        </div>
                        <div class="img_div" ></div>
                        <div class="shade" onclick="javascript:closeShade()">
                            <div class=""><span class="text_span"></span>
                            </div>
                        </div>
                        <%--<div class="shadeImg"  onclick="javascript:closeShadeImg()">--%>
                        <%--<div class="">--%>
                        <%--<img class="showImg" src=""/>--%>
                        <%--</div>--%>
                        <%--</div>--%>
                    </div>
                </form>

                <%--<div id="handout_wrap_inner"><input id="tsInfo" type="text" style="border:none" size="100" readonly/></div>--%>
                <%--<iframe id="pdf_page" name="pdf_page" data-target="_bank" style="width:100%;height:100%"></iframe>--%>
            </div>
            <%--<div class="modal-footer">--%>
            <%--<button type="button" class="btn btn-default btn-sm"--%>
            <%--data-dismiss="modal">返回--%>
            <%--</button>--%>
            <%--</div>--%>
        </div>
    </div>
</div>

<%--发大弹窗--%>
<div class="modal fade" id="maxImg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-header2">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">×</span></button>
        </div>
        <div class="modal-content ">
            <div class="modal-body maxBodyCss">
                <div class="shadeImg" onclick="javascript:closeShadeImg()">
                    <div class="">
                        <img class="showImg" src=""/>
                    </div>
                </div>
            </div>
            <%-- <div class="modal-footer">
                 <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
             </div>--%>
        </div>
    </div>
</div>
<%--确认框--%>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content ">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="exampleModalLabel">确认作废</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <input type="hidden" id="idT" name="idT" value=""/>
                        <label class="control-label">作废该分段记录吗？</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
                <button type="button" class="btn btn-primary btn-sm" id="stateBtn">确认</button>
            </div>
        </div>
    </div>
</div>

<%--确认框--%>
<div class="modal fade" id="delPdfModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content ">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">确认</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <input type="hidden" id="idPdfT" name="idPdfT" value=""/>
                        <input type="hidden" id="pdfFileName" name="pdfFileName" value=""/>
                        <label class="control-label">是否删除该记录？</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
                <button type="button" class="btn btn-primary btn-sm" id="statePdfBtn">确认</button>
            </div>
        </div>
    </div>
</div>

<%--确认框--%>
<div class="modal fade" id="tsPdfModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content ">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">确认</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label class="control-label">是否替换原有的PDF文件？</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
                <button type="button" class="btn btn-primary btn-sm" id="thPdfBtn">确认</button>
            </div>
        </div>
    </div>
</div>

<%--删除pdf某页弹窗--%>
<div class="modal fade" id="delPdfPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-header2">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">×</span>
            </button>
            <h4 class="modal-title">PDF页信息</h4>
        </div>
        <div class="modal-content ">
            <div class="modal-body divCss2" id="delPdfBody">
                <div class="row form-inline">
                    <div id="pdfDiv">
                        <iframe id="pdf_page" name="pdf_page"></iframe>
                    </div>
                    <div id="arrow">&gt;</div>
                    <div id="infoDiv">
                        <form>
                            <div class="row " hidden>
                                <input id="pdfId" hidden/>
                                <span style="vertical-align:top;" hidden>pdf路径：</span>
                                <textarea rows="6" readonly id="pathPdf" hidden></textarea>
                                <textarea rows="6" readonly id="pathPdfR" hidden></textarea>
                            </div>
                            <div class="row" style="margin-left:5px;">
                                页码：
                                <input type="number" id="pagePdf" class="pagePdfCss"/>-<input type="number"
                                                                                              id="pagePdf2"
                                                                                              class="pagePdfCss"/>
                                <button type="button" class="btn btn-primary btn-sm" id="delPageBtn">确认</button>
                            </div>
                        </form>
                        <!--获取所有删除图片的列表-->
                        <%--<div class="row" id="delPicListdiv" style="margin-left: 15px;">
                            <img class="showImg2" src="http://192.168.1.106:8080/emr_medical_record/static/img/login.jpg" onclick='javascript:lookBigImg(this)'/>/>
                            <div row></div>
                        </div>--%>
                        <div class="row" style="margin-left:15px;">
                            <div class="row" id="addDelDiv">---不可恢复--</div>
                            <div class="row" style="margin-bottom: 5px;">
                                <button type="button" class="btn btn-primary btn-sm" id="returnPdfBtn2" onclick="bfPdfFun()">重新备份PDF </button>
                                <button type="button" class="btn btn-default btn-sm" id="upLoadImgBtn" onclick="upLoadImgFun()">上传额外图片</button>
                            </div>
                            <div class="row">
                                <%--<button type="button" class="btn btn-warning btn-sm" id="addPdfPageBtn" onclick="addPdfPageFun()">PDF添加页码</button>--%>
                                <button type="button" class="btn btn-warning btn-sm" id="returnPdfBtn"
                                        onclick="returnPdfFun()">还原备份PDF
                                </button>
                                <button type="button" class="btn btn-danger btn-sm" id="delAllImgBtn">删除全部图片</button>
                            </div>
                        </div>
                        <div class="imglist" id="imglist">

                        </div>
                    </div>
                </div>
            </div>
            <%--<div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
            </div>--%>
        </div>
    </div>
</div>

<%--删除pdf某页确认框--%>
<div class="modal fade" id="delPdfPageModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content ">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">确认</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label class="control-label">是否删除pdf第<span id="numDel"></span>的页面？</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
                <button type="button" class="btn btn-primary btn-sm" id="delPageBtn2">确认</button>
            </div>
        </div>
    </div>
</div>


<%--确认框提示清空所有图片--%>
<div class="modal fade" id="delImgPageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content  ">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">确认</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label class="control-label">删除所有的图片将不可恢复，是否删除？</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">返回</button>
                <button type="button" class="btn btn-primary btn-sm" id="delImgPageBtn">确认</button>
            </div>
        </div>
    </div>
</div>


<%--多图片框删除页--%>
<div class="modal fade" id="imgDelPageModal" tabindex="-1" role="dialog"
     aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content enterCss">
            <div class="modal-header2">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title">手动图片上传</h4>
            </div>
            <div class="modal-body">
                <form id="filesUpload2" method="POST" enctype="multipart/form-data">
                    <div class="imgDivCss" id="divImg2">
                        <div class="form-inline">
                            <button type="button" class="btn btn-primary btn-sm divCss" id="imgsClearBtn2">清空图片</button>
                            <button type="button" class="btn btn-warning btn-sm divCss" id="imgsSaveBtn2">保存</button>
                            <a href="javascript:;" class="a-upload btn btn-info btn-sm">
                                <input type="file" name="myFile2" id="myFile2" multiple="multiple" accept="image/*"
                                       hidden/>选择文件
                            </a>
                        </div>

                        <div class="img_div2"></div>
                        <div class="shade" onclick="javascript:closeShade()">
                            <div class=""><span class="text_span"></span>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>

<script type="text/javascript">
    var transfertDeptStr = "";
    //识别是否加载
    var tipLoad = 1;
    //创建数组保存图片
    var files = new Array();

    var id = 0;
    //初始化类别
    var selectStr = "";
    var url = "";
    var idArr = [];
    var flag = 0;
    var value = [];
    var zNodes = [];
    var nodeList = [];
    var opts = {
        lines: 13, // 花瓣数目
        length: 20, // 花瓣长度
        width: 10, // 花瓣宽度
        radius: 30, // 花瓣距中心半径
        corners: 1, // 花瓣圆滑度 (0-1)
        rotate: 0, // 花瓣旋转角度
        direction: 1, // 花瓣旋转方向 1: 顺时针, -1: 逆时针
        color: '#000', // 花瓣颜色
        speed: 1, // 花瓣旋转速度
        trail: 60, // 花瓣旋转时的拖影(百分比)
        shadow: false, // 花瓣是否显示阴影
        hwaccel: false, //spinner 是否启用硬件加速及高速旋转
        className: 'spinner', // spinner css 样式名称
        zIndex: 2e9, // spinner的z轴 (默认是2000000000)
        top: '50%', // spinner 相对父容器Top定位 单位 px
        left: '450%'// spinner 相对父容器Left定位 单位 px
    };
    var spinner = new Spinner(opts);
    var setting = {
        view: {
            addHoverDom: false,
            removeHoverDom: false,
            selectedMulti: false,
            autoCancelSelected: false
        },
        check: {
            enable: true
        },
        data: {
            simpleData: {
                enable: true,
                idKey: "id",
                pIdKey: "pId",
                rootPId: "0"
            }
        },
        edit: {
            enable: false
        },
        callback: {
            beforeClick: function (treeId, treeNode) {
                $("#assortId").html(treeNode.id);
                //查询之后重新从第一页算起
                $('#table2').bootstrapTable('refreshOptions', {limit: 1, offset: 10});
                //刷新
                $('#table2').bootstrapTable('refresh');
                //idArr = [];
            }

        }
    };

    $(function () {
        var objUrl;
        var img_html;

        var oMoveBox = $("#arrow"), infoDiv = $("#infoDiv"), maxL = 0;
        oMoveBox.click(function () {
            if (maxL > 0) {
                maxL = 0;
                $("#pdfDiv").css("width", '80%');
                $("#arrow").html(">");
                $("#infoDiv").show();
            } else {
                maxL = 1;
                $("#pdfDiv").css("width", '97%');
                $("#arrow").html("<");
                $("#infoDiv").hide();
            }
        });

        $("#myFile").change(function () {
            var img_div = $(".img_div");
            var filepath = $("input[name='myFile']").val();
            //获取所有图片
            var fileALL = this.files;
            for (var i = 0; i < fileALL.length; i++) {
                //获取图片路径
                objUrl = getObjectURL(fileALL[i]);
                if(fileALL[i]!=undefined && fileALL[i]!=null && fileALL[i]!=""){
                    if(fileALL[i].name!=undefined && fileALL[i].name!=null && fileALL[i].name!=""){
                        var extStart = fileALL[i].name.lastIndexOf(".");
                        var ext = fileALL[i].name.substring(extStart, fileALL[i].name.length).toUpperCase();
                        /**
                         *描述：鉴定每个图片上传尾椎限制
                         */
                        if (ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
                            toastr.warning("图片:"+fileALL[i].name+"不符，限于png,gif,jpeg,jpg格式");
                            return false;
                        }else{
                            files.push(fileALL[i]);
                            /**
                             *若规则全部通过则在此提交url到后台数据库
                             */
                            img_html = "<div class='isImg' id='-1'><img src='" + objUrl + "' id='" + fileALL[i].name + "' onclick='javascript:lookBigImg(this)' style='height: 100%; width: 100%;' />"
                            img_html += selectStr+ " <button class='removeBtn' onclick='javascript:removeImg(this)'>x</button></div>";
                            img_div.append(img_html);
                        }
                    }
                }

            }
            /**
             *描述：鉴定每个图片大小总和
             */
            var file_size = 0;
            var all_size = 0;
            for (j = 0; j < fileALL.length; j++) {
                file_size = fileALL[j].size;
                all_size = all_size + fileALL[j].size;
                var size = all_size / 1024;
                if (size > 500000000) {//500
                    //$(".shade").fadeIn(500);
                    //$(".text_span").text("上传的图片大小不能超过100k!");
                    toastr.warning("上传的图片大小不能超过10000000k!");
                    this.value = "";
                    $(".img_div").html("");
                    return false;
                }
            }
            /**
             *描述：鉴定每个图片宽高 以后会做优化 多个图片的宽高 暂时隐藏掉 想看效果可以取消注释就行
             */
            // var img = new Image();
            // img.src = objUrl;
            // img.onload = function() {
            // 	if (img.width > 100 && img.height > 100) {
            //      toastr.warning("图片宽高不能大于一百!");
            // 		$("#myFile").val("");
            // 		$(".img_div").html("");
            // 		return false;
            // 	}
            // }
            return true;
        });

        $("#myFile2").change(function () {
            var img_div = $(".img_div2");
           // var filepath = $("input[name='myFile2']").val();

            //获取所有图片
            var fileALL = this.files;
            for (var i = 0; i < fileALL.length; i++) {
                //获取图片路径
                objUrl = getObjectURL(fileALL[i]);
                if(fileALL[i]!=undefined && fileALL[i]!=null && fileALL[i]!=""){
                    if(fileALL[i].name!=undefined && fileALL[i].name!=null && fileALL[i].name!=""){
                        var extStart = fileALL[i].name.lastIndexOf(".");
                        var ext = fileALL[i].name.substring(extStart, fileALL[i].name.length).toUpperCase();
                        /**
                         *描述：鉴定每个图片上传尾椎限制
                         */
                        if (ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
                            toastr.warning("图片:"+fileALL[i].name+"不符，限于png,gif,jpeg,jpg格式");
                            return false;
                        }else{
                            files.push(fileALL[i]);
                            /**
                             *若规则全部通过则在此提交url到后台数据库
                             */
                            img_html = "<div class='isImg' id='-1'><img src='" + objUrl + "' id='" + fileALL[i].name + "' onclick='javascript:lookBigImg(this)' style='height: 100%; width: 100%;' />"
                            img_html +=" <button class='removeBtn' onclick='javascript:removeImg2(this)'>x</button></div>";
                            img_div.append(img_html);
                        }
                    }
                }
            }

            /**
             *描述：鉴定每个图片大小总和
             */
            var file_size = 0;
            var all_size = 0;
            for (j = 0; j < fileALL.length; j++) {
                file_size = fileALL[j].size;
                all_size = all_size + fileALL[j].size;
                var size = all_size / 1024;
                if (size > 500000000) {
                    toastr.warning("上传的图片大小不能超过10000000k!");
                    this.value = "";
                    $(".img_div2").html("");
                    return false;
                }
            }
            return true;
        });

        /**
         *描述：鉴定每个浏览器上传图片url 目前没有合并到Ie,返回值为blob的url
         */
        function getObjectURL(file) {
            var url = null;
            if (window.createObjectURL != undefined) { // basic
                url = window.createObjectURL(file);
            } else if (window.URL != undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file);
            } else if (window.webkitURL != undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file);
            }
            //console.log(url);
            return url;
        }

        //blob转base64
        function blobToDataURL(blob) {
            var a = new FileReader();
            a.readAsDataURL(blob);//读取文件保存在result中
            a.onload = function (e) {
                var getRes = e.target.result;//读取的结果在result中
            }

        }

        //日期控件
        $(".input-daterange").datepicker({
            format: "yyyy-mm-dd",
            language: "zh-CN"
        });

        var url = window.location.href;
        var index = url.substring(url.lastIndexOf('?') + 1).replace("num=", "");
        if (index != null && index != "" && index.indexOf("excel") != -1) {
            $("#excelBtn").show();
            $("#toolbar").show();
        } else {
            $("#excelBtn").hide();
            $(".columns-right").hide();
        }

        if (index != null && index != "" && index.indexOf("addPdf") != -1) {
            $("#addPdfBtn").show();
        } else {
            $("#addPdfBtn").hide();
        }

        if (index != null && index != "" && index.indexOf("upload") != -1) {
            $("#uploadBtn").show();
        } else {
            $("#uploadBtn").hide();
        }
        if (index != null && index != "" && index.indexOf("pdf") != -1) {
            $("#pdfBtn").show();
        } else {
            $("#pdfBtn").hide();
        }
        if (index != null && index != "" && index.indexOf("pdf2") != -1) {
            $("#pdfBtn2").show();
        } else {
            $("#pdfBtn2").hide();
        }
        if (index != null && index != "" && index.indexOf("cancelAll") != -1) {
            $("#updateStateBtn").show();
        } else {
            $("#updateStateBtn").hide();
        }
        if (index != null && index != "" && index.indexOf("useAll") != -1) {
            $("#updateStateBtn2").show();
        } else {
            $("#updateStateBtn2").hide();
        }

        var deptAdmissionTo = url.substring(url.lastIndexOf('&') + 1).replace("depts=", "");
        var deptArr = deptAdmissionTo.split(',');
        //var n = (deptAdmissionTo.split(',')).length ;
        if (deptAdmissionTo == null || deptAdmissionTo == '' || deptArr.length > 1) {
            $('#deptDiv').show();
        } else {
            $('#deptDiv').hide();
        }

        function getDept() {
            //获取科室列表
            $.ajax({
                url: "${path}/inHosp/getDept",
                type: "POST",
                data: {effective: 1, typecode: "dept_code"},
                success: function (result) {
                    if (result != null) {
                        for (var i = 0; i < result.length; i++) {
                            if (deptArr.length != 1 && deptArr[0] != "") {
                                var bol = deptArr.indexOf(result[i].code);
                                if (bol != -1) {
                                    $("#deptName").append("<option value=" + result[i].code + ">" + result[i].name + "</option>");
                                }
                            } else {
                                $("#deptName").append("<option value=" + result[i].code + ">" + result[i].name + "</option>");
                            }
                        }
                    }
                    $(".selectpicker").selectpicker('refresh'); //
                }
            });
        }

        getDept();
    });

    /**
     * 描述：上传图片附带删除 再次地方可以加上一个ajax进行提交到后台进行删除
     */
    function removeImg(r) {
        //获取data中的图片名
        var filename = $(r).siblings("img").attr('id');

        //删除父节点
        $(r).parent().remove();
        var fileList = Array.from(files);
        //遍历数组
        //console.log(fileList);
        for (var j = 0; j < fileList.length; j++) {
            if(fileList[j]!= undefined){
                //通过图片名判断图片在数组中的位置然后删除
                // console.log(fileList[j].name != undefined);
                if (fileList[j].name != undefined) {
                    if (fileList[j].name == filename) {
                        fileList.splice(j, 1);
                        files = fileList;
                        id--;
                        break;
                    }
                }
            }
        }
        files = fileList;
        var id = $(r).parent().attr('id');
        var maxPicture = $(r).siblings("img").attr('src');

        if ($(r).parent().attr('id') != -1) {
            var target = document.getElementById('filesUpload');
            spinner.spin(target);//给id为foo的div 中绑上spinner
            $.ajax({
                url: "${path}/inHosp/delImg",
                type: "POST",
                data: {id: id, maxPicture: maxPicture},
                success: function (result) {
                    spinner.spin();
                    if (result.indexOf("成功") != -1) {
                        //刷新
                        $('#table2').bootstrapTable('refresh');
                        initTree($("#idLab").html());
                        toastr.success(result);
                    } else {
                        toastr.error(result);
                    }
                }, error: function () {
                    //toastr.error("加载失败!");
                }
            });
        }
    }


    /**
     * 描述：上传图片附带删除 再次地方可以加上一个ajax进行提交到后台进行删除
     */
    function removeImg2(r) {
        //获取data中的图片名
        var filename = $(r).siblings("img").attr('id');
        //删除父节点
        $(r).parent().remove();
        var fileList = Array.from(files);
        //遍历数组
        for (var j = 0; j < fileList.length; j++) {
            //通过图片名判断图片在数组中的位置然后删除
            if(fileList[j].name!=undefined)
            if (fileList[j].name == filename) {
                fileList.splice(j, 1);
                id--;
                break;
            }
            files = fileList;
        }
        files = fileList;
    }

    /**
     * 描述：上传图片附带放大查看处理
     */
    function lookBigImg(b) {
        $('#maxImg').modal({
            backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
            keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
            show: true//弹出对话框
        });

        $(".shadeImg").fadeIn(500);
        $(".showImg").attr("src", $(b).attr("src"));

    }

    /**
     * 描述：关闭弹出层
     */
    function closeShade() {
        // $(".shade").fadeOut(500);
    }

    /**
     *描述：关闭弹出层
     */
    function closeShadeImg() {
        // $(".shadeImg").fadeOut(500);
    }

    function getAssortFun() {
        $.ajax({
            url: "${path}/zdAssort/getAssort",
            type: "POST",
            //data: {patientId: $("#idLab").html()},
            async: true,
            success: function (result) {
                if (result.length > 0) {
                    if (result != null) {
                        selectStr = "<select class='selectB'>";
                        for (i = 0; i < result.length; i++) {
                            selectStr += "<option value='" + result[i].assortId + "' title='"+result[i].assortName+"'>" + result[i].assortName + "</option>";
                            $("#inpGl").append("<option value='" + result[i].assortId + "' title='"+result[i].assortName+"'>" + result[i].assortName + "</option>");
                            //下拉类别
                            $("#inpType").append("<option value='" + result[i].assortId + "' title='"+result[i].assortName+"'>" + result[i].assortName + "</option>");
                        }
                        selectStr += " </select>";
                    }
                }
            }, error: function () {
                // toastr.error("加载失败!");
            }
        });
    }

    getAssortFun();

    /* var opts = {
         lines: 13, // The number of lines to draw |小长条的数量
         length: 20, // The length of each line |小长条的长度
         width: 7, // The line thickness |小长条的宽度
         // left:"50%",
         radius: 15, // The radius of the inner circle |内环的半径长
         corners: 1, // Corner roundness (0..1)
         rotate: 0, // The rotation offset |旋转角度
         direction: 1, // 1: clockwise, -1: counterclockwise |1：顺时针方向 -1：逆时针方向
         color: '#3c8dbc', // #rgb or #rrggbb or array of colors |颜色
         speed: 1, // Rounds per second |每秒转多少圈
         trail: 60, // Afterglow percentage |余晖效果百分比
         shadow: false, // Whether to render a shadow |渲染阴影
         hwaccel: false, // Whether to use hardware acceleration |加速
         className: 'spinner', // The CSS class to assign to the spinner |类名spinner
         zIndex: 2e9, // The z-index (defaults to 2000000000) |显示在最顶层
         top: '25%', // spinner 相对父容器Top定位 单位 px
         left: '50%'// spinner 相对父容器Left定位 单位 px

     };*/


    function uploadFileAndDate() {
        var formData = new FormData();
        formData.append('file', $('#addFile')[0].files[0]);
        formData.append('fileName', $("#outDateLab").val());
        formData.append('id', $("#inpId").val());
        formData.append('masterID', $("#idLab").html());
        formData.append('assortID', $("#inpType").val());
        formData.append('title', $("#inpTitle").val());
        if ($("#pageNumber").val() < 1) {
            $("#pageNumber").val(1);
        }
        formData.append('pageNumber', $("#pageNumber").val());
        formData.append('source', $("#inpSource").val());
        formData.append('flag', $("#inpFlag").val());
        formData.append('sys', "emr_medical_record");
        //console.log($("#inpFlag").val());

        $.ajax({
            url: "${path}/inHosp/uploadPdf2",
            scriptCharset: "UTF-8",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            success: function (result) {
                if (result.indexOf("文件") == -1) {
                    toastr.success("操作成功!");
                    $('#addFile').attr("src", result);
                    url = result;
                    $('#previewFile').css("display", "block");//显示预览按钮
                } else {
                    toastr.warning(result);
                }
                $('#assortModal').modal('hide');  //手动关闭
                //刷新
                $('#table2').bootstrapTable('refresh');
                initTree($("#idLab").html());

            }, error: function (result) {
                $('#assortModal').modal('hide');  //手动关闭
                toastr.success("操作成功!");
                //$('#addFile').attr("src", $("#outDateLab").val() + ".pdf");//.val($("#outDateLab").val()+".pdf");
                //toastr.error("上传PDF失败!");
                //刷新
                $('#table2').bootstrapTable('refresh');
                initTree($("#idLab").html());

            }
        });
    }

    function uploadFileFun() {
        if ($('#addFile')[0].files[0] != undefined) {
            if ($('#addFile')[0].files[0].size > 0) {
                //console.log("=================111==========================");
                //新增或修改
                uploadFileAndDate();
            } else {
                toastr.warning("文件为空!");
            }
        } else {
            if ($('#pdfPathVal').val() == null || $('#pdfPathVal').val() == "") {
                toastr.warning("请选择文件!");
            } else {
                //console.log("===================222======================="+ $('#pdfPathVal').val()+"=");
                //修改
                uploadFileAndDate();
            }
        }
    }

    function blobToDataURL(blob, callback) {

        var a = new FileReader();

        a.onload = function (e) {

            callback(e.target.result);

        }

        a.readAsDataURL(blob);

    }

    function blobToFile(blob, fileName) {
        blob.lastModifiedDate = new Date();
        blob.name = fileName;
        return blob;
    }

    function imgSelectFun() {
        var img_div = $(".img_div");
        if ($("#inpGl").val() != "非类型") {
            var target = document.getElementById('divImg');
            spinner.spin(target);//给id为foo的div 中绑上spinner
            var data = {};
            data.relationId = $("#idLab").html();
            data.assortId = $("#inpGl").val();

            $.ajax({
                url: "${path}/inHosp/getPicList",
                type: "post",
                data: data,
                success: function (result) {
                    if (result != null) {
                        img_div.empty();
                        for (var i = 0; i < result.length; i++) {
                            /**
                             *若规则全部通过则在此提交url到后台数据库
                             */
                                //selectStr= selectStr.replace(result[i].assortId+'\"','\" selected');
                                //console.log(result[i].maxPicture);
                            var fileName = result[i].maxPicture.split("\\");
                            var parentdiv = $("<div class='isImg' id='" + result[i].id + "'></div>");
                            var imgTig = $("<img  onclick='javascript:lookBigImg(this)' style='height: 100%; width: 100%;'/>");

                            //创建一个img
                            imgTig.attr('id', fileName[fileName.length - 1]);
                            //imgTig.attr('src', result[i].maxPicture);
                            if (result[i].maxPicture.indexOf(".") != -1) {
                                if (result[i].maxPicture.indexOf("..") != -1) {
                                    imgTig.attr('src', result[i].maxPicture);
                                } else {
                                    var reg = /\\/g;
                                    var path = "getImg2?path=" + (result[i].maxPicture).replace(reg, "/");
                                    //path= "getImg2?path=C:/Users/Administrator/Desktop/测试/lunfan4.jpg";
                                    //console.log((result[i].maxPicture).replace(reg, "/"));
                                    imgTig.attr('src', path);
                                }
                                // img_html = "<div class='isImg' id='-1'><img src='require(" + objUrl + ")' id='" + fileALL[i].name + "' onclick='javascript:lookBigImg(this)' style='height: 100%; width: 100%;' />"
                            }
                            parentdiv.append(imgTig);        //将子div添加到父div中
                            //parentdiv.addclass('parentdiv');    //添加css样式
                            var subBtn = $("<button class='removeBtn' onclick='javascript:removeImg(this)'>x</button>");
                            parentdiv.append(selectStr);
                            parentdiv.append(subBtn);
                            img_div.append(parentdiv);
                            img_div.find("select").eq(i).val(result[i].assortId);
                        }
                    } else {
                        toastr.success("暂无数据!");
                    }
                    spinner.spin();

                },
                error: function () {
                    toastr.error("获取图片列表失败!");
                }
            });
        } else {
            img_div.empty();
        }

    }

    $("#imgBtn").click(function () {
        //console.log("===查询图片列表===");
        //var target = document.getElementById('filesUpload');
        imgSelectFun();

    });

    $("#imgsSaveBtn").click(function () {
        var target = document.getElementById('divImg');
        spinner.spin(target);//给id为foo的div 中绑上spinner
        var fileArr = [];
        var b = 0;
        //获取图片src和下拉框值
        var div_p = $(".img_div").children();
        var div_data = div_p.children();
        if (div_data != null)
            for (var i = 0; i < div_data.length; i++) {
                //if(div_data[i].getAttribute('src')!=null && div_data[i].getAttribute('src') != "") {
                // console.log("第" + (i + 1) + "个的src=" + div_data[i].getAttribute('src'));
                //obj.fileSrc= div_data[i].getAttribute('src');
                //obj.fileSrc = obj.fileSrc;
                //var s=new File([obj.fileSrc], "a"+i+".jpg");
                //files.push(s);
                //console.log(obj.fileSrc);
                //}
                if (div_data[i].value != null && div_data[i].value != "") {
                    var obj = {};
                   // console.log("第select" + (i + 1) + "个的value=" + div_data[i].value);
                    var selectedIndex=div_data[i].selectedIndex;
                    //console.log(div_data[i].options[index].getAttribute("title"));
                    obj.selectName=div_data[i].options[selectedIndex].getAttribute("title");
                    obj.selectVal = div_data[i].value;
                    if (b < div_data.length / 2) {
                        obj.id = div_p[b].id;
                        b++;
                    }
                    fileArr.push(obj);
                }
            }

        if (fileArr.length > 0) {
            //创建FormData根据form
            //console.log($("#outDateLab").val());
            var uploadFile = new FormData($("#filesUpload")[0]);
            uploadFile.append('fileName', $("#outDateLab").val());
            uploadFile.append('masterID', $("#idLab").html());
            uploadFile.append('assortid', $("#inpGl").val());
            uploadFile.append("list", JSON.stringify(fileArr));
            //console.log(fileArr);
            //遍历图片数组把图片添加到FormData中
            for (var i = 0; i < files.length; i++) {
                uploadFile.append("imgs", files[i]);
            }
            if ("undefined" != typeof (uploadFile) && uploadFile != null && uploadFile != "") {
                //通过ajax上传
                $.ajax({
                    url: "${path}/inHosp/uploadImgS",
                    type: "post",
                    data: uploadFile, //把FormData作为参数
                    contentType: false, //不设置内容类型
                    processData: false, //不处理数据
                    success: function (data) {
                        initTree($("#idLab").html());
                        setTimeout(function () {
                            imgSelectFun();
                            if (data.indexOf("成功") != -1) {
                                toastr.success(data);
                            } else if (data.indexOf("成功") != -1) {
                                toastr.error(data);
                            } else {
                                toastr.warning(data);
                            }
                            spinner.spin();
                        }, 2000);

                        files = new Array();
                    },
                    error: function () {
                        spinner.spin();
                        toastr.error("批量上传失败!");
                    }
                });
            }
        } else {
            spinner.spin();
            toastr.warning("请选择上传的图片!");
        }
    });

    $("#pdfBtn").click(function () {
        //上传后预览pdf文件
        //生成pdf返回url
        var masterId = $("#idLab").html();
        var flag = "0";
        if (masterId != "" && masterId != null) {
            // console.log("========上传后预览pdf文件================="+ masterId);
            var imgStr = "";
            var zTree = $.fn.zTree.getZTreeObj("ztree");//换成实际的图层的id
            var changedNodes = zTree.getChangeCheckedNodes(); //获取改变的全部结点
            for (var i = 0; i < changedNodes.length; i++) {
                var treeNode = changedNodes[i];
                if (treeNode.id != 0) {
                    if (imgStr.indexOf(treeNode.id) == -1) {
                        imgStr += treeNode.id + ",";
                    }
                }
                //console.log((treeNode ? treeNode.id : "root") + "checked " + (treeNode.checked ? "true" : "false"));
            }
            //判断id
            if (imgStr == null || imgStr == '') {
                toastr.warning("请选择分段类别!");
                return;
            }

            if ($("#flag").is(":checked") == true) {
                flag = "1";
            }
            //打开一个不被拦截的新窗口
            var newWindow = window.open();
            var titleName=document.getElementById("nameLab").innerText;
            $.ajax({
                url: "${path}/inHosp/getPdfToPdf",
                type: "POST",
                data: {masterId: masterId, imgStr: imgStr, flag: flag},
                success: function (result) {
                    if (result != "") {
                        var pdfPath = result;
                        //本机E盘下PDF
                        //var pdfPath = "C:/Users/Administrator/Desktop/测试/123.pdf";
                        //encodeURIComponent()处理http请求，进行转化
                        //pdfStreamHandeler 为 @RequestMapping(value = "/pdfStreamHandeler")方法名
                        newWindow.location.href = "${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath+"?titleName="+titleName);

                        //var pdfUrl = "${path}/static/pdfjs/web/viewer.html?file=../../../static/img/pdfFiles/" + result;//+ result;
                        // $('#pdfModal').modal({
                        //         backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                        //         keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                        //         show: true//弹出对话框
                        // });
                        //setTimeout(function () {
                        //$("#pdf_page").attr("src", pdfUrl);
                        //$(".pdf").media();
                        //newWindow.location.href = pdfUrl;
                        // window.open(pdfUrl, 'PDF', 'width:50%;height:50%;top:100;left:100;');
                        //console.log(pdfUrl);
                        //},5*1000);//延迟毫
                    } else {
                        newWindow.close();//此处为ajax失败方法，自动关闭刚才会打开的页面
                        toastr.warning("勾选的PDF文件不存在或破损!");
                    }
                }, error: function (result) {
                    //console.log(result);
                    newWindow.close();//此处为ajax失败方法，自动关闭刚才会打开的页面
                    toastr.error("操作失败!");
                }
            });
        } else {
            toastr.warning("病案不存在!");
        }
    });

    $("#titleSearchBtn").click(function () {
        $('#table2').bootstrapTable('refreshOptions', {limit: 1, offset: 10});
    });

    $("#pdfBtn2").click(function () {
        //选中批量使用
        var idStr = "";
        var getSelectRows = $("#table2").bootstrapTable('getSelections');
        if (getSelectRows.length > 0) {
            for (var i = 0; i < getSelectRows.length; i++) {
                idStr += getSelectRows[i].id + ",";
            }
            idStr = idStr.substring(0, idStr.length - 1);
        } else {
            toastr.warning("请选择记录!");
            return;
        }
        //上传后预览pdf文件,根据id直接获取pdf并合成
        //打开一个不被拦截的新窗口
        var newWindow = window.open();
        var titleName=document.getElementById("nameLab").innerText;
        $.ajax({
            url: "${path}/inHosp/getPdfById",
            type: "POST",
            data: {idStr: idStr, flag: flag},
            success: function (result) {
                if (result != "") {

                    var pdfPath = result;
                    //console.log(result);
                    //本机E盘下PDF
                    //var pdfPath = "C:/Users/Administrator/Desktop/测试/123.pdf";
                    //encodeURIComponent()处理http请求，进行转化
                    //pdfStreamHandeler 为 @RequestMapping(value = "/pdfStreamHandeler")方法名
                    newWindow.location.href = "${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath+"?titleName="+titleName);


                    //var pdfUrl = "${path}/static/pdfjs/web/viewer.html?file=../../../static/img/pdfFiles/typesPdf/" + result;//+ result;
                    // $('#pdfModal').modal({
                    //         backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                    //         keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                    //         show: true//弹出对话框
                    // });
                    //setTimeout(function () {
                    //$("#pdf_page").attr("src", pdfUrl);
                    //$(".pdf").media();
                    // newWindow.location.href = pdfUrl;
                    //window.open(pdfUrl, 'PDF', 'width:50%;height:50%;top:100;left:100;');
                    //console.log(pdfUrl);
                    //},5*1000);//延迟毫

                } else {
                    newWindow.close();//此处为ajax失败方法，自动关闭刚才会打开的页面
                    toastr.warning("勾选的PDF文件不存在或破损!");
                }
            }, error: function (result) {
                //console.log(result);
                newWindow.close();//此处为ajax失败方法，自动关闭刚才会打开的页面
                toastr.error("操作失败!");
            }
        });

    });

    $("#uploadBtn").click(function () {
        $("#inpGl").val("非类型");
        $(".img_div").html("");
        files = new Array();
        // console.log("批量上传图片模态框");
        $('#pdfModal').modal({
            backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
            keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
            show: true//弹出对话框
        });
    });

    $('#addFile').on('change', function () {

    });

    $("#previewFile").on('click', function () {
        //上传后预览pdf文件
        var fileUrl = $("#fileUrlInp").val();

        <%--$.ajax({--%>
        <%--url: "${path}/inHosp/pdfStream",--%>
        <%--type: "POST",--%>
        <%--data: {fileUrl: "D:/123.pdf"},--%>
        <%--success: function (result) {--%>
        <%--console.log("ssssssssssssssssssssssssss");--%>
        <%--}, error: function (result) {--%>
        <%--//console.log(result);--%>
        <%--toastr.error("操作失败!");--%>
        <%--}--%>
        <%--});--%>
        var pdfUrl = "${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent(fileUrl);
        if (fileUrl != null && fileUrl != "") {
            window.open(pdfUrl, 'PDF', 'width:50%;height:50%;top:100;left:100;');

        }
    });

    $("#imgsClearBtn2").click(function () {
        //console.log("===清空删除页的图片===");
        $(".img_div2").empty();
        files = new Array();
    });

    $("#imgsSaveBtn2").click(function () {
        //console.log("===保存删除页的图片===");
        var parentId = $("#pdfId").val();
        //pdf文件名
        //console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
        if (parentId != null && parentId != "") {
            var uploadFile = new FormData($("#filesUpload")[0]);
            uploadFile.append('parentId', parentId);
            if (files.length > 0) {
                //遍历图片数组把图片添加到FormData中
                for (var i = 0; i < files.length; i++) {
                    uploadFile.append("imgs", files[i]);
                }
                if ("undefined" != typeof (uploadFile) && uploadFile != null && uploadFile != "") {
                    $("#mb").css("display", "block");
                    var target = document.getElementById('divImg2');
                    spinner.spin(target);//给id为foo的div 中绑上spinner
                    //console.log("===保存删除页的图片===");
                    //通过ajax上传
                    $.ajax({
                        url: "${path}/inHosp/uploadDelPageImgS",
                        type: "post",
                        data: uploadFile, //把FormData作为参数
                        contentType: false, //不设置内容类型
                        processData: false, //不处理数据
                        success: function (result) {
                            setTimeout(function () {
                                $('#imgDelPageModal').modal("hide");
                                if (result.indexOf("成功") != -1) {
                                    getDelPicPageFun();
                                    toastr.success(result);
                                } else if (result != "") {
                                    toastr.warning(result);
                                } else {
                                    toastr.warning("多图片保存失败!");
                                }
                                spinner.spin();
                            }, 2000);
                            files = new Array();
                        },
                        error: function () {
                            spinner.spin();
                            toastr.error("批量上传失败!");
                        }
                    });
                    $("#mb").css("display", "none");

                }
            } else {
                toastr.warning("请选择上传的图片!");
            }

        } else {
            toastr.warning("记录不存在!");
        }

    });

    function upLoadImgFun() {
        //console.log("======删除页上传图片=======");
        $(".img_div2").empty();
        files = new Array();
        $('#imgDelPageModal').modal({
            backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
            keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
            show: true//弹出对话框
        });
    }

    function bfPdfFun() {
        $("#mb").css("display", "block");
        //console.log("======重新备份=======");
        var parentId = $("#pdfId").val();
        if (parentId != "" && parentId != null) {
            $.ajax({
                url: "${path}/inHosp/bfPdfFile",
                type: "POST",
                data: {id: parentId},
                success: function (result) {
                    setTimeout(function () {
                        if (result.indexOf("成功") != -1) {
                            getDelPicPageFun();
                            $('#pdf_page').attr('src', $('#pdf_page').attr('src'));
                            toastr.success(result);
                        } else if (result != "") {
                            toastr.warning(result);
                        } else {
                            toastr.warning("重新备份pdf文件失败!");
                        }
                    }, 1000);
                }
            });
        } else {
            toastr.warning("暂无备份pdf文件!");
        }
        $("#mb").css("display", "none");
    }

    function returnPdfFun() {
        $("#mb").css("display", "block");
        //console.log("======还原PDF=======");
        var parentId = $("#pdfId").val();
        if (parentId != "" && parentId != null) {
            $.ajax({
                url: "${path}/inHosp/returnPdfFile",
                type: "POST",
                data: {id: parentId},
                success: function (result) {
                    setTimeout(function () {
                        if (result == "") {
                            getDelPicPageFun();
                            $('#pdf_page').attr('src', $('#pdf_page').attr('src'));
                            spinner.spin();
                            toastr.success("pdf文件还原备份成功!");
                        } else {
                            toastr.warning(result);
                        }
                    }, 1000);
                }
            });
        } else {
            toastr.warning("暂无备份pdf文件!");
        }
        $("#mb").css("display", "none");
    }

    function returnPageFun(maxPicture, btnObj) {
        maxPicture = decodeURIComponent(maxPicture, "UTF-8");
        var minPicture = null;
        var parentId = $("#pdfId").val();
        // var parentId=$("#pdfId").val();
        var inpuObj = btnObj.parentNode.firstChild;
        var delPage = inpuObj.value;
        if (delPage == "" || delPage == null || delPage < 0) {
            toastr.warning("请输入还原的页码大于等于0!");
            return;
        }
        var delid = btnObj.id;
        var id = 0;
        var pictureNumber = 0;
        if (delid != "" && delid != null && delid != "delId_") {
            delid = delid.replace("delId_", "");
            id = parseInt(delid);
        }

        if (delPage != "" && delPage != null && delPage >= 0) {
            pictureNumber = delPage;
        }
        if ($("#pathPdf").val() != null && $("#pathPdf").val() != "" && $("#pathPdf").val() != undefined && $("#pathPdf").val() != "undefined") {
            minPicture = $("#pathPdf").val();
        }
        if (id != 0 && pictureNumber >= 0) {
            var entity = {};
            entity.id = id;
            entity.pictureNumber = pictureNumber;
            entity.maxPicture = maxPicture;
            entity.minPicture = minPicture;
            entity.parentId = parentId;
            //console.log(entity);

            $("#mb").css("display", "block");
            var target = document.getElementById('delPdfBody');
            spinner.spin(target);//给id为foo的div 中绑上spinner
            $.ajax({
                url: "${path}/inHosp/returnPage",
                type: "POST",
                data: entity,
                success: function (result) {
                    setTimeout(function () {
                        //if(result!=null && result!="") {
                        if (result.indexOf("成功") != -1) {
                            getDelPicPageFun();
                            // $('#pdf_page').attr('src', result);
                            $('#pdf_page').attr('src', $('#pdf_page').attr('src'));
                            toastr.success(result);
                        } else {
                            toastr.warning(result);
                        }
                        // }else{
                        // toastr.warning("图片还原失败!");
                        // }

                        $("#mb").css("display", "none");
                        spinner.spin();
                    }, 2000);
                }
            });
        }
    }

    function addPdfPageFun() {
        var maxPicture = $("#pathPdf").val();
        if (maxPicture != null && maxPicture != "" && maxPicture != undefined) {
            //console.log("=====添加pdf页码成功=========maxPicture:"+maxPicture);
            $("#mb").css("display", "block");
            var target = document.getElementById('delPdfBody');
            spinner.spin(target);//给id为foo的div 中绑上spinner
            $.ajax({
                url: "${path}/inHosp/addPdfPageBtn",
                type: "POST",
                data: {maxPicture: maxPicture},
                success: function (result) {
                    $("#mb").css("display", "none");
                    $('#pdf_page').attr('src', $('#pdf_page').attr('src'));
                    spinner.spin();
                    if (result == 1) {
                        toastr.success("添加pdf页码成功!");
                    }
                }
            });
        } else {
            // toastr.warning("删除所有图片失败!");
        }
    }

    function delAllImgFun() {
        var parentId = $("#pdfId").val();
        var maxPicture = $("#pathPdf").val();
        var picArr = maxPicture.split("\\");
        maxPicture = picArr[picArr.length - 1].replace(".pdf", "");
        if (parentId != null && parentId != "" && parentId != undefined) {
            var target = document.getElementById('delPdfBody');
            spinner.spin(target);//给id为foo的div 中绑上spinner
            //console.log(parentId+":parentId=====删除所有图片=========maxPicture:"+maxPicture);
            $.ajax({
                url: "${path}/inHosp/delPageImgAll",
                type: "POST",
                data: {parentId: parentId, maxPicture: maxPicture},
                success: function (result) {
                    getDelPicPageFun();
                    spinner.spin();
                    if (result == 1) {
                        toastr.success("删除所有图片成功!");
                    } else {
                        toastr.warning("没图片可删除!");
                    }
                }
            });
            // $('#delImgPageModal').modal('hide');  //手动关闭
        } else {
            // toastr.warning("删除所有图片失败!");
        }
        $('#delImgPageModal').modal('hide');  //手动关闭
    }

    $("#delAllImgBtn").click(function () {
        //弹窗提示不可复原
        $('#delImgPageModal').modal({
            backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
            keyboard: true,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
            show: true//弹出对话框
        });
    });

    $("#delImgPageBtn").click(function () {
        delAllImgFun();
    });

    function delPageFun(maxPicture, obj) {
        $("#mb").css("display", "block");
        var target = document.getElementById('delPdfBody');
        spinner.spin(target);//给id为foo的div 中绑上spinner
        maxPicture = decodeURIComponent(maxPicture, "UTF-8");
        var id = 0;
        if (obj.id != null && obj.id != "" && obj.id != "delId_") {
            id = parseInt(obj.id.replace("delId_", ""));
            //console.log(id+"==========删除图片：===="+maxPicture);
            $.ajax({
                url: "${path}/inHosp/delPageImg",
                type: "POST",
                data: {id: id, maxPicture: maxPicture},
                success: function (result) {
                    setTimeout(function () {
                        if (result == 1) {
                            getDelPicPageFun();
                            toastr.success("删除图片成功!");
                        } else {
                            toastr.warning("删除图片失败!");
                        }
                        $("#mb").css("display", "none");
                        spinner.spin();
                    }, 500);
                }
            });
        } else {
            toastr.warning("图片记录不存在!");
        }
    }

    function getDelPicPageFun() {
        var parentId = $("#pdfId").val();
        //console.log(parentId+"=====获取相应的pdf被删除的图片列表========");
        if (parentId != null && parentId != "") {
            //获取相应的pdf被删除的图片列表
            $.ajax({
                url: "${path}/inHosp/selDelPicList",
                type: "POST",
                data: {effective: 1, parentId: parentId},
                success: function (result) {
                    $("#imglist").empty();
                    var img_div = $("#imglist");
                    if (result != null && result.length > 0) {
                        //console.log(result);
                        var img_html = "";
                        var delId = "delId_";
                        var delPageV = "delPageV_";
                        var maxPicture = "";
                        for (var i = 0; i < result.length; i++) {
                            delId = "delId_" + result[i].id;
                            delPageV = "delPageV_" + result[i].id;
                            //console.log("========="+result[i].id+"======delId:"+delId+"===="+result[i].pictureNumber);
                            maxPicture = result[i].maxPicture.replace(/(\/)+/g, '\\');//.replaceAll("/","\\");
                            //console.log(result[i].maxPicture);
                            img_html = "${path}\\" + maxPicture;
                            img_html = "<div class='row showDelDiv'><img class='showImg2' src='" + img_html + "' onclick='javascript:lookBigImg(this)'/>";
                            img_html += "<div clas='row'>"
                                + "<input type='number' class='returnPageCls' id='" + delPageV + "' value='" + result[i].pictureNumber + "' style='max-width:40%'/>"
                                + "<button class='btn btn-primary btn-sm' id='" + delId + "' onclick='javascript:returnPageFun(\"" + encodeURIComponent(maxPicture, "UTF-8") + "\",this)'>还原</button>"
                                + '<button onclick="javascript:delPageFun(\'' + encodeURIComponent(maxPicture, "UTF-8") + '\',this);"  id="' + delId + '" class="btn btn-danger btn-sm">' + '删除' + '</button>'
                                + "</div>";
                            img_html += "</div>";
                            $("#imglist").append(img_html);
                        }
                    } else {
                        $("#imglist").append("暂无可删除图片!");
                        //toastr.warning("暂无删除图片!");
                    }
                }
            });
        } else {
            toastr.warning("记录不存在!");
        }
    }

    <%--function getDept() {--%>
    <%--//获取科室列表--%>
    <%--$.ajax({--%>
    <%--url: "${path}/inHosp/getDept",--%>
    <%--type: "POST",--%>
    <%--data: {effective: 1, typecode: "dept_code"},--%>
    <%--success: function (result) {--%>
    <%--if (result != null) {--%>
    <%--for (var i = 0; i < result.length; i++) {--%>
    <%--$("#deptName").append("<option value=" + result[i].code + ">" + result[i].name + "</option>");--%>
    <%--}--%>
    <%--}--%>
    <%--}--%>
    <%--});--%>
    <%--}--%>

    <%--getDept();--%>

    //处理导出内容,这个方法可以自定义某一行、某一列、甚至某个单元格的内容,也就是将其值设置为自己想要的内容
    function DoOnCellHtmlData(cell, row, col, data) {
        if (row == 0) {
            return data;
        }
        //由于备注列超过6个字的话,通过span标签处理只显示前面6个字,如果直接导出的话会导致内容不完整,因此要将携带完整内容的span标签中title属性的值替换
        if (col == 4 || col == 11 || col == 7) {
            var spanObj = $(data);//将带 <span title="val"></span> 标签的字符串转换为jQuery对象
            var title = spanObj.attr("title");//读取<span title="val"></span>中title属性的值
            //var span = cell[0].firstElementChild;//读取cell数组中的第一个值下的第一个元素
            if (typeof (title) != 'undefined') {
                return title;
            }
        }
        return data;
    }

    function initTable() {
        if (tipLoad == 1) {
            $("#table").bootstrapTable({ // 对应table标签的id
                //method: 'POST',
                url: "${path}/inHosp/inHospitalList", // 获取表格数据的url
                contentType: "application/x-www-form-urlencoded",//一种编码。好像在post请求的时候需要用到。这里用的get请求，注释掉这句话也能拿到数据
                //dataField: "data",//这是返回的json数组的key.默认是"rows".这里只有前后端约定好就行
                cache: false, // 设置为 false 禁用 AJAX 数据缓存， 默认为true
                striped: true,  //是否显示行间隔色
                pagination: true, // 在表格底部显示分页组件，默认false
                paginationShowPageGo: true,
                pageList: [10, 20, 50, 100], // 如果设置了分页，设置可供选择的页面数据条数。设置为All 则显示所有记录。
                smartDisplay: false,
                pageSize: 2, // 页面数据条数
                pageNumber: 1, // 初始化加载第一页，默认第一页
                sidePagination: 'server', // 设置为服务器端分页     客户端：client
                search: false,
                showColumns: true,
                // fixedColumns: true,//固定列
                // fixedNumber:3,//固定前两列
                // sortable: true,
                // sortOrder: "asc",
                toolbar: '#toolbar',//指定工具栏
                searchOnEnterKey: true, //设置为 true时，按回车触发搜索方法，否则自动触发搜索方法
                undefinedText: '---', //当数据为 undefined 时显示的字符
                singleSelect: false,//设置True 将禁止多选
                clickToSelect: true,//设置true 将在点击行时，自动选择rediobox 和 checkbox
                //height:700,     //定义表格的高度。
                searchTimeOut: 500,// 默认500  设置搜索超时时间。
                toolbarAlign: 'right',// 指定 toolbar 水平方向的位置。'left' 或 'right'
                paginationDetailHAlign: 'left',//指定 分页详细信息 在水平方向的位置。'left' 或 'right'。
                showHeader: true,//是否显示列头。
                trimOnSearch: true,//设置为 true 将自动去掉搜索字符的前后空格。
                //是否显示导出按钮
                showExport: true,
                //导出表格方式（默认basic：只导出当前页的表格数据；all：导出所有数据；selected：导出选中的数据）
                exportDataType: "basic",
                //导出文件类型
                exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
                exportOptions: {
                    fileName: document.title
                },
                // showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                // cardView: false,                    //是否显示详细视图
                // detailView: false,                   //是否显示父子表
                queryParams: function (params) {
                    var currPageSize = this.pageSize;
                    if (currPageSize == 2) {
                        currPageSize = 10;
                    }
                    var limit = null;
                    var offset = params.offset;
                    //判断是否导出全部all
                    if ($("#sel_exportoption").val() == "all") {
                        offset = 0;
                        limit = this.totalRows;
                        this.pageSize = limit;
                    } else {
                        limit = currPageSize;
                        this.pageSize = currPageSize;
                    }

                    // var deptList=[];
                    // deptList.push("20050102");
                    // deptList.push("20070102");

                    var url = window.location.href;
                    var deptAdmissionTo = url.substring(url.lastIndexOf('&') + 1).replace("depts=", "");
                    var len = ($("#deptName").val()).length;
                    var bol=0;
                    var deptStr="";
                    if (len > 0) {
                        var deptName = $("#deptName").val();
                        for(var m=0;m<deptName.length;m++){
                            if(deptName[m]!=""){
                                //console.log("m:"+deptName[m]);
                                deptStr += deptName[m]+",";
                            }else{
                                bol=1
                            }
                        }
                        if(bol!=1){
                            deptAdmissionTo=deptStr;
                        }
                    }

                    // if ($("#deptName").val() != "" && $("#deptName").val() != "") {
                    //     deptAdmissionTo = $("#deptName").val();
                    // }
                    /*  var len = ($("#deptName").val()).length;
                      if (len > 0) {
                          var deptName = $("#deptName").val();
                          if (deptName.indexOf("") != -1) {
                              if (deptAdmissionTo != null && deptAdmissionTo != '') {
                                  deptAdmissionTo += "," + $("#deptAdmissionTo").val();
                              } else if ($("#deptAdmissionTo").val() != null && $("#deptAdmissionTo").val() != '') {
                                  deptAdmissionTo = $("#deptAdmissionTo").val();
                              }
                          } else {
                              deptAdmissionTo = $("#deptName").val().toString();
                          }
                      } else {
                          if (deptAdmissionTo != null && deptAdmissionTo != '') {
                              deptAdmissionTo += "," + $("#deptAdmissionTo").val();
                          } else if ($("#deptAdmissionTo").val() != null && $("#deptAdmissionTo").val() != '') {
                              deptAdmissionTo = $("#deptAdmissionTo").val();
                          }
                      }*/

                    var temp = {
                        limit: limit,     //页面大小
                        offset: offset,   //页码
                        order: params.order,      //排位命令（desc，asc）
                        id: $("#id").val(),
                        idNo: $("#idNo").val(),
                        inpNo: "" + $("#inpNo").val(),
                        visitId: "" + $("#visitId").val(),
                        name: "" + $("#name").val(),
                        //deptName: "" + $("#deptName").val(),
                        archivestate: "在院",
                        startDateTo: $("#startDateTo").val(),
                        endDateTo: $("#endDateTo").val(),
                        deptAdmissionTo: deptAdmissionTo
                        // deptList: deptList
                        //20070102 20050102


                    };

                    return temp;
                },
                sortName: 'id', // 要排序的字段
                sortOrder: 'desc', // 排序规则
                columns: [{
                    title: '全选',
                    field: 'select',   //复选框
                    checkbox: true,
                    width: 25,
                    align: 'center',
                    valign: 'middle',

                }, {
                    title: '病案清单id',
                    field: 'id',
                    align: 'left',
                    valign: 'middle',
                    visible: false
                },
                    {
                        title: '住院号',
                        field: 'inpNo',
                        align: 'left',
                        valign: 'middle',
                    },
                    {
                        title: '住院次数',
                        field: 'visitId',
                        align: 'center',
                        valign: 'middle',
                    },
                    {
                        title: '姓名',
                        field: 'name',
                        align: 'left',
                        valign: 'middle',
                    },
                    {
                        title: '性别',
                        field: 'sex',
                        align: 'center',
                        valign: 'middle',
                    },
                    {
                        title: '身份证号',
                        field: 'idNo',
                        align: 'center',
                        valign: 'middle',
                        visible: false
                    },
                    {
                        title: '入院科室',
                        field: 'deptAdmissionTo',
                        align: 'left',
                        valign: 'middle',
                    },
                    {
                        title: '入院日期',
                        field: 'admissionDateTime',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var result = "";
                            if (value != null && value != "") {
                                result = value.substring(0, 10);
                            }
                            return result;
                        }
                    },
                    // {
                    //     title: '出院科室',
                    //     field: 'deptName',
                    //     align: 'center',
                    //     valign: 'middle',
                    // },
                    // {
                    //     title: '出院日期',
                    //     field: 'dischargeDateTime',
                    //     align: 'center',
                    //     valign: 'middle',
                    //     // formatter: function (value, row, index) {
                    //     //     return value
                    //     // }
                    // },
                    // {
                    //     title: '转科室',
                    //     field: 'transfertDept',
                    //     align: 'left',
                    //     visible: true,
                    //     formatter: function (value, row, index) {
                    //         console.log(row.transfertDept);
                    //         return value;
                    //     }
                    // },
                    {
                        title: '主管医生',
                        field: 'transfertDept',
                        align: 'left',
                        visible: false
                    },
                    {
                        title: '状态',
                        field: 'archivestate',
                        align: 'center',
                        valign: 'middle',
                        formatter: function (value, row, index) {
                            //在院  未归档  归档中  初审 已归档 已认证
                            var a = '';
                            if (value == "未归档") {
                                a = '<span style="color:#c12e2a;"><i class="fa fa-times-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            } else if (value == "已归档") {
                                a = '<span style="color:#030378"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            } else if (value == "在院") {
                                a = '<span style="color:#bfa200"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            } else if (value == "归档中") {
                                a = '<span style="color:#698B69"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            } else if (value == "初审") {
                                a = '<span style="color:#8FBC8F"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            } else if (value == "已认证") {
                                a = '<span style="color:#FF7F24"><i class="fa fa-check-circle-o" aria-hidden="true"></i>' + value + '</span>';
                            }
                            return a;
                        }
                    },
                    {
                        title: "操作",
                        align: 'left',
                        valign: 'middle',
                        width: 80, // 定义列的宽度，单位为像素px
                        formatter: function (value, row, index) {
                            var url = window.location.href;
                            var index = url.substring(url.lastIndexOf('?') + 1).replace("num=", "");
                            var html = "";
                            if (index != null && index != "" && index.indexOf("select") != -1) {
                                //return '<button class="btn btn-danger btn-sm" onclick="selectFun(\'' + row + '\')">查看 </button>';
                                html = '<button type="button" class="btn btn-danger btn-sm selInfo" >查看 </button>';// '<a href="javascript:;" class="delete">删除</a>';
                            }
                            return html;

                        }, events: {
                            'click .selInfo': function (e, value, row, index) {
                                $('#selModal').modal({
                                    backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                                    keyboard: true,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                                    show: true//弹出对话框
                                });

                                //同步
                                $("#idLab").html(row.id);
                                $("#nameLab").html(row.name);
                                if (row.admissionDateTime != null && row.admissionDateTime != '') {
                                    $("#inDateLab").html(row.admissionDateTime.substring(0, 10));
                                }
                                $("#chargeLab").html(row.doctorInCharge);
                                $("#deptToLab").html(row.deptAdmissionTo);
                                $("#outDeptToLab").html(row.deptName);
                                $("#outDeptDateLab").html(row.dischargeDateTime);

                                $("#outHospLab").html(row.dischargeDisposition);
                                $("#inLab").html(row.inpNo);
                                $("#inTimeLab").html(row.visitId);
                                //入/出院年+出院月+住院号+住院次数
                                var outDate = "";
                                //console.log("1:" + row.dischargeDateTime);
                                if (row.dischargeDateTime != null && row.dischargeDateTime != "") {

                                    outDate = row.dischargeDateTime.split("-");
                                } else if (row.admissionDateTime != null && row.admissionDateTime != "") {

                                    outDate = row.admissionDateTime.split("-");
                                }
                                //console.log("====="+outDate[0] + "" + outDate[1] + "" + row.inpNo.trim() + "" + row.visitId + "");
                                $("#outDateLab").val(outDate[0] + "" + outDate[1] + "" + row.inpNo.trim() + "" + row.visitId + "");
                                initTree(row.id);
                                getSourceFun();
                            }
                        },
                        cellStyle: function (value, row, index) {
                            return {classes: 'success'}

                        }
                    }
                ],
                onLoadSuccess: function (result) {  //加载成功时执行
                    // console.info("加载成功");
                    tipLoad = 0;
                },
                onLoadError: function () {  //加载失败时执行
                    //console.info("加载数据失败");
                    tipLoad = 0;
                },
                onPostBody: function () {
                    //重点就在这里，获取渲染后的数据列td的宽度赋值给对应头部的th,这样就表头和列就对齐了
                    var header = $(".fixed-table-header table thead tr th");
                    var body = $(".fixed-table-header table tbody tr td");
                    var footer = $(".fixed-table-header table tr td");
                    body.each(function () {
                        header.width((this).width());
                        footer.width((this).width());
                    });
                }

            });
        }
    }

    function getSourceFun(){
        //console.log("获取来源下拉框：sourceSearch");
        var patientId = $("#idLab").html();
        var source=$("#sourceSearch").val();
        var assortId = $("#assortId").html();
        if (assortId == 0) assortId = null;
        var temp = {
            patientId: patientId,
            assortId: assortId,
            source: source,
            flag: flag
        };
        var title = $("#titleSearch").val();
        if (title != null && title != "") {
            temp.title = title;
        }
        $.ajax({
            url: "${path}/inHosp/getSourceByClo", // 获取表格数据的url
            type: "POST",
            data: temp,
            success: function (result) {
                if (result != null) {
                    $("#sourceSearch").empty();
                     if(source==""){
                         $("#sourceSearch").append("<option value=''  selected='slected'>全部</option>");
                     }else {
                         $("#sourceSearch").append("<option value=''>全部</option>");
                     }
                    for(var i=0;i<result.length;i++){
                        if(result[i]!=null) {
                            if (result[i].source != "" && result[i].source != null && result[i].source != undefined) {
                                if(source==result[i].source && source!=""){
                                    $("#sourceSearch").append("<option value='" + result[i].source + "' selected='slected'>" + result[i].source + "</option>");
                                }else {
                                    $("#sourceSearch").append("<option value=" + result[i].source + ">" + result[i].source + "</option>");
                                }
                            } else {
                                $("#sourceSearch").append("<option value='null'>未知</option>");
                            }
                        }else{
                            $("#sourceSearch").append("<option value='-1'>未知</option>");
                        }
                    }
                    $(".selectpicker").selectpicker('refresh');
                } else {
                    toastr.warning("暂无任何来源!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });
    }

    var scollPostion2 = null;
    //var eidtSelRow2=[];
    function initTable2() {
        //idArr = [];
        $("#table2").bootstrapTable({ // 对应table标签的id
            //method: 'POST',
            url: "${path}/inHosp/getAssortdetail", // 获取表格数据的url
            contentType: "application/x-www-form-urlencoded",//一种编码。好像在post请求的时候需要用到。这里用的get请求，注释掉这句话也能拿到数据
            //dataField: "data",//这是返回的json数组的key.默认是"rows".这里只有前后端约定好就行
            cache: false, // 设置为 false 禁用 AJAX 数据缓存， 默认为true
            striped: true,  //表格显示条纹，默认为false
            pagination: true, // 在表格底部显示分页组件，默认false
            paginationShowPageGo: true,
            pageList: [10, 20, 50, 100], // 如果设置了分页，设置可供选择的页面数据条数。设置为All 则显示所有记录。
            smartDisplay: false,
            pageSize: 10, // 页面数据条数
            geNumber: 1, // 初始化加载第一页，默认第一页
            sidePagination: 'server', // 设置为服务器端分页     客户端：client
            search: false,
            toolbar: '#toolbar2',//指定工具栏
            showColumns: true,
            searchOnEnterKey: true, //设置为 true时，按回车触发搜索方法，否则自动触发搜索方法
            undefinedText: '---', //当数据为 undefined 时显示的字符
            singleSelect: false,//设置True 将禁止多选
            clickToSelect: true,//设置true 将在点击行时，自动选择rediobox 和 checkbox
            height: 650,     //定义表格的高度。
            searchTimeOut: 500,// 默认500  设置搜索超时时间。
            toolbarAlign: 'left',// 指定 toolbar 水平方向的位置。'left' 或 'right'
            paginationDetailHAlign: 'left',//指定 分页详细信息 在水平方向的位置。'left' 或 'right'。
            showHeader: true,//是否显示列头。
            trimOnSearch: true,//设置为 true 将自动去掉搜索字符的前后空格。
            queryParams: function (params) {
                var currPageSize = this.pageSize;
                /*if (currPageSize == 2) {
                    currPageSize = 10;
                }*/
                var limit = null;
                var offset = params.offset;
                var patientId = $("#idLab").html();
                var assortId = $("#assortId").html();
                var deptAdmissionTo = "";
                if (assortId == 0) assortId = null;
                //判断是否导出全部all
                if ($("#sel_exportoption").val() == "all") {
                    offset = 0;
                    limit = this.totalRows;
                    this.pageSize = limit;
                } else {
                    limit = currPageSize;
                    this.pageSize = currPageSize;
                }

                var source =null;
                if($("#sourceSearch").val()!=null){
                    source=$("#sourceSearch").val();
                }
                var temp = {
                    limit: limit,     //页面大小
                    offset: offset,   //页码
                    order: params.order,      //排位命令（desc，asc）
                    patientId: patientId,
                    assortId: assortId,
                    source: source,
                    flag: flag
                };

                var title=$("#titleSearch").val();
                if(title!=null && title!=""){
                    temp.title=title;
                }
                return temp;
            },
            sortName: 'assortSort', // 要排序的字段
            sortOrder: 'desc', // 排序规则
            columns: [{
                title: '全选',
                field: 'select',   //复选框
                checkbox: true,
                width: 25,
                align: 'center',
                hidden: true,
            }, {
                title: '序',
                field: 'id',
                align: 'left',
                visible: false
            },

                {
                    title: '分段类id',
                    field: 'assortId',
                    align: 'left',
                    valign: 'middle',
                    visible: false
                },

                {
                    title: '标题',
                    field: 'title',
                    align: 'left',
                    valign: 'middle',
                },
                {
                    title: '上传时间',
                    field: 'uploaddatetime',
                    align: 'left',
                    valign: 'middle',
                    // width: 150, // 定义列的宽度，单位为像素px
                },
                {
                    title: '来源',
                    field: 'source',
                    align: 'center',
                    valign: 'middle',
                    // width: 50, // 定义列的宽度，单位为像素px
                },
                {
                    title: '状态',
                    field: 'flag',
                    align: 'center',
                    valign: 'middle',
                    // width: 80, // 定义列的宽度，单位为像素px
                    formatter: function (value, row, index) {
                        //在院  未归档  归档中  初审 已归档 已认证
                        var a = '';
                        if (value == "1") {
                            a = '<span style="color:red;"><i class="fa fa-times-circle-o" aria-hidden="true"></i>作废</span>';
                        } else if (value == "0") {
                            a = '<span style="color:green"><i class="fa fa-check-circle-o" aria-hidden="true"></i>使用</span>';
                        }
                        return a;
                    }
                },
                {
                    title: "操作",
                    align: 'left',
                    valign: 'middle',
                    //width: 120, // 定义列的宽度，单位为像素px
                    formatter: function (value, row, index) {
                        var url = window.location.href;
                        var index = url.substring(url.lastIndexOf('?') + 1).replace("num=", "");

                        var html = "";

                        if (index != null && index != "" && index.indexOf("edit") != -1) {
                            //return '<button class="btn btn-danger btn-sm" onclick="selectFun(\'' + row + '\')">查看 </button>';
                            html = html + '<button type="button" class="btn btn-info btn-sm editInfo" >编辑 </button>';// '<a href="javascript:;" class="delete">删除</a>';


                        }

                        if (index != null && index != "" && index.indexOf("cancel") != -1) {
                            if (row.flag == "0") {
                                html = html + '<button type="button" class="btn btn-danger btn-sm stateInfo" >作废 </button>';
                            }
                        }

                        if (index != null && index != "" && index.indexOf("delPdf") != -1) {
                            //console.log("===:" + row.pdfPath + "====" + row.source);
                            //删除
                            if (row.pdfPath != null && row.pdfPath != "") {
                                var pdfName = row.pdfPath.substring(row.pdfPath.lastIndexOf('\\') + 1, row.pdfPath.lastIndexOf('.'));
                                if (pdfName != row.assortId) {
                                    if (row.source != null && row.source != "") {
                                        if (row.source.indexOf("后台") != -1) {
                                            html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
                                        }
                                    }
                                }
                            } else {

                                if (row.source != null && row.source != "") {
                                    if (row.source.indexOf("后台") != -1) {
                                        html = html + '<button type="button" class="btn btn-warning btn-sm delPdfInfo" >删除 </button>';
                                    }
                                }
                            }
                        }

                        if (row.source != null && row.source != "") {
                            if (row.source.indexOf("后台") != -1) {
                                if (index != null && index != "" && index.indexOf("delPage") != -1) {
                                    //return '<button class="btn btn-danger btn-sm" onclick="selectFun(\'' + row + '\')">查看 </button>';
                                    html = html + '<button type="button" class="btn btn-primary btn-sm delPdfPage" >删除页 </button>';// '<a href="javascript:;" class="delete">删除</a>';
                                }
                            }
                        }
                        return html;
                    }, events: {
                        'click .editInfo': function (e, value, row, index) {

                            if (row.pdfPath != null && row.pdfPath != "") {
                                //console.log("===:" + row.pdfPath.indexOf(row.assortId + ".pdf") != -1);
                                if (row.pdfPath.indexOf(row.assortId + ".pdf") != -1) {
                                    $("#upPdfDiv").hide();
                                    $("#inpType").attr("disabled", "true");

                                } else {
                                    $("#upPdfDiv").show();
                                    $("#inpType").removeAttr("disabled");
                                }
                            } else {
                                $("#upPdfDiv").show();
                                $("#inpType").removeAttr("disabled");
                            }
                            if (row.source.indexOf("后台") != -1) {
                                $("#addFile").show();
                            } else {
                                $("#addFile").hide();
                                $("#inpType").attr("disabled", "true");

                            }


                            //同步
                            $("#inpId").val(row.id);
                            $("#inpTitle").val(row.title);
                            $("#inpType").val(row.assortId);
                            $("#inpSource").val(row.source);
                            $("#inpFlag").val(row.flag);
                            // console.log(row);
                            $("#pageNumber").val(row.pageNumber);
                            //console.log("===="+ row.pdfPath);
                            $("#pdfPathVal").val(row.pdfPath);
                            if (row.pdfPath != "" && row.pdfPath != null) {
                                $("#pdfPathVal").show();

                                //..\..\..\static\img\pdfFiles\980bda8d-18e3-4deb-bb25-9d2b3784e9f3\HC3SL2HENH348M8X619PMCA7GC5R3125\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf
                                var pdfUrl = "../../" + (row.pdfPath).replace(/\\/g, "/");

                                $("#fileUrlInp").val(pdfUrl);
                                // var pdfUrl = "${path}/static/pdfjs/web/viewer.html?file=../../../static/img/pdfFiles/typesPdf/" + result;//+ result;

                                $('#previewFile').css("display", "block");//显示预览按钮
                                $('#addFile').attr("src", row.pdfPath);
                                //$("#addFile").val("ssss");
                                $('.inp_file').val(null);
                            } else {
                                $("#pdfPathVal").hide();
                                $('#addFile').attr("src", "");
                                $('.inp_file').val(null);
                            }

                            $('#assortModal').modal({
                                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                                show: true//弹出对话框
                            });
                        }, 'click .stateInfo': function (e, value, row, index) {
                            $('#exampleModal').modal({
                                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                                show: true//弹出对话框
                            });

                            //同步
                            $("#idT").val(row.id);

                        }, 'click .delPdfInfo': function (e, value, row, index) {
                            $('#delPdfModal').modal({
                                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                                show: true//弹出对话框
                            });
                            //同步
                            $("#idPdfT").val(row.id);
                            var pdfFileName = row.pdfPath;
                            if (pdfFileName != null && pdfFileName != "") {
                                pdfFileName = pdfFileName.substring(pdfFileName.lastIndexOf('\\') + 1, pdfFileName.lastIndexOf('.'));
                                $("#pdfFileName").val(pdfFileName);
                            }
                        }, 'click .delPdfPage': function (e, value, row, index) {
                            $("#mb").css("display", "block");
                            var target = document.getElementById('delPdfBody');
                            spinner.spin(target);//给id为foo的div 中绑上spinner
                            var pdfPath = row.pdfPath;//.replaceAll("\\","/");
                            //C:/Users/Administrator/Desktop/test/autoPdf/1617156631367.pdf
                            if (pdfPath != "") {
                                pdfPath = pdfPath.replace(/(\\)+/g, '/');
                                pdfPath = "${path}/static/pdfjs/web/viewer.html?file=" + encodeURIComponent("${path}/inHosp/pdfStreamHandeler?url=" + pdfPath);
                                $('#pdf_page').attr('src', pdfPath);
                                //病案号 45e9b098f9da49ffba1843bfc6930cb8
                            } else {
                                toastr.warning("勾选的PDF文件不存在或破损!");
                            }

                            //删除pdf某一页
                            $('#delPdfPageModal').modal({
                                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                                show: true//弹出对话框
                            });

                            // //同步
                            $("#pdfId").val(row.id);
                            $("#pathPdf").val(row.pdfPath);
                            getDelPicPageFun();
                            setTimeout(function () {
                                $("#mb").css("display", "none");
                                spinner.spin();
                            }, 1500);
                        }
                    },
                    cellStyle: function (value, row, index) {
                        return {classes: 'success'}

                    }
                }
            ],
            onLoadSuccess: function (result) {  //加载成功时执行
                // console.info("加载成功");
               // idArr = [];
                $('#table2').bootstrapTable('scrollTo', scollPostion2);
                if (idArr != []) {
                    //对刷新表格的数据选中之前选的id行
                    $('#table2').bootstrapTable("checkBy", {field: 'id', values: idArr});
                    //console.info(idArr);
                }
            },
            onLoadError: function () {  //加载失败时执行
                // console.info("加载数据失败");
                //toastr.warning("用户长时间未操作，请重新登录!");
            }, onCheckAll: function (rows) { //点击全选框时触发的操作
                if (rows != null && rows.length) {
                    for (var i = 0; i < rows.length; i++) {
                        if(idArr.indexOf(row.id)==-1) {
                            idArr.push(rows[i].id);
                        }
                        //eidtSelRow2.push(rows[i].id);
                    }
                }
            }, onCheck: function (row) {//点击每一个单选框时触发的操作
                scollPostion2 = $('#table2').bootstrapTable('getScrollPosition');
                if(idArr.indexOf(row.id)==-1){
                    idArr.push(row.id);
                }

               /* if(eidtSelRow2.indexOf(row.id)==-1){
                    eidtSelRow2.push(row.id);
                }*/

            }, onUncheck: function (row) {//取消每一个单选框时对应的操作；
                var index = idArr.indexOf(row.id);
                if (index > -1) {
                    idArr.splice(index, 1);
                }
               /* var index2 = eidtSelRow2.indexOf(row.id);
                if (index2 > -1) {
                    eidtSelRow2.splice(index2, 1);
                }*/
                //console.log(eidtSelRow2);
            }, onUncheckAll: function (row) {//取消每一个单选框时对应的操作；
                idArr = [];
               // eidtSelRow2= [];
            }

        });
    }

    initTable2();

    $("#flag").click(function () {
        if ($("#flag").is(":checked") == true) {
            //选中触发事件
            flag = 1;
            $('#table2').bootstrapTable('refreshOptions', {limit: 1, offset: 10});
        } else {
            flag = 0;
            //取消选中触发事件
            $('#table2').bootstrapTable('refreshOptions', {limit: 1, offset: 10});
        }
        initTree($("#idLab").html());
        //idArr = [];
    });

    $("#selModal").keydown(function (e) {
        if (e.keyCode == 13) {
            event.preventDefault();//禁用默认回车事件
        }
    });

    //查询
    $('#searchBtn').click(function () {
        if (tipLoad == 0) {
            $("#table").bootstrapTable("refreshOptions", {pageNumber: 1});
        } else {
            toastr.warning("正在查询，请稍等...");
        }
    });

    //添加pdf记录
    $("#addPdfBtn").click(function () {
        if ($('#inpType').val() != null && $('#inpType').val() != "") {
            $("#inpId").val("");
            $("#inpTitle").val("");
            $("#pageNumber").val(1);
            $("#inpSource").val("后台");
            $('#addFile').attr("src", "");
            $('.inp_file').val(null);
            $('#upPdfDiv').show();
            $("#pdfPathVal").hide();
            $('#addFile').show();
            $("#inpType").removeAttr("disabled");
            $('#assortModal').modal({
                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                show: true//弹出对话框
            });
            $('#pdfPathVal').val("");

        } else {
            toastr.warning("请选择分段类别!");
        }
        //$("#addFile").val("");
        //var obj = document.getElementById("fileID");

        // $("#addFile").outerHTML = obj.outerHTML;

        //同步
        //$("#inpId").val(row.id);
        //$("#inpTitle").val(row.title);
        //$("#inpType").val(row.assortId);
        //$("#inpSource").val(row.source);
        //$("#inpFlag").val(row.flag);
        // if (row.pdfPath != "" && row.pdfPath != "") {
        //..\..\..\static\img\pdfFiles\980bda8d-18e3-4deb-bb25-9d2b3784e9f3\HC3SL2HENH348M8X619PMCA7GC5R3125\HC3SL2HENH348M8X619PMCA7GC5R3125.pdf
        // var pdfUrl = "../../" + (row.pdfPath).replace(/\\/g, "/");
        // $("#fileUrlInp").val(pdfUrl);
        // var pdfUrl = "${path}/static/pdfjs/web/viewer.html?file=../../../static/img/pdfFiles/typesPdf/" + result;//+ result;
        // $('#previewFile').css("display", "block");//显示预览按钮
        //  }

    });


    //获取table的高度
    function getHeight() {
        return $(window).height() - 100;
    }

    initTable();


    //2.初始化select的change事件
    $("#sel_exportoption").change(function () {
        $('#table').bootstrapTable('refreshOptions', {
            exportDataType: $(this).val()
        });
    });
    $("#refreshBtn").click(function () {
        //刷新
        $('#table').bootstrapTable('refresh');
    });

    //导出excel功能
    $("#excelBtn").click(function () {
        var id = "" + $("#id").val();
        var inpNo = "" + $("#inpNo").val();
        var visitId = "" + $("#visitId").val();
        var name = "" + $("#name").val();
        var idNo = "" + $("#idNo").val();
        //var deptName = "" + $("#deptName").val();
        var archivestate = "在院";
        var startDateTo = $("#startDateTo").val();
        var endDateTo = $("#endDateTo").val();
        var url = window.location.href;
        var deptAdmissionTo = url.substring(url.lastIndexOf('&') + 1).replace("depts=", "");
        // if (deptAdmissionTo != null && deptAdmissionTo != '') {
        //     deptAdmissionTo +=  "," + $("#deptAdmissionTo").val();
        // } else {
        //     deptAdmissionTo = $("#deptAdmissionTo").val();
        //     //$('#deptDiv').attr('display', 'black');
        // }
        // if ($("#deptName").val() != null || $("#deptName").val() != '') {
        //     deptAdmissionTo = $("#deptName").val();
        // }
        // if (deptName != null) {
        //     if (deptName == ",") {
        //         deptName = "";
        //     }
        // }
        var len = ($("#deptName").val()).length;
        if (len > 0) {
            var deptName = $("#deptName").val();
            if (deptName.indexOf("") != -1) {
                if (deptAdmissionTo != null && deptAdmissionTo != '') {
                    deptAdmissionTo += "," + $("#deptAdmissionTo").val();
                } else if ($("#deptAdmissionTo").val() != null && $("#deptAdmissionTo").val() != '') {
                    deptAdmissionTo = $("#deptAdmissionTo").val();
                }
            } else {
                deptAdmissionTo = $("#deptName").val().toString();
            }
        } else {
            if (deptAdmissionTo != null && deptAdmissionTo != '') {
                deptAdmissionTo += "," + $("#deptAdmissionTo").val();
            } else if ($("#deptAdmissionTo").val() != null && $("#deptAdmissionTo").val() != '') {
                deptAdmissionTo = $("#deptAdmissionTo").val();
            }
        }

        window.location.href = "${path}/inHosp/exportExcel?inpNo=" + inpNo + "&visitId=" + visitId +
            "&name=" + name + "&archivestate=" + archivestate + "&startDateTo=" + startDateTo
            + "&endDateTo=" + endDateTo + "&deptAdmissionTo=" + deptAdmissionTo;

    });

    function initTree(patientId) {
        var target = document.getElementById('foo');
        spinner.spin(target);//给id为foo的div 中绑上spinner
        zNodes = [];
        //获取所有分段列表
        $.ajax({
            url: "${path}/inHosp/getAssort",
            type: "POST",
            data: {patientId: patientId, flag: flag},
            async: true,
            success: function (result) {
                zNodes.push({id: 0, pId: 0, name: "分段列表", open: true});
                if (result.length > 0) {
                    for (var i = 0; i < result.length; i++) {
                        //下拉类别
                        //$("#inpType").append("<option value=" + result[i].assortId + ">" + result[i].assortName + "</option>");
                        //树列表
                        var obj = {};
                        obj.id = result[i].assortId;
                        obj.pId = 0;
                        obj.name = "" + result[i].assortName + "(" + (result[i].pageNum) + ")";
                        obj.assortSort = result[i].assortSort;
                        obj.patientId = result[i].patientId;
                        obj.printFlag = result[i].printFlag;
                        zNodes.push(obj);
                    }
                }
                //$.fn.zTree.init($("#ztree"), setting, zNodes);
                var treeObj = $.fn.zTree.init($("#ztree"), setting, zNodes);
                var node;
                var currId = $("#assortId").html();
                if (currId != "" && currId != null) {
                    //修改选中已选节点
                    node = treeObj.getNodeByParam("id", currId);
                } else {
                    //添加选中父节点
                    var node = treeObj.getNodeByParam("id", 0);
                }
                treeObj.selectNode(node, true);//将指定ID的节点选中
                $('#table2').bootstrapTable('refresh');
                spinner.spin();
            }, error: function () {
                // toastr.error("加载失败!");
            }
        });
    }

    function searchNode() {
        var zTree = $.fn.zTree.getZTreeObj("ztree");
        var value = $("#key").val();
        if (value == "") {
            var nodes = zTree.getNodesByParam("isHidden", true);
            zTree.showNodes(nodes);
        } else {
            nodeList = zTree.getNodesByParamFuzzy("name", value);
            var nodes = zTree.getNodes();
            zTree.hideNodes(nodes[0].children);
            updateNodes(true);
        }
        zTree.expandAll(true);
    }

    function updateNodes(highlight) {
        var zTree = $.fn.zTree.getZTreeObj("ztree");
        for (var i = 0, l = nodeList.length; i < l; i++) {
            zTree.showNode(nodeList[i]);
        }
    }

    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            searchNode();
        }
    });

    //展开
    function expandAll() {
        var treeObj = $.fn.zTree.getZTreeObj("ztree");
        treeObj.expandAll(true);
    }

    //收缩
    function collapseAll() {
        var treeObj = $.fn.zTree.getZTreeObj("ztree");
        treeObj.expandAll(false);
    }

    $("#searchBtn1").click(function () {
        searchNode();
    });

    $("#updateStateBtn").click(function () {
        //选中批量作废
        var id = idArr.toString();
        //判断id
        if (id == null || id == '') {
            toastr.warning("请选择记录!");
            return;
        }
        $.ajax({
            url: "${path}/inHosp/updateStateAll",
            type: "POST",
            data: {"id": id, flag: "1"},
            success: function (result) {
                if (result == 1) {
                    //刷新
                    $('#table2').bootstrapTable('refresh');
                    toastr.success("批量作废成功!");
                } else {
                    toastr.error("批量作废失败，无记录!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });
        //idArr = [];
    });

    $("#updateStateBtn2").click(function () {
        //选中批量使用
        var id = idArr.toString();
        //判断id
        if (id == null || id == '') {
            toastr.warning("请选择记录!");
            return;
        }
        //console.log(id);
        $.ajax({
            url: "${path}/inHosp/updateStateAll",
            type: "POST",
            data: {"id": id, flag: "0"},
            success: function (result) {
                if (result == 1) {
                    //刷新
                    $('#table2').bootstrapTable('refresh');
                    toastr.success("批量使用成功!");
                } else {
                    toastr.error("批量使用失败，无记录!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });
    });

    $("#stateBtn").click(function () {
        $('#exampleModal').modal('hide');  //手动关闭
        var id = $("#idT").val();
        //console.log("===作废事件=======" + id);
        $.ajax({
            url: "${path}/inHosp/updateState",
            type: "POST",
            data: {"id": id, flag: "1"},
            success: function (result) {
                if (result == 1) {
                    //刷新
                    $('#table2').bootstrapTable('refresh');
                    toastr.success("作废成功!");
                } else {
                    toastr.error("作废失败，无该条记录!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });

    });

    //删除pdf
    $("#statePdfBtn").click(function () {
        $('#delPdfModal').modal('hide');  //手动关闭
        var id = $("#idPdfT").val();
        var pdfPath = $("#pdfFileName").val();
        //console.log(id+"===作废事件=======" +pdfPath);
        $.ajax({
            url: "${path}/inHosp/delPdfInfo",
            type: "POST",
            data: {"id": id, "pdfPath": pdfPath},
            success: function (result) {
                if (result == 1) {
                    //刷新
                    $('#table2').bootstrapTable('refresh');
                    initTree($("#idLab").html());
                    toastr.success("删除成功!");

                } else {
                    toastr.error("删除失败，无该条记录!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });

    });

    //删除pdf页码
    $("#delPageBtn").click(function () {
        var pagePdfVal = $("#pagePdf").val();
        if (pagePdfVal == null || pagePdfVal == "") {
            toastr.warning("页码必填!");
            return;
        }
        if (pagePdfVal != null && pagePdfVal != "") {
            if (pagePdfVal <= 0) {
                toastr.warning("起始页码大于0且必填!");
                return;
            }
        }
        if ($("#pagePdf2").val() != null && $("#pagePdf2").val() != "" && pagePdfVal != null && pagePdfVal != "") {
            if ($("#pagePdf2").val() <= 0) {
                toastr.warning("结尾页码需大于0!");
                return;
            } else if ($("#pagePdf2").val() < $("#pagePdf").val()) {
                toastr.warning("结尾页码必须大于起始页码!");
                return;
            }
        }
        $("#numDel").empty();
        if ($("#pagePdf").val() != "" && $("#pagePdf").val() != null) {
            $("#numDel").append($("#pagePdf").val());
            if ($("#pagePdf2").val() != "" && $("#pagePdf2").val() != null) {
                $("#numDel").append("至" + $("#pagePdf2").val());
            }
            $('#delPdfPageModal2').modal({
                backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                show: true//弹出对话框
            });
        } else {
            toastr.warning("请输入页码!");
        }
    });

    //确认删除pdf页码
    $("#delPageBtn2").click(function () {
        $('#delPdfPageModal2').modal('hide');  //手动关闭
        var entity = {};
        entity.id = $("#pdfId").val();
        entity.title = "" + $("#pagePdf").val();
        if ($("#pagePdf2").val() != null && $("#pagePdf2").val() != null) {
            entity.sys = "" + $("#pagePdf2").val();
        } else {
            entity.sys = "";
        }
        entity.pdfPath = $("#pathPdf").val();
        if (entity.id == null || entity.id == "") {
            toastr.warning("id不为空!");
            return;
        }
        if (entity.title == null || entity.title == "") {
            toastr.warning("起始页码必填!");
            return;
        }
        if (entity.title != null && entity.title != "") {
            if (entity.title <= 0) {
                toastr.warning("起始页码大于0必填!");
                return;
            }
        }
        if (entity.pdfPath == null || entity.pdfPath == "") {
            toastr.warning("PDF不存在!");
            return;
        }
        $("#mb").css("display", "block");
        var target = document.getElementById('delPdfBody');
        spinner.spin(target);//给id为foo的div 中绑上spinner
        $.ajax({
            url: "${path}/inHosp/delPdfPage",
            type: "POST",
            data: entity,
            success: function (result) {
                $("#mb").css("display", "none");
                spinner.spin();
                $("#pagePdf").val("");
                $("#pagePdf2").val("");
                //$('#delPdfPageModal').modal('hide');  //手动关闭
                if (result == 1) {
                    //刷新
                    var pageNum = $("#pageNumber").val();
                    $('#pdf_page').attr('src', $('#pdf_page').attr('src'));
                    $("#pageNumber").val(pageNum);
                    getDelPicPageFun();
                    $('#table2').bootstrapTable('refresh');
                    initTree($("#idLab").html());
                    if (entity.sys == "") {
                        toastr.success("删除pdf页数,第" + entity.title + "页成功!");
                    } else {
                        toastr.success("删除pdf页数,第" + entity.title + "至" + entity.sys + "页成功!");
                    }
                } else if (result == 0) {
                    if (entity.sys == "") {
                        toastr.warning("删除pdf页数,第" + entity.title + "页失败!");
                    } else {
                        toastr.success("删除pdf页数,第" + entity.title + "至" + entity.sys + "页成失败!");
                    }
                } else if (result == 2) {
                    toastr.warning("pdf文件不存在!");
                } else if (result == 3) {
                    toastr.warning("删除页码或页数不得大于总页数!");
                } else if (result == 4) {
                    toastr.warning("删除页码前备份失败!");
                } else if (result == 5) {
                    toastr.warning("只剩一页不可再删!");
                }
            }, error: function () {
                toastr.error("操作失败!");
            }
        });
    });


    // $("#addBtn").click(function () {
    //     $("#inpId").val("");
    //     $("#inpTitle").val("");
    //     $("#inpSource").val("后台");
    //     $("#inpFlag").val("0");
    //     $('#assortModal').modal({
    //         backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
    //         keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
    //         show: true//弹出对话框
    //     });
    // });

    function inpFun() {
        var temp = {};
        temp.id = $("#inpId").val();
        temp.title = $("#inpTitle").val();
        temp.assortid = $("#inpType").val();
        temp.source = $("#inpSource").val();
        temp.flag = $("#inpFlag").val();
        temp.masterid = $("#idLab").html();
        temp.sys = "emr_medical_record";
        return temp
    }

    $("#saveBtn").click(function () {
        if ($("#inpTitle").val().length > 100) {
            toastr.warning("内容长度不超过100!");
            return;
        }
        //判断file是否为空，如果不是弹出提示框标识该文件已经存在是否替换
        //console.log($("#addFile").attr("src")=="");
        if ($("#addFile").attr("src") == "") {
            //判断文件类型，并上传pdf
            uploadFileFun();
        } else {
            //提示是否替换已有的pdf文件且判断file是否为空
            //console.log($('#addFile')[0].files[0]);
            if ($('#addFile')[0].files[0] != undefined) {
                $('#tsPdfModal').modal({
                    backdrop: 'static',//backdrop 为 static 时，点击模态对话框的外部区域不会将其关闭。
                    keyboard: false,//keyboard 为 false 时，按下 Esc 键不会关闭 Modal。
                    show: true//弹出对话框
                });
            } else {
                //判断文件类型，并上传pdf
                uploadFileFun();
            }
        }
        //idArr = [];
        <%--$.ajax({--%>
        <%--url: "${path}/inHosp/saveInfo",--%>
        <%--type: "POST",--%>
        <%--data: inpFun(),--%>
        <%--success: function (result) {--%>
        <%--if (result.indexOf("成功") != -1) {--%>
        <%--$('#assortModal').modal('hide');  //手动关闭--%>
        <%--//获取选中节点--%>
        <%--initTree($("#idLab").html());--%>
        <%--toastr.success(result);--%>
        <%--} else {--%>
        <%--toastr.error(result);--%>
        <%--}--%>
        <%--}, error: function () {--%>
        <%--toastr.error("操作失败!");--%>
        <%--}--%>
        <%--});--%>
    });

    $("#thPdfBtn").click(function () {
        $('#tsPdfModal').modal('hide');  //手动关闭
        //判断文件类型，并上传pdf
        uploadFileFun();
    });


    jQuery(function ($) {
        //解决模态框背景色越来越深的问题
        $(document).on('show.bs.modal', '.modal', function (event) {
            $(this).appendTo($('body'));
        }).on('shown.bs.modal', '.modal.in', function (event) {
            setModalsAndBackdropsOrder();
        }).on('hidden.bs.modal', '.modal', function (event) {
            setModalsAndBackdropsOrder();
        });

        function setModalsAndBackdropsOrder() {
            var modalZIndex = 1040;
            $('.modal.in').each(function (index) {
                var $modal = $(this);
                modalZIndex++;
                $modal.css('zIndex', modalZIndex);
                $modal.next('.modal-backdrop.in').addClass('hidden').css('zIndex', modalZIndex - 1);
            });
            $('.modal.in:visible:last').focus().next('.modal-backdrop.in').removeClass('hidden');
        }

        //覆盖Modal.prototype的hideModal方法
        $.fn.modal.Constructor.prototype.hideModal = function () {
            var that = this
            this.$element.hide()
            this.backdrop(function () {
                //判断当前页面所有的模态框都已经隐藏了之后body移除.modal-open，即body出现滚动条。
                $('.modal.fade.in').length === 0 && that.$body.removeClass('modal-open')
                that.resetAdjustments()
                that.resetScrollbar()
                that.$element.trigger('hidden.bs.modal')
            })
        }
    });

    function enter() {
        if (event.keyCode == 13) {
            document.getElementById('searchBtn').click();
        }
    }
</script>

</html>