| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 | 
							- var self; //当前页面对象
 
- var patiCode; //居民标识
 
- var concernCode; //居民关注标识
 
- var currDays = 7; //默认日期类型
 
- var indexType = "1"; //指标类型
 
- var currIndexCode = "" //当前要显示的指标类型
 
- var docType=""//医生类别
 
- var signType = "";
 
- var oPatiInfo =null;
 
- var iscroller = null;
 
- var doctorCode = null;
 
- var qyRelation;
 
- var overdue; //判断患者与医生的签约状态是否已过期
 
- var currService;
 
- var jtServerCode=[];//服务类型名称  
 
- var jtAdminTeamId; // 标记患者的签约团队id
 
- mui.plusReady(function() {
 
- 	self = plus.webview.currentWebview();
 
- 	concernCode = self.concernCode;
 
- 	patiCode = self.code;
 
- 	doctorCode = JSON.parse(plus.storage.getItem("docInfo")).code; 
 
- 	overdue = self.overdue;
 
-     $("#pati_info").attr("code",patiCode);
 
-     localStorage.removeItem('updateService'); 
 
-     getPatiInfo();
 
-     initScroller(); 
 
- });
 
- mui.back = function(){
 
- 	// self.opener().reload(true);
 
- 	//如果父窗口为im, 更新im
 
- 	if(self.opener().id=='p2dzixun'){
 
- 		mui.fire(self.opener(), 'update');
 
- 	}
 
- 	self.close();
 
- }
 
- //获取病人信息
 
- function getPatiInfo(code){
 
- 	sendGet("/doctor/concern/findByCode",  
 
- 		{concernCode: concernCode}, null,
 
- 		function(res){ 
 
- 			if(res.status == 200){
 
- 				oPatiInfo = res.data; 
 
- 				bindEvents();
 
- 				dealPatiInfoTmpl(oPatiInfo);
 
- 			} else {
 
- 				mui.toast("获取病人信息失败");
 
- 			}
 
- 		},'POST','',true);
 
- }
 
- function sendWeixinRemind() {
 
- 	sendPost("doctor/family_contract/wechat_focus_remind", 
 
-     		{patient: patiCode,isAll:0}, null, 
 
-     		function(res){
 
-     			if(res.status == 200){
 
-     				oPatiInfo.wechatFocusRemind = 1;
 
-     				showRemindBtn(true);
 
-     			} else {
 
-     				oPatiInfo.wechatFocusRemind = 1; 
 
-     				showRemindBtn(true);
 
-     				mui.toast(res.msg);
 
-     			}
 
-     		},'POST','',true);
 
- }
 
- function showRemindBtn(isReminded) {
 
-     var $remind = $("#remind_gz");
 
-     $remind.show();
 
- 	if(isReminded) {
 
-         $remind.addClass("ytx");
 
-         $remind.find("a").text("已提醒关注");
 
- 	} else {
 
-         $remind.removeClass("ytx");
 
-         $remind.find("a").text("提醒关注微信");
 
- 	}
 
- }
 
- function checkWeixinRemind(data) {
 
- 	return new Promise(function(resolve, reject) {
 
- 		sendPost("doctor/family_contract/is_patient_remind_focus",  
 
-     		{patient: patiCode}, null, 
 
-     		function(res){
 
-     			if(res.status == 200){
 
-     				if(res.data==0) { // 0: 当日未提醒
 
-     					isWeiXinRemind(data);
 
-     				}
 
-     				
 
-     			} else {
 
-     				mui.toast(res.msg);
 
-     			}
 
-     		},'POST','',true)
 
- 	});
 
- }
 
- function isWeiXinRemind (data) {
 
- 	
 
- 	if(data) {
 
- 		var isReminded = data.wechatFocusRemind=="1"? true: false,
 
- 		// 签约类型: 1-->三师  2-->家庭 3-->三师 、家庭两者都有
 
- 		signType = data.signType,
 
- 		// 缴费状态: 2-->已退费 1-->已缴费 0-->未交费
 
- 		expensesStatus = data.expensesStatus,
 
- 		openid = data.openid;
 
- 		if(!openid) {
 
- 			// 有签约家庭医生,但未交费,则有该悬浮按钮
 
- 			if((signType=="2" || signType=="3") && expensesStatus=="1") {
 
- 				showRemindBtn(isReminded);
 
- 			} 
 
- 			// 2、如只有三师签约,但无openid,则有该悬浮按钮
 
- 			else if(signType == "1") {
 
- 				showRemindBtn(isReminded);
 
- 			}
 
- 		}
 
- 	}
 
- 	
 
- }
 
- // 滚动条实例初始化
 
- function initScroller() {
 
-     //阻尼系数
 
-     var deceleration = mui.os.ios?0.003:0.0009;
 
-     mui('.mui-scroll-wrapper').scroll({
 
-         bounce: false,
 
-         indicators: true, //是否显示滚动条
 
-         deceleration:deceleration
 
-     });
 
-     
 
-     iscroller = mui(".mui-scroll").pullToRefresh({
 
-         down: {
 
-             callback: function() {
 
-                 var self = this;
 
-                 setTimeout(function() {
 
-                     refreshPage();
 
-                     self.endPullDownToRefresh();
 
-                 }, 1000);
 
-             }
 
-         }
 
-     });
 
- }
 
