var imgKey = null; var xtCode; var scroller1 = null; mui.init(); mui.plusReady(function(){ var doctorTemp = window.localStorage.getItem("doctorTemp"); doctorInfo = JSON.parse(plus.storage.getItem("docInfo")); if(doctorTemp&&doctorTemp!=""){ doctorTemp = JSON.parse(doctorTemp); }else{ //return; } var arrangeDate = window.localStorage.getItem("arrangeDate"); var self = plus.webview.currentWebview(); var patient = self.patient; xtCode = self.xtCode; if(arrangeDate&&arrangeDate!=""){ arrangeDate = JSON.parse(arrangeDate); } bindEvents(); function bindEvents(){ $(".visit-ul").on("click",".searchbar-clear",function(){ $(this).prev().val(""); $(this).css("pointer-events","none").css("opacity",0); $(this).prev().focus(); return false; }); $(".div-immediately-btn").on("click",function(){ applyData(); }) } var patientInfo; initData(); function initData(){ $("#hospitalName").html(doctorTemp['hospitalName']); $("#hosDeptDocName").html(doctorTemp['hosDeptName']+" "+doctorTemp['name']); $("#yyTime").html(arrangeDate['startTime'].split(" ")[0]+" "+arrangeDate['yysj']); query(); } function query() { var data={patient:patient}; sendPost('doctor/patient/info', data, queryFailed, querySuccess); } function querySuccess(res){ if(res.status==200){ patientInfo = res.data; //身份证号 var idcard = patientInfo.idcard; var jj = idcard.substring(idcard.length-2,idcard.length-9); var idcardStr = idcard.replace(jj,'*******'); //医保卡号 var ssc = patientInfo.ssc; var j = ssc.substring(ssc.length,ssc.length-3); var sscStr = ssc.replace(j,'***'); $("#username").html(res.data.name); $("#idcard").html(idcardStr); $("#ssc").html(sscStr); $("#mobile").val(res.data.mobile); }else{ queryFailed(res); } } function queryFailed(res){ plus.nativeUI.closeWaiting(); if (res && res.msg) { mui.toast(res.msg); } else { mui.toast("加载失败"); } } function applyData(){ var mobile = $("#mobile").val(); if(!isphone(mobile)) { mui.toast("请输入正确的手机号码"); return; } plus.nativeUI.showWaiting(); var params = {}; params.city=CITY_CODE; params.hospitalId=doctorTemp.hospitalId; params.hospitalName = doctorTemp.hospitalName; params.hosDeptId = doctorTemp.hosDeptId; params.hosDeptName = doctorTemp.hosDeptName; params.doctorId = doctorTemp.id; params.doctorName = doctorTemp.name; delete arrangeDate.yysj; params.arrangeDate=JSON.stringify(arrangeDate); params.patient = patientInfo.code; params.patientName = patientInfo.name; params.cardNo = patientInfo.idcard; params.clinicCard = patientInfo.ssc; params.dcode = doctorInfo.code;//代预约人code params.dname = doctorInfo.name;//代预约人编码 params.patientPhone = mobile;//patientInfo.mobile; sendPost("third/guahao/CreateOrderByDoctor",params,queryFailed,submitSuccess); } function submitSuccess(res){ plus.nativeUI.closeWaiting(); if(res.status==200){ mui.fire(plus.webview.getWebviewById('p2dzixun'), 'update'); var myappo = plus.webview.getWebviewById('my-appointment'); var docappo = plus.webview.getWebviewById('doctor-appointment'); if(myappo){ mui.fire(myappo, 'update'); }else if(docappo){ mui.fire(docappo, 'update'); } mui.toast("预约成功"); setTimeout(function(){ openWebviewExtras("detail-appointment.html",{dataId:res.data,xtCode:xtCode}); },500) }else{ queryFailed(res); } } });