Ver código fonte

厦门i健康1.4.8版本的代码作为初始版本

raolu 6 anos atrás
pai
commit
97b9337a1e

+ 194 - 0
html/xuqian/css/information.css

@ -0,0 +1,194 @@
.bgc-826edb{background-color: #826edb;}
.bgc-1dbe78{background-color: #1dbe78;}
.bgc-f59701{background-color: #f59701;}
.bgc-37affb{background-color: #37affb;}
.bgc-19d5c5{background-color: #19d5c5;}
.bgc-2e2068{background-color: #2e2068;}
.c-00e669{color: #00e669;}
.c-ffff00{color: #ffff00;}
.c-f7af99{color: #f7af99;}
.mt90{margin-top: 90px;}
.info-img{
    position: absolute;
    /*bottom: 50px;*/
    left: 0;
    width: 100%;
    top: 36%;
    -webkit-transform: translateY(-50%);
    -o-transform: translateY(-50%);
    transform: translateY(-50%);
    z-index: -1;
}
.info-img3{
    position: absolute;
    left:0;
    bottom: 0;
    width: 100%;
    z-index: -1;
}
.info-img4{
    top: 60%;
}
.info-img0{
    top: 50%;
    -webkit-transform: translateY(-50%);
    -o-transform: translateY(-50%);
    transform: translateY(-50%);
}
.pre-btn, .next-btn{
    /*display: inline-block;*/
    position: absolute;
    left: 50%;
    width: 40px;
    margin-left: -20px;
    z-index: 100;
}
.pre-btn img, .next-btn img{
    width: 100%;
}
.pre-btn{
    top: 10px;
}
.next-btn{
    bottom: 20px;
}
.page-text{
    position: absolute;
    z-index: 100;
}
.page1-text{
    position: relative;
    border-radius: 5px;
    height: 36px;
    line-height: 36px;
}
.page1-text img{
    position: absolute;
    width: 68%;
    right: 15px;
    margin-top: 6px;
}
.page1-text .num{
    position: absolute;
    right: 15%;
}
.page1-div1{
    margin-top: 50px;
}
.page1-text-1{
    top: 19%;
    right: 24%;
}
.page2-div1{
    background: url(../images/02xuanqian_img02_bg.png) no-repeat;
    background-size: 100%;
    width: 100%;
    height: auto;
    margin-top: 60px;
}
.page2-text-1{
    padding: 0 10%;
    width: 100%;
    text-align: center;
    padding-bottom: 5px;
}
.page2-text-3{
    top: 5%;
    left: 50%;
    margin-left: -13px;
}
.page2-text-4{
    top: 39%;
    left: 11%;
}
.page2-text-5{
    top: 39%;
    left: 50%;
}
.page2-text-6{
    top: 66%;
    left: 31%;
}
.more-btn{
    position: absolute;
    left: 50%;
    bottom: 20px;
    margin-left: -90px;
    background-color: #f3f3f3;
    color: #666;
    border-radius: 5px;
}
@media only screen and (width: 320px) {
    
    .page1-div1{
        margin-top: 19px;
    }
    .page1-text-1{
        top: 6px;
        right: 76px;
    }
    .page1-text img{
        width: 60%;
        margin-top: 10px;
    }
    .page1-text .num{
        right: 12%;
    }
    .page2-div1{
        margin-top: 50px;
    }
    .page2-text-1,
    .page2-text-2{
        margin-top: -2px;
    }
    .page2-text-3{
        top: 2px;
    }
    .page2-text-4,
    .page2-text-5{
        top: 35%;
    }
    .page2-text-6{
        top: 62%;
    }
}
#loading{
    position: absolute;
    top: 0;
    left:0;
    width: 100%;
    height: 100%;
    background-color: #f3f3f3;
    z-index: 2;
}
.result-info{
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 100%;
}
.bottom-btn{
    position: absolute;
    left: 0;
    width: 100%;
    bottom: 20px;
    text-align: center;
}
#skip{
    position: fixed;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    line-height: 35px;
    color: #fff;
    text-align: center;
    
    background-color: #aaa;
    border-radius: 50%;
    opacity: 0.8;
    z-index: 5;
    display: none;
}

Diferenças do arquivo suprimidas por serem muito extensas
+ 132 - 0
html/xuqian/html/agreement.html


+ 92 - 0
html/xuqian/html/information.html

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="author" content="yihu.com" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <title>家庭医生续签</title>
        <link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
        <link rel="stylesheet" href="../../../css/cross.css" type="text/css" />
        <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
        <link rel="stylesheet" type="text/css" href="../../../widget/swiper/3.1/swiper.min.css"/>
        <link rel="stylesheet" type="text/css" href="../../../widget/swiper/3.1/animate.min.css"/>
        <link rel="stylesheet" type="text/css" href="../css/information.css"/>
    </head>
    <body>
        <div id="loading">
            <img src="../images/00xuqian_img_bg.png" style="width: 100%;" class="mt50">
            <img src="../images/0.png" class="info-img info-img0 ani">
            <p class="plr20 result-info c-f18 c-bold c-f7af99 c-t-center"></p>
            <div class="bottom-btn c-hide">
                <a class="c-btn plr20 ptb10 c-f16 bgc-19d5c5 border-radius-pill" id="directBtn">我知道了</a>
            </div>
        </div>
        <div id="skip">跳过</div>
        <div class="swiper-container" style="opacity: 0;">
            <div class="swiper-wrapper">
                <div class="swiper-slide swiper-slide1 bgc-826edb c-position-r" data-hash="page1">
                    <div class="c-position-r page1-div1">
                        <img src="../images/01xuanqian_img01_bg.png" style="width: 100%;">
                        <span class="c-f20 c-00e669 page-text page1-text-1 c-bold ani" swiper-animate-effect="bounceIn" swiper-animate-duration="0.5s" swiper-animate-delay="0s"></span>
                    </div>
                    <img src="../images/1.png" class="info-img ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="0" >
                    <a href="#" class="next-btn">
                        <img src="../images/anniu_xia_btn.png">
                    </a>
                </div>
                <div class="swiper-slide swiper-slide2 bgc-1dbe78" data-hash="page2">
                    <div class="page2-div1">
                        
                    </div>
                    <div class="c-position-r">
                        <img src="../images/02xuanqian_img_bg.png" style="width: 100%;">
                        <span class="c-f20 c-ffff00 page-text page2-text-3 c-bold ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="1s"></span>
                        <span class="c-f20 c-ffff00 page-text page2-text-4 c-bold ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="1.5s"></span>
                        <span class="c-f20 c-ffff00 page-text page2-text-5 c-bold ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="2s"></span>
                        <span class="c-f20 c-ffff00 page-text page2-text-6 c-bold ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="2.5s"></span>
                    </div>
                    <img src="../images/2.png" class="info-img resize ani" swiper-animate-effect="fadeInLeft" swiper-animate-duration="0.5s" swiper-animate-delay="0">
                    <a href="#" class="pre-btn">
                        <img src="../images/anniu_shang_btn.png">
                    </a>
                    <a href="#" class="next-btn">
                        <img src="../images/anniu_xia_btn.png">
                    </a>
                </div>
                <div class="swiper-slide swiper-slide3 bgc-f59701" data-hash="page3">
                    <img src="../images/03xuanqian_img_bg.png" style="width: 100%;" class="ani mt50" swiper-animate-effect="bounceIn" swiper-animate-duration="0.5s" swiper-animate-delay="0s">
                    <img src="../images/3.png" class="info-img3" style="bottom: 0;">
                    <a href="#" class="pre-btn">
                        <img src="../images/anniu_shang_btn.png">
                    </a>
                    <a href="#" class="next-btn">
                        <img src="../images/anniu_xia_btn.png">
                    </a>
                </div>
                <div class="swiper-slide swiper-slide4 bgc-37affb" data-hash="page4">
                    <img src="../images/04xuanqian_img_bg.png" style="width: 100%;" class="ani mt90" swiper-animate-effect="lightSpeedIn" swiper-animate-duration="0.5s" swiper-animate-delay="0s">
                    <img src="../images/4.png" class="info-img info-img4">
                    <a href="#" class="pre-btn">
                        <img src="../images/anniu_shang_btn.png">
                    </a>
                    <a class="c-btn c-f16 more-btn">我要续签</a>
                </div>
            </div>
        </div>
        <script src="../../../js/jquery/2.1.3/jquery.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/weixin_common.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
        <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../widget/swiper/3.1/swiper.jquery.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../widget/swiper/3.1/swiper.animate1.0.2.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
        <script src="../js/information.js?v=1341" type="text/javascript" charset="utf-8"></script>
    </body>
</html>

BIN
html/xuqian/images/0.png


BIN
html/xuqian/images/00xuqian_img_bg.png


BIN
html/xuqian/images/01xuanqian_img01_bg.png


BIN
html/xuqian/images/01xuanqian_img02_bg.png


BIN
html/xuqian/images/02xuanqian_img02_bg.png


BIN
html/xuqian/images/02xuanqian_img_bg.png


BIN
html/xuqian/images/03xuanqian_img_bg.png


BIN
html/xuqian/images/04xuanqian_img_bg.png


BIN
html/xuqian/images/1.png


BIN
html/xuqian/images/2.png


BIN
html/xuqian/images/3.png


BIN
html/xuqian/images/4.png


BIN
html/xuqian/images/anniu_shang_btn.png


BIN
html/xuqian/images/anniu_xia_btn.png


BIN
html/xuqian/images/icon_more.png


+ 402 - 0
html/xuqian/js/argument.js

@ -0,0 +1,402 @@
var d = dialog({contentType:'load', skin:'bk-popup', content:''});
var userAgent = localStorage.getItem(agentName);
var patient, doctor, healthDoctor, doctorName, healthDoctorName;
var doctors = []; 
var request = GetRequest();
var changeDoctor = request.changeDoctor; //标记是否是从医生发起的模板消息
var request = GetRequest();
var signStatus = request.signStatus;
var isSignLimit = false; //判断签约人数是否达到上限
if(userAgent){
    userAgent = JSON.parse(userAgent);
    patient = userAgent.represented?userAgent.represented:userAgent.uid;
}
$(function() {
//  var referrer = document.referrer;
    getSignMessage();
    
    $('#agree_btn').on('click',function() {
        //判断协议checkbox是否选中
        var $checkbox = $("#agree-checkbox");
        if(!$checkbox.prop("checked")){
            dialog({
                content:'您还未同意家庭医生签约协议',
                skin:'bk-popup', 
                contentType:'tipsbox',
                bottom: true
            }).show();
            return false;
        }else{
            checkRenewEnable();
        }
    });
    
    $("#changeDoctor").on("click", function(){
        window.localStorage.setItem("is_renew", "1");
        window.location.href = "../../qygl/html/select-doctor.html?renew=1";
    });
});
function checkRenewEnable(){
    //判断是否可以续签
    var url = "/patient/family_contract/checkCanRenew",
        params = {patient: userAgent.represented?userAgent.represented:userAgent.uid};
    d.show();
    sendPost(url, params, "json", "post", reqFailed , function(res){
        if(res.status == 200){
            d.close();
            var code = res.data.code,
                msg = res.data.mes,
                enable = true;
            var now = new Date(),
                signYear = now.getFullYear()+"~"+(now.getFullYear()+1);
            
            switch (parseInt(code)){
                case -5:
                    msg = "医生已同意您的续签,您无需再次签约";
                    enable = false;
                    break;
                case -4:
                    msg = "您当前无可续签的家庭医生,可在签约管理页面签约医生";
                    enable = false;
                    break;
                case -3:
                    //已经提交续签申请了
                    msg = "您已提交过申请,无需重复提交";
                    enable = false;
                    break;
                case -2:
                    msg = "您已完成"+signYear+"年度签约,不能再次签约";
                    enable = false;
                    break;
                case -1:
                    msg = "当前时间段不允许续签,可前往签约管理页面签约医生";
                    enable = false;
                    break;
                case 0:
                    msg = "患者数据有误";
                    enable = false;
                    break;
            }
            if(!enable){
                if(code == "-4" || code == "-1"){
                    dialog({
                        content: msg,
                        okValue: "我知道了",
                        ok: function(){
                            location.href = "../../qygl/html/signing_management.html";
                        }
                    }).showModal();
                }else{
                    dialog({
                        content: msg,
                        okValue: "我知道了",
                        ok: function(){
                        }
                    }).showModal();
                }
            }else{
                showDialogInfo(code);
            }
        }else{
            reqFailed(res);
        }
    });
}
//弹框信息
function showDialogInfo(status){
    if(status == 1){
        if(parseInt(changeDoctor)){
            if(isSignLimit){
                dialog({
                    content: doctors.join("、")+"医生签约人数已达上限,请重新选择签约医生",
                    okValue: "选择其他医生",
                    ok: function(){
                        window.localStorage.setItem("is_renew", "1");
                        window.location.href = "../../qygl/html/select-doctor.html?renew=1";
                    },
                    cancelValue: "我再看看",
                    cancel: function(){}
                }).showModal();
            }else{
                dialog({
                    content: "您希望"+doctors.join("、")+"继续作为家庭医生,为您提供健康服务吗?",
                    okValue: "立即提交",
                    ok: function(){
                        var renew = window.localStorage.getItem("is_renew");
                        if(renew){
                            window.localStorage.setItem("is_renew", "0");
                        }
//                      renewSign();
                        getBaseInfo(); //获取是否有医疗保险号信息,没有需弹框提示患者输入
                    },
                    cancelValue: "我再看看",
                    cancel: function(){}
                }).showModal();
            }
        }else{
            var content = "";
            if(isSignLimit){
                content = doctors.join("、")+"医生签约人数已达上限,请重新选择签约医生";
                $("#renewSign").hide();
            }else{
                content = "您希望"+doctors.join("、")+"继续作为家庭医生,为您提供健康服务吗?";
            }
            $("#remind-msg").text(content);
            mui('#sheet1').popover('toggle');
        }
    }
    if(status == 2){ //签约过期的患者
        getOverdueSignMessage();
    }
}
/*获取签约信息*/
function getSignMessage(){
    d.show();
    var url = "/patient/family_contract/getSignMessage",
        params = {patientCode: patient};
    
    sendPost(url, params, "json", "post", reqFailed, function(res){
        if(res.status == 200){
            d.close();
            var len = res.list.length;
            for(i=0; i< len; i++){
                var item = res.list[i];
                if(item.level == 2){
                    doctor = item.code;
                    doctorName = item.name;
                }
                if(item.level == 3){
                    healthDoctor = item.code;
                    healthDoctorName = item.name;
                }
            }
            if(doctorName){
                doctors.push(doctorName);
            }
            if(healthDoctorName){
                doctors.push(healthDoctorName);
            }
            if(doctor){
                getDoctorInfo();
            }
        }else{
            reqFailed(res);
        }
    });
}
//获取已过期的签约信息
function getOverdueSignMessage(){
	doctors.length=0;
    var url = "/patient/family_contract/getSignMessageOverdue",
        params = {patientCode: patient};
    d.show();
    sendPost(url, params, "json", "get", reqFailed, function(res){
        if(res.status == 200){
            d.close();
            var len = res.list.length;
            for(i=0; i< len; i++){
                var item = res.list[i];
                if(item.level == 2){
                    doctor = item.code;
                    doctorName = item.name;
                }
                if(item.level == 3){
                    healthDoctor = item.code;
                    healthDoctorName = item.name;
                }
            }
            if(doctorName){
                doctors.push(doctorName);
            }
            if(healthDoctorName){
                doctors.push(healthDoctorName);
            }
            //如果获取不到全科医生的信息,即全科医生变成健管师
            if(!doctor){
                dialog({
                    content: "您要续签的医生不再提供全科服务,请重选续签医生~",
                    okValue: "选择其他医生",
                    ok: function(){
                        window.localStorage.setItem("is_renew", "1");
                        window.location.href = "../../qygl/html/select-doctor.html?renew=1";
                    },
                    cancelValue: "我再看看",
                    cancel: function(){}
                }).showModal();
                return false;
            }
            getDoctorInfo(function(){
                if(parseInt(changeDoctor)){
                    if(isSignLimit){
                        dialog({
                            content: doctors.join("、")+"医生签约人数已达上限,请重新选择签约医生",
                            okValue: "选择其他医生",
                            ok: function(){
                                window.localStorage.setItem("is_renew", "1");
                                window.location.href = "../../qygl/html/select-doctor.html?renew=1";
                            },
                            cancelValue: "我再看看",
                            cancel: function(){}
                        }).showModal();
                    }else{
                        dialog({
                            content: "您希望"+doctors.join("、")+"继续作为家庭医生,为您提供健康服务吗?",
                            okValue: "立即提交",
                            ok: function(){
                                var renew = window.localStorage.getItem("is_renew");
                                if(renew){
                                    window.localStorage.setItem("is_renew", "0");
                                }
//                              renewSign();
                                getBaseInfo(); //获取是否有医疗保险号信息,没有需弹框提示患者输入
                            },
                            cancelValue: "我再看看",
                            cancel: function(){}
                        }).showModal();
                    }
                }else{
                    var content = "";
                    if(isSignLimit){
                        content = doctors.join("、")+"医生签约人数已达上限,请重新选择签约医生";
                        $("#renewSign").hide();
                    }else{
                        content = "您希望"+doctors.join("、")+"继续作为家庭医生,为您提供健康服务吗?";
                    }
                    $("#remind-msg").text(content);
                    mui('#sheet1').popover('toggle');
                }
            });
            
        }else{
            reqFailed(res);
        }
    });
}
//获取医生是否签约达到上限
function getDoctorInfo(cb){
    var url = 'family_contract/homepage/homepage',
        data = {doctor: doctor};
    sendPost(url, data, 'json', 'post', reqFailed, function(res){
        if(res.status == 200){
            //判断签约人数是否达到上限
            if(res.data.signTotal >= res.data.limitTotal){
                isSignLimit = true;
            }
            if(cb && (typeof cb == "function")){
                cb();
            }
        }else{
            reqFailed(res);
        }
    });
}
var medicareNumber = "";
//获取是否有医疗保险号信息,没有需弹框提示患者输入
function getBaseInfo(){
	var submited = false
    sendPost('patient/baseinfo', {}, 'json', 'post', reqFailed, function(res) {
        if(res.status == 200){
            if(res.data.medicareNumber){
                medicareNumber = res.data.medicareNumber;
                renewSign();
            }else{
                mui('#sheet1').popover('toggle');
                var width = window.innerWidth - 50 - 30;
                var content = '<div>请完善医疗保险信息</div>'+
                            '<div><input type="text" class="c-f14" style="width:'+width+'px" id="medicareNumber" placeholder="输入医疗保险号"></div>'+
                            '<div class="warning-text c-hide"><span>* 医疗保险号不能为空!</span></div>';
                
                dialog({
                    content: content,
                    okValue: "立即提交",
                    ok: function(){
                    	if(submited === false) {
                    		submited = true
                    		medicareNumber = $("#medicareNumber").val();
	                        if(!medicareNumber){
	                            $("#medicareNumber").focus();
	                            $("#medicareNumber").addClass("required-input");
	                            $(".warning-text").show();
	                            return false;
	                        }else{
	                            renewSign();
	                        }
                    	}
                        
                    },
                    cancelValue: "我再看看",
                    cancel: function(){}
                }).showModal();
            }
        }else{
            reqFailed(res);
        }
    });
}
//续签
function renewSign(){
    //续签时,需要获取患者的医疗保险号
    var url = "/patient/family_contract/signRenew",
        params = {
            doctor: doctor || "",
            healthDoctor: healthDoctor || "",
            patient: patient,
            medicareNumber: medicareNumber
        };
    d.showModal();
    sendPost(url, params, "json", "post", reqFailed, function(res){
        if(res.status == 200){
            d.close();
            window.location.href = "../../qygl/html/signing_management.html";
        }else{
            reqFailed(res);
        }
    })
}
function reqFailed(res){
    d.close();
    if(res.msg){
        dialog({
            contentType:'tipsbox',
            bottom:true, 
            skin:'bk-popup',
            content: res.msg
        }).show();
    }else{
        dialog({
            contentType:'tipsbox',
            bottom:true, 
            skin:'bk-popup',
            content: "请求失败,请重试"
        }).show();
    }
}
function notSignFlow(){
    dialog({
        content: "您当前未签约家庭医生,是否前往签约家庭医生?",
        okValue: "签约家庭医生",
        ok: function(){
            location.href = "../../qygl/html/select-doctor.html";
        },
        cancelValue: "不了,谢谢",
        cancel: function(){}
    }).showModal();
}
function preSignedFlow(){
    dialog({
        content: "您已完成2017~2018年度预签约,不能再次签约",
        okValue: "我知道了",
        ok:{}
    }).showModal();
}

+ 310 - 0
html/xuqian/js/information.js

@ -0,0 +1,310 @@
var d = dialog({contentType:'load', skin:'bk-popup', content:'加载中...'});
var mySwiper;
var pagetype = 33;
var signStatus;
var Request = GetRequest();
var userAgent = localStorage.getItem(agentName);
var changeDoctor = Request.changeDoctor || 0; //标记是否是医生发起的模板消息,1-医生发起的
$(function(){
	var toUser = Request["toUser"];
	var toName = decodeURIComponent(Request["toName"]);
	var openid = Request["openid"];
	var represented = Request["represented"];
	if(!userAgent) {
        window.location.href = server + "wx/html/home/html/zhmm-login.html?type=" + pagetype + "&openid=" + openid;
		return false;	
	}
	var newUaObj = JSON.parse(userAgent)
	//判断关系
	function hasFamilyRelation(a,b){
		return new Promise(function(resolve, reject) {
			var data={
				patient:a,
				familyMember:b
			}
			sendPost("patient/family/is_authorize", data, "json", "get", function(res){
				dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求家庭成员关系失败'}).show(); 
			}, function(res){
				if(res.status == 200) {
					window.localStorage.setItem('nowPatientName',res.data.name);
					resolve(res)
				}else if(res.status == 100) {
					dialog({
						content:'对不起,'+res.data.name+'未授权给您,如需查看,请切换'+res.data.name+'账号登录',
						okValue:'切换账号',
						ok: function() {
							window.localStorage.setItem(pageName, JSON.stringify({pageurl: location.href}))
							window.location.href = "../../grzx/html/change-login.html?type=0&openid="+ Request["openid"];
						},
						cancelValue: '我不看了',
						cancel: function () {
							wx.closeWindow();
			            }
					}).showModal();
				}else{
					relogin();
				}
				
			})
		})
	}
	//重新登录操作
	function relogin(){
		dialog({
			content:'对不起,该消息是发给'+toName+',如需查看,请切换'+toName+'账号登录',
			okValue:'切换账号',
			ok: function() {
				window.localStorage.setItem(pageName, JSON.stringify({pageurl: location.href}))
				window.location.href = "../../grzx/html/change-login.html?type=0&openid="+ Request["openid"];
			},
			cancelValue: '我不看了',
			cancel: function () {
				wx.closeWindow();
            }
		}).showModal();
	}
	//保存信息
	function saveUserInfo(a,b){
		Promise.all([hasFamilyRelation(a,b)]).then(function () {
			newUaObj.represented = represented;
			window.localStorage.setItem(agentName,JSON.stringify(newUaObj));
			userAgent = JSON.parse(localStorage.getItem(agentName));
			queryInit()
		})
	}
	
	function initFamilyData () {
		//从微信模板消息进入
		if(represented && userAgent && toUser){
			if(toUser == represented){
				saveUserInfo(represented,newUaObj.uid)
			}else if(toUser != represented && represented == newUaObj.uid){
				//本人代理
				saveUserInfo(represented,newUaObj.uid)
			}else if(toUser != represented && toUser == newUaObj.uid){
				//需要判定关系 200有授权 100家人 1无关系	
				saveUserInfo(represented,newUaObj.uid)
			}else{
				//重新登录	
				relogin();
			}
		}else{
			userAgent = JSON.parse(userAgent);
			queryInit()
		}
	}
	initFamilyData();
	
    $('.swiper-slide,.swiper-container').css({
        height: $(window).height()
    });
    $(window).on('resize',function(){
        $('.swiper-slide,.swiper-container').css({
            height: $(window).height()
        });
    });
});
function queryInit(){
    var date = new Date();
    getStatistics(); //获得统计数据
    bindEvents();
    getWeixinSign();
}
function reqFailed(res){
    d.close();
    if(res.msg){
        dialog({
            contentType:'tipsbox',
            bottom:true, 
            skin:'bk-popup',
            content: res.msg
        }).show();
    }else{
        dialog({
            contentType:'tipsbox',
            bottom:true, 
            skin:'bk-popup',
            content: "请求失败,请重试"
        }).show();
    }
}
function initSwiper(){
    mySwiper = new Swiper('.swiper-container',{
        setWrapperSize :true,
        direction:"vertical",
        speed : 1000,
        longSwipesRatio : 0.3,
        grabCursor:true,
        nextButton:'.next-btn',
        prevButton:'.pre-btn',
        mousewheelControl : true,
        lazyLoading : true,
        lazyLoadingInPrevNext : true,
        lazyLoadingOnTransitionStart : true,
        onInit: function(swiper){
            setTimeout(function(){
                $("#loading").remove();
                $(".swiper-container").css({"opacity":"1"});
                swiperAnimateCache(swiper);
                swiperAnimate(swiper);
            },1000);
        },
        onSlideChangeEnd: function(swiper){
            swiperAnimate(swiper);
        },
        onTransitionEnd: function(swiper){
            swiperAnimate(swiper);
        }
    });
}
function getStatistics(){
    d.show();
    var url = "/patient/family_contract/getSignCountInfoInYear",
        params = {patient: userAgent.represented?userAgent.represented:userAgent.uid};
    
    sendPost(url, params, "JSON", "get", reqFailed, function(res){
        if(res.status == 200){
            d.close();
            var data = res.data,
                consultTotal = data.consultTotal,
                articleCount = data.articleResult[0].articleCount,
                guidanceCount = data.guidanceResult[0].guidanceCount,
                reservationCount = data.reservationResult[0].reservationCount,
                totalCount = articleCount + guidanceCount + reservationCount;
            if(consultTotal == 0 && totalCount == 0){
                $(".result-info").html("您没有该年度的服务记录");
                $("#directBtn").text("我要续签");
                $("#directBtn").parent().show();
                $("#directBtn").attr("href", "agreement.html?changeDoctor="+changeDoctor);
                return;
            }
            $("#skip").show();
            $(".page1-text-1").text(res.data.consultTotal);
            var len = res.data.consultResult.length;
            var newRs = _.sortBy(res.data.consultResult, function(o){
                return -o.consultCount;
            });
            var page1html = "";
            for(i=0; i<len; i++){
                var item = newRs[i];
                var mt = "";
                if(i > 0){
                    mt = "mt10";
                }
                if(i < 3){
                    page1html += '<div class="mlr10 bgc-2e2068 plr10 page1-text '+mt+' ani" swiper-animate-effect="lightSpeedIn" swiper-animate-duration="0.5s" swiper-animate-delay="'+(i*0.5)+'s">'+
                    '<span class="c-f16 c-00e669">'+item.doctorName+'</span>'+
                    '<img src="../images/01xuanqian_img02_bg.png">'+
                    '<span class="c-f20 c-00e669 num">'+item.consultCount+'</span></div>';
                    
                }else{
                    page1html += '<div class="ani c-t-center mt10" swiper-animate-effect="lightSpeedIn" swiper-animate-duration="0.5s" swiper-animate-delay="'+(i*0.5)+'s"><img src="../images/icon_more.png"></div>'
                    break;
                }
            }
            $(".swiper-slide1").append(page1html);
            
            //第二页内容填充
            var page2html = '<p class="page2-text-1"><span class="c-24 c-bold c-fff mr5">今年</span>';
            var docLen = res.data.doctors.length;
            if(docLen == 0){
                page2html += '<span class="c-f16 c-ffff00">没有</span>';
            }
            for(j=0; j<docLen; j++){
                var item = res.data.doctors[j];
                if(j > 0){
                    page2html += '<span class="c-f16 c-ffff00">、</span>';
                }
                page2html += '<span class="c-f16 c-ffff00 ani" swiper-animate-effect="fadeInDown" swiper-animate-duration="0.5s" swiper-animate-delay="'+(j*0.5)+'s">'+item.name+'</span>';
            }
            page2html += '<span class="c-24 c-bold c-fff ml5">医生</span></p>';
            $(".page2-div1").append(page2html);
            
            $(".page2-text-3").text(totalCount);
            $(".page2-text-4").text(reservationCount);
            $(".page2-text-5").text(guidanceCount);
            $(".page2-text-6").text(articleCount);
            initSwiper();
        }else{
            if(res.status == -1){
                //请求判断是和情况
                var url = "/patient/family_contract/checkCanRenew",
                    params = {patient: userAgent.represented?userAgent.represented:userAgent.uid};
                sendPost(url, params, "json", "post", reqFailed , function(res){
                    if(res.status == 200){
                        var code = res.data.code,
                            msg = "您没有签约关系<br/>请前往签约管理页面签约医生",
                            enable = true;
                        switch (parseInt(code)){
                            case -4:
                                msg = "您当前无可续签的家庭医生<br/>可在签约管理页面签约医生";
                                enable = false;
                                break;
                            case -2:
                                msg = "您已完成新年度的签约<br/>不能再次签约";
                                enable = false;
                                break;
                            case -1:
                                msg = "当前时间段不允许续签<br/>可前往签约管理页面签约医生";
                                enable = false;
                                break;
                        }
                        $(".result-info").html(msg);
                        $("#directBtn").text("我知道了");
                        $("#directBtn").parent().show();
                        $("#directBtn").attr("href", "../../qygl/html/signing_management.html");
                    }else{
                        $(".result-info").html("您没有签约关系<br/>请前往签约管理页面签约医生");
                        $("#directBtn").text("我知道了");
                        $("#directBtn").parent().show();
                        $("#directBtn").attr("href", "../../qygl/html/signing_management.html");
                    }
                    d.close();
                });
                
            }
        }
    });
}
function bindEvents(){
    $(".more-btn").on('tap', function(){
        window.location.href = "agreement.html?signStatus="+signStatus+"&changeDoctor="+changeDoctor;
    });
    $("#skip").on("tap", function(){
        window.location.href = "agreement.html?signStatus="+signStatus+"&changeDoctor="+changeDoctor;
    })
}
function getWeixinSign(){
    var params = {};
    params.pageUrl = window.location.href;
    $.ajax(server + "weixin/getSign", {
        data: params,
        dataType: "json",
        type: "post",
        success: function(res) {
            if(res.status == 200) {
                var t = res.data.timestamp;
                var noncestr = res.data.noncestr;
                var signature = res.data.signature;
                wx.config({
                    //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
                    appId: appId, // 必填,公众号的唯一标识
                    timestamp: t, // 必填,生成签名的时间戳
                    nonceStr: noncestr, // 必填,生成签名的随机串
                    signature: signature, // 必填,签名,见附录1
                    jsApiList: [
                            'closeWindow'
                        ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
                });
            }
        }
    });
}