var d = dialog({contentType:'load', skin:'bk-popup'}); var pagetype = 48; var barCode; $(function(){ checkUserAgent(); getImmuneMembers(); bindEvents(); }) function getImmuneMembers(){ var data = {}; sendPost("patient/family/members", data, "json", "get", queryListFailed, queryAppoListSuccesss); } function queryAppoListSuccesss(res){ if (res.status == 200) { barCode = ""; if (res.data.immunemembers.length > 0) { showMember(res); } if(res.data.immunemembers.length == 0){ $('#wrapper2').css('top','0px'); d.close(); $(".main").hide(); $(".div-no-info").show(); } }else{ //非200则为失败 queryListFailed(res); } } function queryListFailed(res) { if (res && 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 showMember(res){ var html='', data=res.data.immunemembers; for(var i=0;i\ \
'+data[i].name+'('+data[i].familyRelationName+')
' } html = '
\
'+html+'
'; $('#memberContainer').append(html); setTimeout(function(){ addEvent(); },200) initData(); } function active(one){ one.find('img').css({width: '55px',height: '55px'}); one.find('.name').css({'font-size': '14px','line-height':'23px'}); } function addEvent(){ mui('.family-member').scroll({ scrollY: false, //是否竖向滚动 scrollX: true, //是否横向滚动 }); $('#memberContainer').on('tap','.mui-control-item',function(){ var $this = $(this), $code = $this.data('code'); barCode = $code; $('.mui-control-item').find('img').css({width: '40px',height: '40px'}); $('.mui-control-item').find('.name').css({'font-size': '12px','line-height':'20px'}); active($this); initData(); }) } function initData(){ $(".c-list").html(""); pageIndex = 1; getMyAppo(); } function getMyAppo(){ d.show(); var data={}; if(barCode==""){ var $ul = $('#memberContainer').find('.mui-control-item'); barCode = $ul.eq(0).data('code') if(barCode){ active($ul.eq(0)); } } if(barCode){ $('#wrapper2').css('top','90px'); $('.div-no-info').css('padding-top','150px'); $(".main").show(); $(".div-no-info").hide(); data.BarCode = barCode; sendPost('/patient/guahao/imm/GetResImmuneListWithBarCode', data, 'json', 'get', getListFail, successFun); }else{ $('#wrapper2').css('top','0px'); d.close(); $(".main").hide(); $(".div-no-info").show(); } } function successFun(res){ if(res.status==200){ if(res.data&&res.data.length>0){ pageIndex=pageIndex+1; appendMyAppo(res.data); }else{ if(pageIndex==1){ $(".main").hide(); $(".div-no-info").show(); $("#footer").show(); }else{ dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show(); } d.close(); } }else{ getListFail(res); } } function getListFail(res){ d.close(); if (res && res.msg) { if((res.msg).indexOf("SOAP")>=0){ dialog({contentType:'tipsbox', skin:'bk-popup' , content:"医院接口访问异常,请刷新后重试!",bottom:true}).show(); return false; } dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg,bottom:true}).show(); } else { dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败',bottom:true}).show(); } } function appendMyAppo(dataList){ var appoHtml =""; appoHtml = template("doctor_list_tmp", {list:dataList}); $(".c-list").append(appoHtml); setTimeout(function(){ scroller1.myScroll.refresh(); },500) d.close(); $(".main").show(); $("#footer").show(); } function bindEvents(){ $(".c-list").on("click",".n-list-li,.n-list-content",function(event){ var parentLi = $(this).closest("li"); var id = parentLi.attr("data-id"); var guahaoTime = parentLi.attr("guahao-time"); var jiuzhenTime = parentLi.attr("jiuzhen-time"); var jiezhongHospital = parentLi.attr("jiezhong-hospital"); var jiuzhenName = parentLi.attr("jiuzhen-name"); var idCard = parentLi.attr("id-card"); var hospitalCard = parentLi.attr("hospital-card"); var dataPhone = parentLi.attr("data-phone"); var dataStatus = parentLi.attr("data-status"); var SectionType = parentLi.attr("Section-type"); var hospitalId = parentLi.attr("hospital-id"); location.href = "detail-immune-appointment.html?barCode="+id+"&guahaoTime="+guahaoTime +"&jiuzhenTime="+jiuzhenTime+"&jiezhongHospital="+jiezhongHospital+"&jiuzhenName="+jiuzhenName+"&idCard="+idCard +"&hospitalCard="+hospitalCard+"&dataPhone="+dataPhone+"&dataStatus="+dataStatus+"&SectionType="+SectionType+"&hospitalId="+hospitalId; }).on("click",".div-again",function(){ var parentLi = $(this).closest("li"); var hospitalId = parentLi.attr("hospital-id"); location.href = "immune-date.html?hospitalId="+hospitalId; }) $(".div-add-btn").on("click",function(){ location.href = "appointment-register.html"; }) } //下拉刷新 function pullDownAction(theScrollerTemp) { // $(".main").hide(); // $("#footer").hide(); // $(".pullDown").show(); // initData(); // setTimeout(function () { // $(".pullDown").hide(); // }, 1000); } //将scroller1的初始化代码放到外面来,不然从微信授权重定向过来这个页面的时候, //iscroll-pull-up-down 里监听的window的load方法不会触发,导致scroller初始化代码没有执行 var scroller1 = new IScrollPullUpDown('wrapper2',{ probeType:2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel:false, scrollbars:true, fadeScrollbars:true, click:true, interactiveScrollbars:false },pullDownAction,null);