| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 | var self,	firstData,	docInfo,	state,	secondData;mui.plusReady(function(){	self = plus.webview.currentWebview();	state = self.state;	docInfo = JSON.parse(plus.storage.getItem("docInfo"));	firstData = JSON.parse(plus.storage.getItem("jiandangCase1"));	var case2 = plus.storage.getItem("jiandangCase2")	secondData = case2?JSON.parse(case2):'';	var html = template('list_tmp',{fData:firstData,sData:secondData})	$(".c-main").html(html)	bindEvent()	function bindEvent(){		$('.edit').on('tap',function(){			var $id = $(this).attr('data-id');			if($id == 1){				mui.openWindow({					id: "zizhujiandang",					url: "zizhujiandang.html",					waiting:{autoShow:false}				})			}			if($id == 2){				mui.openWindow({					id: "xinxicaiji",					url: "xinxicaiji.html",					waiting:{autoShow:false}				})			}		})		$('.jm-btn').on('tap',function(){			var params = {				doctorCode:docInfo.code,	            idcard:firstData.idcard,	            ssc:firstData.ssc,	            sex:firstData.sex,	            name:firstData.name,	            mobile:firstData.mobile,	            origo:firstData.addressCode,	            origoStr:firstData.address,	            jwCountryCode:firstData.countryCode,	            nation:firstData.national,	            blood:firstData.Blood_type,	            marry:firstData.marry,	            adress:firstData.Present_Address,	            brithday:firstData.Birthday,	            education:secondData.education,//教育水平			    occupation:secondData.occupation,//职业			    payment:secondData.payment, //支付方式			    drugAllergys:secondData.drugAllergys,//药物过敏历史			    drugOtherContent:secondData.drugOtherContent, //药物过敏其他内容			    pastHistorys:secondData.pastHistorys,//既往史			    pastHistoryDate:secondData.pastHistoryDate, //时间			    pastHistoryContent:secondData.pastHistoryContent, //既往史其他内容			    geneticFlag:secondData.geneticFlag,//有无遗传病历史0无,1有			    geneticContent:secondData.geneticContent,//遗传病历史内容			    disabilitys:secondData.disabilitys, //残疾			    familyHistoryFlag:secondData.familyHistoryFlag,//有无			    familyFatherHistorys:secondData.familyFatherHistorys,//父亲的疾病			    familyMotherHistorys:secondData.familyMotherHistorys, //母亲的疾病			    familyBrotherHistorys:secondData.familyBrotherHistorys, //兄弟的疾病			    familyChildrenHistorys:secondData.familyChildrenHistorys, //子女的疾病	        }     	        var params2 = {	        	name:firstData.name,	        	idcard:firstData.idcard,	        	ssc:firstData.ssc,	        	mobile:firstData.mobile	        }	        plus.nativeUI.showWaiting();	        sendPost('/doctor/patient/check_regist_info',params2,function(){	        	plus.nativeUI.closeWaiting();	        	mui.toast('请求失败'); 	        },function(res){	            if (res.status==200) {	            	sendPost('doctor/patient/createProfileAndSignDeail',{archiveJson:JSON.stringify(params)},function(){			        	plus.nativeUI.closeWaiting();			        	mui.toast('请求失败')			        },function(res){			        	plus.nativeUI.closeWaiting(); 			        	if(res.status == 200){			        		mui.toast('提交成功')			        		plus.storage.removeItem("jiandangCase1")			    			plus.storage.removeItem("jiandangCase2")			        		if(state == -3){//未签约			        			setTimeout(function(){				        			mui.openWindow({										id: "dailiqianyue",										url: "../../mine/html/dailiqianyue.html",										extras: {											name:firstData.name,		        							idCard:firstData.idcardAll,											ssc:firstData.ssc,		        							mobile:firstData.mobile,		        							countryCode:firstData.countryCode,		        							countryName:firstData.countryName,											kind:1										}									})			        			},500)			        		}else{			        			var dljd = plus.webview.getWebviewById('dailijiandang');			        			var zzjd = plus.webview.getWebviewById('zizhujiandang');							    var xxcj = plus.webview.getWebviewById('xinxicaiji');							    var xxqr = plus.webview.getWebviewById('xinxiqueren');							    var jmqy = plus.webview.getWebviewById('juminqianyue');							    var jmda = plus.webview.getWebviewById('jumindangan');							    if(jmda){jmda.close('none')}							    if(jmqy){jmqy.close('none')}							    if(dljd){dljd.close('none')}						    	if(xxcj){xxcj.close('none')}						    	if(zzjd){zzjd.close('none')}			        			setTimeout(function(){				        			xxqr.close('none')				        		},300)			        		}			        	}else{			        		mui.toast('提交失败')			        	}			        },'post')	            }else{	            	plus.nativeUI.closeWaiting();	          		if(res.msg){	          			mui.toast(res.msg)	          		}else{	          			mui.toast('填写信息格式不对')	          		}	            }	        },'get')	    })	} })template.helper('setNull',function(o){	if(o==''){		return '无'	}else{		return o	}})template.helper('setDataGroup',function(o,a){	if(a[0]==''){		var name = o.split(',')		var time = a[1].split(',')		var html="";		$.map(name,function(item,i){			if(time[i] != '0'){				html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'			}else{				html += '<div>'+item+'</div>'			}		})		return html	}else if(o==''){		return a[0]	}else{		var name = o.split(',')		var time = a[1].split(',')		var html='';		$.map(name,function(item,i){			if(time[i] != '0'){				html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'			}else{				html += '<div>'+item+'</div>'			}		})		return html+'<div>'+a[0]+'</div>'	}})template.helper('setDrug',function(o,p){	if(p==''){		return o	}else if(o==''){		return p	}else{		return o+','+p	}})
 |