123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802 |
-
- (function(doc, win) {
- var docEl = doc.documentElement,
- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
- recalc = function() {
- var clientWidth = docEl.clientWidth;
- if(!clientWidth) return;
- docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
- };
- if(!doc.addEventListener) return;
- win.addEventListener(resizeEvt, recalc, false);
- doc.addEventListener('DOMContentLoaded', recalc, false);
- })(document, window);
-
- function initScroller(){
- scroller1 = $("#wrapper1").initScroll(
- {
- pullDownAction: function(){
- plus.nativeUI.showWaiting();
- page.init();
- },pullUpAction: function() {
- $(".pullUp").hide();
- return false;
- }
- }
- );
- }
-
-
- var mb;
- var docType, page, area, level, index,title,initArea,initLevel;
- var startDate, endDate, checked;
- //定义年份
- var chooseYear;
- var now = new Date();
- if(now.getMonth() >= 6){
- chooseYear = now.getFullYear();
- }else{
- chooseYear = now.getFullYear() - 1;
- }
- mui.plusReady(function() {
- //plusReady调用完成后才可以调用plus的api
- window.addEventListener("loadData", function(e) {
- location.reload();
- });
- //下拉刷新初始化
- initScroller();
-
- plus.nativeUI.showWaiting();
- /*管理员信息*/
- var sDocInfo = plus.storage.getItem("docInfo");
- var docInfo = JSON.parse(sDocInfo);
- var docSex = docInfo.sex;
- var docPhoto = docInfo.photo;
- /*传参接收*/
- var self = plus.webview.currentWebview();
- startDate = self.startDate;//开始时间
- endDate = self.endDate;//结束时间
- checked = self.checked;//时间控件选择值
- area = self.area;//区域或机构代码
- level = self.level;//级别(4:市 3:区 2:社区医院 1:团队)
- index = self.index;//查询指标代码 格式:(指标代码,指标代码,指标代码)
- title = self.title;
- initArea = self.area;
- initLevel = self.level;
- if(level==4){
- title = title.substring(0,3);
- }
- $("#title").html(title);
- //显示年份
- $(".choose-label").text(chooseYear+"年");
- if(chooseYear == '2016'){
- $("#onlineInfo").hide();
- }else{
- $("#onlineInfo").show();
- }
-
- // //请求获取线上缴费数据
- // getOnlineInfo();
- //
- //设置时间选择器默认值
- // var p = {from: startDate, to: endDate};
- // if(checked!=-1)
- // p = {from: checked}
- // dataPicker.setValue(p.from, p.to);
-
- function tab(date1,date2){
- var oDate1 = new Date(date1);
- var oDate2 = new Date(date2);
- var isYse=false
- if(oDate1.getTime() > oDate2.getTime()){
- isYse=false
- } else {
- isYse=true
- }
- return isYse
- }
- function today(){
- var c = new Date();
- c.setDate(c.getDate() - 1);
- return formatDate(c);
- }//昨天
-
- function getPreDate(pre){
- var c = new Date();
- c.setDate(c.getDate() - pre);
- return formatDate(c);
- }//前几天
-
- function formatDate(d){
- return d.getFullYear() + "-" + getMonth(d.getMonth()) + "-" + d.getDate();
- }
- function getMonth(m){
- m++;
- if(m<10)
- return "0" + m.toString();
- return m.toString();
- }
- function getEndDate() {
- chooseYear = parseInt(chooseYear);
- var endDate = new Date((chooseYear+1) + '-06-30'),
- now = new Date();
- if(now <= endDate){
- var month = now.getMonth()+1,
- date1 = now.getDate();
- if(month < 10){
- month = "0"+month;
- }
- if(date1 < 10){
- date1 = "0"+date1;
- }
- return now.getFullYear()+"-"+month+"-"+date1;
- }else{
- return (chooseYear+1) + '-06-30';
- }
-
- }
-
- page={
- $juZheng:$(".juzheng"),//年龄分布
- init:function(){
- this.initJs();
- this.initData();
- //console.log(startDate+" "+endDate+" "+area+" "+level+" "+index)
- scroller1.refresh();
-
- },
- initData:function(){
- var m=this;
- m.shujujiezhi(),
- m.jiaofeiList(startDate,endDate,area,level)
- m.healthList(startDate,endDate,area,level)
- m.groupList(startDate,endDate,area,level)
- m.sexList(startDate,endDate,area,level)
- m.agoList(startDate,endDate,area,level)
- //请求获取线上缴费数据
- if(chooseYear == '2016'){
- $("#onlineInfo").hide();
- }else{
- $("#onlineInfo").show();
- getOnlineInfo();
- }
-
- },//数据初始化
- initJs:function(){
- var m=this;
- },
- shujujiezhi:function(){
- var m=this;
- sendPost("/statistics/time",null,function(res){
-
- },function(res){
- if(res.status=="200"){
- var date = (res.data && res.data.substring(11,16)) || "";
- $(".jiezhi-time").html(date)
- }
- })
-
- },//数据截止
- jiaofeiList:function(startDate,endDate,area,level,index){
- var m=this;
- sendGet("/statistics/leveltwo_increment",{
- startDate:startDate,
- endDate:getEndDate(), //截止时间
- area:area,//
- level:level,
- index:16
- },function(res){
-
- },function(res){
-
- if(res.status=="200"){
- var data=res.data.index_16;
- var arry=[];
- // console.log("16:"+JSON.stringify(data))
- if(data && data.length==1 && data[0].code==0){//未缴费率为100%的情况,后台没有返回已缴费的数据
- $(".div-yijiaofei .y-amount").html("0");
- $(".div-yijiaofei .y-rate").html("0.00%");
- }
- $.each(data,function(i,v){
- if(v.code == 0 || v.code == 1){
- v.rate = parseFloat(v.rate).toFixed(2);
- if(v.code==1){
- $(".div-yijiaofei .y-amount").html(v.amount);
- $(".div-yijiaofei .y-rate").html(v.rate+"%");
- }else{
- $(".div-weijiaofei .y-amount").html(v.amount);
- $(".div-weijiaofei .y-rate").html(v.rate+"%");
- }
- arry.push({"value":v.rate, "name":v.name+" \n "+v.rate+"%"})
- }
- })
- m.echartsJFQKFun(arry) ;
- }
- })
-
- },
- //健康分布
- healthList:function(startDate,endDate,area,level,index){
- var m=this;
- var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
- sendGet("/statistics/leveltwo_increment",{
- startDate:startDate,
- endDate:getEndDate(), //截止时间
- area:area,//
- level:level,
- index:15
- },function(res){
-
- },function(res){
- if(res.status=="200"){
- var data=res.data.index_15;
- // console.log("15:"+JSON.stringify(data))
- var arry=[];
- $.each(data,function(i,v){
- v.rate = parseFloat(v.rate).toFixed(2);
- arry.push({"value":v.rate, "name":v.name});
- });
- var colors = "#42C7FF,#FFC84C,#FB5DAB,#CD67FD,#795548,#607d8b,#ff5722,#cddc39,#9e9e9e,#3f51b5,#f44336,#9c27b0".split(',');
- var html = template('li_tmpl',{list: _.map(arry,function(v,i) {
- v.color = colors[i];
- return v;
- })});
- $('#jkCatalogs').html(html);
- m.echartsJKFBFun(arry,colors.slice(0,arry.length)) ;
- }
- })
- },
-
- //服务分布
- groupList:function(startDate,endDate,area,level,index){
- var m=this;
- var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
- var index = ((chooseYear==2016)?7:36);
- sendPost("/statistics/leveltwo_increment",{
- startDate:startDate,
- endDate:getEndDate(), //截止时间
- area:area,
- level:level,
- index:index
- },function(res){
-
- },function(res){
- if(res.status=="200"){
- var data=res.data["index_"+index];
- // console.log("777:"+JSON.stringify(data))
- var total = 0;
- mb= {};
- var arry=[];
- if(chooseYear==2016) {
- $.each(data,function(i,v){
- if(v.code == 1 || v.code == 2 || v.code == 3 || v.code == 7){
- v.rate = parseFloat(v.rate).toFixed(2);
- arry.push({"value":v.rate, "name":v.name});
-
- if(v.code=="1"){//普通人群 #42C7FF
- $(".div-ptrq").html(v.rate+"%");
- }else if(v.code=="2"){//慢病人群65岁以下 #FFC84C
- $(".div-65xmbrq").html(v.rate+"%");
- }else if(v.code=="3"){//65岁以上人群 #FB5DAB
- $(".div-65srq").html(v.rate+"%");
- }else if(v.code=="7"){//慢病人群65岁以上 #CD67FD
- $(".div-65smbrq").html(v.rate+"%");
- }
-
- }
- else{
- mb[(v.code==100? "gat" : v.code==4? "gxy" : "tnb")] = v;
- total += v.amount;
- }
- })
- var colors = "#42C7FF,#FFC84C,#FB5DAB,#CD67FD,#795548,#607d8b,#ff5722,#cddc39,#9e9e9e,#3f51b5,#f44336,#9c27b0".split(',');
- var html = template('li_tmpl',{list: _.map(arry,function(v,i) {
- v.color = colors[i];
- return v;
- })});
- $('#fwCatalogs').html(html);
- mb["total"] = total;
- jbfb();
- m.echartsFun(arry,colors.slice(0,arry.length))
- $('#ser2016').show();
- $('#ser2017').hide();
- }else{
- $('#ser2017').show();
- $('#ser2016').hide();
- arry = _.chain(data).filter(function(v) {
- return !_.contains(["0","2","13"],v.code)
- }).map(function(v) {
- v.rate = parseFloat(v.rate).toFixed(2);
- return {"value":v.rate, "name":v.name}
- }).value();
- plus.nativeUI.closeWaiting();
- m.echartsFun2(arry)
- }
- }
- })
- },//分组情况
- sexList:function(startDate,endDate,area,level){
- var m=this;
- var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
- sendGet("/statistics/leveltwo_increment",{
- startDate:startDate,
- endDate:getEndDate(), //截止时间
- area:area,
- level:level,
- index:6
- },null,function(res){
- if(res.status=="200"){
- var data=res.data.index_6;
- var no = {"c-1": 1, "c-2": 2, "c-3": 3};
- $.each(data, function(i,v){
- delete no["c-"+ v.code];
- m.rotateCyc($(".fzabout cite.a"+parseInt(v.code)), parseFloat(v.rate).toFixed(2), v.amount);
- })
- for(var k in no){
- m.rotateCyc($(".fzabout cite.a"+parseInt(no[k])), 0, 0);
- }
- }
-
- })
- },//性别情况
- agoList:function(startDate,endDate,area,level){
- var m=this;
- var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
-
- var parmas={
- startDate:startDate,
- endDate:getEndDate(), //截止时间
- area:area,//
- level:level,
- index:8
- }
-
- sendGet("/statistics/leveltwo_increment",parmas,function(res){
- //console.log("1"+JSON.stringify(res))
- },function(res){
-
- //console.log("2"+JSON.stringify(res))
- if(res.status=="200"){
- var data=res.data.index_8;
- m.txingInit(data);
- }
-
- })
- },
- //健康分布
- echartsJKFBFun:function(arry,colors){
- var m=this;
- var myChart = echarts.init(document.getElementById('jkfb-main'));
- var option = {
- tooltip: {
- trigger: 'item',
- formatter: "{a} <br/>{b}: {c} ({d}%)"
- },
- // textStyle: {
- // color: '#fff',
- // fontStyle: 'normal',
- // fontSize: 16,
- // },
- color:colors,
- series: [
- {
- name:'访问来源',
- type:'pie',
- // center: ['50%', '50%'],
- radius : '65%',
- center:[70,'50%'],
- // selectedMode: 'single',
- // radius: [0, '100%'],
- // legendHoverLink:false,
- // hoverAnimation:false,
- // selectedOffset:0,
- label: {
- normal: {
- show: false,
- textStyle: {
- color: "#000"
- }
- // position: 'inner'
- }
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- data:arry
- },
- ]
- };
- myChart.setOption(option);
- },
- //健康分布扇形统计图
- echartsJFQKFun:function(arry){
- var m=this;
- var myChart = echarts.init(document.getElementById('jfqk-main'));
- var option = {
- tooltip: {
- trigger: 'item',
- formatter: "{a} <br/>{b}: {c} ({d}%)"
- },
- // textStyle: {
- // color: '#fff',
- // fontStyle: 'normal',
- // fontSize: 16,
- // },
- color:['#909090', '#29C681'],
- series: [
- {
- type:'pie',
- radius : ['70%', '90%'],
- // center:[70,55],
- itemStyle : {
- normal : {
- label : {
- show : false
- },
- labelLine : {
- show : false
- }
- },
- },
- // selectedMode: 'single',
- // radius: [0, '100%'],
- // legendHoverLink:false,
- // hoverAnimation:false,
- // selectedOffset:0,
- // label: {
- // normal: {
- // textStyle: {
- // color: "#000"
- // }
- //// position: 'inner'
- // }
- // },
- labelLine: {
- normal: {
- // show: false
- }
- },
- data:arry
- },
- ]
- };
- myChart.setOption(option);
- },
- //服务分布2017
- echartsFun2:function(arry){
- console.log("xx:"+JSON.stringify(arry))
- var m=this;
- var myChart = echarts.init(document.getElementById('main2'));
- var name=[];
- var rate =[];
- $.map(arry,function(item,index){
- name.push(item.name)
- rate.push(item.value)
- })
- var option = {
- grid: {y: 25, y2:30, x:10, x2:10,width:$("#main2").width(),borderColor:'#ffffff'},
- xAxis : [
- {
- type : 'category',
- axisLine: {show:true,lineStyle:{color:'#dcdcdc',width:1}},
- axisTick: {show:false},
- axisLabel: {
- show:true,
- interval:0,
- textStyle: {
- color:'#333',
- fontSize: 14,
- },
- formatter:function(val){
- if(val.length>4){
- return val.substring(0,4)+'…'
- }else{
- return val
- }
- },
- },
- splitArea: {show:false},
- splitLine: {show:false},
- data : name
- }
- ],
- yAxis : [
- {
- type : 'value',
- show:false,
- axisLine: {show:true,lineStyle:{color:'#dcdcdc',width:1}},
- axisTick: {show:false},
- axisLabel: {show:false},
- splitArea: {show:false},
- splitLine: {show:false},
- axisLabel:{show:false}
- }
- ],
- dataZoom: [
- {
- type: 'inside',
- orient:'horizontal',
- filterMode:'none',
- zoomLock:true,
- zoomOnMouseWheel:false,
- preventDefaultMouseMove:false,
- xAxisIndex:0,
- start: 0,
- end: 40
- }
- ],
- series : [
- {
- name:'',
- type:'bar',
- barWidth:20,
- barMinHeight:1,
- label:{
- normal:{
- show:true,
- position:'top',
- formatter: '{c}%',
- textStyle: {
- color: '#333',
- fontSize: 14,
- },
- }
- },
- itemStyle: {normal: {color:'#17B3EC'}},
- data:rate
- }
- ]
- }
- myChart.setOption(option);
- },
- //服务分布2016
- echartsFun:function(arry,colors){
- console.log("xx:"+JSON.stringify(arry))
- var m=this;
- var myChart = echarts.init(document.getElementById('main'));
- var option = {
- tooltip: {
- trigger: 'item',
- formatter: "{a} <br/>{b}: {c} ({d}%)"
- },
- // textStyle: {
- // color: '#fff',
- // fontStyle: 'normal',
- // fontSize: 16,
- // },
- color:colors,
- calculable : true,
- series: [
- {
- name:'访问来源',
- type:'pie',
- // center: ['50%', '50%'],
- radius : '65%',
- center:[70,'50%'],
- // name:'访问来源',
- // type:'pie',
- // center: ['50%', '50%'],
- // radius : '65%',
- // roseType : 'radius',
- // radius : [20, 80],
- // center:[100,'50%'],
- // selectedMode: 'single',
- // radius: [0, '100%'],
- // legendHoverLink:false,
- // hoverAnimation:false,
- // selectedOffset:0,
- label: {
- normal: {
- show: false,
- textStyle: {
- color: "#000"
- }
- // position: 'inner'
- }
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- data:arry
- },
- ]
- };
- myChart.setOption(option);
- },//服务分布扇形统计图
- rotateCyc:function(obj,deg,size){
-
- var deg1=360*(deg/100)
-
- if(deg<51){
- obj.html('<div class="fontdiv"><font>'+deg+'%</font><span>'+size+'</span></div><i class="rotate1" style="transform: rotate('+deg1+'deg);-webkit-transform: rotate('+deg1+'deg);"></i><i class="rotate2" ></i><i class="bg"></i>')
- }else{
- obj.html('<div class="fontdiv"><font>'+deg+'%</font><span>'+size+'</span></div><i class="rotate3"></i><i class="rotate4" style="transform: rotate('+deg1+'deg);-webkit-transform: rotate('+deg1+'deg);"></i><i class="bg"></i>')
- }
- },//分组情况
- txingInit:function(data){
- var m=this;
- var data=data;
- // console.log(JSON.stringify(data))
- /*条形图 变量*/
- var dataLength=data.length;
- var dataWidth=20
- if(dataLength!=0){
- dataWidth=100/dataLength
- }
- var html="";
-
- // var data=[{"amount":0,"code":"1","name":"0~6"},{"amount":0,"code":"2","name":"7~18"},{"amount":0,"code":"3","name":"18~30"},{"amount":0,"code":"4","name":"30~50"},{"amount":0,"code":"5","name":"50~65"},{"amount":0,"code":"1","name":">65"}]
- var count=0;
- $.each(data,function(i,v){
- count+=parseInt(v.amount)
- html+='<li style="width:'+dataWidth+'%" data-value="'+v.amount+'">'+
- '<h3>'+v.amount+'</h3>'+
- '<cite>'+
- '<i style="height:0%;"></i>'+
- '</cite>'+
- '<em>'+v.name+'</em>'+
- '</li>'
-
- })
- m.$juZheng.html(html)
- if(count!=0){//如果有数据
- m.$juZheng.find("li").each(function(i,v){
- var val=$(v).attr("data-value");
- $(v).find("i").css("height",(parseInt(val)/count)*100+"%")
-
- })
- }
-
- }
- }
- page.init()
-
- });
-
- function asse(a, t){
- return (a/t).toFixed(2) * 100;
- }
- function jbfb(){
- var parmas={
- startDate:startDate,
- endDate:endDate, //截止时间
- area:area,//
- level:level,
- index:8
- }
- sendPost("/statistics/sixfive_statistics", parmas, null, function(res){
- if(res.status==200){
- var total = 0;
- function setGlrq(t){
- if(t != 0){
- $.each(res.data, function(i, v) {
- if(v.amount != 0 ){
- if(v.code==1)
- $('#glrq div.gxy').css('width', asse(v.amount, t) +'%').html(v.amount);
- else if(v.code==2)
- $('#glrq div.tnb').css('width', asse(v.amount, t) +'%').html(v.amount);
- else if(v.code==3)
- $('#glrq div.gat').css('width', asse(v.amount, t) +'%').html(v.amount);
- else if(v.code==4)
- $('#glrq div.jk').css('width', asse(v.amount, t) +'%').html(v.amount);
- }
- });
-
- for(var k in mb){
- if(mb[k].amount != 0 )
- $('#mbrq div.'+ k).css('width', asse(mb[k].amount, t) +'%').html(mb[k].amount);
- }
- }
- }
-
-
- $.each(res.data, function(i, v) {
- if(v.code != 0){
- total += v.amount;
- }
- });
- if(total > mb.total){
- setGlrq(total);
- } else{
- setGlrq(mb.total);
- }
-
- } else
- mui.toast(res.msg);
- plus.nativeUI.closeWaiting();
- // console.log("65sui"+ JSON.stringify(res))
- })
- }
- //获取线上缴费情况信息
- function getOnlineInfo(){
- var url = "/statistics/signPayOnline",
- params = {
- level:level,
- area:area,
- year: chooseYear
- };
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- $("#onlineV1").text(res.data.signPayOnlineNum);
- var total = parseInt(res.data.signPayOnlineNum) + parseInt(res.data.signPayUnderNum);
- $("#onlineV2").text(" / "+ total);
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- var dataPicker;
- $(function(){
- dataPicker = $('#datePickDIV').lpicker({onCheck: function(){
- var parent = plus.webview.getWebviewById("analysis1");
- mui.fire(parent, "setDateVal", this.getValue());
- var val = this.getValue();
- page.groupList(val.from, val.to, area, level)
- page.sexList(val.from, val.to,area, level)
- page.agoList(val.from, val.to,area, level)
- }});
-
- window.addEventListener("showMask", function() {
- dataPicker.toggle();
- });
-
- //添加信息删除按钮的点击事件
- $("#closeBtn").on("tap", function(){
- $(".information").hide();
- scroller1.refresh();
- });
-
- //点击缴费情况跳转缴费情况详情页面
- $("#onlineInfo").on("tap", function(){
- if(chooseYear == '2016'){
- return false;
- }
- mui.openWindow({
- url:"pay-online-analysis.html",
- id: "pay-online-analysis",
- extras:{
- level: level,
- code: area,
- title: $("#title").html(),
- year: chooseYear
- }
- })
- });
-
- window.addEventListener("showInformation", function(){
- $(".information").show();
- scroller1.refresh();
- });
- })
- window.addEventListener("refresh", function(e) {
- area = e.detail.area || initArea;
- level = e.detail.level || initLevel;
- name = e.detail.name;
- chooseYear = e.detail.year;
- // console.log("area:"+area+" level:"+level+" name:"+name)
- $("#title").html(name);
- $(".choose-label").text(chooseYear+"年");
- if(chooseYear == '2016'){
- $("#onlineInfo").hide();
- }else{
- $("#onlineInfo").show();
- }
- page.init();
- });
- document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
|