gongzuobaogao.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. $(function() {
  2. var teamCode = '',
  3. tType = 0;
  4. //接口
  5. var pi = {
  6. ztqk: 'statistics/getStatTitleInfo',
  7. qyqk: 'statistics/getSignCountLineByType',
  8. zxtj: 'statistics/getReyStatbyTeam',
  9. jgnfw: 'statistics/getServiceRankingList',
  10. ccftj: 'statistics/getPrescriptionTotalCount',
  11. xqzq: 'statistics/getTeamRenewChangeLine',
  12. pjmyd: 'statistics/getAvgLine'
  13. };
  14. function openWebview(href,hrefId,extras) {
  15. if(plus.os.name == "Android") {
  16. var wv = plus.webview.create( href, hrefId, {hardwareAccelerated:false}, extras);
  17. wv.show("slide-in-right",250);
  18. } else {
  19. mui.openWindow({
  20. url:href,
  21. id:hrefId,
  22. extras:extras
  23. })
  24. }
  25. }
  26. var gzbg = {
  27. // 下拉
  28. $demoComtop: $('.demo-comtop'),
  29. $linMask: $('.lin-mask'),
  30. $linSelGroup: $('.lin-sel-group'),
  31. $selTit: $('#selTit'),
  32. // echarts
  33. $qyqkChart: document.getElementById('qyqkChart'),
  34. $zxtjChart: document.getElementById('zxtjChart'),
  35. $jgChart: document.getElementById('jgChart'),
  36. $ccfChart: document.getElementById('ccfChart'),
  37. $xqzqChart: document.getElementById('xqzqChart'),
  38. $mydChart: document.getElementById('mydChart'),
  39. // 续约/签约切换
  40. $qiehuan: $('#qiehuan'),
  41. $qyLab: $('.qy-lab'),
  42. $qyQh: $('.qy-qh'),
  43. $jgnph: $('.jgnph'),
  44. //总体情况
  45. $qyrs: $('#qyrs'),
  46. $fwrs: $('#fwrs'),
  47. $pjmyd: $('#pjmyd'),
  48. //咨询统计
  49. $whfs: $('#whfs'),
  50. $yhfs: $('#yhfs'),
  51. $jgnph: $('.jgnph'),
  52. $zbdj: $('.zbdj'),
  53. //事件
  54. es: ['tap'],
  55. weeksData: null,
  56. monthData: null,
  57. type: 0,
  58. startDate: '',
  59. endDate: '',
  60. self: null,
  61. weeks: ['','第一周','第二周','第三周','第四周','第五周'],
  62. dateArr: [],
  63. init: function () {
  64. var me = this;
  65. me.self = plus.webview.currentWebview();
  66. teamCode = me.self.teamCode;
  67. me.bindEvent();
  68. me.setDate();
  69. },
  70. setDate: function () {
  71. if (this.type === 0) {
  72. this.startDate = $d.init(1);
  73. this.endDate = $d.init(2);
  74. } else {
  75. this.startDate = $d.init(3);
  76. this.endDate = $d.init(4);
  77. }
  78. if (this.weeksData === null || this.monthData === null) {
  79. this.loadDate();
  80. } else {
  81. this.setDateInPage();
  82. }
  83. },
  84. getZTQKData: function () {
  85. return getReqPromise( pi.ztqk, {
  86. startDate: this.startDate,
  87. endDate: this.endDate
  88. }, 'GET');
  89. },
  90. getQYQKData: function (t) {
  91. return getReqPromise( pi.qyqk, {
  92. startDate: this.startDate,
  93. endDate: this.endDate,
  94. signType: t,
  95. type: this.type
  96. }, 'GET');
  97. },
  98. getZXTJData: function () {
  99. return getReqPromise( pi.zxtj, {
  100. startDate: this.startDate,
  101. endDate: this.endDate,
  102. isNow: 1
  103. }, 'GET');
  104. },
  105. getJGNFWData: function () {
  106. return getReqPromise( pi.jgnfw, {
  107. startDate: this.startDate,
  108. endDate: this.endDate
  109. }, 'GET');
  110. },
  111. getCCFTJData: function(){
  112. //获得长处方统计数据
  113. return getReqPromise( pi.ccftj, {
  114. startDate: this.startDate,
  115. endDate: this.endDate,
  116. adminTeamId: teamCode
  117. }, 'GET');
  118. },
  119. getXQZQData: function () {
  120. return getReqPromise( pi.xqzq, {
  121. teamCode: teamCode,
  122. startDate: this.startDate,
  123. endDate: this.endDate,
  124. type: this.type
  125. }, 'GET');
  126. },
  127. getPJMYDData: function () {
  128. return getReqPromise( pi.pjmyd, {
  129. startDate: this.startDate,
  130. endDate: this.endDate,
  131. type: this.type
  132. }, 'GET');
  133. },
  134. loadDate: function () {
  135. var me = this;
  136. Promise.all([ me.getZTQKData(), me.getQYQKData(0), me.getZXTJData()]).then(function (ress) {
  137. // ress = [{"msg":"查询成功","data":[{"signTotal":100000},{"consultCount":100000},{"reservationCount":100000},{"articleCount":100000},{"guidanceCount":100000},{"followupCount":100000},{"avgScore":""}],"status":200},{"msg":"查询成功","data":[{"signCount":100,"applyDate":"2018-06-25"},{"signCount":10,"applyDate":"2018-06-26"},{"signCount":10,"applyDate":"2018-06-27"},{"signCount":0,"applyDate":"2018-06-28"},{"signCount":0,"applyDate":"2018-06-29"},{"signCount":0,"applyDate":"2018-06-30"},{"signCount":0,"applyDate":"2018-07-01"}],"status":200},{"msg":"查询成功","data":{"onReyCount":550,"totalCount":50},"status":200},{"msg":"查询成功","data":[{"consultRK":0},{"followupRK":0},{"reservationRK":0},{"guidanceRK":0},{"articleRK":0}],"status":200},{"msg":"查询成功","data":[],"status":200},{"msg":"查询成功","data":{"outLine":[],"inLine":[]},"status":200},{"msg":"查询成功","data":{"patientCancelCount":0,"total":0,"finishCount":0,"payOuttimeCount":0,"processingCount":0,"noReviewedCount":0},"status":200}]
  138. if (me.type === 0) {
  139. me.weeksData = ress;
  140. }
  141. if (me.type === 1) {
  142. me.monthData = ress;
  143. }
  144. console.error(JSON.stringify(ress))
  145. me.setDateInPage();
  146. });
  147. },
  148. setDateInPage: function () {
  149. var me = this,
  150. data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
  151. d = [],
  152. qyrs = 0,
  153. fwrs = 0,
  154. pjmyd = 0,
  155. whfs = 0,
  156. yhfs = 0;
  157. if (data[0].status == 200) {
  158. d= data[0].data;
  159. qyrs = d[7].concernCount;
  160. fwrs = d[1].consultCount + d[2].reservationCount + d[3].articleCount + d[4].guidanceCount + d[5].followupCount;
  161. pjmyd = d[6].avgScore;
  162. }
  163. if (data[2].status == 200) {
  164. whfs = data[2].data.onReyCount;
  165. yhfs = data[2].data.totalCount;
  166. }
  167. me.$qyrs.html(qyrs);//qyrs
  168. me.$fwrs.html("-");//fwrs
  169. if(pjmyd==0){
  170. me.$pjmyd.html("-");//'暂无评分'
  171. }else{
  172. me.$pjmyd.html("-");//pjmyd
  173. }
  174. //咨询统计
  175. me.$whfs.html(whfs);
  176. me.$yhfs.html(yhfs);
  177. me.initChartsData();
  178. },
  179. initChartsData: function () {
  180. var me = this,
  181. data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
  182. qy = {dt:[],da:[]},
  183. zxtj = [],
  184. jgnfw = [],
  185. ccftj = [],
  186. pjmyd = {dt:[],da:[]},
  187. xqzq = {da1: [], da2: []},
  188. dArr = $d.init(5);
  189. me.dateArr = $d.init(6);
  190. if (data[1].status == 200) {
  191. qy = me.getDataXY( data[1].data, 1);
  192. if (me.type === 0) {
  193. qy = $h.contrastDate( dArr, qy, 'dt', 'da');
  194. }
  195. if (me.type === 1) {
  196. var d1 = $h.getWeeksData( qy, 'dt', 'da'),
  197. qy = d1.da;
  198. me.dateArr = d1.dt;
  199. }
  200. }
  201. if (data[2].status == 200) {
  202. zxtj = data[2].data;
  203. }
  204. if (data[0].status == 200) {
  205. 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];
  206. }
  207. // if (data[3].status == 200) {
  208. // var html = '';
  209. // html += '<li>' + (data[3].data[0].consultRK ? ('第' + data[3].data[0].consultRK + '名') : '') + '</li>';
  210. // html += '<li>' + (data[3].data[1].followupRK ? ('第' + data[3].data[1].followupRK + '名') : '') + '</li>';
  211. // html += '<li>' + (data[3].data[2].reservationRK ? ('第' + data[3].data[2].reservationRK + '名') : '') + '</li>';
  212. // html += '<li>' + (data[3].data[3].guidanceRK ? ('第' + data[3].data[3].guidanceRK + '名') : '') + '</li>';
  213. // html += '<li>' + (data[3].data[4].articleRK ? ('第' + data[3].data[4].articleRK + '名') : '') + '</li>';
  214. // me.$jgnph.html(html);
  215. // }
  216. // if (data[4].status == 200) {
  217. // pjmyd = me.getDataXY( data[4].data, 2);
  218. // if (me.type === 0) {
  219. //// me.dateArr = $d.init(5);
  220. // pjmyd = $h.contrastDate( dArr, pjmyd, 'dt', 'da');
  221. // }
  222. // if (me.type === 1) {
  223. // var d1 = $h.getWeeksData( pjmyd, 'dt', 'da'),
  224. // pjmyd = d1.da;
  225. // me.dateArr = d1.dt;
  226. // }
  227. // }
  228. // if (data[5].status == 200) {
  229. // xqzq.dt1 = me.getXQDataXY( data[5].data.inLine, 1);
  230. // xqzq.dt2 = me.getXQDataXY( data[5].data.outLine, 2);
  231. // if (me.type === 0) {
  232. //// me.dateArr = $d.init(5);
  233. // xqzq.dt1 = $h.contrastDate( dArr, xqzq.dt1, 'dt', 'da');
  234. // xqzq.dt2 = $h.contrastDate( dArr, xqzq.dt2, 'dt', 'da');
  235. // }
  236. // if (me.type === 1) {
  237. // var d1 = $h.getWeeksData( xqzq.dt1, 'dt', 'da'),
  238. // d2 = $h.getWeeksData( xqzq.dt2, 'dt', 'da');
  239. // xqzq.dt1 = d1.da;
  240. // xqzq.dt2 = d2.da;
  241. // me.dateArr = d1.dt;
  242. // }
  243. // }
  244. // if(data[6].status == 200){
  245. // var ccfdata = data[6].data;
  246. // ccftj.push(ccfdata.total);
  247. // ccftj.push(ccfdata.finishCount);
  248. // ccftj.push(ccfdata.processingCount);
  249. // ccftj.push(ccfdata.patientCancelCount);
  250. // ccftj.push(ccfdata.noReviewedCount);
  251. // ccftj.push(ccfdata.payOuttimeCount);
  252. // }
  253. // me.loadCharts( qy, zxtj, jgnfw, null, pjmyd, [ me.setXQSeries( 1, xqzq.dt1), me.setXQSeries( 2, xqzq.dt2)]);
  254. me.loadCharts( qy, zxtj, jgnfw, null, null, null, null);
  255. },
  256. initQYQKCharts: function ( t, xd, yd) {
  257. // console.log(t)
  258. // console.log(xd)
  259. // console.log(yd)
  260. $ic.init({
  261. el: this.$qyqkChart,
  262. xAxisData: xd,
  263. seriesData: this.setSeries(t, yd),
  264. chartsType: 1
  265. });
  266. },
  267. loadCharts: function ( qy, zxtj, jgnfw, ccftj, pjmyd, xqzq) {
  268. var me = this;
  269. var count = zxtj.onReyCount + zxtj.totalCount;
  270. var zx = count == 0 ? (1/2)*100 : 0;
  271. Promise.all([
  272. // 签约情况
  273. // me.initQYQKCharts( 1, me.dateArr, qy),
  274. // 资讯统计
  275. $ic.init({
  276. el: me.$zxtjChart,
  277. seriesData: [{
  278. name: '未回复咨询',
  279. value: zxtj.onReyCount || zx
  280. }, {
  281. name: '已回复咨询',
  282. value: zxtj.totalCount || zx
  283. }],
  284. chartsType: 2
  285. }),
  286. // 机构内服务
  287. // $ic.init({
  288. // el: me.$jgChart,
  289. // xAxisData: ['咨询', '随访', '代预约', '指导', '教育'],
  290. // seriesData: jgnfw,
  291. // chartsType: 3,
  292. // color: '#fbba31',
  293. // cb: me.eConsole
  294. // }),
  295. // 长处方统计
  296. // $ic.init({
  297. // el: me.$ccfChart,
  298. // xAxisData: ['总量', '已完成', '进行中', '居民\n取消', '审核\n未通过', '其他\n原因\n取消'],
  299. // seriesData: ccftj,
  300. // chartsType: 3,
  301. // color: '#17B3EC',
  302. // grid: {
  303. // x: 35,
  304. // y: 30,
  305. // x2: 20,
  306. // y2: 60
  307. // },
  308. // cb: function(){}
  309. // }),
  310. // 平均医生评分
  311. // $ic.init({
  312. // el: me.$mydChart,
  313. // xAxisData: me.dateArr,
  314. // seriesData: me.setSeries(2, pjmyd),
  315. // chartsType: 1
  316. // }),
  317. // 续签转签
  318. // $ic.init({
  319. // el: me.$xqzqChart,
  320. // xAxisData: me.dateArr,
  321. // seriesData: xqzq,
  322. // chartsType: 1,
  323. // legend: {
  324. // x: 'right',
  325. // data: ["签入人数", "签出人数"]
  326. // }
  327. // })
  328. ]);
  329. },
  330. getDataXY: function ( d, t) {
  331. var data = {dt:[],da:[]};
  332. if (this.type == 0) {
  333. for (var i = 0, len = d.length; i< len; i++) {
  334. data.dt.push(t == 1 ? d[i].applyDate : d[i].dateNo);
  335. data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
  336. }
  337. return data;
  338. }
  339. if (this.type == 1) {
  340. for (var i = 0, len = d.length; i< len; i++) {
  341. data.dt.push(t == 1 ? d[i].weekOfMonth : d[i].weekNo);
  342. data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
  343. }
  344. return data;
  345. }
  346. },
  347. getXQDataXY: function ( d, t) {
  348. var data = {dt:[],da:[]};
  349. for (var i = 0, len = d.length; i< len; i++) {
  350. if (this.type === 0) {
  351. data.dt.push(d[i].dateNo);
  352. }
  353. if (this.type === 1) {
  354. data.dt.push(d[i].weekOfMonth);
  355. }
  356. data.da.push(t == 1 ? d[i].inCount : d[i].outCount);
  357. }
  358. return data;
  359. },
  360. setXQSeries: function ( type, seriesData) {
  361. return {
  362. name: type == 1 ? '签入人数' : type == 2 ? '签出人数' : '',
  363. type: "line",
  364. symbol: "emptyCircle",
  365. data: seriesData
  366. }
  367. },
  368. setSeries: function ( type, seriesData) {
  369. return [{
  370. name: type == 1 ? '签约数' : type == 2 ? '医生评分' : type == 3 ? '续签数' : '',
  371. type: "line",
  372. symbol: "emptyCircle",
  373. data: seriesData
  374. }]
  375. },
  376. bindEvent: function () {
  377. var me = this;
  378. // 续约/签约切换
  379. $h.setEvent([
  380. [ me.$qiehuan, me.es[0], function () {
  381. me.xyQyEventFun( this, me);
  382. }],
  383. [ me.$demoComtop, me.es[0], function () {
  384. me.xlEventFun( this, me);
  385. }, 'h1'],
  386. [ me.$linMask, me.es[0], function () {
  387. $(this).hide();
  388. me.$linSelGroup.hide();
  389. }],
  390. [ me.$linSelGroup, me.es[0], function () {
  391. me.switchWeeksToMonth( this, me);
  392. }, 'li'],
  393. [ $(me.$xqzqChart), me.es[0], function () {
  394. openWebview('../html/tuanduizhuanqianxiangqing.html', 'tuanduizhuanqianxiangqing', {
  395. teamCode: teamCode
  396. })
  397. }],
  398. [ me.$zbdj, me.es[0], function () {
  399. var o = { seriesIndex:1, dataIndex:0};
  400. o.dataIndex = $(this).index();
  401. me.eConsole(o);
  402. console.log($(this).index());
  403. }, 'li']
  404. ]);
  405. },
  406. //周月切换
  407. switchWeeksToMonth: function ( that, me) {
  408. var type = $(that).attr('data-type');
  409. $(that).siblings().removeClass('checked');
  410. $(that).addClass('checked');
  411. me.$selTit.html($(that).find('label').html());
  412. me.$linMask.hide();
  413. me.$linSelGroup.hide();
  414. me.type = parseInt(type);
  415. tType = me.type;
  416. this.setDate();
  417. },
  418. //下拉
  419. xlEventFun: function ( thst, me) {
  420. var lCss = me.$linMask.css('display');
  421. if (lCss == 'none') {
  422. me.$linMask.show();
  423. me.$linSelGroup.show();
  424. } else {
  425. me.$linMask.hide();
  426. me.$linSelGroup.hide();
  427. }
  428. },
  429. getSwitchData: function ( t1, t2, t3, that, me) {
  430. var qy = {dt:[],da:[]};
  431. Promise.all([me.getQYQKData(t1)]).then(function (res) {
  432. if (res[0].status == 200) {
  433. qy = me.getDataXY( res[0].data, 1),
  434. dArr = $d.init(5);
  435. me.dateArr = $d.init(6);
  436. if (me.type === 0) {
  437. // me.dateArr = $d.init(5);
  438. qy = $h.contrastDate( dArr, qy, 'dt', 'da');
  439. }
  440. if (me.type === 1) {
  441. var d1 = $h.getWeeksData( qy, 'dt', 'da'),
  442. qy = d1.da;
  443. me.dateArr = d1.dt;
  444. }
  445. me.initQYQKCharts( t2, me.dateArr, qy);
  446. }
  447. });
  448. $(that).attr('data-type', t3);
  449. },
  450. // 续约/签约切换时间函数
  451. xyQyEventFun: function ( that, me) {
  452. var type = $(that).attr('data-type');
  453. if(type == '1') {
  454. me.$qyLab.html('续约情况');
  455. me.$qyQh.html('切换签约情况');
  456. me.getSwitchData( 1, 3, '2', that, me);
  457. }
  458. if(type == '2') {
  459. me.$qyLab.html('签约情况');
  460. me.$qyQh.html('切换续约情况');
  461. me.getSwitchData( 0, 1, '1', that, me);
  462. }
  463. },
  464. eConsole: function (param) {
  465. // return;
  466. if(typeof param.seriesIndex != 'undefined') {
  467. switch(param.dataIndex) {
  468. case 0:
  469. openWebview('../html/tuanduizixunxiangqing.html', 'tuanduizixunxiangqing', {
  470. teamCode: teamCode,
  471. type: tType
  472. })
  473. break;
  474. case 1:
  475. openWebview('../html/tuanduisuifangxiangqing.html', 'tuanduisuifangxiangqing', {
  476. teamCode: teamCode,
  477. type: tType
  478. })
  479. break;
  480. case 2:
  481. openWebview('../html/tuanduidaiyuyuexiangqing.html', 'tuanduidaiyuyuexiangqing', {
  482. teamCode: teamCode,
  483. type: tType
  484. })
  485. break;
  486. case 3:
  487. openWebview('../html/tuanduizhidaoxiangqing.html', 'tuanduizhidaoxiangqing', {
  488. teamCode: teamCode,
  489. type: tType
  490. })
  491. break;
  492. case 4:
  493. openWebview('../html/tuanduijiaoyuxiangqing.html', 'tuanduijiaoyuxiangqing', {
  494. teamCode: teamCode,
  495. type: tType
  496. })
  497. break;
  498. default:
  499. break;
  500. }
  501. }
  502. }
  503. };
  504. mui.init();
  505. mui.plusReady(function(){
  506. gzbg.init();
  507. });
  508. });