<div ng-controller="listctr" class="container">
    <div class="title"><i class="title-line"></i>查询条件</div>

    <div class="searchForm row" style="margin:0px;margin-left: 20px;">


        <form class="form-horizontal">

            <div class="form-group">
                <label for="channel1" class="col-md-1 control-label"
                       style="font-weight: normal;color: #666666;">业务来源</label>
                <div class="col-sm-3">
                    <select ng-model="channel1" class="form-control" id='channel1' ng-change="branch()"  ng-options="m.value as  m.policyname for m in model" ng-required="true" name="channelDress">
 <!--                       <option ng-value="1">产险</option>
                        <option ng-value="2">寿险</option>
                        <option ng-value="3">健康险</option>-->
                    </select>
                </div>
                <label for="branchName1" class="col-md-1 control-label" style="font-weight: normal;color: #666666;">分公司</label>
                <div class="col-sm-3">
                    <select ng-model="branchName1" class="form-control" id="branchName1" ng-options="m.branchid as  m.branchname for m in branchs" ng-required="true"
                            name="branchNameDress">
                      <!--  <option>北京分公司</option>-->
                    </select>
                </div>
                <label for="policyHolder1" class="col-md-1 control-label"
                       style="font-weight: normal;color: #666666;">投保人</label>
                <div class="col-sm-3">
                    <input ng-model="policyHolder1" type="text" class="form-control" id="policyHolder1" placeholder=""
                           ng-required="true" name="policyHolderDress"/>
                </div>
            </div>


            <div class="form-group">
                <label for="policyNumber1" class="col-md-1 control-label"
                       style="font-weight: normal;color: #666666;">保单号</label>
                <div class="col-sm-3">
                    <input ng-model="policyNumber1" type="text" class="form-control" id="policyNumber1" placeholder=""
                           ng-required="true" name="resumeDress"/>
                </div>

                <label for="claimNo1" class="col-md-1 control-label"
                       style="font-weight: normal;color: #666666;">赔案号</label>
                <div class="col-sm-3">
                    <input ng-model="claimNo1" type="text" class="form-control" id="claimNo1" placeholder=""
                           ng-required="true" name="claimNoDress"/>
                </div>

                <label for="IdNnumber1" class="col-md-1 control-label"
                       style="font-weight: normal;color: #666666;">证件号</label>
                <div class="col-sm-3">
                    <input ng-model="IdNnumber1" type="text" class="form-control" id="IdNnumber1" placeholder=""
                           ng-required="true" name="IdNnumberDress"/>
                </div>
            </div>


            <div class="form-group">
                <label for="IdNnumber1" class="col-md-1 control-label" style="font-weight: normal;color: #666666;padding-left: 0px;padding-right: 0px;">结案起止日期</label>
                <div class="col-sm-5">
                    <input ng-model="date1" type="text" class="form-control" id="date1" onFocus="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd'})" placeholder=""
                           style="display: inline-block;width: auto;">-<input ng-model="date2" type="text" class="form-control" onFocus="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd'})"  id="date2" placeholder="" style="display: inline-block;width: auto;">
                </div>
                <label class="col-md-1 control-label" style="font-weight: normal;color: #666666;">分值区间</label>
                <div class="col-sm-5">
                    <input ng-model="score1" id="score1" type="text" class="form-control"
                           style="display: inline-block;width: auto;">-<input ng-model="score2" id="score2" type="text"
                                                                              class="form-control"
                                                                              style="display: inline-block;width: auto;">
                </div>
            </div>


        </form>


        <div class="line"></div>
        <div class="submitBtn">
            <button ng-click="listquery()" type="button" class="btn btn-primary">查询11</button>
            <button type="button" id="play1" ng-click="exportExcel()" disabled="disabled"   class="btn btn-default">导出</button>
        </div>
       <input   type="hidden" ng-model="filename" />

    </div>


    <div class="title"><i class="title-line"></i>查询结果</div>
    <div class="tableList row" style="margin:0px;margin-left: 20px;">
        <div border="1px" style="width:1088px;overflow-x: scroll">
            <table id="list-tr" class="table table-bordered" style="width:3000px">
                <thead>
                <tr  align="center">
                    <td width="200px">赔案号</td>
                    <td width="200px">保单号</td>
                    <td width="100px">被保人姓名</td>
                    <td width="200px">证件号</td>
                    <td width="100px">证件类型</td>
                    <td width="100px">投保人</td>

                    <td width="150px">收据总金额</td>
                    <td width="150px">自费</td>
                    <td width="150px">分类自付</td>
                    <td width="150px">统筹支付</td>
                    <td width="150px">第三方支付</td>
                    <td width="150px">立案预估金额</td>
                    <td width="150px">赔付金额</td>
                    <td width="150px">剔除金额</td>
                    <td width="150px">案件状态</td>
                    <td width="150px">赔付结论</td>
                    <td width="150px">挂起类型</td>
                    <td width="80px">结案时间</td>
                    <td width="80px">智控评分</td>
                    <td width="100px">智控报告</td>
                </tr>
                </thead>
                <tbody>
                <tr align="center" ng-repeat="l in items" ng-if="l.claimNo !=null" on-finish-render-filters>
                    <td>{{l.claimNo}}</td>
                    <td>{{l.policyNo}}</td>
                    <td>{{l.policyInsured}}</td>
                    <td>{{l.idNumber}}</td>
                    <td>{{l.type}}</td>
                    <td>{{l.policyholder}}</td>
                    <td>{{l.total_receipt}}</td>
                    <td>{{l.own_expense}}</td>
                    <td>{{l.classification_expense}}</td>
                    <td>{{l.overall_payment}}</td>
                    <td>{{l.third_payment}}</td>
                    <td>{{l.estimated_filing}}</td>
                    <td>{{l.claim_amount}}</td>
                    <td>{{l.excluded_amount}}</td>
                    <td>{{l.case_status}}</td>
                    <td>{{l.claim_conclusion}}</td>
                    <td>{{l.suspend_type}}</td>
                    <td>{{l.enddate}}</td>
                    <td>{{l.score}}</td>
                    <td>
                        <input id="modalbtn" type="hidden" data-toggle= 'modal'data-target='#myModal'>

                        <button ng-click="listoutPutId(l.claimNo)" type="button" class="btn btn-primary" >查看
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="page" style="text-align: center;">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a ng-click="Previous()" aria-label="Previous">
                            <span aria-hidden="true">上一页</span>
                        </a>
                    </li>
                    <li class="active1" ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}">
                        <a ng-click="selectPage(page)">{{page}}</a>
                    </li>
                    <li>
                        <a ng-click="Next()" aria-label="Next">
                            <span aria-hidden="true">下一页</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
