var myScroll, docCode, teamCode, type, self, num = 0, curDocCode; mui.plusReady(function(){ self = plus.webview.currentWebview(); docCode = self.docCode; teamCode = self.teamCode; type = self.type; curDocCode = getUid(); if(type == "dfp"){ getDfpPatiLs(); }else getPatiLs(); }) function getDfpPatiLs(){ plus.nativeUI.showWaiting(); sendGet("/doctor/family_contract/findNoHealthSignFamilyHealth", {doctor: curDocCode, page: 0, pageSize: 2000}, null, function(res){ if(res.status == 200){ console.log(JSON.stringify(res)) res.data = res.list; if(!res.data || res.data.length==0){ $('#wushuju').show(); $('.lin-footer').hide(); $('.doc-list').hide(); } else { $('.doc-list').html(template('pati_tmpl', res)); } myScroll.refresh(); plus.nativeUI.closeWaiting(); } else mui.toast(res.msg) }) } function getPatiLs(){ plus.nativeUI.showWaiting(); sendGet("/doctor/admin-teams/teams/"+ teamCode +"/members/"+ docCode +"/signing", {}, null, function(res){ if(res.status == 200){ if(!res.data || res.data.length==0){ $('#wushuju').show(); $('.lin-footer').hide(); $('.doc-list').hide(); } else { $('.doc-list').html(template('pati_tmpl', res)); } myScroll.refresh(); plus.nativeUI.closeWaiting(); } else mui.toast(res.msg) }) } var loaded = function () { myScroll = new IScroll('#wrapper', { mouseWheel: true }); document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); }(); /** * 下一步操作 */ function submit(){ if(num<=0) return; plus.nativeUI.showWaiting(); var patients = [], patiCodes = []; var patient; $.each($('.doc-list').find('.doc-item.checked'), function(i, v) { patient = JSON.parse($(v).attr('data-info')); patients.push(patient); patiCodes.push(patient.code); }); sendPost("/doctor/consult/getConsultByPatientAndDoctor", {patientCode: patiCodes.join(","), doctor: docCode}, null, function(res){ var tem = {}; if(res.length==0){ to_next(patients); } else if(patients.length == res.length){ plus.nativeUI.closeWaiting(); mui.confirm("对不起,您选择的居民均有尚未结束的健康咨询,无法继续转移。", "提示", ["我知道了"], function(e){ }) return; } else if(res.length <= 3 ){ tem = getCanTrans(patients, res); mui.confirm("居民"+ tem.names + ",尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){ if(e.index == 0){ to_next(tem.canPati); cancleSel(res); } }) } else if(res.length < patients.length){ tem = getCanTrans(patients, res); mui.confirm("选中居民中有"+ res.length + "人,尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){ if(e.index == 0){ to_next(tem.canPati); cancleSel(res); } }) } else{ } plus.nativeUI.closeWaiting(); }) } function cancleSel(notCodes){ $.each(notCodes, function(i, v) { $('.doc-item[data-code="'+ v +'"]').removeClass("checked"); }); num = $('.doc-list').find('.doc-item.checked').length; $('.checked-num label').html(num); $('.link').toggleClass('c-ccc', num<=0); } function getCanTrans(patients, notCodes){ var canPati = []; var names = []; $.each(patients, function(i, v) { var has = false; $.each(notCodes, function(n, m) { if(v.code == m){ has = true; names.push(v.name); } }); if(!has){ canPati.push(v); } }); return {canPati: canPati, names: names.join(",")} } function to_next(patients){ mui.openWindow({ id: "xuanzejieshouyisheng.html", url: "xuanzejieshouyisheng.html", extras: { jgs: self.jgs, patients: patients, docCode: docCode, teamCode: teamCode, type: "转移" } }); } $('.doc-list').on('tap', '.doc-item', function(){ $(this).toggleClass('checked'); num = $('.doc-list').find('.doc-item.checked').length; $('.checked-num label').html(num); $('.link').toggleClass('c-ccc', num<=0); }) $('#allSel').on('tap', function(){ $(this).toggleClass('checked'); if($(this).hasClass('checked')){ $(this).next().html("取消全选"); $('.doc-list').find('.doc-item').addClass('checked'); } else { $(this).next().html("全选"); $('.doc-list').find('.doc-item').removeClass('checked'); } num = $('.doc-list').find('.doc-item.checked').length; $('.checked-num label').html(num); $('.link').toggleClass('c-ccc', num<=0); })