var self, patient, selectDatas, xtCode; mui.plusReady(function(){ self = plus.webview.currentWebview(); patient = self.patient; xtCode = self.code;//协同 plus.nativeUI.showWaiting() Promise.all([queryPatient(),queryData()]).then(function(datas){ plus.nativeUI.closeWaiting() var html = template('text_tmp',{data:$.map(datas[1].data,function(o,index){ o.jsonStr = JSON.stringify(o);return o ;}),patient:datas[0].data}) $('#show_content').html(html) bindEvents(); }) }) function queryData(){ return getReqPromise("doctor/pcCustomer/GetRegList",{patient:patient},'post') } function queryPatient(){ return getReqPromise("doctor/patient_label_info/patient",{patient:patient},'get') } function bindEvents(){ $(".add-btn").on('click', function(){ mui.openWindow({ id: "xietongfuwu-deal", url: "../../xtfw/html/xietongfuwu-deal.html", extras: { type:1,//预约 code:xtCode } }) }); $(".mui-scroll").on("change", ".icon-checkbox", function(){ var $this = $(this); if($this.prop("checked")){ $(".list-item").removeClass("active"); $this.parent().parent().addClass("active"); var json = $this.parent().parent().attr('data-json'); selectDatas = json?JSON.parse(json):'' } }) mui('.mui-scroll-wrapper').scroll({ bounce: true, //是否启用回弹 }) $("#submitBtn").on('tap',function(){ if(!selectDatas){ mui.toast('请选择要关联的记录') return } var params = { type:1,//1.预约成功,2.预约失败 code:xtCode, orderHospital:selectDatas.orgCode, orderHospitalName:selectDatas.orgName, orderDept:selectDatas.deptCode, orderDeptName:selectDatas.deptName, orderDoctor :selectDatas.doctorCode, orderDoctorName:selectDatas.doctorName, orderTime:selectDatas.startTime,//就诊时间 registerTime:selectDatas.czrq//挂号 } plus.nativeUI.showWaiting(); sendPost("doctor/pcCustomer/dealAppointCallService",params, function(){ plus.nativeUI.closeWaiting(); mui.toast("请求失败"); }, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ refreshHz() mui.toast("关联协同任务完成"); closePage() }else{ mui.toast("关联协同任务失败"); } }) }) } //刷新事件 function refreshHz(){ var page = plus.webview.getWebviewById("xietongfuwu-management"); if(page){ mui.fire(page, "refreshXietong") } var page1 = plus.webview.getWebviewById("xietongfuwu-message"); if(page1){ mui.fire(page1, "refreshXTmsg") } } //关闭页面 function closePage(){ var page = plus.webview.getWebviewById("xietongfuwu-detail"); if(page){ page.close('none') } var page1 = plus.webview.getWebviewById("appointment-register"); if(page1){ page1.close('none') } setTimeout(function(){ mui.back() },1000) } template.helper("setPhoto", function(p) { return getImgUrl(p); });