123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- //@ sourceURL=index.js
- //菜单
- // var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
- //
- // var randomScalingFactor = function () {
- // return Math.round(Math.random() * 100);
- // //return 0;
- // };
- // var randomColorFactor = function () {
- // return Math.round(Math.random() * 255);
- // };
- // var randomColor = function (opacity) {
- // var rgg='rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')';
- // console.log(rgg);
- // return rgg;
- // };
- var config = {
- type: 'line',
- data: {
- labels: [],
- datasets: [
- {
- label: "挂号金额",
- data: [],
- /* fill: false,*/
- // borderDash: [5, 5],
- borderColor: 'rgba(130,236,134,0.4)',
- backgroundColor: 'rgba(13,199,122,0.5)',
- // pointBorderColor: 'rgba(69,231,165,0.7)',
- // pointBackgroundColor: 'rgba(229,185,45,0.5)',
- pointBorderWidth: 1,
- },
- {
- //hidden: true,
- label: '接诊金额',
- data: [],
- borderColor: 'rgba(185,190,209,0.4)',
- backgroundColor: 'rgba(77,5,148,0.5)',
- pointBorderWidth: 1,
- },
- {
- label: "退号金额",
- data: [],
- borderColor: 'rgba(152,99,170,0.4)',
- backgroundColor: 'rgba(166,86,59,0.5)',
- pointBorderWidth: 1,
- },
- {
- label: "退费金额",
- data: [],
- borderColor: 'rgba(254,169,161,0.4)',
- backgroundColor: 'rgba(235,30,145,0.5)',
- // pointBorderColor: 'rgba(254,169,161,0.4)',
- // pointBackgroundColor: randomColor(0.5),
- pointBorderWidth: 1,
- }
- ]
- },
- options: {
- responsive: true,
- /* legend: {
- position: 'bottom',
- },*/
- // title: {
- // // display: true,
- // // text: '门诊运营趋势',
- // // },
- tooltips: {
- mode: 'label',
- callbacks: {
- // beforeTitle: function() {
- // return '...beforeTitle';
- // },
- // afterTitle: function() {
- // return '...afterTitle';
- // },
- // beforeBody: function() {
- // return '...beforeBody';
- // },
- // afterBody: function() {
- // return '...afterBody';
- // },
- // beforeFooter: function() {
- // return '...beforeFooter';
- // },
- // footer: function() {
- // return 'Footer';
- // },
- // afterFooter: function() {
- // return '...afterFooter';
- // },
- }
- },
- hover: {
- mode: 'dataset'
- },
- scales: {
- xAxes: [{
- display: true,
- scaleLabel: {
- show: true,
- labelString: 'Month'
- }
- }],
- yAxes: [{
- display: true,
- scaleLabel: {
- show: true,
- labelString: 'Value'
- },
- ticks: {
- suggestedMin: 0,
- suggestedMax: 250,
- }
- }]
- }
- }
- };
- // window.onload = function() {
- // var ctx = document.getElementById("canvas").getContext("2d");
- // window.myLine = new Chart(ctx, config);
- // };
- $(function () {
- init_daterangepicker();
- $('#reportrange span').html(moment().subtract(6, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
- $.ajax({
- type: "GET",
- url: '/thmz/getIndexCount',
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- $("#registrationNum").html(res.registrationNum);
- $("#haveClinicalNum").html(res.haveClinicalNum);
- if (res.ghAmount != null) {
- $("#ghAmount").html(res.ghAmount.toFixed(2));
- }
- if (res.sfAmount != null) {
- $("#sfAmount").html(res.sfAmount.toFixed(2));
- }
- }
- }
- });
- var rePortRangeArr = getRePortRangeArr();
- $.ajax({
- type: "POST",
- url: '/thmz/getMzyytsqs',
- contentType: "application/json;charset=UTF-8",
- dataType: "json",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- data: JSON.stringify({beginTime: new Date(rePortRangeArr[0]), endTime: new Date(rePortRangeArr[1])}),
- success: function (res) {
- if (res == '401' || res == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (res.code == 0) {
- if(res.keyList!=null && res.keyList.length>0){
- for (var i=0;i<res.keyList.length;i++){
- config.data.labels[i]=res.keyList[i];
- }
- }
- if(res.data!=null && res.data.length>0){
- var ghje=config.data.datasets[0].data;
- var jzje=config.data.datasets[1].data;
- var thje=config.data.datasets[2].data;
- var tfje=config.data.datasets[3].data;
- for (var i=0;i<res.data.length;i++){
- ghje[i]=res.data[i].ghAmount;
- jzje[i]=res.data[i].sfAmount;
- thje[i]=res.data[i].thAmount;
- tfje[i]=Math.abs(res.data[i].tfAmount);
- }
- }
- var ctx = $("#canvas").get(0).getContext("2d");
- window.myLine = new Chart(ctx, config);
- }else {
- errorMesage(res);
- }
- }
- });
- });
- /**
- * 获取时间选择器的时间数组
- * @returns {string[]}
- */
- function getRePortRangeArr() {
- var rePortRange = $('#reportrange span').html();
- var rePortRangeArr = rePortRange.split(" - ");
- rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
- rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
- return rePortRangeArr;
- }
|