- /*
 
-  * 拼接居民信息模板
 
-  */
 
- function dealPatiInfoTmpl(patiInfoObj) {
 
- 	patiInfoObj.idcard = plusXing(patiInfoObj.idcard,6,2);
 
- 	patiInfoObj.ssc = plusXing(patiInfoObj.ssc,4,1);
 
- 	$("#pati_info_wrap").html(template("pati_info_tmpl", patiInfoObj));
 
- 	$('#view_wrap').show();
 
- }
 
- /*
 
-  * 查看居民资料
 
-  */
 
- function toInfo() {
 
- 	var $el = $(this);	
 
- 	mui.openWindow("huanzeziliao.html", "huanzeziliao", {
 
- 		extras: {
 
- 			patiPhoto: $el.find('.doc-avatar img').attr('src'), 
 
- 			patiCode: patiCode,
 
- 			signType: signType,
 
- 			teamCode: self.teamCode,
 
- 			//添加续签状态值
 
- 			qyRelation: qyRelation,
 
- 			renewable: oPatiInfo.isRenewable
 
- 		}
 
- 	})
 
- }
 
- function openwdsb(){
 
- //	var params={};
 
- //	params.patient = patiCode;
 
- //	openWebviewExtras("../../wdsb/html/my-equipments.html",params);
 
- 	mui.openWindow('../../jkjl/html/health-record.html', 'health-record', {
 
- 		extras: {
 
- 			patientCode: patiCode,
 
- 			patientName: oPatiInfo.name,
 
- 			qyRelation: qyRelation
 
- 		}
 
- 	})	
 
- }
 
- /*
 
-  * 服务记录
 
-  */
 
