Browse Source

Merge branch 'dev-1.1.4' into 'dev-1.1.4'

医生概览页面

See merge request lihong/thmz_system!6
zheng 2 năm trước cách đây
mục cha
commit
25c6d62bc1

+ 1 - 1
src/main/resources/static/css/doctorIndex.css

@@ -19,7 +19,7 @@ body {
     padding: 0 !important
 }
 #content {
-    padding: 10px 20px;
+    padding: 10px 50px;
     box-sizing: border-box;
 }
 .container {

+ 369 - 124
src/main/resources/static/js/doctorIndex.js

@@ -121,10 +121,150 @@ var config = {
 //     var ctx = document.getElementById("canvas").getContext("2d");
 //     window.myLine = new Chart(ctx, config);
 // };
+
+// 计算月份 00:00:00
+function getRecentMonth_Date(n) {
+    let result = '';
+    const datenow = new Date();
+    const dateend =
+        datenow.getFullYear().toString() +
+        '-' +
+        (datenow.getMonth() + 1).toString() +
+        '-' +
+        datenow.getDate().toString();
+    datenow.setMonth(datenow.getMonth() - n);
+    let dyear = datenow.getFullYear();
+    let dmonth = datenow.getMonth() + 1;
+    dmonth = dmonth < 10 ? 0 + dmonth : dmonth;
+    let dday = datenow.getDate();
+    const datestart =
+        dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString() + ' 00:00:00';
+    result += datestart + ',';
+    result += dateend;
+    console.log(datestart);
+    return datestart;
+}
+function getMonth_Date(n) {
+    let result = '';
+    const datenow = new Date();
+    const dateend =
+        datenow.getFullYear().toString() +
+        '-' +
+        (datenow.getMonth() + 1).toString() +
+        '-' +
+        datenow.getDate().toString();
+    datenow.setMonth(datenow.getMonth() - n);
+    let dyear = datenow.getFullYear();
+    let dmonth = datenow.getMonth() + 1;
+    dmonth = dmonth < 10 ? 0 + dmonth : dmonth;
+    let dday = datenow.getDate();
+    const datestart =
+        dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString() + ' 00:00:00';
+    result += datestart + ',';
+    result += dateend;
+    console.log(datestart);
+    return datestart;
+}
+// 获取当前时间  23:59:59
+function today_Date(e) {
+    console.log('1111111111111', e);
+    const today = new Date();
+    const year = today.getFullYear()
+    const month = today.getMonth()+1
+    const day = today.getDate()
+    const formattedDate = year+'-'+month +'-'+day+e
+    return formattedDate
+}
+
+var option1;
+var option;
+var myChart1;
+var myChart;
+console.log('echarts-----------', echarts)
 $(function () {
+    // 获取当天的数据
+    let query = {
+        startTime: today_Date(' 00:00:00'),
+        endTime: today_Date(' 23:59:59'),
+        reportId: '',
+        reportType: 'cy',
+        reportIds: ['cy_ryrs'],
+        type: 1,
+        groupColumn: '',
+    }
+    let query2 = {
+        startTime: today_Date(' 00:00:00'),
+        endTime: today_Date(' 23:59:59'),
+        reportId: '',
+        reportType: '',
+        reportIds: ['mz_mzjcfzb','mz_mzypfzb','mz_ybjjsr'],
+        type: 2,
+        groupColumn: 'yf',
+    }
+    // 首页头部的数据
+    $.ajax({
+        type: "post",
+        url: '/thmz/selectDoctorIndexData',
+        dataType: "json",
+        headers: {'content-type': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify(query),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                console.log('接口返回的参数--------', res.data)
+                let data = res.data
+                $("#registrationNum").html(data.cy_ryrs[0].value);
+                // $("#haveClinicalNum").html(res.haveClinicalNum);
+                // if (res.ghAmount != null) {
+                //     $("#ghAmount").html(res.ghAmount.toFixed(2));
+                // }
+                // if (res.sfAmount != null) {
+                //     $("#sfAmount").html(res.sfAmount.toFixed(2));
+                // }
+            }
+
+        }
+    });
+    // 图二请求数据
+    $.ajax({
+        type: "post",
+        url: '/thmz/selectDoctorIndexData',
+        dataType: "json",
+        headers: {'content-type': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify(query2),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                console.log('接口返回的参数--------', res.data)
+                let jczb = []
+                let yzb = []
+                let jjzb= []
+                res.data.mz_mzjcfzb.forEach(ele => {
+                    jczb.push(ele.value)
+                });
+                res.data.mz_mzypfzb.forEach(ele => {
+                    yzb.push(ele.value)
+                });
+                res.data.mz_ybjjsr.forEach(ele => {
+                    jjzb.push(ele.value)
+                });
+                option.series[0].data = jczb
+                option.series[1].data = yzb
+                option.series[2].data = jjzb
+                myChart.setOption(option, true)
+                console.log('折线图数据----------', option);
+            }
+
+        }
+    });
     // 柱状图
-    var myChart1 = echarts.init(document.getElementById('canvas'))
-    var option1;
+    myChart1 = echarts.init(document.getElementById('canvas'))
     option1 = {
         legend: {},
         tooltip: {},
@@ -196,10 +336,8 @@ $(function () {
     window.addEventListener("resize", function() {
         myChart1.resize()
     })
-
     // 折线图
-    var myChart= echarts.init(document.getElementById('canvas1'))
-    var option;
+    myChart= echarts.init(document.getElementById('canvas1'))
     option = {
         title: {
             text: ''
@@ -270,135 +408,242 @@ $(function () {
         myChart.resize()
     })
 
-    init_daterangepicker();
+    // init_daterangepicker();
 
-    $.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));
-                }
-            }
+    // $.ajax({
+    //     type: "GET",
+    //     url: '/thmz/getIndexCount',
+    //     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) {
+    //             $("#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");
+    //             console.log('参数-------', config)
+    //             window.myLine = new Chart(ctx, config);
+    //         }else {
+    //             errorMesage(res);
+    //         }
+    //
+    //     }
+    // });
 
-    var rePortRangeArr = getRePortRangeArr();
+
+
+    //获取医生工作统计数据
+    // $.ajax({
+    //     type: "GET",
+    //     url: '/thmz/getDoctorDateForDay',
+    //     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) {
+    //             $("#numberOfPatient").html(res.numberOfPatient);
+    //             $("#numberOfPrescription").html(res.numberOfPrescription);
+    //             var html='';
+    //             if(res.numberOfIcdText!=null && res.numberOfIcdText.length>0){
+    //                 for(var i=0;i<res.numberOfIcdText.length;i++){
+    //                     var obj=res.numberOfIcdText[i];
+    //                     html+=' <div class="work_detail_full">';
+    //                     html+='<div title="'+obj.icd_text+'" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 300px);float: left;">';
+    //                     html+='<i class="fa fa-file-text" style="color: #6D31CF;margin-right: 10px;"></i>';
+    //                     html+=obj.icd_text+'</div>';
+    //                     html+='<div class="el-col el-col-4" style="float: right;text-align: right;margin-right: 5px;">';
+    //                     html+=obj.num;
+    //                     html+=' 次</div><div style="clear: both;"></div></div>';
+    //                 }
+    //             }
+    //             $("#numberOfIcdText").html(html);
+    //         }
+    //
+    //     }
+    // });
+
+});
+
+// 按钮选择日期处理
+function btnTime(e) {
+    var  monthData = ''
+    if(e == '近三个月') {
+        monthData= getRecentMonth_Date(3)
+    }else if(e == '近半年') {
+        monthData= getRecentMonth_Date(6)
+    }
+    return monthData
+}
+
+// 图一
+$('.dropdown-menu1').click(function(event) {
+    let time = event.target.innerHTML
+    $('.dropdown-toggle1 .text').html(time)
+    let query = {
+        startTime: btnTime(time),
+        endTime: today_Date(' 23:59:59'),
+        reportId: '',
+        reportType: 'cy',
+        reportIds: ['cy_ryrs'],
+        type: 1,
+        groupColumn: '',
+    }
     $.ajax({
-        type: "POST",
-        url: '/thmz/getMzyytsqs',
-        contentType: "application/json;charset=UTF-8",
+        type: "post",
+        url: '/thmz/selectDoctorIndexData',
         dataType: "json",
-        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
-        data: JSON.stringify({beginTime: new Date(rePortRangeArr[0]), endTime: new Date(rePortRangeArr[1])}),
+        headers: {'content-type': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify(query),
         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");
-                console.log('参数-------', config)
-                window.myLine = new Chart(ctx, config);
-            }else {
-                errorMesage(res);
+                console.log('接口返回的参数--------', res.data)
+                // $("#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));
+                // }
             }
 
         }
     });
-
-
-
-    //获取医生工作统计数据
+})
+// 图二
+$('.dropdown-menu2').click(function(event) {
+    let time1 = event.target.innerHTML
+    $('.dropdown-toggle2 .text').html(time1)
+    let query = {
+        startTime: btnTime(time1),
+        endTime: today_Date(' 23:59:59'),
+        reportId: '',
+        reportType: '',
+        reportIds: ['mz_mzjcfzb','mz_mzypfzb','mz_ybjjsr'],
+        type: 2,
+        groupColumn: 'yf',
+    }
     $.ajax({
-        type: "GET",
-        url: '/thmz/getDoctorDateForDay',
+        type: "post",
+        url: '/thmz/selectDoctorIndexData',
         dataType: "json",
-        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        headers: {'content-type': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify(query),
         success: function (res) {
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
                 return;
             }
             if (res.code == 0) {
-                $("#numberOfPatient").html(res.numberOfPatient);
-                $("#numberOfPrescription").html(res.numberOfPrescription);
-                var html='';
-                if(res.numberOfIcdText!=null && res.numberOfIcdText.length>0){
-                    for(var i=0;i<res.numberOfIcdText.length;i++){
-                        var obj=res.numberOfIcdText[i];
-                        html+=' <div class="work_detail_full">';
-                        html+='<div title="'+obj.icd_text+'" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 300px);float: left;">';
-                        html+='<i class="fa fa-file-text" style="color: #6D31CF;margin-right: 10px;"></i>';
-                        html+=obj.icd_text+'</div>';
-                        html+='<div class="el-col el-col-4" style="float: right;text-align: right;margin-right: 5px;">';
-                        html+=obj.num;
-                        html+=' 次</div><div style="clear: both;"></div></div>';
-                    }
-                }
-                $("#numberOfIcdText").html(html);
+                console.log('接口返回的参数--------', res.data)
+                let jczb = []
+                let yzb = []
+                let jjzb= []
+                res.data.mz_mzjcfzb.forEach(ele => {
+                    jczb.push(ele.value)
+                });
+                res.data.mz_mzypfzb.forEach(ele => {
+                    yzb.push(ele.value)
+                });
+                res.data.mz_ybjjsr.forEach(ele => {
+                    jjzb.push(ele.value)
+                });
+                option.series[0].data = jczb
+                option.series[1].data = yzb
+                option.series[2].data = jjzb
+                option.xAxis.data = res.data.yf
+                myChart.setOption(option, true)
+                console.log('折线图数据----------', option);
+                // $("#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));
+                // }
             }
 
         }
     });
-
-});
-
-
-
-/**
- * 获取时间选择器的时间数组
- * @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;
-}
+})
 
 /**
  * 获取时间选择器的时间数组
  * @returns {string[]}
  */
