| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 | mui.init();var title,    type, //plan: 检测方案, target:控制目标, article: 健康文章    teamCode,    disease = '-1', //初始默认选中全部病种    deviceType = '-1', //初始默认全部    listLoaded = false,    page = [],    pagesize = 10,    multiPeopleCodes = []; //批量分配时选中的居民codemui.plusReady(function(){    var self = plus.webview.currentWebview();    title = self.title;    type = self.type;    teamCode = self.teamCode;        $("#title").text(title+'-选择居民');        initScroller();        queryPeopleNum();    fillSickDropdown();    fillDeviceDropdown();        bindEvents();})//查询人数function queryPeopleNum(){    var url = "doctor/scheme/get/disease/patientcodes",        params = {            teamCode: teamCode,            disease: disease,            diseaseCondition: '-1', //全部居民,不区分绿黄红标居民            deviceType: deviceType,            trackFlag: 1 //重点关注居民        };            plus.nativeUI.showWaiting();    sendGet(url, params, null, function(res){        if(res.status==200){            multiPeopleCodes = res.data;            $('#allNum').text('全部'+multiPeopleCodes.length+'人');            $("#multiSend span").text('('+multiPeopleCodes.length+'人)')        }else{            mui.toast("查询失败");        }        plus.nativeUI.closeWaiting();    }, true);}//获得居民分组数量function getPatientGroupNum(){    var url = "doctor/patient_label_info/label_patient_amount",        params = {            labelType: 3,            teamCode: teamCode,            isSlowDisease: true,            diseaseCondition: '',            trackFlag: 1 // 重点关注居民        };    plus.nativeUI.showWaiting();    sendGet(url, params, null, function(res){        if(res.status == 200){            listLoaded = true;            for(i=0; i<res.data.length; i++){                page.push(1);            }            var html = template('pati_group_tmpl', {list: res.data});            $("#pati_list").empty().append(html);        }else{            mui.toast(res.msg);        }        plus.nativeUI.closeWaiting();    }, true)}//获得居民列表数据function getPatientList(index, code){    var url = "doctor/patient_label_info/patients_by_label",        params = {            teamCode: teamCode,             labelType: 3,            labelCode: code,             page: page[index],             pagesize: pagesize,            isSlowDisease:true,            trackFlag: 1       };        var $group = $(".patient-list").eq(index);    plus.nativeUI.showWaiting();    sendGet(url, params, null, function(res){        if(res.status == 200){            if(res.data.length < pagesize){                if(page[index] == 1){                    $group.find(".load-more").hide();                }else{                    $group.find(".load-more").attr("noMore", 'true').text("没有更多了");                }            }else{                page[index] ++;                $group.find(".load-more").show();            }            var html = template('pati_list_tmpl', {list: res.data});            $group.find(".n-list").append(html);        }else{            mui.toast(res.msg);        }        plus.nativeUI.closeWaiting();    }, true);}//慢病类型function fillSickDropdown(){     $('#selSick').mobiscroll({        theme: 'ios',        lang: 'zh',        customWheels: true,        wheels: [            [{                keys: ['-1', '1', '2'],                values: ['全部病种', '高血压', '糖尿病']            }]        ],        onSelect: function(valueText, inst) {            var dd = eval("[" + valueText + "]");            $(this).text(dd[0].values);            $(this).attr('data-val',dd[0].keys);            disease = dd[0].keys;            queryPeopleNum();        }    })}//设备绑定function fillDeviceDropdown(){    $('#selDevice').mobiscroll({        theme: 'ios',        lang: 'zh',        customWheels: true,        wheels: [            [{                keys: ['-1', '1', '0'],                values: ['全部', '已绑定', '未绑定']            }]        ],        onSelect: function(valueText, inst) {            var dd = eval("[" + valueText + "]");            $(this).text(dd[0].values);            $(this).attr('data-val',dd[0].keys);            deviceType = dd[0].keys;            queryPeopleNum();        }    })}//计算页面中选中的居民数量function getPeopleSum(){    var $list = $(".icon-checkbox2:checked"),        len = $list.length;        $("#listSend span").text('('+len+'人)');    }function bindEvents(){    document.querySelector('#slider').addEventListener('slide', function(event) {        if (event.detail.slideNumber === 1){            if(!listLoaded){                //获得居民列表数据                getPatientGroupNum();            }        }    });        $("#pati_list").on('tap', ".patient-type", function(){        var $this = $(this),            $parent = $this.parent(),            group = $parent.data("group"),            index = $parent.index(),            $ul = $parent.find("ul"),            $arrow = $this.find(".ui-arrow");                if($arrow.hasClass("ui-arrow-b")){            if($ul.find("li").length == 0){                getPatientList(index, group);            }            $ul.show();            $arrow.addClass("ui-arrow-t");            $arrow.removeClass("ui-arrow-b");        }else{            $ul.hide();            $arrow.addClass("ui-arrow-b");            $arrow.removeClass("ui-arrow-t");        }    });        //加载更多操作    $("#pati_list").on('tap', '.load-more', function(e){        e.stopPropagation();        var $parent = $(this).parent(),            group = $parent.data("group"),            index = $parent.index();        if($(this).attr("noMore") == 'true'){            return false;        }        getPatientList(index, group);    });        //选中列表中的居民信息    $("#pati_list").on('change', ".icon-checkbox2", function(){        var $this = $(this),            code = $this.data("id");                getPeopleSum();    });        //下一步    $("#slider").on('tap', '#multiSend', function(){        if(multiPeopleCodes.length==0){            mui.toast('至少选一个居民');            return false;        }        //type - plan: 检测方案, target:控制目标, article: 健康文章        if(type == 'plan'){            mui.openWindow({                id: "jc-xuanzefangan",                url: "jc-xuanzefangan.html",                extras: {                    pCodes:multiPeopleCodes                }            })        }else if(type == 'target'){            mui.openWindow({                id: "control-goal-multi",                url: "control-goal-multi.html",                extras: {                    pCodes:multiPeopleCodes                }            })        }else if(type == 'article'){            mui.openWindow({                id: "article-store",                url: "../../jkjy/html/article-store.html",                extras: {                    pCodes:multiPeopleCodes,                    referrer: 'manbing'                }            })        }    });        //列表页点击下一步    $("#slider").on('tap', '#listSend', function(){        var $list = $(".icon-checkbox2:checked"),            len = $list.length;        if(len==0){            mui.toast('至少选一个居民');            return false;        }        var list = [];        for(i=0; i<len; i++){            var $item = $($list[i]),                code = $item.data("id");            if(list.indexOf(code) == -1){                list.push(code);            }        }        //type - plan: 检测方案, target:控制目标, article: 健康文章        if(type == 'plan'){            mui.openWindow({                id: "jc-xuanzefangan",                url: "jc-xuanzefangan.html",                extras: {                    pCodes:list                }            })        }else if(type == 'target'){            mui.openWindow({                id: "control-goal-multi",                url: "control-goal-multi.html",                extras: {                    pCodes:list                }            })        }else if(type == 'article'){            mui.openWindow({                id: "article-store",                url: "../../jkjy/html/article-store.html",                extras: {                    pCodes:list,                    referrer: 'manbing'                }            })        }    })        template.helper('getImgUrl', function(str){        return getImgUrl(str);    });        template.helper("setExpenses", function(str){        switch(str) {            case "1":                 return "已缴费";            case "2":                 return "已退费";            default:                return "未缴费"        }    });}function initScroller(){    //阻尼系数    var deceleration = mui.os.ios?0.003:0.0009;    mui('.mui-scroll-wrapper').scroll({        bounce: false,        indicators: true, //是否显示滚动条        deceleration:deceleration    });}
 |