gongzuobaogao.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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. plus.nativeUI.showWaiting();
  137. Promise.all([ me.getZTQKData(), me.getQYQKData(0), me.getZXTJData()]).then(function (ress) {
  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. plus.nativeUI.closeWaiting();
  147. });
  148. },
  149. setDateInPage: function () {
  150. var me = this,
  151. data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
  152. d = [],
  153. qyrs = 0,
  154. fwrs = 0,
  155. pjmyd = 0,
  156. whfs = 0,
  157. yhfs = 0;
  158. if (data[0].status == 200) {
  159. d= data[0].data;
  160. qyrs = d[7].concernCount;
  161. fwrs = d[1].consultCount + d[2].reservationCount + d[3].articleCount + d[4].guidanceCount + d[5].followupCount;
  162. pjmyd = d[6].avgScore;
  163. }
  164. if (data[2].status == 200) {
  165. whfs = data[2].data.onReyCount;
  166. yhfs = data[2].data.totalCount;
  167. }
  168. me.$qyrs.html(qyrs);//qyrs
  169. me.$fwrs.html("-");//fwrs
  170. if(pjmyd==0){
  171. me.$pjmyd.html("-");//'暂无评分'
  172. }else{
  173. me.$pjmyd.html("-");//pjmyd
  174. }
  175. //咨询统计
  176. me.$whfs.html(whfs);
  177. me.$yhfs.html(yhfs);
  178. me.initChartsData();
  179. },
  180. initChartsData: function () {
  181. var me = this,
  182. data = me.type === 0 ? me.weeksData : me.type === 1 ? me.monthData : [],
  183. qy = {dt:[],da:[]},
  184. zxtj = [],
  185. jgnfw = [],
  186. ccftj = [],
  187. pjmyd = {dt:[],da:[]},
  188. xqzq = {da1: [], da2: []},
  189. dArr = $d.init(5);
  190. me.dateArr = $d.init(6);
  191. if (data[1].status == 200) {
  192. qy = me.getDataXY( data[1].data, 1);
  193. if (me.type === 0) {
  194. qy = $h.contrastDate( dArr, qy, 'dt', 'da');
  195. }
  196. if (me.type === 1) {
  197. var d1 = $h.getWeeksData( qy, 'dt', 'da'),
  198. qy = d1.da;
  199. me.dateArr = d1.dt;
  200. }
  201. }
  202. if (data[2].status == 200) {
  203. zxtj = data[2].data;
  204. }
  205. if (data[0].status == 200) {
  206. 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];
  207. }
  208. // if (data[3].status == 200) {
  209. // var html = '';
  210. // html += '<li>' + (data[3].data[0].consultRK ? ('第' + data[3].data[0].consultRK + '名') : '') + '</li>';
  211. // html += '<li>' + (data[3].data[1].followupRK ? ('第' + data[3].data[1].followupRK + '名') : '') + '</li>';
  212. // html += '<li>' + (data[3].data[2].reservationRK ? ('第' + data[3].data[2].reservationRK + '名') : '') + '</li>';
  213. // html += '<li>' + (data[3].data[3].guidanceRK ? ('第' + data[3].data[3].guidanceRK + '名') : '') + '</li>';
  214. // html += '<li>' + (data[3].data[4].articleRK ? ('第' + data[3].data[4].articleRK + '名') : '') + '</li>';
  215. // me.$jgnph.html(html);
  216. // }
  217. // if (data[4].status == 200) {
  218. // pjmyd = me.getDataXY( data[4].data, 2);
  219. // if (me.type === 0) {
  220. //// me.dateArr = $d.init(5);
  221. // pjmyd = $h.contrastDate( dArr, pjmyd, 'dt', 'da');
  222. // }
  223. // if (me.type === 1) {
  224. // var d1 = $h.getWeeksData( pjmyd, 'dt', 'da'),
  225. // pjmyd = d1.da;
  226. // me.dateArr = d1.dt;
  227. // }
  228. // }
  229. // if (data[5].status == 200) {
  230. // xqzq.dt1 = me.getXQDataXY( data[5].data.inLine, 1);
  231. // xqzq.dt2 = me.getXQDataXY( data[5].data.outLine, 2);
  232. // if (me.type === 0) {
  233. //// me.dateArr = $d.init(5);
  234. // xqzq.dt1 = $h.contrastDate( dArr, xqzq.dt1, 'dt', 'da');
  235. // xqzq.dt2 = $h.contrastDate( dArr, xqzq.dt2, 'dt', 'da');
  236. // }
  237. // if (me.type === 1) {
  238. // var d1 = $h.getWeeksData( xqzq.dt1, 'dt', 'da'),
  239. // d2 = $h.getWeeksData( xqzq.dt2, 'dt', 'da');
  240. // xqzq.dt1 = d1.da;
  241. // xqzq.dt2 = d2.da;
  242. // me.dateArr = d1.dt;
  243. // }
  244. // }
  245. // if(data[6].status == 200){
  246. // var ccfdata = data[6].data;
  247. // ccftj.push(ccfdata.total);
  248. // ccftj.push(ccfdata.finishCount);
  249. // ccftj.push(ccfdata.processingCount);
  250. // ccftj.push(ccfdata.patientCancelCount);
  251. // ccftj.push(ccfdata.noReviewedCount);
  252. // ccftj.push(ccfdata.payOuttimeCount);
  253. // }
  254. // me.loadCharts( qy, zxtj, jgnfw, null, pjmyd, [ me.setXQSeries( 1, xqzq.dt1), me.setXQSeries( 2, xqzq.dt2)]);
  255. me.loadCharts( qy, zxtj, jgnfw, null, null, null, null);
  256. },
  257. initQYQKCharts: function ( t, xd, yd) {
  258. // console.log(t)
  259. // console.log(xd)
  260. // console.log(yd)
  261. $ic.init({
  262. el: this.$qyqkChart,
  263. xAxisData: xd,
  264. seriesData: this.setSeries(t, yd),
  265. chartsType: 1
  266. });
  267. },
  268. loadCharts: function ( qy, zxtj, jgnfw, ccftj, pjmyd, xqzq) {
  269. var me = this;
  270. var count = zxtj.onReyCount + zxtj.totalCount;
  271. var zx = count == 0 ? (1/2)*100 : 0;
  272. Promise.all([
  273. // 签约情况
  274. // me.initQYQKCharts( 1, me.dateArr, qy),
  275. // 资讯统计
  276. $ic.init({
  277. el: me.$zxtjChart,
  278. seriesData: [{
  279. name: '未回复咨询',
  280. value: zxtj.onReyCount || zx
  281. }, {
  282. name: '已回复咨询',
  283. value: zxtj.totalCount || zx
  284. }],
  285. chartsType: 2
  286. }),
  287. // 机构内服务
  288. // $ic.init({
  289. // el: me.$jgChart,
  290. // xAxisData: ['咨询', '随访', '代预约', '指导', '教育'],
  291. // seriesData: jgnfw,
  292. // chartsType: 3,
  293. // color: '#fbba31',
  294. // cb: me.eConsole
  295. // }),
  296. // 长处方统计
  297. // $ic.init({
  298. // el: me.$ccfChart,
  299. // xAxisData: ['总量', '已完成', '进行中', '居民\n取消', '审核\n未通过', '其他\n原因\n取消'],
  300. // seriesData: ccftj,
  301. // chartsType: 3,
  302. // color: '#17B3EC',
  303. // grid: {
  304. // x: 35,
  305. // y: 30,
  306. // x2: 20,
  307. // y2: 60
  308. // },
  309. // cb: function(){}
  310. // }),
  311. // 平均医生评分
  312. // $ic.init({
  313. // el: me.$mydChart,
  314. // xAxisData: me.dateArr,
  315. // seriesData: me.setSeries(2, pjmyd),
  316. // chartsType: 1
  317. // }),
  318. // 续签转签
  319. // $ic.init({
  320. // el: me.$xqzqChart,
  321. // xAxisData: me.dateArr,
  322. // seriesData: xqzq,
  323. // chartsType: 1,
  324. // legend: {
  325. // x: 'right',
  326. // data: ["签入人数", "签出人数"]
  327. // }
  328. // })
  329. ]);
  330. },
  331. getDataXY: function ( d, t) {
  332. var data = {dt:[],da:[]};
  333. if (this.type == 0) {
  334. for (var i = 0, len = d.length; i< len; i++) {
  335. data.dt.push(t == 1 ? d[i].applyDate : d[i].dateNo);
  336. data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
  337. }
  338. return data;
  339. }
  340. if (this.type == 1) {
  341. for (var i = 0, len = d.length; i< len; i++) {
  342. data.dt.push(t == 1 ? d[i].weekOfMonth : d[i].weekNo);
  343. data.da.push(t == 1 ? d[i].signCount : d[i].avgCount);
  344. }
  345. return data;
  346. }
  347. },
  348. getXQDataXY: function ( d, t) {
  349. var data = {dt:[],da:[]};
  350. for (var i = 0, len = d.length; i< len; i++) {
  351. if (this.type === 0) {
  352. data.dt.push(d[i].dateNo);
  353. }
  354. if (this.type === 1) {
  355. data.dt.push(d[i].weekOfMonth);
  356. }
  357. data.da.push(t == 1 ? d[i].inCount : d[i].outCount);
  358. }
  359. return data;
  360. },
  361. setXQSeries: function ( type, seriesData) {
  362. return {
  363. name: type == 1 ? '签入人数' : type == 2 ? '签出人数' : '',
  364. type: "line",
  365. symbol: "emptyCircle",
  366. data: seriesData
  367. }
  368. },
  369. setSeries: function ( type, seriesData) {
  370. return [{
  371. name: type == 1 ? '签约数' : type == 2 ? '医生评分' : type == 3 ? '续签数' : '',
  372. type: "line",
  373. symbol: "emptyCircle",
  374. data: seriesData
  375. }]
  376. },
  377. bindEvent: function () {
  378. var me = this;
  379. // 续约/签约切换
  380. $h.setEvent([
  381. [ me.$qiehuan, me.es[0], function () {
  382. me.xyQyEventFun( this, me);
  383. }],
  384. [ me.$demoComtop, me.es[0], function () {
  385. me.xlEventFun( this, me);
  386. }, 'h1'],
  387. [ me.$linMask, me.es[0], function () {
  388. $(this).hide();
  389. me.$linSelGroup.hide();
  390. }],
  391. [ me.$linSelGroup, me.es[0], function () {
  392. me.switchWeeksToMonth( this, me);
  393. }, 'li'],
  394. [ $(me.$xqzqChart), me.es[0], function () {
  395. openWebview('../html/tuanduizhuanqianxiangqing.html', 'tuanduizhuanqianxiangqing', {
  396. teamCode: teamCode
  397. })
  398. }],
  399. [ me.$zbdj, me.es[0], function () {
  400. var o = { seriesIndex:1, dataIndex:0};
  401. o.dataIndex = $(this).index();
  402. me.eConsole(o);
  403. console.log($(this).index());
  404. }, 'li']
  405. ]);
  406. },
  407. //周月切换
  408. switchWeeksToMonth: function ( that, me) {
  409. var type = $(that).attr('data-type');
  410. $(that).siblings().removeClass('checked');
  411. $(that).addClass('checked');
  412. me.$selTit.html($(that).find('label').html());
  413. me.$linMask.hide();
  414. me.$linSelGroup.hide();
  415. me.type = parseInt(type);
  416. tType = me.type;
  417. this.setDate();
  418. },
  419. //下拉
  420. xlEventFun: function ( thst, me) {
  421. var lCss = me.$linMask.css('display');
  422. if (lCss == 'none') {
  423. me.$linMask.show();
  424. me.$linSelGroup.show();
  425. } else {
  426. me.$linMask.hide();
  427. me.$linSelGroup.hide();
  428. }
  429. },
  430. getSwitchData: function ( t1, t2, t3, that, me) {
  431. var qy = {dt:[],da:[]};
  432. Promise.all([me.getQYQKData(t1)]).then(function (res) {
  433. if (res[0].status == 200) {
  434. qy = me.getDataXY( res[0].data, 1),
  435. dArr = $d.init(5);
  436. me.dateArr = $d.init(6);
  437. if (me.type === 0) {
  438. // me.dateArr = $d.init(5);
  439. qy = $h.contrastDate( dArr, qy, 'dt', 'da');
  440. }
  441. if (me.type === 1) {
  442. var d1 = $h.getWeeksData( qy, 'dt', 'da'),
  443. qy = d1.da;
  444. me.dateArr = d1.dt;
  445. }
  446. me.initQYQKCharts( t2, me.dateArr, qy);
  447. }
  448. });
  449. $(that).attr('data-type', t3);
  450. },
  451. // 续约/签约切换时间函数
  452. xyQyEventFun: function ( that, me) {
  453. var type = $(that).attr('data-type');
  454. if(type == '1') {
  455. me.$qyLab.html('续约情况');
  456. me.$qyQh.html('切换签约情况');
  457. me.getSwitchData( 1, 3, '2', that, me);
  458. }
  459. if(type == '2') {
  460. me.$qyLab.html('签约情况');
  461. me.$qyQh.html('切换续约情况');
  462. me.getSwitchData( 0, 1, '1', that, me);
  463. }
  464. },
  465. eConsole: function (param) {
  466. // return;
  467. if(typeof param.seriesIndex != 'undefined') {
  468. switch(param.dataIndex) {
  469. case 0:
  470. openWebview('../html/tuanduizixunxiangqing.html', 'tuanduizixunxiangqing', {
  471. teamCode: teamCode,
  472. type: tType
  473. })
  474. break;
  475. case 1:
  476. openWebview('../html/tuanduisuifangxiangqing.html', 'tuanduisuifangxiangqing', {
  477. teamCode: teamCode,
  478. type: tType
  479. })
  480. break;
  481. case 2:
  482. openWebview('../html/tuanduidaiyuyuexiangqing.html', 'tuanduidaiyuyuexiangqing', {
  483. teamCode: teamCode,
  484. type: tType
  485. })
  486. break;
  487. case 3:
  488. openWebview('../html/tuanduizhidaoxiangqing.html', 'tuanduizhidaoxiangqing', {
  489. teamCode: teamCode,
  490. type: tType
  491. })
  492. break;
  493. case 4:
  494. openWebview('../html/tuanduijiaoyuxiangqing.html', 'tuanduijiaoyuxiangqing', {
  495. teamCode: teamCode,
  496. type: tType
  497. })
  498. break;
  499. default:
  500. break;
  501. }
  502. }
  503. }
  504. };
  505. mui.init();
  506. mui.plusReady(function(){
  507. gzbg.init();
  508. });
  509. });