-function getRePortRangeArrById(id) {
-    var rePortRange = $('#'+id+' span').html();
-    var rePortRangeArr = rePortRange.split(" - ");
-    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
-    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
-    return rePortRangeArr;
-}
+// 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;
+// }
+//
+// /**
+//  * 获取时间选择器的时间数组
+//  * @returns {string[]}
+//  */
+// function getRePortRangeArrById(id) {
+//     var rePortRange = $('#'+id+' span').html();
+//     var rePortRangeArr = rePortRange.split(" - ");
+//     rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
+//     rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
+//     return rePortRangeArr;
+// }
 
 /**
  * 获取年龄(小于7岁精确到天)
@@ -406,26 +651,26 @@ function getRePortRangeArrById(id) {
  * @param nowDate 当前日期
  * @returns {string}
  */
-function getBirthSlot(birthDay,nowDate) {
-    var birth = new Date(birthDay);
-    var now = new Date(nowDate);
-    var date1 = Date.parse(birth);
-    var date2 = Date.parse(now);
-    var day = Math.ceil((date2 - date1) / (60 * 60 * 1000 * 24));
-    var age = '';
-    var year = Math.floor(day / 365);
-    if(year > 0) age += year + '岁';
-    var y = day % 365;
-    var month = Math.floor(y / 30);
-    if(month > 0) age += month + '月';
-    var d = Math.floor(day % 365 % 30);
-    if(d > 0) age += d + '天';
-    if(age.substring(0,age.indexOf('岁')) >= 7){
-        age = age.substring(0,age.indexOf('岁')+1);
-    }
-    return age;
-}
+// function getBirthSlot(birthDay,nowDate) {
+//     var birth = new Date(birthDay);
+//     var now = new Date(nowDate);
+//     var date1 = Date.parse(birth);
+//     var date2 = Date.parse(now);
+//     var day = Math.ceil((date2 - date1) / (60 * 60 * 1000 * 24));
+//     var age = '';
+//     var year = Math.floor(day / 365);
+//     if(year > 0) age += year + '岁';
+//     var y = day % 365;
+//     var month = Math.floor(y / 30);
+//     if(month > 0) age += month + '月';
+//     var d = Math.floor(day % 365 % 30);
+//     if(d > 0) age += d + '天';
+//     if(age.substring(0,age.indexOf('岁')) >= 7){
+//         age = age.substring(0,age.indexOf('岁')+1);
+//     }
+//     return age;
+// }
 
