var docType, docInfo; var myScroll; function initScroller(){ //阻尼系数 var deceleration = mui.os.ios?0.003:0.0009; mui('.mui-scroll-wrapper').scroll({ scrollX: true, bounce: false, indicators: true, //是否显示滚动条 deceleration:deceleration }); myScroll = mui(".mui-scroll").pullToRefresh({ down: { callback: function() { var self = this; setTimeout(function() { load(); self.endPullDownToRefresh(); }, 1000); } }, scrollLeft: function(){ xScroll = true; } }); } mui.plusReady(function() { initScroller(); //切换角色事件 initQiehuanDom(); //初始化扫码按钮 initSaoMaDom(); docType = parseInt(plus.storage.getItem("docType")); docInfo = JSON.parse(plus.storage.getItem("docInfo")); $("#doc_name").html(docInfo.name); $("#doc_type").html(docInfo.jobName); $("#hospital").html(docInfo.hospitalName); //控制团队报告 // if(docInfo.isLeader == 1){ // $('#work_resport').show() // }else{ // $('#work_resport').hide() // } //控制协同服务 if(docInfo.hospital){ if(docInfo.hospital.substr(0,6) == '350211' && docInfo.isLeader == 1){ $('#xtfw_li').show() }else{ $('#xtfw_li').hide() } }else{ $('#xtfw_li').hide() } initDocPhoto("doc_photo", docInfo.photo, docInfo.sex);//图片加载失败时使用默认图片 load(); checkIdcard(docInfo.idcard); /* * 刷新页面数据 */ window.addEventListener("refresh", load); }); /** * 初始化扫码按钮 */ function initSaoMaDom(){ var flag = isMultiRole(); var docInfo = JSON.parse(plus.storage.getItem("docInfo")); if(docInfo.level==3){//登录者是健康管理师 // if(flag){ // $('#div-saoma').addClass("abs-right60").show(); // }else{ // $('#div-saoma').addClass("abs-right10").show(); // } } } function load(){ getSignCount(); //签约、待签约数量 getPatiTypeAmount();//病种人群数量 updateBadgeNumber(); //刷新应用角标数字 // getGroupMsgCount(); // 获取讨论组总数 // sendPost("doctor/baseinfo", null, function(res){ // mui.toast(res.msg); // }, function(res){ // if(res.status==200){ // var data = res.data; // $('#fullNum').html(res.data.evaluateScore?res.data.evaluateScore:'暂无评分') // } // },'POST','',true); } /* * 获取患者类型数量 */ function getPatiTypeAmount() { var postUrl = "/doctor/family_contract/patientGroupByServerType"; var params = {}; sendGet(postUrl, params, null, function(res) { if(res.status == 200) { var data = res.data; document.getElementById("hypertension_amount").innerText = "( "+ data[0].amount +" 人)"; document.getElementById("diabetes_amount").innerText = "( "+ data[1].amount +" 人)"; document.getElementById("other_amount").innerText = "( "+ data[2].amount +" 人)"; } else { console.error(res.msg); } },'POST','',true); } /* * 获取签约情况 */ function getSignCount() { sendPost("doctor/baseinfoCount", {doctorType: docType}, null, function(res) { if(res.status == 200) { $('#waitNum').html(res.data.concernCount||0); $('#last_amount').html(res.data.concernCount||0); $('#signNum').html(res.data.doctoConsult||0); $('#fullNum').html(res.data.doctorScore?res.data.doctorScore:'暂无评分') } else { console.error(res.msg); } },'POST','',true); } /* * 刷新应用角标数字 */ function updateBadgeNumber() { var userId = plus.storage.getItem('im_userid'); imClient.Application.getBadgeNo(userId, function(result) { console.log(JSON.stringify(result)); try { if(result && result.badge != null) { plus.runtime.setBadgeNumber(result.badge); } } catch(e) { } }) } function initHtml1(data, page){ var json = data[0]; var html = ""; //load_doc_more if(!json){ $("#load_doc_more").closest(".view-more").hide(); return; } if(json.length<10){ $("#load_doc_more").closest(".view-more").hide() } if(docType==3){ $.each(json, function(i, v) { html += '
  • ' + '
    ' + '医生头像' + '' + '
    ' + '
    ' + '

    '+ v.name+'

    ' + '

    '+v.hospitalName+'

    ' + '
    ' + '
  • '; }); } else { $.each(json, function(i, v) { html += '
  • ' + '
    ' + '医生头像' + '' + '
    ' + '
    ' + '

    '+v.name+'

    ' + '

    签约总数:'+ v.count+'

    ' + '
    ' + '
  • '; }); } if(json.length==0){ html += '
  • ' + '
    ' + '

    暂无数据

    ' + '
    ' + '
  • '; } if(page==1){ $('#doc_list').html(html); }else{ $('#doc_list').append(html); } $('.my-team img.photo').error(function(){ this.src = $(this).attr('data-sex')==1 ? "../../../images/d-male.png" : "../../../images/d-female.png"; }).load(function(){ $(this).prev().hide(); $(this).show(); }); } function initHtml2(data, page){ var json = data[1]; html = ""; if(!json){ $("#load_pro_more").closest(".view-more").hide(); return; } if(json.length<10){ $("#load_pro_more").closest(".view-more").hide(); } $.each(json, function(i, v) { html +='
  • ' + '
    ' + '医生头像' + '' + '
    ' + '
    ' + '

    ' + ''+v.name+'' + ''+(v.deptName || "")+'' + ''+v.hospitalName+'' + '

    ' + '

    ' + '总咨询次数:'+(v.allCount || 0 )+'' + '今日咨询次数:'+(v.currentCount || 0)+'' + '

    ' + '
    ' + '
  • '; }); if(json.length==0){ html += '
  • ' + '
    ' + '

    暂无数据

    ' + '
    ' + '
  • '; } if(page==1){ $('#pro_doc_list').html(html); }else{ $('#pro_doc_list').append(html); } $('.my-team img.photo').error(function(){ this.src = $(this).attr('data-sex')==1 ? "../../../images/d-male.png" : "../../../images/d-female.png"; }).load(function(){ $(this).prev().hide(); $(this).show(); }); } /* * 签约数跳转 */ $("#sign_amount").on("tap", "li", function() { var type = $(this).data("type"); if(type == 5){ mui.openWindow({ url: "../../mine/html/manyidu.html", id: 'manyidu.html', waiting:{ autoShow:false }, extras:{ type: type } }); }else if(type==2){ mui.openWindow({ url: "../../xiaoxi/html/jiankangzixun.html" }); }else if(type==1){ mui.openWindow({ url: "../../qygl/html/follow_manage.html" }); } }); /* * 跳转到居民 */ mui(".mod-bd").on("tap", ".patient-type", function() { var patiType = this.getAttribute("data-type"); var huanzheWv = plus.webview.getWebviewById("huanzhe.html"); var mainWv = plus.webview.getWebviewById("main"); if(mainWv) { if(huanzheWv){ huanzheWv.evalJS("showGroup("+ patiType +")"); mui.fire(mainWv, "activeHuanzhe"); }else{ var subStyles = { top: "0px", bottom: "51px", scorllIndicator: "none", bounceBackground: "#17b3ec" }; huanzheWv = mui.openWindow({ url:"huanzhe.html", id:"huanzhe.html", styles:subStyles, waiting:{ autoShow:true,//自动显示等待框,默认为true title:'正在加载...'//等待对话框上显示的提示内容 } }); mainWv.append(huanzheWv); huanzheWv.evalJS("showGroup("+ patiType +")"); mui.fire(mainWv, "activeHuanzhe"); } } }); function toErweima(){ mui.openWindow('../../mine/html/erweima.html','erweima',{ extras:{code:docCode,name:docName,job:docJob,sex:sex,photo:photo,hospitalName:hospitalName} } ) } /* * 我的服务跳转 */ mui(".list-fuwu2").on("tap", "li[data-href]", function() { //添加特殊处理,处理随访咨询 var _this = this; if($(this).attr("id") == "suifang"){ var patiType = _this.getAttribute("data-href"), type = _this.getAttribute("data-type"); openWebview(patiType,{type: type, photo:docInfo.photo, name: docInfo.name,code: docInfo.code, job: docInfo.jobName, sex:docInfo.sex,hospitalName: docInfo.hospitalName }); }else if($(this).attr("data-id") == "gongzuo"){//工作报告 mui.openWindow({ id: "gongzuobaogao", url: "../../tuandui/html/gongzuobaogao.html", extras: { teamCode:docInfo.adminTeamCode } }) }else if($(this).attr("data-id") == "manbing"){//慢病 mui.openWindow({ id: "manbingguanli", url: "../../mbgl/html/manbingguanli.html", extras: { } }) }else if($(this).attr("data-id") == "guidance_list"){//健康指导 var patiType = this.getAttribute("data-href"), type = this.getAttribute("data-type"), origin = this.getAttribute("data-origin"); openWebview(patiType,{isIndex: true,code: docInfo.code, job: docInfo.jobName, sex:docInfo.sex,hospitalName: docInfo.hospitalName,origin: origin}); } else{ var patiType = this.getAttribute("data-href"), type = this.getAttribute("data-type"), origin = this.getAttribute("data-origin"); openWebview(patiType,{type: type, photo:docInfo.photo, name: docInfo.name,code: docInfo.code, job: docInfo.jobName, sex:docInfo.sex,hospitalName: docInfo.hospitalName,origin: origin}); } return false; }).on('tap','#xfdd', function() { if(docType == "3") { openWebview("../../prescription/html/xufangdingdan-jg.html"); } else if(docType == "2") { openWebview("../../prescription/html/xufangdingdan.html"); } }).on('tap', 'li[data-href1]', function(){ mui.toast("暂未开放"); }) /* * 医学交流跳转 */ mui(".list-doctor").on("tap", "li", function() { if(!$(this).hasClass("zwsj")){ var code = this.getAttribute("data-code"); var name = $(this).attr("data-name"); var photo = $(this).find("img.photo").attr("src"); var sex = $(this).attr("data-sex"); mui.openWindow({ id: "p2p", url: "../../message/html/p2p.html", extras: { otherCode: code, otherName: name, otherPhoto: photo, otherSex: sex } }) } });//创建讨论组 /* * 我的团队跳转 */ /*$("#groupCountDiv").on("tap", function(){ mui.openWindow('../html/gongzuozu.html','gongzuozu',{}); }) function getGroupMsgCount(){ sendPost("/doctor/talkgroup/count", {}, function(res){ mui.toast("查询我的团队总数出错!"); }, function(res){ if(res.status=="200"){ $('#groupCount').html(res.data); } else{ mui.toast("查询我的团队总数出错!"); } }) }*/ $("#zixun_link").on("tap", function() { openWebview("../../mygl/html/zixun-xuanzeyisheng.html"); }); $(function() { $(".mod-team .c-lab-mor >li").on("click", function() { var i = $(this).index(); $(this).addClass('curr').siblings().removeClass('curr'); $(".my-team> li").eq(i).show().siblings().hide(); }) }); /* * 代理签约成功后刷新我的居民个数、签约数 */ window.addEventListener("refreshPatCount", function() { // getPatiTypeAmount(); getSignCount(); }); //健管师扫码事件 $("#div-saoma").on('tap', function() { openWebview("../../prescription/html/saoerweima.html"); })