<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <div  class="content-wrapper" style="margin-left:0;">
            <div  id="dialog" style="display: none;width: 600px;height: 400px;border: solid white 1px;background: #ffffff;position: fixed;z-index: 2;left:25%;bottom:30%">
                <div style="width: 600px;height: 50px;background: ghostwhite;">
                    <span style="line-height: 50px;padding-left: 30px;font-weight: bold">审核未通过原因</span>
                </div>
                <div style="padding-left: 120px;padding-top: 50px">
                    <textarea  rows="10" cols="50"  id="descriptionAdd">

            </textarea>
                </div>
                <div style="padding-top: 15px;width: 100%;border-bottom: black solid 1px" ></div>
                <div style="padding-left: 100px;padding-top: 20px">

                    <input type="button" style="width: 200.4px"  class="btn btn-primary" id="confo" onclick="review() " value="确认" >&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;

                    <input  style="width: 200.4px" type="button"  id="close"  class="btn btn-primary" id="close" value="关闭" onclick="closeHide()">
                </div>
            </div>
        <section class="content-header">
            <h1>
                咨询单管理
                <small>咨询单</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">咨询单</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="myForm">
                            <input id="id" name="id" value="$!{data.id}" hidden="true"/>

                            <div class="box-body">

                                <div class="form-group form-md-line-input">
                                    <label>咨询单编码<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="consultId"
                                           id="consultId" readonly="readonly"
                                           maxlength="50" placeholder="用药人姓名"
                                           value="$!{data.consultId}"
                                    >
<!--                                    <div-->
<!--                                           class="form-control" name="consultId"-->
<!--                                           id="consultId"-->
<!--                                           style="height: 68px;background: #EEEEEE"-->
<!--                                    >$!{data.consultId}</div>-->
                                    <label>用药人姓名<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="userName"
                                           id="userName" readonly="readonly"
                                           maxlength="50" placeholder="用药人姓名"
                                           value="$!{data.userName}"
                                    >
