From 1c0ef3ceca7fa8ffbf5ff0dfd9dbf35334d74ae4 Mon Sep 17 00:00:00 2001
From: houruijun <411269194@kidgrow.com>
Date: Mon, 10 Aug 2020 12:04:31 +0800
Subject: [PATCH] 修改首页统计图表

---
 kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/console.html |  139 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 137 insertions(+), 2 deletions(-)

diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/console.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/console.html
index efeaf5b..0f9a8ef 100644
--- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/console.html
+++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/console.html
@@ -168,6 +168,22 @@
                 </div>
             </div>
         </div>
+        <div class="layui-row layui-col-space10">
+            <div class="layui-col-lg6 layui-col-md6">
+                <div class="layui-card">
+                    <div class="card-block">
+                        <div id="aiphoto" style="height:300px"></div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-col-lg6 layui-col-lg6">
+                <div class="layui-card">
+                    <div class="card-block">
+                        <div id="report" style="height:300px"></div>
+                    </div>
+                </div>
+            </div>
+        </div>
     </div>
 
     <script type="text/javascript">
@@ -220,8 +236,8 @@
                     }
                 }, "get");
             }
-                        //加载套餐使用图表
-                        var loadContractChart = function () {
+            //加载套餐使用图表
+            var loadContractChart = function () {
                 var chartcontract = echarts.init(document.getElementById('contract'));
                 admin.req("api-opration/productorderdetail/proCountChart", {}, function (data) {
                     if (0 === data.code) {
@@ -314,6 +330,121 @@
                 }, "get");
             }
 
+            //加载报告图表
+            var loadreportChart = function (dataType) {
+                var nowYear = new Date().getFullYear();
+                var apiUrl =
+                    "api-bicenter/statisticalmonthlydata/findList?itemCode=3201&page=1&limit=12&startYearMonth=" +
+                    nowYear + "01&endYearMonth=" + nowYear + "12";
+                if (dataType == "1") {
+                    apiUrl =
+                        "api-bicenter/statisticalyearlydata/findList?itemCode=3201&page=1&limit=10&startYear=" +
+                        nowYear - 5 + "&endYear=" + nowYear;
+                }
+                var chartreport = echarts.init(document.getElementById('report'));
+                admin.req(apiUrl, {}, function (data) {
+                    if (0 === data.code) {
+                        var listData = data.data;
+                        var Xdata = new Array();
+                        var Ydata = new Array();
+                        if (listData != null) {
+                            for (let index = 0; index < listData.length; index++) {
+                                Xdata.push(listData[index].itemName);
+                                if (dataType == "1") {
+                                    Ydata.push(listData[index].collectYear);
+                                } else if (dataType == "0") {
+                                    Ydata.push(listData[index].collectYearMonth);
+                                }
+                            }
+                            var optionchart = {
+                                title: {
+                                    text: 'H端报告量'
+                                },
+                                color: ['#3398DB'],
+                                tooltip: {
+                                    trigger: 'axis',
+                                    axisPointer: { // 坐标轴指示器,坐标轴触发有效
+                                        type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
+                                    }
+                                },
+                                xAxis: {
+                                    type: 'category',
+                                    data: Xdata
+                                },
+                                yAxis: {
+                                    type: 'value'
+                                },
+                                series: [{
+                                    name: '报告数量',
+                                    data: Ydata,
+                                    type: 'bar',
+                                    barWidth: '10%',
+                                    showBackground: true
+                                }]
+                            };
+                            chartreport.setOption(optionchart, true);
+                        }
+                    }
+                }, "get");
+            }
+            //加载读片图表
+            var loadaiphotoChart = function (dataType) {
+                var nowYear = new Date().getFullYear();
+                var apiUrl =
+                    "api-bicenter/statisticalmonthlydata/findList?itemCode=1301&page=1&limit=12&startYearMonth=" +
+                    nowYear + "01&endYearMonth=" + nowYear + "12";
+                if (dataType == "1") {
+                    apiUrl =
+                        "api-bicenter/statisticalyearlydata/findList?itemCode=1301&page=1&limit=10&startYear=" +
+                        nowYear - 5 + "&endYear=" + nowYear;
+                }
+                var chartaiphoto = echarts.init(document.getElementById('aiphoto'));
+                admin.req(apiUrl, {}, function (data) {
+                    if (0 === data.code) {
+                        var listData = data.data;
+                        var Xdata = new Array();
+                        var Ydata = new Array();
+                        if (listData != null) {
+                            for (let index = 0; index < listData.length; index++) {
+                                Xdata.push(listData[index].itemName);
+                                if (dataType == "1") {
+                                    Ydata.push(listData[index].collectYear);
+                                } else if (dataType == "0") {
+                                    Ydata.push(listData[index].collectYearMonth);
+                                }
+                            }
+                            var optionchart = {
+                                title: {
+                                    text: '读片量'
+                                },
+                                color: ['#3398DB'],
+                                tooltip: {
+                                    trigger: 'axis',
+                                    axisPointer: { // 坐标轴指示器,坐标轴触发有效
+                                        type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
+                                    }
+                                },
+                                xAxis: {
+                                    type: 'category',
+                                    data: Xdata
+                                },
+                                yAxis: {
+                                    type: 'value'
+                                },
+                                series: [{
+                                    name: '读片数量',
+                                    data: Ydata,
+                                    type: 'bar',
+                                    barWidth: '10%',
+                                    showBackground: true
+                                }]
+                            };
+                            chartaiphoto.setOption(optionchart, true);
+                        }
+                    }
+                }, "get");
+            }
+
             //先拿到当前登录用户的信息
             var nowUser = config.getUser();
             if (!strUtil.isEmpty(nowUser)) {
@@ -360,6 +491,8 @@
                         $("#ht_doctor").html(counts);
                         loadContractChart();
                         loadProductChart();
+                        loadreportChart(0);
+                        loadaiphotoChart(0);
                     } else if (element.code == "opration") {
                         //正式医院
                         loadHospitalChart(0);
@@ -415,6 +548,8 @@
                         loadDoctorChart(2);
                         loadContractChart();
                         loadProductChart();
+                        loadreportChart(0);
+                        loadaiphotoChart(0);
                     }
                 }
             }

--
Gitblit v1.8.0