123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- 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"));
- var hospital = docInfo.hospital;
- if(hospital.indexOf("350205") == 0){ //海沧区的医生才能够看到设备绑定的入口
- $("#sbbd_li").show();
- $("#jfgl_li").show();
- }else{
- $("#sbbd_li").hide();
- $("#jfgl_li").hide();
- }
- $("#doc_name").html(docInfo.name);
- //控制团队报告
- 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);//图片加载失败时使用默认图片
-
- if(docType == "3") {
- document.getElementById("doc_type").innerText = "健康管理师"
- } else if(docType == "2") {
- document.getElementById("doc_type").innerText = "全科医生";
- }
-
- 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:'<span style="font-size:0.58rem">暂无评分</span>')
- }
- },'POST','',true);
- }
-
- /*
- * 获取患者类型数量
- */
- function getPatiTypeAmount() {
- var postUrl = "/doctor/family_contract/patientGroupByServerType";
- var params = {};
- sendGet(postUrl, params, null, function(res) {
- if(res.status == 200) {
- var allAmount = 0;
- var useAmount = 0;
- var otherAmount = 0;
- $.each(res.data, function(i, v) {
- if(v.labelCode == 1){//普通人群
- document.getElementById("normal_amount").innerText = "( "+ v.amount +" 人)";
- useAmount = useAmount + v.amount;
- }
- if(v.labelCode == 3){//老年人
- document.getElementById("old_amount").innerText = "( "+ v.amount +" 人)";
- useAmount = useAmount + v.amount;
- }
- if(v.labelCode == 4){//高血压
- document.getElementById("hypertension_amount").innerText = "( "+ v.amount +" 人)";
- useAmount = useAmount + v.amount;
- }
- if(v.labelCode == 5){//糖尿病
- document.getElementById("diabetes_amount").innerText = "( "+ v.amount +" 人)";
- useAmount = useAmount + v.amount;
- }
- allAmount = allAmount + v.amount;//总人数
- });
- otherAmount = allAmount - useAmount;//其他的人数
- document.getElementById("other_amount").innerText = "( "+ otherAmount +" 人)";
- } 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.unsign_amount);
- $('#signNum').html(res.data.signed_amount);
- } 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 += '<li data-name="'+ v.name+'" data-type="2" data-code='+v.code+' data-sex='+v.sex+'>' +
- '<div class="avatar">' +
- '<img class="default" src="../images/loading_03.gif" alt="医生头像" />' +
- '<img class="photo" data-sex="'+ v.sex +'" src="'+ getImgUrl(v.photo) +'" alt="医生头像" style="display: none" />' +
- '</div>' +
- '<div class="info">' +
- '<p><span class="name">'+ v.name+'</span></p>' +
- '<p class="c-909090">'+v.hospitalName+'</p>' +
- '</div>' +
- '</li>';
- });
- } else {
- $.each(json, function(i, v) {
- html += '<li data-name="'+ v.name+'" data-type="3" data-code='+v.code+' data-sex='+v.sex+'>' +
- '<div class="avatar">' +
- '<img class="default" src="../images/loading_03.gif" alt="医生头像" />' +
- '<img class="photo" data-sex="'+ v.sex +'" src="'+ getImgUrl(v.photo) +'" alt="医生头像" style="display: none" />' +
- '</div>' +
- '<div class="info">' +
- '<p><span class="name">'+v.name+'</span></p>' +
- '<p class="c-909090">签约总数:'+ v.count+'</p>' +
- '</div>' +
- '</li>';
-
- });
- }
-
- if(json.length==0){
- html += '<li class="zwsj">' +
-
- '<div class="info">' +
- '<p style="text-align: center;line-height: 56px;">暂无数据<br/></p>' +
- '</div>' +
- '</li>';
- }
-
- 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 +='<li data-name="'+ v.name+'" data-type="1" data-code='+v.code+' data-sex='+v.sex+'>' +
- '<div class="avatar">' +
- '<img class="default" src="../images/loading_03.gif" alt="医生头像" />' +
- '<img class="photo" data-sex="'+ v.sex +'" src="'+ getImgUrl(v.photo) +'" alt="医生头像" style="display: none" />' +
- '</div>' +
- '<div class="info">' +
- '<p>' +
- '<span class="name">'+v.name+'</span>' +
- '<span class="c-909090 ml10" >'+(v.deptName || "")+'</span>' +
- '<span class="c-909090 ml10" style="overflow:hidden;width: 54%;height: 20px;display: inline-block;white-space: nowrap;text-overflow: ellipsis;">'+v.hospitalName+'</span>' +
- '</p>' +
- '<p class="c-909090 clearfix">' +
- '<span class="fl">总咨询次数:'+(v.allCount || 0 )+'</span>' +
- '<span class="fr">今日咨询次数:'+(v.currentCount || 0)+'</span>' +
- '</p>' +
- '</div>' +
- '</li>';
-
-
- });
- if(json.length==0){
- html += '<li class="zwsj">' +
-
- '<div class="info">' +
- '<p style="text-align: center;line-height: 56px;">暂无数据</p>' +
- '</div>' +
- '</li>';
- }
- 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{
- mui.openWindow({
- url: "../../qygl/html/sign_manage.html",
- id: getId("../../qygl/html/sign_manage.html"),
- waiting:{
- autoShow:false
- },
- extras:{
- type: type
- }
- });
- }
- });
- /*
- * 跳转到居民
- */
- 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{
- 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");
- }
- });;
- /*
- * 医学交流跳转
- */
- 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");
- })
|