|  | @ -19,7 +19,7 @@ var $searchbar = $('.searchbar'),
 | 
	
		
			
				|  |  | 	// 分页查询最后一页
 | 
	
		
			
				|  |  | 	$history = $('#history_search'),//历史搜索
 | 
	
		
			
				|  |  | 	$hisSearList = $('#his_sear_list');
 | 
	
		
			
				|  |  | var page = 1,
 | 
	
		
			
				|  |  | var page = 0,
 | 
	
		
			
				|  |  |     search_keyword = "", //记录搜索框的内容
 | 
	
		
			
				|  |  | 	lastTeamId,// 从缓存取出所选团队
 | 
	
		
			
				|  |  | 	pagesize = 15,
 | 
	
	
		
			
				|  | @ -83,24 +83,7 @@ historyList = function(){
 | 
	
		
			
				|  |  | },
 | 
	
		
			
				|  |  | // 初始化“患者”视图列表
 | 
	
		
			
				|  |  | initPatientViewList = function(data,keyword,isAppend) {
 | 
	
		
			
				|  |  | 	var html = template("pati_list_tmpl", {list: _.map(data,function(o) {
 | 
	
		
			
				|  |  | 		o.jsonStr = JSON.stringify(o);
 | 
	
		
			
				|  |  | 		var labels = [], tmp,id="";
 | 
	
		
			
				|  |  | 		//判断身份证匹配
 | 
	
		
			
				|  |  | 		if(o.idcard.indexOf(keyword) != -1){
 | 
	
		
			
				|  |  | 		    id = o.idcard;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		for(var k in o.labels){
 | 
	
		
			
				|  |  | 			tmp = o.labels[k];
 | 
	
		
			
				|  |  | 			if((tmp.labelType == 3 || tmp.labelType == 4)
 | 
	
		
			
				|  |  | 					&& labels.indexOf(tmp.labelName) == -1){
 | 
	
		
			
				|  |  | 			    if(tmp.labelName.indexOf(keyword) != -1)
 | 
	
		
			
				|  |  | 				labels.push(tmp.labelName);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		o.labels = id+" "+labels.join(',');
 | 
	
		
			
				|  |  | 		return o;
 | 
	
		
			
				|  |  | 	})});
 | 
	
		
			
				|  |  | 	var html = template("pati_list_tmpl", {list: data});
 | 
	
		
			
				|  |  | 	searchText = $searchbarInput.val().trim();
 | 
	
		
			
				|  |  | 	if(isAppend == true){
 | 
	
		
			
				|  |  | 		$patiList.append(html)
 | 
	
	
		
			
				|  | @ -212,16 +195,11 @@ searchByPaging = function (isAppend,fun) {
 | 
	
		
			
				|  |  | 		return ;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	plus.nativeUI.showWaiting();
 | 
	
		
			
				|  |  | 	if(self.labelType == '9'){//签约到期
 | 
	
		
			
				|  |  | 		var url = self.type==1? "doctor/patient_label_info/patient_search_all_exitdoc_overdue" : "doctor/patient_label_info/patient_search_Overdue";
 | 
	
		
			
				|  |  | 	}else{
 | 
	
		
			
				|  |  | 		var url = self.type==1? "doctor/patient_label_info/patient_search_all_exitdoc" : "doctor/patient_label_info/patient_search";
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	var params = { page:page, filter: search_keyword, pagesize:pagesize, teamCode: lastTeamId};
 | 
	
		
			
				|  |  | 	var reqType = self.type==1? "GET" : "POST";
 | 
	
		
			
				|  |  | 	getReqPromise(url,params, reqType).then(function(res){
 | 
	
		
			
				|  |  | 	var url = "/doctor/concern/getConcernPatients",
 | 
	
		
			
				|  |  | 	 params = { page:page,pageSize:pagesize,patientName:search_keyword};
 | 
	
		
			
				|  |  | 	getReqPromise(url,params, "GET").then(function(res){
 | 
	
		
			
				|  |  |  		if(res.status == 200) {
 | 
	
		
			
				|  |  | 			if((page==1 && !res.data) || (page==1 && !res.data.length)) {
 | 
	
		
			
				|  |  | 			if((page==0 && !res.data) || (page==0 && !res.data.length)) {
 | 
	
		
			
				|  |  | 				$searchtResult.hide();
 | 
	
		
			
				|  |  | 				$noResultWrap.show();
 | 
	
		
			
				|  |  | 			} else {
 | 
	
	
		
			
				|  | @ -272,49 +250,7 @@ bindEvents = function (){
 | 
	
		
			
				|  |  | 	})
 | 
	
		
			
				|  |  | 	mui('#his_scroll').scroll({
 | 
	
		
			
				|  |  |     	bounce: true, //是否启用回弹
 | 
	
		
			
				|  |  |     })
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	$patiList.on('tap','.patient-list',function() {
 | 
	
		
			
				|  |  | 		var code = $.trim($(this).attr("data-group")),
 | 
	
		
			
				|  |  | 			isOpen = togglePatientListShow($(this));
 | 
	
		
			
				|  |  | 		code && !isOpen && initPatientListByGroup(code);
 | 
	
		
			
				|  |  | 	}).on('tap','li[data-patient-code]',function() {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		var patiInfo = $(this).attr("data-json");
 | 
	
		
			
				|  |  | 		var info = JSON.parse(patiInfo);
 | 
	
		
			
				|  |  | 		if(baseEnv.webview.msgForward) {
 | 
	
		
			
				|  |  | 			// 转发的消息
 | 
	
		
			
				|  |  | 			var messages = baseEnv.webview.imMessages;
 | 
	
		
			
				|  |  | 			mui.confirm("是否确认将消息逐条转发给"+info.name+"?", "提示", ["不了,谢谢", "确认转发"], function(e) {
 | 
	
		
			
				|  |  | 				if(e.index == 0) {
 | 
	
		
			
				|  |  | 					
 | 
	
		
			
				|  |  | 				} else {
 | 
	
		
			
				|  |  | 					Promise.all(_.map(messages,function(msg){
 | 
	
		
			
				|  |  | 						return new Promise(function(resolve, reject) {
 | 
	
		
			
				|  |  | 							im.sendPrivateMsg(baseInfo.userAgent.uid,info.code,msg.content,msg.type,function() {
 | 
	
		
			
				|  |  | 								resolve(true);
 | 
	
		
			
				|  |  | 							},function() {
 | 
	
		
			
				|  |  | 								resolve(true);
 | 
	
		
			
				|  |  | 							})
 | 
	
		
			
				|  |  | 						})
 | 
	
		
			
				|  |  | 					})).then(function() {
 | 
	
		
			
				|  |  | 						openWebview("../../message/html/p2p.html",{otherCode: info.code,otherName: info.name,otherPhoto: info.photo,otherSex: info.sex});
 | 
	
		
			
				|  |  | 					});
 | 
	
		
			
				|  |  | 					
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			})
 | 
	
		
			
				|  |  | 		} else if(baseEnv.webview.message) {
 | 
	
		
			
				|  |  | 			openWebview("../../message/html/p2p.html",{otherCode: info.code,otherName: info.name,otherPhoto: info.photo,otherSex: info.sex});
 | 
	
		
			
				|  |  | 		} else {
 | 
	
		
			
				|  |  | 			openWebview("../../huanzhe/html/huanzhexinxi.html",{
 | 
	
		
			
				|  |  | 				teamCode: self.type==1? lastTeamId : undefined, 
 | 
	
		
			
				|  |  | 				patiInfo: patiInfo,
 | 
	
		
			
				|  |  | 				patiCode: info.code
 | 
	
		
			
				|  |  | 			});
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		return false;
 | 
	
		
			
				|  |  | 	});
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	$searchbarInput.on('input', function() {
 | 
	
		
			
				|  |  | 		var text = $(this).val().trim();
 | 
	
	
		
			
				|  | @ -330,7 +266,7 @@ bindEvents = function (){
 | 
	
		
			
				|  |  | 		showSearchSuggest(text);
 | 
	
		
			
				|  |  | 	}).on('keydown',function(e) {
 | 
	
		
			
				|  |  | 		if (e.which === 13) {
 | 
	
		
			
				|  |  | 		    page = 1;
 | 
	
		
			
				|  |  | 		    page = 0;
 | 
	
		
			
				|  |  | 		    $searchSuggest.hide();
 | 
	
		
			
				|  |  | 			searchByPaging(false);
 | 
	
		
			
				|  |  | 			//保存历史数据20个
 | 
	
	
		
			
				|  | @ -346,7 +282,7 @@ bindEvents = function (){
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	$hisSearList.on('click','.his-list',function(){
 | 
	
		
			
				|  |  | 		var $that = $(this);
 | 
	
		
			
				|  |  | 		page = 1;
 | 
	
		
			
				|  |  | 		page = 0;
 | 
	
		
			
				|  |  | 		$("#searchAll").hide();
 | 
	
		
			
				|  |  | 	    $searchSuggest.hide();
 | 
	
		
			
				|  |  | 	    $history.hide();
 | 
	
	
		
			
				|  | @ -366,7 +302,7 @@ bindEvents = function (){
 | 
	
		
			
				|  |  | 	})
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	$searchSuggest.on('click',function() {
 | 
	
		
			
				|  |  | 	    page = 1;
 | 
	
		
			
				|  |  | 	    page = 0;
 | 
	
		
			
				|  |  | 		$searchSuggest.hide();
 | 
	
		
			
				|  |  | 		searchByPaging(false);
 | 
	
		
			
				|  |  | 		
 | 
	
	
		
			
				|  | @ -374,6 +310,27 @@ bindEvents = function (){
 | 
	
		
			
				|  |  | 		saveHisData()
 | 
	
		
			
				|  |  | 	});
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	$patiList.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");
 | 
	
		
			
				|  |  | 		if(baseEnv.webview.origin=="suifang") {//“随访”功能
 | 
	
		
			
				|  |  | 			if(baseEnv.webview.follow_type == 1){
 | 
	
		
			
				|  |  | 	            openWebview("../../suifang/html/add_plan.html",{patientInfo: {code:code,mobile:mobile,address:address},chooseDate:baseEnv.webview.chooseDate});
 | 
	
		
			
				|  |  | 	            return false;
 | 
	
		
			
				|  |  | 	        }
 | 
	
		
			
				|  |  | 	        if(baseEnv.webview.follow_type == 2){
 | 
	
		
			
				|  |  | 	            openWebview("../../suifang/html/follow_way.html",{patientInfo: {code:code,mobile:mobile,address:address}});
 | 
	
		
			
				|  |  | 	            return false;
 | 
	
		
			
				|  |  | 	        }
 | 
	
		
			
				|  |  | 		}else{
 | 
	
		
			
				|  |  | 			openWebview("../../huanzhe/html/huanzhexinxi.html",{
 | 
	
		
			
				|  |  | 				patiCode: code
 | 
	
		
			
				|  |  | 			});
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return false;
 | 
	
		
			
				|  |  | 	})
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	function saveHisData(){
 | 
	
		
			
				|  |  | 		//保存历史数据20个
 | 
	
		
			
				|  |  | 		var value = $searchbarInput.val().trim();
 |