<!-- 模态框（Modal） -->
<div ng-controller="chargebox" class="modal fade" id="myModal" tabindex="-1"  role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-Chargecontent">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">创建时间</h4>
            </div>
            <div class="modal-body"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<div ng-controller="analysisCtr"  class="modal fade" id="confirmBox" tabindex="-1" role="dialog"
      aria-labelledby="myModalLabel" aria-hidden="true">
    <div  class="modal-dialog" style="top:5%;" role="document">
        <div   class="modalContent report-wrap">
            <div id="pdfbox" class="report-wrap">
            <div class="report-title">智控分析报告</div>
            <div class="report-content">
                <div class="report-section1">
                    <div class="section1-left">
                        <div class="section1-title white" style="margin-bottom:50px;">综合风险评分</div>
                        <div class="temper-wrap">
                            <div class="temper-inner">
                                <div class="temper-top"></div>
                            </div>
                        </div>
                        <div class="temper-bottom">
                            <span>0</span>
                            <span>200</span>
                            <span>400</span>
                            <span>600</span>
                            <span>800</span>
                            <span>1000</span>
                        </div>
                    </div>
                    <div class="section1-right fr">
                        <div class="section1-title txt-right">综合风险等级</div>
                        <div class="section1-flex">
                            <p class="fl f79 blue">{{levelscore}}</p>
                            <div class="section1-line fl"></div>
                            <div class="fl">
                                <P class="f44 orange">{{level}}</P>
                                <p class="f22 orange">风险</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="report-section2">
                    <div class="fl depart-left">
                        <div class="section-title">分项风险等级</div>
                        <div id="showecharts" class="showecharts" style="width:400px;height:280px;margin-left:20px;margin-top:50px"></div>
                        <div class="section-right-top">
                            <div id="triangle-up"></div>

                            <p id="claim_behavior" class="orange">索赔行为:高</p>
                            <p id="medical_treatment" class="blue">医疗行为:中</p>
                            <p id="disease_diagnosis" class="blue">疾病诊断:中</p>
                            <p id="drug_project" class="green">药品项目:低</p>
                            <p id="diagnosis_project" class="green">诊疗项目:低</p>
                        </div>
                    </div>
                    <div class="fr depart-right">
                        <div class="section-title">赔案基本信息</div>
                        <div class="depart-content">
                            <div class="top">
                                <div class="fl">
                                    <img id="agesvg" src="../compass/app/img/nv.svg">
                                </div>
                                <div class="fl top-right">
                                    <table>
                                        <tr><td><p><span>姓名：</span><span>{{name}}</span></p></td></tr>
                                        <tr><td><p><span>性别：</span><span>{{sex}}</span></p></td></tr>
                                        <tr><td><p><span>年龄：</span><span>{{age}}</span></p></td></tr>
                                    </table>
                                </div>
                            </div>
                            <div class="bottom">
                                <table>
                                    <tr><td><p><span>赔案号：</span><span>{{claimNo_one}}</span></p></td></tr>
                                    <tr><td><p><span>出险日期：</span><span>{{policydate}}</span></p></td></tr>
                                    <tr><td><p><span>索赔日期：</span><span>{{claimdate}}</span></p></td></tr>
                                    <tr><td><p><span>业务来源：</span><span>{{business_source}}</span></p></td></tr>
                                    <tr><td><p><span>分公司：</span><span>{{branch}}</span></p></td></tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="report-section3">
                    <div class="section-title">风险提示及审核指引</div>
                    <table class="deport-table">
                        <thead>
                        <th style="min-width: 244px" width="244">风险提示</th>
                        <th style="min-width: 267px" width="267">风险详细说明</th>
                        <th style="min-width: 282px" width="282">审核方向指引</th>
                        </thead>
                        <tbody>
                        <tr ng-repeat="c in items" ng-if="c.Mname !=null">
                            <td ng-bind-html="c.Mname| to_trusted">{{c.Mname}}</td>
                            <td style="padding: 3px 4px 3px 4px;text-align: left" ng-bind-html=" c.massage| to_trusted">{{c.massage}}</td>
                            <td style="padding: 3px 4px 3px 4px;text-align: left" ng-bind-html="c.advice| to_trusted">{{c.advice}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <form id="myform">
                    <div class="report-section3">
                        <div class="section-title">报告评估反馈</div>

                        <input type="hidden" name="outputId" value="{{outputId}}">
                        <input type="hidden" name="backCount" value="{{backCount}}">
                        <input type="hidden" name="outDetailId" value="{{outDetailId}}">
                        <input type="hidden" name="claimNo_one" value="{{claimNo_one}}">
                        <table class="deport-table">
                            <thead>
                            <th style="min-width: 244px" width="244px">风险提示</th>
                            <th style="min-width: 267px" width="267px">提示反馈</th>
                            <th style="min-width: 282px" width="282px">反馈说明</th>
                            </thead>
                            <tbody>
                            <tr ng-repeat="c in items " ng-if="c.Mname !=null" on-finish-render-filters>
                                <td>{{c.Mname}}</td>
                                <td>
                                    <div class="fl radio-box">
                                        <input  type="radio"  name="{{c.radioname}}"
                                               value="1" class="checkradio " style="margin-right:5px;vertical-align:middle;margin-top:-2px;"><span style="font-size: 12px;">准确</span>
                                    </div>
                                    <div class="fl radio-box">
                                        <input  type="radio"  name="{{c.radioname}}"
                                               value="-1" class="checkradio " style="margin-right:5px;vertical-align:middle;margin-top:-2px;"><span style="font-size: 12px;">不准确</span>
                                    </div>
                                    <div class="fl radio-box">
                                        <input type="radio"  name="{{c.radioname}}"
                                               value="0" class="checkradio " style="margin-right:5px;vertical-align:middle;margin-top:-2px;"><span style="font-size: 12px;">忽略</span>
                                    </div>
                                </td>
                                <td>
                                    <input type="text" name="{{c.textname}}"
                                           class="search_showbox" value="{{c.text}}" style="    padding: 3px 4px 3px 4px;font-size:12px" >
                                </td>
                            </tr>

                            </tbody>
                        </table>

                    </div>
                    <div class="report-section3">
                        <div class="section-title">其他反馈</div>
                        <textarea name="otherFeedBack" id="othertext" ng-model="othertext" style="padding-left:4px;border: 0px;width: 793px;height: 100px">{{othertext}}</textarea>
                    </div>
                </form>
            </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <div style="float: left;z-index: 10;padding-top: 10px">{{createdate}}</div>
                <button type="button" onclick="hidePopup()" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a style="float: right;padding-right: 3px;">
                    <button  id="pdfbtn" style="height: 30px" type="button" class="btn btn-default" data-dismiss="modal">导出为pdf</button>
                </a>
            </div>
        </div>
        <div id="popupcontent"></div>
    </div>
</div>

<!--<script src="../compass/app/js/jquery.form.js"></script>-->
<script src="../compass/app/js/echarts/echarts.min.js"></script>
<script src="../compass/app/js/jsPdf.debug.js"></script>
<script src="../compass/app/js/html2canvas.js"></script>
<script src="../compass/app/js/bluebird.min.js"></script>
<script type="text/javascript">
    $("#pdfbtn").click(
        function(){
            var height = $("#pdfbox").height();
            var width = $("#pdfbox").width();
            html2canvas(document.getElementById("pdfbox"),{
                scale:2,
                height:height*2,
                width:width*2,
                onrendered: function(canvas) {

                    var contentWidth = width;
                    var contentHeight = height;
                    //一页pdf显示html页面生成的canvas高度;
                    var pageHeight =1700;
                    //未生成pdf的html页面高度
                    var leftHeight = contentHeight;
                    //页面偏移
                    var position = 0;
                    //a4纸的尺寸[595.28,841.89]，html页面生成的canvas在pdf中图片的宽高
                    var imgWidth = 1200;
                    var imgHeight =height;

                    var pageData = canvas.toDataURL('image/jpeg', 1.0);
                    var pdf = new jsPDF('', 'pt', 'a4');

                    //有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
                    //当内容未超过pdf一页显示的范围，无需分页
                    /*pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight );*/

                    if(leftHeight<pageHeight) {
                        pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth,pageHeight);
                    } else {
                        while(leftHeight > 0) {
                            //arg3-->距离左边距;arg4-->距离上边距;arg5-->宽度;arg6-->高度
                            pdf.addImage(pageData, 'JPEG', 0, position,imgWidth, imgHeight)
                            leftHeight -= pageHeight;
                            position -= 841.89;
                            //避免添加空白页
                            if(leftHeight > 0) {
                                //注②
                                pdf.addPage();
                            }
                        }
                    }

                    var claim=document.getElementsByName("claimNo_one")[0];
                    pdf.save(claim.value+'.pdf');

                }
            });
        }
    );

    $(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');
    }

</script>