<!--                                    <label>身份证号<font style="color: red"></font></label>-->
<!--                                    <input type="text"-->
<!--                                           class="form-control" name="numberId"-->
<!--                                           id="numberId" readonly="readonly"-->
<!--                                           maxlength="50" placeholder="身份证号"-->
<!--                                           value="$!{data.numberId}"-->
<!--                                    >-->
                                    <label>出生年月<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="benebitId"
                                           id="benebitId" readonly="readonly"
                                           maxlength="50" placeholder="出生年月"
                                           value="$!{data.benebitId}"
                                    >
                                    <label>性别<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="sex"
                                           id="sex" readonly="readonly"
                                           maxlength="50" placeholder="出生年月"
                                           value="$!{data.sex}"
                                    >
                                    <label>联系方式<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="iPhone"
                                           id="iPhone" readonly="readonly"
                                           maxlength="50" placeholder="联系方式"
                                           value="$!{data.iPhone}"
                                    >
                                    <label>疾病史<font style="color: red"></font></label>
                                    <div
                                           class="form-control" name="pastRecords"
                                           id="pastRecords"
                                           maxlength="50"
                                           style="height: 68px;background: #EEEEEE"
                                    >$!{data.pastRecords}</div>
                                    <label>过敏史<font style="color: red"></font></label>
                                    <div
                                           class="form-control" name="allergy"
                                           id="allergy"
                                           maxlength="50"
                                           style="height: 68px;background: #EEEEEE"
                                    >$!{data.allergy}</div>

                                    <label>处方单<font style="color: red"></font></label>
                                    <br/>
                                    <div class="form-group " id="imageurl" style=" width: 130px; height: 120px;margin-left: 5px; padding :10px ;background-color :#f4f4f4; border:  1px solid #CCCCCC">
                                        <img style="cursor:zoom-in; width: 108px;height: 100% "  src="$!{data.prescription}" onclick="imgcli(this)">
                                    </div>



                                    <label>药师姓名<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="doctorName"
                                           id="doctorName" readonly="readonly"
                                           maxlength="50" placeholder="药师姓名"
                                           value="$!{data.pharmaName}"
                                    >
                                    <label>客服姓名<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="customerName"
                                           id="customerName" readonly="readonly"
                                           maxlength="50" placeholder="客服姓名"
                                           value="$!{data.customerName}"
                                    >
                                    <label>病情描述<font style="color: red"></font></label>
                                    <div
                                           class="form-control" name="illness"
                                           id="illness"
                                           maxlength="50"
                                           style="height: 68px;background: #EEEEEE"
                                    >$!{data.illness}</div>
                                    <label>审核状态<font style="color: red"></font></label>
                                    <input type="text"
                                           class="form-control" name="status"
                                           id="status" readonly="readonly"
                                           maxlength="50" placeholder="status"
                                           value="$!{data.status}"
                                    >
                                    <label>备注(审核未通过原因)<font style="color: red"></font></label>
                                    <div
                                           class="form-control" name="description"
                                           id="description"
                                           maxlength="50"
                                           style="height: 68px;background: #EEEEEE"
                                    >$!{data.description}</div>


                                </div>

                                <div class="box-footer">
                                    #if($shiro.hasPermission("qy:consultSheet:edit"))
                                    <input class="btn btn-info" id="save" value="通过" type="submit">
                                    <a id="reject"  class="btn btn-danger" onclick="beizhu()">拒绝</a>
                                    #end
                                    <a  href="#springUrl('/a/consultSheet/list')" class="btn btn-default">返回</a>
                                </div>
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<div  id="divimg" style="cursor:zoom-out;background: rgba(0,0,0,.6);width:100%;height:100%;position: absolute;z-index: 9999;left: 0;top: 0;display: none" onclick="hide()">
    <img style="width: 50%;margin-left: 30%; ">
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
    var  consultid

    function beizhu() {
        $("#dialog").show();
    }
    function closeHide(){

        $("#dialog").hide();
    }

    // href="#springUrl('/a/consultSheet/list')"
    $().ready(function () {
          consultid = $("#consultId").val();

        var value = $("#sex").val();
        // if (value == 0) {
        //     $("#sex").val("女");
        // } else {
        //     $("#sex").val("男");
        // }
        var status = $("#status").val();
        console.log("status:", status)
        if (status == 0) {
            $("#status").val("未审核");
        } else if (status == 1) {
            $("#status").val("已通过");
        } else if (status == 2) {
            $("#status").val("已拒绝");
        }
        if (status == 1 || status == 2) {
            $("#reject").hide();
            $("#save").hide();
        }


        Cfapp.init();
        recdTypeAdd.init();
    });


    $('#divimg').click(function(){$(this).fadeOut(200)})
    function imgcli(obj) {
        console.log($(obj).attr("src"))
        $('#divimg').fadeIn(200);
        $('#divimg img').attr('src', $(obj).attr("src"));
        $('#divimg img').css("margin-top", "10%")
        $('#divimg img').css("height", "55%")

    }
    function hide() {
        $("#hide").hide();
    }
    function review() {

        var url = "#springUrl('/a/consultSheet/updateData')";

        var   descriptionAdd = $("#descriptionAdd").val();
        var aadata ={
            consultId : consultid,
            status : "2",
            description:descriptionAdd
        };

        $.ajax({
            url:url,
            data:aadata,
            type:"GET",
            dataType:"JSON",
            success:function(data){
                if(data.errorNo==1){
                    alert("拒绝成功");
                    location.href = "#springUrl('/a/consultSheet/list')"
                }else if (data.errorNo==0){
                    alert("拒绝失败");
                    location.href = "#springUrl('/a/consultSheet/list')"
                }
            }
        });
    }
    var recdTypeAdd = function () {
        var initForm = function () {
            var initFormCtrl = function () {
                bindEvent();
            };
            var bindEvent = function () {

                $("#myForm").validate({
                    rules: {},
                    messages: {},
                    submitHandler: function (form) {
                        // $("#save").attr("disabled", true);
                      // var dataJSON =  $("#myForm").serialize();
                      var dataJSON =  {};
                        dataJSON.consultId  = $("#consultId").val();
                        dataJSON.status = "1";
                        $.getJSON("#springUrl('/a/consultSheet/updateStatus')",dataJSON , function (returnobj) {

                            // $("#save").attr("disabled", false);
                            if (returnobj.errorNo == 1) {  //保存成功
                                Cfapp.confirm({
                                    message: "审核成功",
                                    btncanceltext: "关闭",
                                    success: function () {
                                        location.href = "#springUrl('/a/consultSheet/list')";
                                    },
                                    cancel: function () {
                                        location.href = "#springUrl('/a/consultSheet/list')";
                                    }
                                });
                            } else if (returnobj.errorNo == 0) {  //修改成功
                                Cfapp.alert({
                                    message: "审核失败",
                                    btntext: "确定",
                                    success: function () {
                                        location.href = "#springUrl('/a/consultSheet/list')";
                                    }
                                });
                            }
                        });
                    }
                })
            }
            initFormCtrl();
        }
        return {

            //main function to initiate the module
            init: function () {
                initForm();
            }

        };
    }();
</script>
</body>

<!-- END BODY -->
</html>