123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- $(function() {
- var teamCode = '',
- tType = 0;
- //接口
- var pi = {
- ztqk: 'statistics/getStatTitleInfo',
- qyqk: 'statistics/getSignCountLineByType',
- zxtj: 'statistics/getReyStatbyTeam',
- jgnfw: 'statistics/getServiceRankingList',
- ccftj: 'statistics/getPrescriptionTotalCount',
- xqzq: 'statistics/getTeamRenewChangeLine',
- pjmyd: 'statistics/getAvgLine'
- };
-
- function openWebview(href,hrefId,extras) {
- if(plus.os.name == "Android") {
- var wv = plus.webview.create( href, hrefId, {hardwareAccelerated:false}, extras);
- wv.show("slide-in-right",250);
- } else {
- mui.openWindow({
- url:href,
- id:hrefId,
- extras:extras
- })
- }
- }
-
- var gzbg = {
- // 下拉
- $demoComtop: $('.demo-comtop'),
- $linMask: $('.lin-mask'),
- $linSelGroup: $('.lin-sel-group'),
- $selTit: $('#selTit'),
- // echarts
- $qyqkChart: document.getElementById('qyqkChart'),
- $zxtjChart: document.getElementById('zxtjChart'),
- $jgChart: document.getElementById('jgChart'),
- $ccfChart: document.getElementById('ccfChart'),
- $xqzqChart: document.getElementById('xqzqChart'),
- $mydChart: document.getElementById('mydChart'),
- // 续约/签约切换
- $qiehuan: $('#qiehuan'),
- $qyLab: $('.qy-lab'),
- $qyQh: $('.qy-qh'),
- $jgnph: $('.jgnph'),
- //总体情况
- $qyrs: $('#qyrs'),
- $fwrs: $('#fwrs'),
- $pjmyd: $('#pjmyd'),
- //咨询统计
- $whfs: $('#whfs'),
- $yhfs: $('#yhfs'),
- $jgnph: $('.jgnph'),
- $zbdj: $('.zbdj'),
- //事件
- es: ['tap'],
- weeksData: null,
- monthData: null,
- type: 0,
- startDate: '',
- endDate: '',
- self: null,
- weeks: ['','第一周','第二周','第三周','第四周','第五周'],
- dateArr: [],
- init: function () {
- var me = this;
- me.self = plus.webview.currentWebview();
- teamCode = me.self.teamCode;
- me.bindEvent();
- me.setDate();
- },
- setDate: function () {
- if (this.type === 0) {
- this.startDate = $d.init(1);
- this.endDate = $d.init(2);
- } else {
- this.startDate = $d.init(3);
- this.endDate = $d.init(4);
- }
- if (this.weeksData === null || this.monthData === null) {
- this.loadDate();
- } else {
- this.setDateInPage();
- }
- },
- getZTQKData: function () {
- return getReqPromise( pi.ztqk, {
- startDate: this.startDate,
- endDate: this.endDate
- }, 'GET');
- },
- getQYQKData: function (t) {
- return getReqPromise( pi.qyqk, {
- startDate: this.startDate,
- endDate: this.endDate,
- signType: t,
- type: this.type
- }, 'GET');
- },
- getZXTJData: function () {
- return getReqPromise( pi.zxtj, {
- startDate: this.startDate,
- endDate: this.endDate,
- isNow: 1
- }, 'GET');
- },
- getJGNFWData: function () {
- return getReqPromise( pi.jgnfw, {
- startDate: this.startDate,
- endDate: this.endDate
- }, 'GET');
- },
- getCCFTJData: function(){
- //获得长处方统计数据
- return getReqPromise( pi.ccftj, {
- startDate: this.startDate,
- endDate: this.endDate,
- adminTeamId: teamCode
- }, 'GET');
- },
- getXQZQData: function () {
- return getReqPromise( pi.xqzq, {
- teamCode: teamCode,
- startDate: this.startDate,
- endDate: this.endDate,
- type: this.type
- }, 'GET');
- },
- getPJMYDData: function () {
- return getReqPromise( pi.pjmyd, {
- startDate: this.startDate,
- endDate: this.endDate,
- type: this.type
- }, 'GET');
- },
- loadDate: function () {
- var me = this;
- Promise.all([ me.getZTQKData(), me.getQYQKData(0), me.getZXTJData(), me.getJGNFWData(), me.getPJMYDData(), me.getXQZQData(), me.getCCFTJData()]).then(function (ress) {
- if (me.type === 0) {
- me.weeksData = ress;
- }
- if (me.type === 1) {
- me.monthData = ress;
- }
- me.setDateInPage();
- });
- },
- setDateInPage: function () {
- var me = this,
- data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
- d = [],
- qyrs = 0,
- fwrs = 0,
- pjmyd = 0,
- whfs = 0,
- yhfs = 0;
- if (data[0].status == 200) {
- d= data[0].data;
- qyrs = d[0].signTotal;
- fwrs = d[1].consultCount + d[2].reservationCount + d[3].articleCount + d[4].guidanceCount + d[5].followupCount;
- pjmyd = d[6].avgScore;
- }
- if (data[2].status == 200) {
- whfs = data[2].data.onReyCount;
- yhfs = data[2].data.totalCount;
- }
- me.$qyrs.html(qyrs);
- me.$fwrs.html(fwrs);
- if(pjmyd==0){
- me.$pjmyd.html('暂无评分');
- }else{
- me.$pjmyd.html(pjmyd);
- }
- //咨询统计
- me.$whfs.html(whfs);
- me.$yhfs.html(yhfs);
- me.initChartsData();
- },
- initChartsData: function () {
- var me = this,
- data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
- qy = {dt:[],da:[]},
- zxtj = [],
- jgnfw = [],
- ccftj = [],
- pjmyd = {dt:[],da:[]},
- xqzq = {da1: [], da2: []},
- dArr = $d.init(5);
- me.dateArr = $d.init(6);
- if (data[1].status == 200) {
- qy = me.getDataXY( data[1].data, 1);
- if (me.type === 0) {
- qy = $h.contrastDate( dArr, qy, 'dt', 'da');
- }
- if (me.type === 1) {
- var d1 = $h.getWeeksData( qy, 'dt', 'da'),
- qy = d1.da;
- me.dateArr = d1.dt;
- }
- }
- if (data[2].status == 200) {
- zxtj = data[2].data;
- }
- if (data[0].status == 200) {
- jgnfw = [data[0].data[1].consultCount, data[0].data[5].followupCount, data[0].data[2].reservationCount, data[0].data[4].guidanceCount, data[0].data[3].articleCount];
- }
- if (data[3].status == 200) {
- var html = '';
- html += '<li>' + (data[3].data[0].consultRK ? ('第' + data[3].data[0].consultRK + '名') : '') + '</li>';
- html += '<li>' + (data[3].data[1].followupRK ? ('第' + data[3].data[1].followupRK + '名') : '') + '</li>';
- html += '<li>' + (data[3].data[2].reservationRK ? ('第' + data[3].data[2].reservationRK + '名') : '') + '</li>';
- html += '<li>' + (data[3].data[3].guidanceRK ? ('第' + data[3].data[3].guidanceRK + '名') : '') + '</li>';
- html += '<li>' + (data[3].data[4].articleRK ? ('第' + data[3].data[4].articleRK + '名') : '') + '</li>';
- me.$jgnph.html(html);
- }
- if (data[4].status == 200) {
- pjmyd = me.getDataXY( data[4].data, 2);
- if (me.type === 0) {
- // me.dateArr = $d.init(5);
- pjmyd = $h.contrastDate( dArr, pjmyd, 'dt', 'da');
- }
- if (me.type === 1) {
- var d1 = $h.getWeeksData( pjmyd, 'dt', 'da'),
- pjmyd = d1.da;
- me.dateArr = d1.dt;
- }
- }
- if (data[5].status == 200) {
- xqzq.dt1 = me.getXQDataXY( data[5].data.inLine, 1);
- xqzq.dt2 = me.getXQDataXY( data[5].data.outLine, 2);
- if (me.type === 0) {
- // me.dateArr = $d.init(5);
- xqzq.dt1 = $h.contrastDate( dArr, xqzq.dt1, 'dt', 'da');
- xqzq.dt2 = $h.contrastDate( dArr, xqzq.dt2, 'dt', 'da');
- }
- if (me.type === 1) {
- var d1 = $h.getWeeksData( xqzq.dt1, 'dt', 'da'),
- d2 = $h.getWeeksData( xqzq.dt2, 'dt', 'da');
- xqzq.dt1 = d1.da;
- xqzq.dt2 = d2.da;
- me.dateArr = d1.dt;
- }
- }
- if(data[6].status == 200){
- var ccfdata = data[6].data;
- ccftj.push(ccfdata.total);
- ccftj.push(ccfdata.finishCount);
- ccftj.push(ccfdata.processingCount);
- ccftj.push(ccfdata.patientCancelCount);
- ccftj.push(ccfdata.noReviewedCount);
- ccftj.push(ccfdata.payOuttimeCount);
- }
- me.loadCharts( qy, zxtj, jgnfw, ccftj, pjmyd, [ me.setXQSeries( 1, xqzq.dt1), me.setXQSeries( 2, xqzq.dt2)]);
- },
- initQYQKCharts: function ( t, xd, yd) {
- // console.log(t)
- // console.log(xd)
- // console.log(yd)
- $ic.init({
- el: this.$qyqkChart,
- xAxisData: xd,
- seriesData: this.setSeries(t, yd),
- chartsType: 1
- });
- },
- loadCharts: function ( qy, zxtj, jgnfw, ccftj, pjmyd, xqzq) {
- var me = this;
- var count = zxtj.onReyCount + zxtj.totalCount;
- var zx = count == 0 ? (1/2)*100 : 0;
- Promise.all([
- // 签约情况
- me.initQYQKCharts( 1, me.dateArr, qy),
- // 资讯统计
- $ic.init({
- el: me.$zxtjChart,
- seriesData: [{
- name: '未回复咨询',
- value: zxtj.onReyCount || zx
- }, {
- name: '已回复咨询',
- value: zxtj.totalCount || zx
- }],
- chartsType: 2
- }),
- // 机构内服务
- $ic.init({
- el: me.$jgChart,
- xAxisData: ['咨询', '随访', '代预约', '指导', '教育'],
- seriesData: jgnfw,
- chartsType: 3,
- color: '#fbba31',
- cb: me.eConsole
- }),
- // 长处方统计
- $ic.init({
- el: me.$ccfChart,
- xAxisData: ['总量', '已完成', '进行中', '居民\n取消', '审核\n未通过', '其他\n原因\n取消'],
- seriesData: ccftj,
- chartsType: 3,
- color: '#17B3EC',
- grid: {
- x: 35,
- y: 30,
- x2: 20,
- y2: 60
- },
- cb: function(){}
- }),
- // 平均医生评分
- $ic.init({
- el: me.$mydChart,
- xAxisData: me.dateArr,
- seriesData: me.setSeries(2, pjmyd),
- chartsType: 1
- }),
- // 续签转签
- $ic.init({
- el: me.$xqzqChart,
- xAxisData: me.dateArr,
- seriesData: xqzq,
- chartsType: 1,
- legend: {
- x: 'right',
- data: ["签入人数", "签出人数"]
- }
- })
- ]);
- },
- getDataXY: function ( d, t) {
- var data = {dt:[],da:[]};
- if (this.type == 0) {
- for (var i = 0, len = d.length; i< len; i++) {
- data.dt.push(t == 1 ? d[i].applyDate : d[i].dateNo);
- data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
- }
- return data;
- }
- if (this.type == 1) {
- for (var i = 0, len = d.length; i< len; i++) {
- data.dt.push(t == 1 ? d[i].weekOfMonth : d[i].weekNo);
- data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
- }
- return data;
- }
- },
- getXQDataXY: function ( d, t) {
- var data = {dt:[],da:[]};
- for (var i = 0, len = d.length; i< len; i++) {
- if (this.type === 0) {
- data.dt.push(d[i].dateNo);
- }
- if (this.type === 1) {
- data.dt.push(d[i].weekOfMonth);
- }
- data.da.push(t == 1 ? d[i].inCount : d[i].outCount);
- }
- return data;
- },
- setXQSeries: function ( type, seriesData) {
- return {
- name: type == 1 ? '签入人数' : type == 2 ? '签出人数' : '',
- type: "line",
- symbol: "emptyCircle",
- data: seriesData
- }
- },
- setSeries: function ( type, seriesData) {
- return [{
- name: type == 1 ? '签约数' : type == 2 ? '医生评分' : type == 3 ? '续签数' : '',
- type: "line",
- symbol: "emptyCircle",
- data: seriesData
- }]
- },
- bindEvent: function () {
- var me = this;
- // 续约/签约切换
- $h.setEvent([
- [ me.$qiehuan, me.es[0], function () {
- me.xyQyEventFun( this, me);
- }],
- [ me.$demoComtop, me.es[0], function () {
- me.xlEventFun( this, me);
- }, 'h1'],
- [ me.$linMask, me.es[0], function () {
- $(this).hide();
- me.$linSelGroup.hide();
- }],
- [ me.$linSelGroup, me.es[0], function () {
- me.switchWeeksToMonth( this, me);
- }, 'li'],
- [ $(me.$xqzqChart), me.es[0], function () {
- openWebview('../html/tuanduizhuanqianxiangqing.html', 'tuanduizhuanqianxiangqing', {
- teamCode: teamCode
- })
- }],
- [ me.$zbdj, me.es[0], function () {
- var o = { seriesIndex:1, dataIndex:0};
- o.dataIndex = $(this).index();
- me.eConsole(o);
- console.log($(this).index());
- }, 'li']
- ]);
- },
- //周月切换
- switchWeeksToMonth: function ( that, me) {
- var type = $(that).attr('data-type');
- $(that).siblings().removeClass('checked');
- $(that).addClass('checked');
- me.$selTit.html($(that).find('label').html());
- me.$linMask.hide();
- me.$linSelGroup.hide();
- me.type = parseInt(type);
- tType = me.type;
- this.setDate();
- },
- //下拉
- xlEventFun: function ( thst, me) {
- var lCss = me.$linMask.css('display');
- if (lCss == 'none') {
- me.$linMask.show();
- me.$linSelGroup.show();
- } else {
- me.$linMask.hide();
- me.$linSelGroup.hide();
- }
- },
- getSwitchData: function ( t1, t2, t3, that, me) {
- var qy = {dt:[],da:[]};
- Promise.all([me.getQYQKData(t1)]).then(function (res) {
- if (res[0].status == 200) {
- qy = me.getDataXY( res[0].data, 1),
- dArr = $d.init(5);
- me.dateArr = $d.init(6);
- if (me.type === 0) {
- // me.dateArr = $d.init(5);
- qy = $h.contrastDate( dArr, qy, 'dt', 'da');
- }
- if (me.type === 1) {
- var d1 = $h.getWeeksData( qy, 'dt', 'da'),
- qy = d1.da;
- me.dateArr = d1.dt;
- }
- me.initQYQKCharts( t2, me.dateArr, qy);
- }
- });
- $(that).attr('data-type', t3);
- },
- // 续约/签约切换时间函数
- xyQyEventFun: function ( that, me) {
- var type = $(that).attr('data-type');
- if(type == '1') {
- me.$qyLab.html('续约情况');
- me.$qyQh.html('切换签约情况');
- me.getSwitchData( 1, 3, '2', that, me);
- }
- if(type == '2') {
- me.$qyLab.html('签约情况');
- me.$qyQh.html('切换续约情况');
- me.getSwitchData( 0, 1, '1', that, me);
- }
- },
- eConsole: function (param) {
- // return;
- if(typeof param.seriesIndex != 'undefined') {
- switch(param.dataIndex) {
- case 0:
- openWebview('../html/tuanduizixunxiangqing.html', 'tuanduizixunxiangqing', {
- teamCode: teamCode,
- type: tType
- })
- break;
- case 1:
- openWebview('../html/tuanduisuifangxiangqing.html', 'tuanduisuifangxiangqing', {
- teamCode: teamCode,
- type: tType
- })
- break;
- case 2:
- openWebview('../html/tuanduidaiyuyuexiangqing.html', 'tuanduidaiyuyuexiangqing', {
- teamCode: teamCode,
- type: tType
- })
- break;
- case 3:
- openWebview('../html/tuanduizhidaoxiangqing.html', 'tuanduizhidaoxiangqing', {
- teamCode: teamCode,
- type: tType
- })
- break;
- case 4:
- openWebview('../html/tuanduijiaoyuxiangqing.html', 'tuanduijiaoyuxiangqing', {
- teamCode: teamCode,
- type: tType
- })
- break;
- default:
- break;
- }
- }
- }
- };
-
- mui.init();
- mui.plusReady(function(){
- gzbg.init();
- });
- });
|