|
|
@@ -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;
|
|
|
+ }
|
|
|
}
|