123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var scroller1,
- scroller2,
- scroller3;
- $(function(){
-
- //医院列表初始化信息
- var pageIndex = 1 ;
- var pageSize = 100;
- var hostpitallist = 0;
-
- //社区列表初始化信息
- var pageIndex1 = 1 ;
- var pageSize1 = 100;
- var communitylist = 0;
-
- //计划免疫列表初始化信息
- var pageIndex2 = 1 ;
- var pageSize2 = 100;
- var immunelist = 0;
-
- bindEvents();
-
- //初始化医院列表
- initHospital();
-
- //初始化社区列表
- initCommunity();
-
- //初始化计划免疫列表
- initImmune();
-
- //下拉刷新
- function pullDownAction(theScrollerTemp) {
- $(".pullDown").show();
- $(".ul-hospital").html("");
- initHospital();
- setTimeout(function () {
- $(".pullDown").hide();
- }, 1000);
- }
-
- //上拉加载数据
- function pullUpAction(theScrollerTemp) {
- if(hostpitallist%100==0){
- $(".pullUp").show();
- getHosptitalByType(1);
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show();
- }
- setTimeout(function () {
- $(".pullUp").hide();
- }, 1000);
- }
-
-
- //下拉刷新
- function pullDownAction2(theScrollerTemp) {
- $(".pullDown").show();
- $(".ul-community").html("");
- initCommunity();
- setTimeout(function () {
- $(".pullDown").hide();
- }, 1000);
- }
-
- //上拉加载数据
- function pullUpAction2(theScrollerTemp) {
- if(communitylist%100==0){
- $(".pullUp").show();
- getHosptitalByType(2);
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show();
- }
- setTimeout(function () {
- $(".pullUp").hide();
- }, 1000);
- }
- initScroller();
- function initScroller(){
- if(!scroller1) {
- scroller1 = new IScrollPullUpDown('wrapper6',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- click:true,
- scrollbars:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- },null,null);
- }
- if(!scroller2) {
- scroller2 = new IScrollPullUpDown('wrapper7',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- click:true,
- scrollbars:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- },null,null);
- }
-
-
- if(!scroller3) {
- scroller3 = new IScrollPullUpDown('wrapper8',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- click:true,
- scrollbars:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- },null,null);
- }
- }
-
-
-
-
- function bindEvents(){
- $(".pt-tab").on("click","li",function(){
- var activeId = $(this).attr("id");
- $(".pt-tab li").removeClass("hit");
- $(this).addClass("hit");
- $(".area-list-wrap").hide();
- var ele = $(".area-list-wrap")[$(this).index()];
- var scroller = window["scroller"+($(this).index()+1)]
- $(ele).show();
- setTimeout(function() {
- scroller && scroller.myScroll.refresh();
- }, 500)
- })
-
- $(".ul-community").on("click","li",function(){
- var hospitalId = $(this).attr("data-id");
- location.href = "hospital-dept.html?hospitalId="+hospitalId;
- })
-
- $(".ul-hospital").on("click","li",function(){
- var hospitalId = $(this).attr("data-id");
- location.href = "hospital-dept.html?hospitalId="+hospitalId;
- })
- $(".ul-immune").on("click", "li", function() {
- var hospitalId = $(this).attr("data-id");
- location.href = "immune-date.html?hospitalId=" + hospitalId;
- })
- $(".div-yuyue-btn").on("click",function(){
- //location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wxurl+"%2fwdyy%2fhtml%2fmy-appointment.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
- location.href = "my-appointment.html";
- })
- }
-
- /**
- * 接口数据获取
- */
- function getHosptitalByType(type){
- d.show();
- var data={};
- data.city = "350200";
- data.filter ="";
- data.type = type;
- if(type==1){
- data.pageIndex = pageIndex;
- data.pageSize = pageSize;
- }else if(type ==2){
- data.pageIndex = pageIndex1;
- data.pageSize = pageSize1;
- }
- var successFun = type == 1 ? getHosptitalSuccess : getCommunitySuccess;
- sendPost('third/guahao/GetOrgList', data, 'json', 'post', getListFail, successFun);
- }
-
- function getHosptitalSuccess(res){
- d.close();
- if(res.status==200){
- var dataList = res.data;
- if(dataList&&dataList.length>0){
- pageIndex = pageIndex+1;
- appendHopital(dataList);
- hostpitallist = hostpitallist+dataList.length;
- scroller1.myScroll.refresh();
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show();
- }
-
- }else{
- getListFail(res);
- }
- }
-
-
- function getCommunitySuccess(res){
- d.close();
- if(res.status==200){
- var dataList = res.data;
- if(dataList&&dataList.length>0){
- pageIndex1= pageIndex1+1;
- appendCommunity(dataList);
- communitylist = communitylist+dataList.length;
- scroller2.myScroll.refresh();
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show();
- }
- } else {
- getListFail(res);
- }
- $(".main").show();
- $("#footer").show();
- }
-
- function appendHopital(dataList){
- var hopitalLi ="";
- for(var j in dataList){
- var data = dataList[j];
- var photo = getImgUrl(data.photo);
- if(!photo){
- photo = "../images/hospital_default.png";
- }
- hopitalLi +='<li class="pt5 cb-ffffff pl10" data-id="'+data.id+'">'+
- '<a href="#" class="ui-grid">'+
- '<div class="ui-col-0 width-70 pt5 pb5" >'+
- '<img src="'+photo+'" class="br5 width-60 height-50"></img>'+
- '</div>'+
- '<div class="ui-col-1 item-name">'+
- '<div class="c-f16 c-fwb c-toe name-text c-333" style="line-height: 60px;">'+data.address+'</div>'+
- //等医院地址有值时,则上一句注释,下面两句注释放开
- // '<div class="mt5 c-f16 c-fwb c-toe name-text c-333">'+data.name+'</div>'+
- // '<div class="mt5 c-f14 c-666666 c-toe">'+data.address+'</div>'+
- '</div>'+
- '</a>'+
- '</a>'+
- '</li>';
- }
- $(".ul-hospital").append(hopitalLi);
-
- setTimeout(function(){
- if(!scroller1){
- initScroller();
- }
- scroller1.myScroll.refresh();
- },500);
- }
-
- function appendCommunity(dataList){
- var communitylLi ="";
- for(var j in dataList){
- var data = dataList[j];
- var photo = getImgUrl(data.photo);
- if(!photo){
- photo = "../images/hospital_default.png";
- }
- communitylLi +='<li class="pt5 cb-ffffff pl10" data-id="'+data.id+'">'+
- '<a href="#" class="ui-grid">'+
- '<div class="ui-col-0 width-70 pt5 pb5" >'+
- '<img src="'+photo+'" class="br5 width-60 height-50"></img>'+
- '</div>'+
- '<div class="ui-col-1 item-name">'+
- '<div class="c-f16 c-fwb c-toe name-text c-333" style="line-height:60px;">'+data.address+'</div>'+
- //等医院地址有值时,则上一句注释,下面两句注释放开
- // '<div class="mt5 c-f16 c-fwb c-toe name-text c-333">'+data.name+'</div>'+
- // '<div class="mt5 c-f14 c-666666 c-toe">'+data.address+'</div>'+
- '</div>'+
- '</a>'+
- '</li>';
- }
- $(".ul-community").append(communitylLi);
- if(!scroller2){
- initScroller();
- }
- scroller2.myScroll.refresh();
- }
-
- /**
- * 计划免疫列表数据获取
- */
- function getImmune() {
- var url = "/patient/guahao/imm/GetOrgImmuneList";
- sendPost(url, {},'json','get', getListFail, function(res){
- if(res.status == 200){
- appendImmune(res.data);
- }else{
- getListFail(res);
- }
- });
- }
- function appendImmune(dataList){
- var immuneLi ="";
- for(var j in dataList){
- var data = dataList[j];
- var photo = getImgUrl(data.photo);
- if(!photo){
- photo = "../images/hospital_default.png";
- }
- immuneLi +='<li class="pt5 cb-ffffff pl10" data-id="'+data.id+'">'+
- '<a href="#" class="ui-grid">'+
- '<div class="ui-col-0 width-70 pt5 pb5" >'+
- '<img src="'+photo+'" class="br5 width-60 height-50"></img>'+
- '</div>'+
- '<div class="ui-col-1 item-name">'+
- // '<div class="c-f16 c-fwb c-toe name-text c-333" style="line-height:60px;">'+data.address+'</div>'+
- //等医院地址有值时,则上一句注释,下面两句注释放开
- '<div class="mt5 c-f16 c-fwb c-toe name-text c-333">'+data.name+'</div>'+
- '<div class="mt5 c-f14 c-666666 c-toe">'+data.zone_name+data.shortName+'</div>'+
- '</div>'+
- '</a>'+
- '</li>';
- }
- $(".ul-immune").append(immuneLi);
- $(".main").removeClass("f-dn")
- setTimeout(function() {
- if(!scroller3){
- initScroller();
- }
- scroller3.myScroll.refresh();
- }, 500)
- }
-
- 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 initHospital(){
- pageIndex = 1 ;
- hostpitallist = 0 ;
- getHosptitalByType(1);
- }
-
- /**
- * 初始化社区
- */
- function initCommunity(){
- pageIndex1 = 1 ;
- communitylist = 0;
- getHosptitalByType(2);
- }
- /**
- * 初始化计划免疫
- */
- function initImmune() {
- pageIndex2 = 1;
- immunelist = 0;
- getImmune();
- }
- });
|