var obj, code, name, patientInfo = {}, patientInfoArr = [], self, arrSumInfo = []; var newPickerf,newPickers,newPicket //创建变量 var $specialty = $("#specialty"), $healthy = $('#healthy'), $custom = $('#custom'), $concealment = $('#concealment'); $recovery = $('#recovery'); $nongroup = $('#nongroup'); //初始化mui mui.init(); //mui文档就绪执行函数 mui.plusReady(function() { //获取基础信息 obj = init(); //获取页面信息 self = plus.webview.currentWebview(); //初始化页面 initPage(); //获取没标签居民数目(数字) residentCount(); //获取没标签居民数(具体的居民列表) residentList() //事件绑定执行函数 bindEvent(); }) function init() { var userAgent = JSON.parse(plus.storage.getItem('userAgent')); var teamInfo = JSON.parse(plus.storage.getItem('teamInfo')); var doctorInfo = JSON.parse(plus.storage.getItem("docInfo")); return { userAgent: userAgent, teamInfo: teamInfo, doctorInfo: doctorInfo } } function initPage(){ newPickerf = new mui.PopPicker({}); newPickers = new mui.PopPicker({}); newPickert= new mui.PopPicker({}); getSelect(7) getSelect(8) getSelect(4) } function getSelect(type) { sendGet('/doctor/specialist/findLabelbyType', { type: type, teamCode: "" }, null, function(res) { if(res.status == 200) { var arr = [] for(i in res.data) { res.data[i].text = res.data[i].labelName; } if (type==7) { newPickerf.setData(res.data) }if (type==8) { newPickers.setData(res.data) }if (type==4) { newPickert.setData(res.data) } } else { mui.toast(res.msg); } plus.nativeUI.closeWaiting(); }, 'GET', '', true); } function residentCount() { sendGet('/doctor/specialist/findSpecialistPatientRelationCout', { doctor: obj.doctorInfo.code }, null, function(res) { if(res.status == 200) { $('#sum').html(res.data) } else { mui.toast(res.msg); } }, 'GET', '', true); } function residentList() { sendGet('/doctor/specialist/findNoLabelPatientRelation', { doctor: obj.doctorInfo.code }, null, function(res) { if(res.status == 200) { for(var i in res.data){ res.data[i].photo = getImgUrl(res.data[i].photo) } $('.n-list').html(template('no_label_resident', { list: res.data })); } else { mui.toast(res.msg); } }, 'GET', '', true); } function bindEvent() { $specialty.on('tap', function(e) { e.stopPropagation(); newPickerf.show(function(selectItems) { $concealment.html(selectItems[0].text); $concealment.attr('data-code', selectItems[0].labelCode) $concealment.attr('data-type', selectItems[0].labelType) }) }); $healthy.on('tap', function(e) { e.stopPropagation(); newPickers.show(function(selectItems) { $recovery.html(selectItems[0].text) $recovery.attr('data-code', selectItems[0].labelCode) $recovery.attr('data-type', selectItems[0].labelType) }) }); $custom.on('tap', function() { newPickert.show(function(selectItems) { $nongroup.html(selectItems[0].text) $nongroup.attr('data-code', selectItems[0].labelCode) $nongroup.attr('data-type', selectItems[0].labelType) }) }); $("#times").on("tap", function(e) { e.stopPropagation(); e.preventDefault(); }); //点击确定的时候设置居民标签 var juage = true; $('#makeSure').on('tap', function(e) { if(juage==true){ var disType = $concealment.html(); var situaType = $recovery.html(); var Grouping = $nongroup.html(); var residentSum = $(".n-list input[name=jvmin]:checked"); var j_list = $(".n-list input[name=jvmin]:checked").parent().parent(); if(disType.length == 0 || disType == '请选择专病类型') { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '专病类型不能为空!', closeTime: 2000 }).showModal(); return false; } else if(situaType.length == 0 || situaType == '请选择健康情况') { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '健康情况不能为空!', closeTime: 2000 }).showModal(); return false; } else if(residentSum.length == 0) { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '请选择居民!', closeTime: 2000 }).showModal(); return false; } for(var k = 0; k < j_list.length; k++) { var middleVar = {}; var code = j_list[k].getAttribute('data-code'); var name = j_list[k].getAttribute('data-name'); middleVar = { patient: code, pname: name } patientInfoArr.push(middleVar); } //获取疾病类型标签 var dName = $concealment.html(); var dCode = $concealment.attr('data-code'); var dType = $concealment.attr('data-type'); //获取健康状况标签 var hName = $recovery.html(); var hCode = $recovery.attr('data-code'); var hType = $recovery.attr('data-type'); //获取自定义分组标签 var cName = $nongroup.html(); var cCode = $nongroup.attr('data-code'); var cType = $nongroup.attr('data-type'); //设置居民标签接口的参数 var contain = []; if(Grouping.length != 0 || Grouping != '未分组') { for(var h = 0; h < 3; h++) { if(h == 0) { var obj1 ={}; for(var j = 0;j