Просмотр исходного кода

add:首页数据看板-统计条

Scott 2 лет назад
Родитель
Сommit
47438e759b

+ 18 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/HomePageController.java

@@ -6,9 +6,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.medical.response.DashboardStatisticsBarResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsViolateResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsLineResponse;
 import org.jeecg.modules.medical.service.IHomePageService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -35,6 +36,22 @@ public class HomePageController {
         DashboardStatisticsBarResponse response = homePageService.loadStatisticsBar(startTime, endTime);
         return Result.OK(response);
     }
+
+    @ApiOperation(value="数据看板-违规时段统计-折线图", notes="数据看板-违规时段统计-折线图")
+    @GetMapping(value = "/statistics/line")
+    public Result<DashboardStatisticsLineResponse> loadStatisticsLine(@Param("startTime") String startTime, @Param("endTime") String endTime) {
+        DashboardStatisticsLineResponse response = homePageService.loadStatisticsLine(startTime, endTime);
+        return Result.OK(response);
+    }
+
+    @ApiOperation(value="数据看板-违规类型分类明细", notes="数据看板-违规类型分类明细")
+    @GetMapping(value = "/statistics/violate/rules")
+    public Result<DashboardStatisticsViolateResponse> loadStatisticsViolateRulesTop(@Param("startTime") String startTime, @Param("endTime") String endTime) {
+        DashboardStatisticsViolateResponse response = homePageService.loadStatisticsViolateRulesTop(startTime, endTime);
+        return Result.OK(response);
+    }
+
+
 }
 
 

+ 22 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/response/DashboardStatisticsDetailedItem.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.medical.response;
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author LENOVO
+ * @time 2023/10/17 22:09 星期二
+ * @description '这里写类描述'
+ * @parentProject medical-java
+ */
+@Data
+public class DashboardStatisticsDetailedItem implements Serializable {
+    @ApiModelProperty(value = "明细title")
+    private String title;
+    @ApiModelProperty(value = "数据集合")
+    private List<JSONObject> list;
+}

+ 20 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/response/DashboardStatisticsLineResponse.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.medical.response;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Scott
+ * @time 2023/10/17 21:19 星期二
+ * @description '数据看板,折现图'
+ * @parentProject medical-java
+ */
+@Data
+public class DashboardStatisticsLineResponse implements Serializable {
+
+    List<JSONObject> lineData;
+    List<String> xDate;
+}

+ 30 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/response/DashboardStatisticsViolateResponse.java

@@ -0,0 +1,30 @@
+package org.jeecg.modules.medical.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author Scott
+ * @time 2023/10/17 22:09 星期二
+ * @description '分类明细'
+ * @parentProject medical-java
+ */
+@Data
+public class DashboardStatisticsViolateResponse implements Serializable {
+
+    @ApiModelProperty(value = "事前规则类型排名")
+    private DashboardStatisticsDetailedItem beforeRulesTop;
+    @ApiModelProperty(value = "事中规则类型排名")
+    private DashboardStatisticsDetailedItem middleRulesTop;
+    @ApiModelProperty(value = "事后规则类型排名")
+    private DashboardStatisticsDetailedItem afterRulesTop;
+
+    @ApiModelProperty(value = "事中医生违规数")
+    private DashboardStatisticsDetailedItem middleDoctorsViolateTop;
+    @ApiModelProperty(value = "事后医生违规数排名")
+    private DashboardStatisticsDetailedItem afterDoctorsViolateTop;
+
+
+}

