| 
					
				 | 
			
			
				@ -5,22 +5,15 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 基本信息(包括userAgent、上个页面传递的数据) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				var baseInfo = null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 基础环境信息(包括当前webview) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					baseEnv = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					baseEnv = null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					pages = {}, //记录个分组内数据页数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					docInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				var $patientListWrapper = $('#patient_list_wrap'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$patientList = $('#pati_list'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 搜索输入框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$searchbarInput = $('.searchbar .search-input'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				var $searchbarInput = $('.searchbar .search-input'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					// 搜索无结果时显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$noResultWrap = $('#no_result_wrap'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					patientInfo = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 分页查询当前页数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				var curPage = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	pageSize = 15, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	myScroll = null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	hasMore = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 获取基本信息(包括userAgent、上个页面传递的数据) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				var getBaseInfoPromise = function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 登录的相关信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -40,38 +33,66 @@ getBaseEnvPromise = function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return env; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 分页查询列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				searchByPaging = function (isRefresh) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 curPage = isRefresh ? 0 : curPage+1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					var url = "/doctor/concern/getConcernPatients", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					params = { page:curPage,pageSize:pageSize}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					getReqPromise(url,params,'GET').then(function(res){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						var data = res.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(!data || !data.length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							$patientListWrapper.hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							$noResultWrap.show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							$noResultWrap.hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							$patientListWrapper.show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						data = _.map(data,function(item){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							item.photo = getImgUrl(item.photo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return item; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 if(isRefresh){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            myScroll.refresh(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $patientList.empty().append(template("pati_list_tmpl", {list: data})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $patientList.append(template('pati_list_tmpl', {list: data})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(data.length < pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            hasMore = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            myScroll.endPullUpToRefresh(!hasMore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".mui-pull-bottom-tips").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//获取分组信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				getGroupData = function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    docInfo = JSON.parse(plus.storage.getItem("docInfo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    var url = "doctor/patient_label_info/label_patient_amount", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            labelType: 4, //获取团队标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            teamCode: docInfo.adminTeamCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    plus.nativeUI.showWaiting(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    sendPost(url, params, null,function(res){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(res.status == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(i=0; i<res.data.length; i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var item = res.data[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                pages[item.labelCode] = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var html = template("pati_group_tmpl", {list: res.data}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $("#groupList").empty().append(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            plus.nativeUI.closeWaiting(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            hasMore = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".mui-pull-bottom-tips").show() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            plus.nativeUI.closeWaiting(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mui.toast(res.msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 分页查询列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				initPatientListByGroup = function(code, isInit) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    if(isInit){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        pages[code] = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					var url = "doctor/patient_label_info/patients_by_label", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    params = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        labelType: 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        labelCode: code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        teamCode: docInfo.adminTeamCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        page: pages[code], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        pagesize: 50 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					getReqPromise(url, params, 'GET').then(function(res){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    if(res.status == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        var list = res.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(list.length == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $(".group-item[data-group="+code+"]").find(".load-more").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var html = template("pati_list_tmpl", {list: list}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(isInit){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    $(".n-list[data-group="+code+"]").empty().append(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    $(".n-list[data-group="+code+"]").append(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(list.length < 50){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    $(".group-item[data-group="+code+"]").find(".load-more").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    pages[code] ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    $(".group-item[data-group="+code+"]").find(".load-more").show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        mui.toast(res.msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}).catch(function(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						console && console.error(e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -86,21 +107,12 @@ initScroller = function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        deceleration:deceleration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   myScroll =  mui(".mui-scroll").pullToRefresh({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    	up: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            callback: function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                setTimeout(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    searchByPaging(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    self.endPullUpToRefresh(!hasMore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }, 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    mui(".mui-scroll").pullToRefresh({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        down: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            callback: function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                setTimeout(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    searchByPaging(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    getGroupData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    self.endPullDownToRefresh(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }, 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -109,7 +121,7 @@ initScroller = function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 绑定页面事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				bindEvents = function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$patientList.on('tap','li[data-patient-code]',function(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$("#groupList").on('tap','li[data-patient-code]',function(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						var code = $(this).attr("data-patient-code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						var mobile = $(this).attr("data-patient-phone"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						var address = $(this).attr("data-patient-address"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -128,7 +140,48 @@ bindEvents = function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$("#groupList").on('tap', ".group-item", function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    var $el = $(this), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        code = $.trim($el.attr("data-group")), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        amount = parseInt($el.attr("data-amount")), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        isOpen = $el.hasClass("current"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $groupInfo = $el.find('.group-info'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $siblings = $el.siblings(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(isOpen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.removeClass("current"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.find(".ui-arrow").removeClass("ui-arrow-t"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.find(".ui-arrow").addClass("ui-arrow-b"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $groupInfo.hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var $opened = $(".group-item.current"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.addClass("current"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.find(".ui-arrow").removeClass("ui-arrow-b"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $el.find(".ui-arrow").addClass("ui-arrow-t"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if($opened.length > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $opened.removeClass('current').find(".group-info").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $opened.find(".ui-arrow").removeClass("ui-arrow-t"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $opened.find(".ui-arrow").addClass("ui-arrow-b"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(amount > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $groupInfo.show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var liLen = $el.find('ul.n-list li').length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(liLen == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    initPatientListByGroup(code, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$("#groupList").on('tap', ".load-more", function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    var $this = $(this), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        code = $this.attr("data-group"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    initPatientListByGroup(code, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$searchbarInput.on('tap',function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						mui.openWindow({ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -137,10 +190,16 @@ bindEvents = function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							extras: {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						})	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					$(".header-link").on('click', function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					    openWebview("../../huanzhe/html/biaoqianguanli.html",{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            teamCode: docInfo.adminTeamCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/*刷新事件*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//	window.addEventListener("refresh", function group(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		searchByPaging(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//	}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					window.addEventListener("refresh", function group(e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						getGroupData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 页面业务处理流程开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				new Promise(function(resolve, reject) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -159,7 +218,8 @@ new Promise(function(resolve, reject) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 获取登录医生信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						baseInfo = getBaseInfoPromise(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						initScroller(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						searchByPaging(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		searchByPaging(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        getGroupData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 绑定页面事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						bindEvents(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(baseEnv.webview.origin){//“随访”功能,需要返回按钮 
			 |