- function fwjl() {
 
- 	mui.openWindow('fuwujilu.html', 'fuwujilu', {
 
- 		extras: {
 
- 			patientCode: patiCode,
 
- 			patientName: oPatiInfo.name,
 
- 			qyRelation: qyRelation
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 健康指导
 
-  */
 
- function jkzd() {
 
- //				diaAdd.close();
 
- 	mui.openWindow('../../hzzd/html/guidance_list.html', 'jkzd', {
 
- 		extras: {
 
- 			code: patiCode
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 体征预警
 
-  */
 
- function tzyj() {
 
- //				diaAdd.close();
 
- 	mui.openWindow('tzyj.html', 'tzyj', {
 
- 		extras: {
 
- 			code: patiCode
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 健康记录点击事件
 
-  */
 
- /*
 
-  * 药物记录
 
-  */
 
- function ywjl(dom) {
 
- 	var text = $(dom).find("p").eq(0).text();
 
- 	if(text == "-") {
 
- 		mui.toast("暂无健康记录");
 
- 		return;
 
- 	}
 
- 	mui.openWindow('../../hzgl/html/health-record-drug.html', 'health-record-drug', {
 
- 		extras: {
 
- 			pCode: patiCode
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 饮食记录
 
-  */
 
- function ysjl(dom) {
 
- 	var text = $(dom).find("p").eq(0).text();
 
- 	if(text == "-") {
 
- 		mui.toast("暂无健康记录");
 
- 		return;
 
- 	}
 
- 	mui.openWindow('../../hzgl/html/health-record-diet.html', 'health-record-diet', {
 
- 		extras: {
 
- 			pCode: patiCode
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 运动记录
 
-  */
 
- function ydjl(dom) {
 
- 	var text = $(dom).find("p").eq(0).text();
 
- 	if(text == "-") {
 
- 		mui.toast("暂无健康记录");
 
- 		return;
 
- 	}
 
- 	mui.openWindow('../../hzgl/html/health-record-sport.html', 'health-record-sport', {
 
- 		extras: {
 
- 			pCode: patiCode
 
- 		}
 
- 	});
 
- }
 
- /*
 
-  * 分组
 
-  */
 
- function fz() {
 
- 	mui.openWindow('../../zxyy/html/xuanzeyiyuan.html', 'xuanzeyiyuan', {
 
- 		extras: {
 
- 			pCode: patiCode
 
- 		}
 
- 	});
 
- }
 
- function toSelectJb(){
 
- 	var self = plus.webview.currentWebview();
 
- 	var update = localStorage.getItem('updateService');
 
- 	var oldData = jtServerCode.join(',');
 
- 	mui.openWindow({
 
- 		url: 'disease-label-edit.html', 
 
- 		id: 'disease-label-edit',
 
- 		extras: {
 
- 			patientCode: patiCode, 
 
- 			viewId: self.id,
 
- 			signCode:oPatiInfo.signCode,//变更服务类型用
 
- 			serviceCode: update?update:oldData,
 
- 			isChange:$("#smallTipSev").is(":hidden")?false:true//判断是否处于变更
 
- 		}
 
- 	});
 
- }
 
- function dial(){
 
- 	var moblie = $(".div-dianhua").attr("data-mobile");
 
- 	var phone = $(".div-dianhua").attr("data-phone");
 
- 	var type = $(this).attr("data-type");
 
-     //观察者模式下,不可以拨打被观察者患者的电话
 
-     var userAgent = plus.navigator.getUserAgent(),
 
-         index = userAgent.indexOf("}"),
 
-         s = userAgent.substr(0, index+1),
 
-         item = JSON.parse(s);
 
-     if(item.observer){
 
-         mui.toast("观察者模式无法拨打患者电话");
 
-     }else{
 
-     	if(type==1){
 
-     		if(moblie){
 
- 			 	dialog({
 
- 				    content: moblie,
 
- 				    okValue:'立即拨号',
 
- 				    ok: function (){				            		
 
- 				      	window.location.href = "tel:"+moblie;
 
- 				    },
 
- 				    cancelValue: '不了,谢谢',
 
- 				    cancel: function () {
 
- 						return;
 
- 				    }
 
- 				 }).showModal();
 
- 			 }else{
 
- 			 	if(phone){
 
- 				 	dialog({
 
- 						    content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,是否拨打联系人电话?",
 
- 						    okValue:'立即拨号',
 
- 						    ok: function (){				            		
 
- 						      	window.location.href = "tel:"+phone;
 
- 						    },
 
- 						    cancelValue: '不了,谢谢',
 
- 						    cancel: function () {
 
- 								return;
 
- 						    }
 
- 					 }).showModal();
 
- 			 	}else{
 
- 			 		dialog({
 
- 						    content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,无法电话联系",
 
- 						    okValue:'我知道了',
 
- 						    ok: function (){				            		
 
- 						      	return;
 
- 						    },
 
- 					 }).showModal();
 
- 			 	}
 
- 			 }
 
-     	}else{
 
-     		if(phone){
 
- 			 	dialog({
 
- 				    content: phone,
 
- 				    okValue:'立即拨号',
 
- 				    ok: function (){				            		
 
- 				      	window.location.href = "tel:"+moblie;
 
- 				    },
 
- 				    cancelValue: '不了,谢谢',
 
- 				    cancel: function () {
 
- 						return;
 
- 				    }
 
- 				 }).showModal();
 
- 			 }else{
 
- 			 	if(moblie){
 
- 				 	dialog({
 
- 						    content: "对不起,"+$(".patient-name").html()+"未填写联系人电话,是否拨打绑定的手机号码?",
 
- 						    okValue:'立即拨号',
 
- 						    ok: function (){				            		
 
- 						      	window.location.href = "tel:"+phone;
 
- 						    },
 
- 						    cancelValue: '不了,谢谢',
 
- 						    cancel: function () {
 
- 								return;
 
- 						    }
 
- 					 }).showModal();
 
- 			 	}else{
 
- 			 		dialog({
 
- 						    content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,无法电话联系",
 
- 						    okValue:'我知道了',
 
- 						    ok: function (){				            		
 
- 						      	return;
 
- 						    },
 
- 					 }).showModal();
 
- 			 	}
 
- 			 }
 
-     	}
 
-     }
 
- }
 
- function refreshPage () {
 
- 	labelName =[];
 
- 	jtServerCode = [];
 
- 	localStorage.removeItem('updateService');
 
- 	getPatiInfo();
 
- }
 
- window.addEventListener("refresh1", function(){
 
- 	refreshPage();
 
- 	var xxWv = plus.webview.getWebviewById("huanzhe-by-type");
 
- 	// 如果有打开分组列表也要刷新列表
 
- 	if(xxWv){
 
- 		mui.fire(xxWv, "refresh");
 
- 	}
 
- 	var xxindex = plus.webview.getWebviewById("huanzhe.html");
 
- 	// 如果有打开分组列表也要刷新列表
 
- 	if(xxindex){
 
- 		mui.fire(xxindex, "refresh");
 
- 	}
 
- })
 
- window.addEventListener("setDiseaseTypes", function(e){
 
- 	$('#diseases').html(e.detail.names);
 
- 	oPatiInfo.diseases = e.detail.diseases;  
 
- })
 
- function toInfo() {
 
- 	var $el = $(this);	
 
- 	mui.openWindow("../../huanzhe/html/huanzhexinxi.html", "huanzhexinxi", {
 
- 		extras: {
 
- 			patiCode: patiCode
 
- 		}
 
- 	})
 
- }
 
- /* 事件绑定*/
 
- function bindEvents(){
 
- 	//查看居民详情
 
- 	$("#pati_info_wrap").on('tap', '#pati_info', toInfo);
 
- 	//拨打电话
 
- 	$("#pati_info_wrap").on('tap','.div-dianhua',dial)
 
- }
 
- //str:字符串,frontLen:前面保留位数,endLen:后面保留位数
 
- function plusXing(str, frontLen, endLen) {
 
- 	var len = str.length - frontLen - endLen;
 
- 	var xing = '';
 
- 	for(var i = 0; i < len; i++) {
 
- 		xing += '*';
 
- 	}
 
- 	return str.substring(0, frontLen) + xing + str.substring(str.length - endLen);
 
- }
 
 
  |