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 += '
'+item+'(确诊时间:'+time[i]+')
' }else{ html += '
'+item+'
' } }) 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 += '
'+item+'(确诊时间:'+time[i]+')
' }else{ html += '
'+item+'
' } }) return html+'
'+a[0]+'
' } }) template.helper('setDrug',function(o,p){ if(p==''){ return o }else if(o==''){ return p }else{ return o+','+p } })