-$('#ghAmount').click(function() {
-    console.log('1111')
-})
+// $('#ghAmount').click(function() {
+//     console.log('1111')
+// })

+ 8 - 15
src/main/resources/templates/doctorIndex.html

@@ -3,18 +3,11 @@
 <link rel="stylesheet" href="/thmz/css/doctorIndex.css">
 
 <script>
-    // 图一
-    $('.dropdown-menu1').click(function(event) {
-        $('.dropdown-toggle1 .text').html(event.target.innerHTML)
-    })
-    // 图二
-    $('.dropdown-menu2').click(function(event) {
-        $('.dropdown-toggle2 .text').html(event.target.innerHTML)
-    })
+
 </script>
+<script src="/thmz/js/dependent/jquery.min.js"></script>
 <script src="/thmz/js/echarts/echarts.min.js"></script>
 <script src="/thmz/js/dependent/moment.min.js"></script>
-<script src="/thmz/js/dependent/jquery.min.js"></script>
 <script src="/thmz/js/doctorIndex.js"></script>
 <title>主页面</title>
 <div style="height: 100%;overflow: hidden; overflow-y: scroll">
@@ -38,7 +31,7 @@
                 <div class="icon" style="top: 18px">
                     <span class="glyphicon glyphicon-calendar" aria-hidden="true" style="font-size: 50px;color: #54BCBD"></span>
                 </div>
