var pageIndex = 1; var pageSize = 100; var patient = null; var hospitalId = null; var deptId= null; var scroller1 = null; var xtCode = ""; mui.init(); mui.plusReady(function(){ var self = plus.webview.currentWebview(); patient = self.patient; hospitalId = self.hospitalId; deptId = self.deptId; xtCode = self.xtCode bindEvents(); initDoctors(); initScroller(); //协同 if(xtCode){ $('#no_appoint').show() $('#no_appoint').on('click',function(){ mui.openWindow({ id: "xietongfuwu-deal", url: "../../xtfw/html/xietongfuwu-deal.html", extras: { type:1, code:xtCode } }) }) } }); function initScroller(){ scroller1 = $("#wrapper3").initScroll( { pullDownAction: function(){ initDoctors(); },pullUpAction: function() { updatePullUpText(scroller1,new Array()); } } ); } var updatePullUpText= function(scroller,list) { var $wrap = $(scroller.wrapper), $pullupLabel = $wrap.find('.pullUpLabel'); $(".pullUp").removeClass("loading"); if(!list || !list.length) { $pullupLabel.text('没有更多'); } else { $pullupLabel.text('上拉加载更多'); } scroller.on('refresh',function() { if(!list || !list.length) { $pullupLabel.text('没有更多'); } else { $pullupLabel.text('上拉加载更多'); } }) } function bindEvents(){ $(".c-list").on("click","li",function(event){ var doctorId = $(this).attr("data-id"); var target = $(event.target); var params = {}; params.patient = patient; params.xtCode = xtCode; if(target.closest(".div-timeList").length==0){ params.type=1; params.doctorId = doctorId; params.hospitalId = hospitalId; params.deptId = deptId; //跳转到医生简介 openWebviewExtras("doctor-detail.html",params); }else{//跳转到门诊预约 var id = target.closest("div").eq(0).attr("data-id"); params.type=2; params.doctorId = doctorId; params.hospitalId = hospitalId; params.deptId = deptId; params.dataid = id; openWebviewExtras("doctor-detail.html",params); } }) } function initDoctors(){ pageIndex = 1 ; $(".c-list").html(""); $("#wrapper3").hide() getDoc(); } function getDoc(){ var data={}; data.city = "350200"; data.filter =""; data.hospitalId = hospitalId; data.hosDeptId = deptId; data.pageIndex = pageIndex; data.pageSize = pageSize; plus.nativeUI.showWaiting(); sendPost('third/guahao/GetDoctorList', data,getListFail, successFun); } function successFun(res){ if(res.status==200){ appendDoc(res.data); }else{ getListFail(res); } } function getListFail(res){ plus.nativeUI.closeWaiting(); if (res && res.msg) { mui.toast(res.msg); } else { mui.toast("医生列表获取失败!"); } } function appendDoc(dataList){ var dochtml =""; if(pageIndex==1){ $(".c-list").html(""); } updatePullUpText(scroller1,dataList); for(var j in dataList){ var data = dataList[j]; getDocTime(data); } } function getDocTime(data){ var params={}; params.OrgCode = hospitalId; params.DeptCode = deptId; params.DocCode = data.id; sendPost('wlyy_service/third/smjk/RegDeptSpeDoctorSectionList', params, getListFail, function(res){ if(res.status==200){ plus.nativeUI.closeWaiting(); if(!res.data||res.data.length==0){ return; } var title = ""; var introduce = ""; var img = getImgUrl(data.photo) || "d-male.png"; if(data.title){ title = '('+data.title+')'; } if(data.introduce){ introduce = '