mui.init(); var pCodes = []; //记录从前一个页面跳转过来的患者信息; var kfxt = '7.0', chxt = '11.1', kfxtdx = '4.0', chxtdx = '4.0', ssy = '140', szy = '90', ssydx = '90', szydx = '60', step = '10000', minbmi = '18.5', maxbmi = '23.9'; mui.plusReady(function(){ var self = plus.webview.currentWebview(); pCodes = self.pCodes; bindEvents(); }); function bindEvents(){ //绑定数字键盘 $.each(document.querySelectorAll('input[type=text]'), function(index, el){ var name = el.name; if(name == "xyval"){ $(el).mobiscroll().numpad({ theme: 'ios', display: 'bottom', lang: 'zh', placeholder: '0', fill: 'rtl', allowLeadingZero: true, template: 'ddd', scale:0, buttons: ['set','cancel'], onSelect: function(valueText, inst){ var value = parseFloat($('.mbsc-np-dsp').text()); if(index == 4) { ssy = value; $('#ssy').val(ssy ? ssy + 'mmHg' : ''); } else if(index == 5) { szy = value; $('#szy').val(szy ? szy + 'mmHg' : ''); } else if(index == 6) { ssydx = value; $('#ssydx').val(ssydx ? ssydx+ 'mmHg' : ''); } else if(index == 7) { szydx = value; $('#szydx').val(szydx ? szydx + 'mmHg' : ''); } } }); }else if(name == "xtval" || name == "bmi"){ $(el).mobiscroll().numpad({ theme: 'ios', display: 'bottom', lang: 'zh', placeholder: '0', fill: 'rtl', allowLeadingZero: true, template: 'dd.d', scale:0, buttons: ['set','cancel'], onSelect: function(valueText, inst){ var value = parseFloat($('.mbsc-np-dsp').text()); if(index == 0) { kfxt = value; $('#kfxt').val(kfxt ? kfxt + 'mmol/L' : ''); } else if(index == 1) { chxt = value; $('#chxt').val(chxt ? chxt + 'mmol/L' : ''); } else if(index == 2) { kfxtdx = value; $('#kfxtdx').val(kfxtdx ? kfxtdx + 'mmol/L' : ''); } else if(index == 3) { chxtdx = value; $('#chxtdx').val(chxtdx ? chxtdx + 'mmol/L' : ''); } else if(index == 9) { minbmi = value; $('#minbmi').val(minbmi ? minbmi : ''); } else if(index == 10) { maxbmi = value; $('#maxbmi').val(maxbmi ? maxbmi : ''); } } }) } else if (name == "step"){ $(el).mobiscroll().numpad({ theme: 'ios', display: 'bottom', lang: 'zh', placeholder: '0', fill: 'rtl', allowLeadingZero: true, template: 'ddddd', scale:0, buttons: ['set','cancel'], onSelect: function(valueText, inst){ var value = parseFloat($('.mbsc-np-dsp').text()); if(index == 8) { step = value; $('#step').val(step ? step + '步' : ''); } } }) }; }); // 保存 $('body').on("tap", "#save", function(){ // if(!kfxt || !chxt || !kfxtdx || !chxtdx || !ssy || !szy || !ssydx || !szydx || !step || !minbmi || !maxbmi) { // mui.toast("需要完整填写目标数据!"); // return false; // } var sugger = { fbg: kfxt, hpg: chxt, fbgMin: kfxtdx, hpgMin: chxtdx, unit: "mmol/L" }, pressure = { sbp: ssy, dbp: szy, sbpMin: ssydx, dbpMin: szydx, unit: "mmHg" }, sport = { dailyStepCount: step, bmiMax: maxbmi, bmiMin: minbmi }; var param = { patient: pCodes.join(","), suggerJson: JSON.stringify(sugger), pressureJson: JSON.stringify(pressure), sportJson: JSON.stringify(sport) } plus.nativeUI.showWaiting(); sendPost("/doctor/scheme/setPatientAim", param, null, function(res){ if(res.status == 200) { mui.toast(res.msg); var self = plus.webview.currentWebview(); backToPage(self); } else { mui.toast(res.msg || "保存失败!"); } plus.nativeUI.closeWaiting(); }, 'POST'); }) } function backToPage(wv){ var targetId = "zhongdiangenzong", selfId = "control-goal-multi"; if(wv.id == targetId){ plus.webview.getWebviewById(selfId).close(); }else{ var opener = wv.opener(); if(wv.id != selfId){ wv.close(); } backToPage(opener); } }