-                <div class="count" id="ghAmount">0.00</div>
+                <div class="count">0.00</div>
                 <h3>出诊天数</h3>
             </div>
         </div>
@@ -62,11 +55,11 @@
                     </div>
                     <div class="col-md-4">
                         <div class="btn-group">
-                            <button type="button" class="btn btn-default dropdown-toggle1" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                            <button type="button" class="btn btn-default dropdown-toggle1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                 <span class="text" style="color: #000">近半年</span>
                                 <span class="caret"></span>
                             </button>
-                            <ul class="dropdown-menu dropdown-menu1" aria-labelledby="dropdownMenu">
+                            <ul class="dropdown-menu dropdown-menu1">
                                 <li><a href="#">近三个月</a></li>
                                 <li><a href="#">近半年</a></li>
                                 <li><a href="#">近一年</a></li>
@@ -75,7 +68,7 @@
                     </div>
                 </div>
                 <!-- 图一 -->
-                <div style="padding: 20px 0;">
+                <div style="padding: 20px 0 40px 0;">
                     <div id="canvas" style="min-height: 500px"></div>
                 </div>
             </div>
@@ -93,7 +86,7 @@
                                 <span class="text" style="color: #000">近半年</span>
                                 <span class="caret"></span>
                             </button>
-                            <ul class="dropdown-menu dropdown-menu2" aria-labelledby="dropdownMenu1">
+                            <ul class="dropdown-menu dropdown-menu2">
                                 <li><a href="#">近三个月</a></li>
                                 <li><a href="#">近半年</a></li>
                                 <li><a href="#">近一年</a></li>
@@ -102,7 +95,7 @@
                     </div>
                 </div>
                 <!-- 图二 -->
-                <div style="padding: 20px 0;">
+                <div style="padding: 20px 0 40px 0;">
                     <div id="canvas1" style="min-height: 500px"></div>
                 </div>
             </div>