luolei 5 năm trước cách đây
mục cha
commit
51d232f720
1 tập tin đã thay đổi với 35 bổ sung29 xóa
  1. 35 29
      src/js/console.js

+ 35 - 29
src/js/console.js

@@ -95,17 +95,17 @@ $(function(){
             deptType="外科"
             getAverageScoreLis()
             $(this).parent().slideToggle().prev().find("span").html(str+"系统")
-        }else if(type == 7){//病案首页
+        }else if(type == 7){//病案首页firstLevelPercent emptyPercent  errorPercent
             lineType="合格率"
-            lineChartHome(lineType4,lineType1)
+            getHomeData('firstLevelPercent')
             $(this).parent().slideToggle().prev().find("span").html(str)
         }else if(type == 8){//病案首页
             lineType = "完整率"
-            lineChartHome(lineType4,lineType2)
+            getHomeData('emptyPercent')
             $(this).parent().slideToggle().prev().find("span").html(str)
         }else if(type == 9){//病案首页
             lineType = "完善率"
-            lineChartHome(lineType4,lineType3)
+            getHomeData('errorPercent')
             $(this).parent().slideToggle().prev().find("span").html(str)
         }
     })
@@ -305,6 +305,35 @@ function getEveryDeptLevel(){
         $(".toggleSlide1").css("opacity",0.5)
     }
 }
+//病案首页合格率  firstLevelPercent emptyPercent  errorPercent
+function getHomeData(name){
+    if(hasData("FUNC000075")){
+        post(api.homePageLevelLimit,{//病案首页
+            "type": dateType||2,//1月2年
+            "startDate":behosDateStart,
+            "endDate":behosDateEnd,
+            "desc": name
+        }).then((res)=>{
+            let data = res.data;
+            if(data.code == 0){
+                let result1 = data.data||[]
+                let dataX=[],dataY1=[],dataY2=[],dataY3=[]
+                for(let i = 0;i < result1.length;i++){
+                    dataX.push(result1[i].deptName)
+                    dataY1.push((result1[i].firstLevelPercentStr.replace('%','')-0))
+                    dataY2.push((result1[i].emptyPercentStr.replace('%','')-0))
+                    dataY3.push((result1[i].errorPercentStr.replace('%','')-0))
+                }
+                // lineType1 = dataY1.sort(function(a, b){return b - a})
+                // lineType2 = dataY2.sort(function(a, b){return b - a})
+                // lineType3 = dataY3.sort(function(a, b){return b - a})
+                lineType4 = dataX
+                let datay = (lineType == "合格率")?dataY1:(lineType=="完整率"?dataY2:dataY3)
+                lineChartHome(dataX,datay)
+            }
+        })
+    }
+}
 //获取图表数据
 function getBarData(type){
     // if(hasData('FUNC000045')){
@@ -371,31 +400,6 @@ function getBarData(type){
     //         }
     //     })
     // }
-    if(hasData("FUNC000075")){
-        post(api.homePageLevelLimit,{//病案首页
-            "type": type||1,//1月2年
-            "startDate":behosDateStart,
-            "endDate":behosDateEnd
-        }).then((res)=>{
-            let data = res.data;
-            if(data.code == 0){
-                let result1 = data.data||[]
-                let dataX=[],dataY1=[],dataY2=[],dataY3=[]
-                for(let i = 0;i < result1.length;i++){
-                    dataX.push(result1[i].deptName)
-                    dataY1.push((result1[i].firstLevelPercentStr.replace('%','')-0))
-                    dataY2.push((result1[i].emptyPercentStr.replace('%','')-0))
-                    dataY3.push((result1[i].errorPercentStr.replace('%','')-0))
-                }
-                lineType1 = dataY1.sort(function(a, b){return b - a})
-                lineType2 = dataY2.sort(function(a, b){return b - a})
-                lineType3 = dataY3.sort(function(a, b){return b - a})
-                lineType4 = dataX
-                let datay = (lineType == "合格率")?lineType1:(lineType=="完整率"?lineType2:lineType3)
-                lineChartHome(dataX,datay)
-            }
-        })
-    }
     if(hasData('FUNC000049')){
         post(api.leaveHosCount,{//出院人数统计
             "type": type||1,//1月2年
@@ -1698,6 +1702,7 @@ $(".sureDate").click(function(){
     getAverageScoreLis()
     getBarData(dateType)
     getEveryDeptLevel()
+    getHomeData('firstLevelPercent')
 })
 //日期联动
 function dateConsole(dateType){
@@ -1726,6 +1731,7 @@ function dateConsole(dateType){
     getStaticDate()
     getAverageScoreLis()
     getBarData(dateType)
+    getHomeData('firstLevelPercent')
     getEveryDeptLevel()
 }
 function getStaticDate(){