123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- mui.init();
- var teamCode,
- docInfo,
- xueyaLoaded = false; //标记血压信息是否已经加载过
- var sdate = new Date(),
- edate = new Date();
- sdate.setDate(edate.getDate() - 6);
- sdate = sdate.format("yyyy-MM-dd");
- edate = edate.format('yyyy-MM-dd');
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- docInfo = JSON.parse(plus.storage.getItem("docInfo"));
- teamCode = self.teamCode || docInfo.adminTeamCode;
- getTeamInfo();
- getPageInfo();
- bindEvents();
- });
- function getTeamInfo(){
- //设置团队
- var teamInfo = JSON.parse(plus.storage.getItem("teamInfo"));
-
- $('.lin-sel-group').html(template('teams_tmpl', teamInfo));
-
- var index =0;
-
- if(teamCode){
- for(var i=0;i<teamInfo.data.length;i++){
- if(teamInfo.data[i].id == teamCode){
- index = i;
- }
- }
- }
- $('.lin-sel-group li').eq(index).addClass('checked');
- setCurTeamName()
- }
- function setCurTeamName(){
- teamCode = $('.lin-sel-group li.checked').attr('data-code');
- $('.demo-comtop h1').html(($('.lin-sel-group li.checked').attr('data-name'))+'重点跟踪<label class="lin-down-arrow"></label>');
- }
- function getPageInfo(){
- //获得顶部居民数量数据
- getPaitentNumber();
- //获得服务情况数据
- getServiceData();
- //获得近一周血糖,血压情况
- getXuetangData(0);
- //获得近一周控制目标达标人数
- getTargetInfo();
- //获得设备绑定情况
- getDeviceBindInfo();
- }
- //获得顶部数据
- function getPaitentNumber(){
- var url = "/doctor/scheme/getTrackPatientCountTitle",
- params = {
- teamCode: teamCode,
- startDate: sdate,
- endDate: edate
- };
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- $(".all-people .num").text(res.data.trackPatientCount);
- $(".new-people .num").text(res.data.trackPatientAddCount);
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- }
- //获得服务情况数据
- function getServiceData(){
- var url = "/doctor/scheme/getTrackPatientServerCount",
- params = {
- teamCode: teamCode,
- startDate: sdate,
- endDate: edate
- };
- var colors = ["#1fa8dc", "#7360a8", "#69b839", "#ed704a", "#f4c31e"],
- names = ['健康咨询', '慢病随访', '健康指导', '续方审核', '代预约'];
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var arr = [],
- total = 0;
- var data = res.data,
- dataArr = [data.consultCount, data.followupCount, data.guidanceCount, data.reviewedCount, data.reservationCount];
- for(i=0; i<5; i++){
- var obj = {
- value: dataArr[i],
- color: colors[i],
- name: names[i],
- itemStyle:{
- normal:{
- color: colors[i]
- }
- }
- };
- total += dataArr[i];
- arr.push(obj);
- }
- $("#allServiceNum").text(total);
- drawPieChart(arr);
- var html = template('service_tmp', {list: arr});
- $("#serverType").empty().append(html);
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- }
- //获得近一周血糖、血压情况数据
- function getXuetangData(type){
- var url = "/doctor/scheme/getPatientHealthIndexByTeam",
- params = {
- startDate: sdate,
- endDate: edate,
- type: type, //0:血糖, 1: 血压
- teamCode: teamCode
- };
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var html = template('xt-tmp', res.data);
- if(type == 0){
- $(".xuetang-info .mui-loading").remove();
- $(".xuetang-info").empty().append(html);
- }else{
- xueyaLoaded = true;
- $(".xueya-info .mui-loading").remove();
- $(".xueya-info").empty().append(html);
- }
- }else{
- mui.toast(res.msg);
- }
- });
- }
- //获得近一周控制目标达标人数
- function getTargetInfo(){
- var url = '/doctor/scheme/getTrackPatientAimByteam',
- params = {
- teamCode: teamCode,
- startDate: sdate,
- endDate: edate
- };
-
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- $("#xt_num").text(res.data.dbSuggerCount);
- $("#xy_num").text(res.data.dbPresCount);
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- }
- //获得设备绑定情况
- function getDeviceBindInfo(){
- var url = '/doctor/scheme/getDeviceStateByTeam',
- params = {teamCode: teamCode};
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- $("#xty_num").text(res.data.suggerDevCount);
- $("#xyj_num").text(res.data.presDevCount);
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- function drawPieChart(data){
- var pieChart = echarts.init(document.getElementById('pieChart'));
- var option = {
- tooltip: {
- trigger: 'item',
- // formatter: "{a} <br/>{b}: {c} ({d}%)",
- formatter: function(params, ticket, callback) {
- console.log(params)
- if (isNaN(params.percent)) {
- return params.seriesName + '<br />' + params.name + ':' + params.value + ' (0%)';
- } else {
- return params.seriesName + '<br />' + params.name + ':' + params.value + ' (' + params.percent + '%)';
- }
- },
- position: ['50%', '50%']
- },
- series: [
- {
- name:'近一周服务情况',
- type:'pie',
- radius: ['75%', '98%'],
- startAngle: 270,
- // legendHoverLink: false,
- hoverAnimation: false,
- avoidLabelOverlap: false,
- labelLine: {
- normal: {
- show: false
- }
- },
- data: data
- }
- ]
- };
- pieChart.setOption(option);
- }
- /**
- * 显示团队选择
- */
- function showGroupSel(e, isShow){
- isShow = isShow || $('.lin-mask:hidden').length != 0;
- $('.lin-mask').toggle(isShow);
- $('.lin-sel-group').toggle(isShow);
- }
- function bindEvents(){
- $('.demo-comtop h1').on('tap', showGroupSel);
-
- $(".lin-sel-group").on('click', 'li', function(){
- showGroupSel(undefined, false);
- if(!$(this).hasClass('checked')){
- $(this).addClass('checked').siblings().removeClass('checked');
- setCurTeamName();
- }
- getPageInfo();
- })
-
- $(".icon-notice").on('click', function(){
- var $this = $(this),
- val = $this.data("val"),
- content = "";
- switch(val){
- case 'fw':
- content = '近七天签约团队为重点关注居民服务的次数';
- break;
- case 'xt':
- content = '近七天重点关注居民的血糖/血压体征数据统计';
- break;
- case 'mubiao':
- content = '近七天体征达标率>=70%的重点关注居民人数';
- break;
- case 'shebei':
- content = '重点关注居民已绑定设备的数量统计';
- break;
- }
- if(content){
- dialog({
- content: '<div><div class="c-f14 c-333 c-t-left">'+content+'</div></div>',
- quickClose: true
- }).showModal();
- }
- return false;
- });
- //血压血糖按钮切换
- $(".switch-box").on('click', "span", function(){
- var $this = $(this),
- val = $this.attr("data-val"),
- index = $this.index();
- if($this.hasClass("active")){
- return false;
- }
-
- $this.siblings().removeClass("active");
- $this.addClass("active");
-
- mui('.mui-slider').slider().gotoItem(parseInt(index));
-
- if(val == "xt"){
- $("#xtName").text("血糖");
- }else if(val == "xy"){
- if(!xueyaLoaded){
- getXuetangData(1);
- }
- $("#xtName").text("血压");
- }
- });
-
- //监听血压,血糖情况滚动切换
- document.querySelector('.mui-slider').addEventListener('slide', function(event) {
- if (event.detail.slideNumber === 0) {
- $(".switch-box span").eq(0).addClass("active");
- $(".switch-box span").eq(1).removeClass("active");
- $("#xtName").text("血糖");
- } else if (event.detail.slideNumber === 1) {
- if(!xueyaLoaded){
- getXuetangData(1);
- }
- $(".switch-box span").eq(0).removeClass("active");
- $(".switch-box span").eq(1).addClass("active");
- $("#xtName").text("血压");
- }
- });
-
- //查看血糖情况
- $("body").on('tap', ".cycle-div", function(){
- var $this = $(this),
- $parent = $this.closest(".ui-grid"),
- type = 0; //0:血糖,1:血压
- if($parent.hasClass("xuetang-info")){
- type = 0;
- }else{
- type = 1;
- }
- openWebview("../../jkjl/html/patients-record.html", {
- teamCode: teamCode,
- type: type
- })
- });
-
- //跳转居民列表页
- $(".people").on('click', function(){
- var $this = $(this),
- selectType = $this.hasClass("all-people") ? '0' : '1';
- openWebview("guanzhujumin.html",{
- selectType: selectType //0: 总居民, 1: 新增居民
- });
- });
-
- //监测方案设置、控制目标设置、发送文章等点击跳转去选择居民页面
- $(".setting-div").on('click', function(){
- var $this = $(this),
- $name = $this.find(".name"),
- name = $name.text(),
- val = $name.data("val");
- openWebview("choose-jumin-multiple.html", {
- teamCode: teamCode,
- title: name,
- type: val //plan: 检测方案, target:控制目标, article: 健康文章
- });
- })
- }
|