123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- var self,
- teamCode,
- diseaseCondition = -1,//居民标签
- disease = -1,//慢病类型
- deviceType = -1,//设备情况
- peopleCodes = [];//选择人数code
- // 获取登录相关信息
- var getBaseInfo = function(){
- self = plus.webview.currentWebview();
- teamCode = self.teamCode;
- },
- // 查询人数
- queryPeopleNum = function() {
- plus.nativeUI.showWaiting();
- var params ={
- teamCode:teamCode,
- disease:disease,
- diseaseCondition:diseaseCondition,
- deviceType:deviceType
- }
- sendPost("doctor/scheme/get/disease/patientcodes",params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status==200){
- peopleCodes = res.data;
- $('#allNum').text('全部'+peopleCodes.length+'人');
- }else{
- mui.toast("查询失败");
- }
- },'get')
- },
- // 绑定页面事件
- bindEvents = function (){
- $("#sendBtn").on('tap',function(){
- if(!$('#selTag_dummy').val()){
- mui.toast('请选择居民标签');
- return;
- }
- if(peopleCodes.length==0){
- mui.toast('至少选一个居民');
- return;
- }
- //取居民code
- mui.openWindow({
- id: "jc-xuanzefangan",
- url: "jc-xuanzefangan.html",
- extras: {
- pCodes:peopleCodes
- }
- })
- })
- }
- //慢病类型
- function fillSickDropdown(){
- var $id = $('#selSick'),
- data = [{'code':'-1','name':'全部病种'},{'code':'1','name':'高血压'},{'code':'2','name':'糖尿病'}],
- html="";
- for(i=0; i<data.length; i++){
- if(data[i].code == -1){html += '<option selected value="'+data[i].code+'">'+data[i].name+'</option>';}
- else{html += '<option value="'+data[i].code+'">'+data[i].name+'</option>'}
- }
- $id.html(html);
- $id.mobiscroll().select({
- theme: 'ios',lang: 'zh',display: 'bottom',rows:4,
- onSelect: function ( valueText, inst) {
- disease = inst._tempValue;
- queryPeopleNum()
- }
- })
- }
- //居民标签
- function fillTagDropdown(){
- var $id = $('#selTag'),
- data = [{'code':'-1','name':'全部居民'},{'code':'0','name':'绿标居民'},{'code':'1','name':'黄标居民'},{'code':'2','name':'红标居民'}],
- html="";
- for(i=0; i<data.length; i++){
- if(data[i].code == '-1'){html += '<option selected value="'+data[i].code+'">'+data[i].name+'</option>';}
- else{html += '<option value="'+data[i].code+'">'+data[i].name+'</option>'}
- }
- $id.html(html);
- $id.mobiscroll().select({
- theme: 'ios',lang: 'zh',display: 'bottom',rows:4,
- placeholder:'请选择居民标签',
- onSelect: function ( valueText, inst) {
- if(inst._tempValue.length == 3){
- $('#selTag_dummy').val('全部居民')
- diseaseCondition= -1
- }else{
- diseaseCondition=(inst._tempValue).join(',')
- }
- if(!$('#selTag_dummy').val()){
- $('#allNum').text('')
- }else{
- queryPeopleNum()
- }
- },
- onChange: function (event, inst){
- filterSer(event)
- },
- onShow: function (event, inst) {
- filterSer(inst)
- },
- })
- }
- function filterSer(name){
- var $li = $('.dw-bf').find('div.dw-li');
- $li.addClass('dw-v');
- var nameArr = name.split(',');
- $.map(nameArr,function(item,index){
- if(nameArr[0]){
- if(item.trim() == '全部居民'){
- var arr = [1,2,3]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }else{
- var arr = [0]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- }
- })
- }
- //设备绑定
- function fillDeptDropdown(){
- var $id = $('#selDept'),
- data = [{'code':'-1','name':'全部'},{'code':'1','name':'已绑定'},{'code':'0','name':'未绑定'}],
- html="";
- for(i=0; i<data.length; i++){
- if(data[i].code == '-1'){html += '<option selected value="'+data[i].code+'">'+data[i].name+'</option>';}
- else{html += '<option value="'+data[i].code+'">'+data[i].name+'</option>'}
- }
- $id.html(html);
- $id.mobiscroll().select({
- theme: 'ios',lang: 'zh',display: 'bottom',rows:4,
- onSelect: function ( valueText, inst) {
- deviceType = inst._tempValue;
- queryPeopleNum()
- }
- })
- }
- // 处理流程开始
- new Promise(function(resolve, reject){
- mui.plusReady(function(){
- resolve(true)
- })
- }).then(function(){
- getBaseInfo()
- bindEvents()
- fillTagDropdown()
- fillSickDropdown()
- fillDeptDropdown()
- $('.icon-come').show()
- queryPeopleNum()
- }).catch(function(e) {
- plus.nativeUI.closeWaiting()
- console && console.error(e)
- })
|