+ 12 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IHomePageService.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.medical.service;
 
 import org.jeecg.modules.medical.response.DashboardStatisticsBarResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsLineResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsViolateResponse;
 
 /**
  * @author LENOVO
@@ -10,4 +12,14 @@ import org.jeecg.modules.medical.response.DashboardStatisticsBarResponse;
  */
 public interface IHomePageService {
     DashboardStatisticsBarResponse loadStatisticsBar(String startTime, String endTime);
+
+    DashboardStatisticsLineResponse loadStatisticsLine(String startTime, String endTime);
+
+    /**
+     * 违规分类明细
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    DashboardStatisticsViolateResponse loadStatisticsViolateRulesTop(String startTime, String endTime);
 }

+ 127 - 7
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/HomePageServiceImpl.java

@@ -1,13 +1,21 @@
 package org.jeecg.modules.medical.service.impl;
 
 import cn.hutool.core.date.DateTime;
+import com.alibaba.druid.sql.dialect.oracle.ast.expr.OracleDateTimeUnit;
+import com.alibaba.fastjson.JSONObject;
 import org.jeecg.modules.medical.response.DashboardStatisticsBarResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsDetailedItem;
+import org.jeecg.modules.medical.response.DashboardStatisticsLineResponse;
+import org.jeecg.modules.medical.response.DashboardStatisticsViolateResponse;
 import org.jeecg.modules.medical.service.IHomePageService;
 import org.jeecg.modules.utils.DateTimeUtil;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author Scott
@@ -21,19 +29,19 @@ public class HomePageServiceImpl implements IHomePageService {
     @Override
     public DashboardStatisticsBarResponse loadStatisticsBar(String startTime, String endTime) {
         DashboardStatisticsBarResponse result = new DashboardStatisticsBarResponse();
-        result.setSwipesTotal(30);
-        result.setBeforeReminderTotal(26);
-        result.setFormulaTotal(28);
-        result.setMiddleReviewTotal(10);
-        result.setViolationAmountTotal(new BigDecimal("280.05"));
-        result.setAfterSupervisoryTotal(9);
+        result.setSwipesTotal(300);
+        result.setBeforeReminderTotal(260);
+        result.setFormulaTotal(280);
+        result.setMiddleReviewTotal(100);
+        result.setViolationAmountTotal(new BigDecimal("2880.05"));
+        result.setAfterSupervisoryTotal(90);
 
         Date startTimeDate = DateTimeUtil.parse(startTime, DateTimeUtil.FULL_STYLE);
         Date endTimeDate = DateTimeUtil.parse(endTime, DateTimeUtil.FULL_STYLE);
 
         long diffDay = DateTimeUtil.subDay(startTimeDate, endTimeDate);
         if (diffDay > 0) {
-            BigDecimal factor = new BigDecimal(diffDay).multiply(new BigDecimal("1.1"));
+            BigDecimal factor = getFactoryValue(diffDay);
             result.setSwipesTotal(new BigDecimal(result.getSwipesTotal()).multiply(factor).intValue());
             result.setBeforeReminderTotal(new BigDecimal(result.getBeforeReminderTotal()).multiply(factor).intValue());
             result.setFormulaTotal(new BigDecimal(result.getFormulaTotal()).multiply(factor).intValue());
@@ -41,8 +49,120 @@ public class HomePageServiceImpl implements IHomePageService {
             result.setViolationAmountTotal(new BigDecimal(String.valueOf(result.getViolationAmountTotal())).multiply(factor).setScale(2, BigDecimal.ROUND_HALF_UP));
             result.setAfterSupervisoryTotal(new BigDecimal(result.getAfterSupervisoryTotal()).multiply(factor).intValue());
         }
+        return result;
+    }
+
+
+    /**
+     * 根据天数获取因子数
+     * @param diffDay
+     * @return
+     */
+    @NotNull
+    public static BigDecimal getFactoryValue(long diffDay) {
+        BigDecimal factory1 = new BigDecimal(diffDay).multiply(new BigDecimal("0.12"));
+        if ((diffDay % 2) == 0) {
+            factory1 = factory1.subtract(new BigDecimal(diffDay).multiply(new BigDecimal("0.10")));
+        }
+        return factory1;
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 20; i++) {
+            BigDecimal factoryValue = HomePageServiceImpl.getFactoryValue(i);
+            System.out.println(i);
+            System.out.println(factoryValue);
+        }
+    }
+
+    @Override
+    public DashboardStatisticsLineResponse loadStatisticsLine(String startTime, String endTime) {
+        DashboardStatisticsLineResponse result = new DashboardStatisticsLineResponse();
+
+
+        Date startTimeDate = DateTimeUtil.parse(startTime, DateTimeUtil.FULL_STYLE);
+        Date endTimeDate = DateTimeUtil.parse(endTime, DateTimeUtil.FULL_STYLE);
+
+        long diffDay = DateTimeUtil.subDay(startTimeDate, endTimeDate);
+
+        DashboardStatisticsBarResponse sourceData = new DashboardStatisticsBarResponse();
+        sourceData.setBeforeReminderTotal(260);
+        sourceData.setMiddleReviewTotal(100);
+        sourceData.setAfterSupervisoryTotal(90);
+
+
+        List<Integer> beforeReminderList = new ArrayList<>();
+        List<Integer> middleReviewList = new ArrayList<>();
+        List<Integer> afterList = new ArrayList<>();
+
+        List<String> xDateList = new ArrayList<>();
 
+        for (int i = 0; i <= diffDay; i ++) {
+            Date ss = DateTimeUtil.addDay(startTimeDate, (long) i);
 
+            BigDecimal factor = new BigDecimal("1");
+            if (i > 0) {
+                factor = getFactoryValue(i);
+            }
+
+
+            // 事前提醒
+            int beforeReminderItem = new BigDecimal(sourceData.getBeforeReminderTotal()).multiply(factor).intValue();
+            beforeReminderList.add(beforeReminderItem);
+            // 事中审查
+            int middleReviewItem = new BigDecimal(sourceData.getMiddleReviewTotal()).multiply(factor).intValue();
+            middleReviewList.add(middleReviewItem);
+            // 事后监管
+            int after = new BigDecimal(sourceData.getAfterSupervisoryTotal()).multiply(factor).intValue();
+            afterList.add(after);
+
+            String xDate = DateTimeUtil.formatterStr(ss, "MM-dd");
+            xDateList.add(xDate);
+
+        }
+        JSONObject before = new JSONObject();
+        before.put("title", "事前提醒");
+        before.put("yData", beforeReminderList);
+
+        JSONObject middle = new JSONObject();
+        middle.put("title", "事中审查");
+        middle.put("yData", middleReviewList);
+
+        JSONObject after = new JSONObject();
+        after.put("title", "事后监管");
+        after.put("yData", afterList);
+
+        List<JSONObject> temp = new ArrayList<>();
+        temp.add(before);
+        temp.add(middle);
+        temp.add(after);
+
+        result.setLineData(temp);
+        result.setXDate(xDateList);
         return result;
     }
+
+    /**
+     * 违规分类明细
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Override
+    public DashboardStatisticsViolateResponse loadStatisticsViolateRulesTop(String startTime, String endTime) {
+        DashboardStatisticsViolateResponse result = new DashboardStatisticsViolateResponse();
+        Date startTimeDate = DateTimeUtil.parse(startTime, DateTimeUtil.FULL_STYLE);
+        Date endTimeDate = DateTimeUtil.parse(endTime, DateTimeUtil.FULL_STYLE);
+        long diffDay = DateTimeUtil.subDay(startTimeDate, endTimeDate);
+
+        // 生成事前规则类型排名
+        DashboardStatisticsDetailedItem beforeRulesTop = new DashboardStatisticsDetailedItem();
+        beforeRulesTop.setTitle("事前规则类型排名");
+
+
+
+
+
+        return null;
+    }
 }