|
@@ -2,9 +2,10 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.AverageStatisticsDTO;
|
|
|
-import com.diagbot.dto.ResultDetailDTO;
|
|
|
import com.diagbot.entity.BehospitalInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
@@ -12,12 +13,13 @@ import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.FilterVO;
|
|
|
import com.diagbot.vo.QcresultFilterVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.text.DecimalFormat;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -36,6 +38,8 @@ public class ConsoleFacade {
|
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
@Autowired
|
|
|
private HomePageFacade homePageFacade;
|
|
|
+ @Autowired
|
|
|
+ private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -156,48 +160,57 @@ public class ConsoleFacade {
|
|
|
if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
|
|
|
filterVO.setLimitCount(10);
|
|
|
}
|
|
|
- List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics(filterVO);
|
|
|
- if (ListUtil.isNotEmpty(results)) {
|
|
|
- results.forEach(result -> {
|
|
|
- DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
- String percentStr
|
|
|
- = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- result.setPercentStr(percentStr);
|
|
|
- });
|
|
|
- retMap.put("缺陷排行列表", results);
|
|
|
- }
|
|
|
- List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept(filterVO);
|
|
|
- if (ListUtil.isNotEmpty(results2)) {
|
|
|
- List<ResultDetailDTO> retResults = Lists.newLinkedList();
|
|
|
- if (results2.size() <= 6) {
|
|
|
- retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
|
|
|
- } else {
|
|
|
+ // List<ResultDetailDTO> results = behospitalInfoFacade.resultStatistics(filterVO);
|
|
|
+ // if (ListUtil.isNotEmpty(results)) {
|
|
|
+ // results.forEach(result -> {
|
|
|
+ // DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ // String percentStr
|
|
|
+ // = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ // result.setPercentStr(percentStr);
|
|
|
+ // });
|
|
|
+ // retMap.put("缺陷排行列表", results);
|
|
|
+ // }
|
|
|
+ // List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept(filterVO);
|
|
|
+ // if (ListUtil.isNotEmpty(results2)) {
|
|
|
+ // List<ResultDetailDTO> retResults = Lists.newLinkedList();
|
|
|
+ // if (results2.size() <= 6) {
|
|
|
+ // retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
|
|
|
+ // } else {
|
|
|
+ //
|
|
|
+ // Double rate = 0d;
|
|
|
+ // Integer num = 0;
|
|
|
+ // for (ResultDetailDTO result : results2) {
|
|
|
+ // if (retResults.size() < 5) {
|
|
|
+ // rate = BigDecimal.valueOf(rate)
|
|
|
+ // .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
|
|
|
+ // .doubleValue();
|
|
|
+ // retResults.add(result);
|
|
|
+ // } else {
|
|
|
+ // num += result.getNum();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // ResultDetailDTO retResult = new ResultDetailDTO();
|
|
|
+ // retResult.setName("其他");
|
|
|
+ // retResult.setNum(num);
|
|
|
+ // retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
|
|
|
+ // retResults.add(retResult);
|
|
|
+ // }
|
|
|
+ // retResults.forEach(result -> {
|
|
|
+ // DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ // String percentStr
|
|
|
+ // = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ // result.setPercentStr(percentStr);
|
|
|
+ // });
|
|
|
+ // retMap.put("各科室缺陷占比", retResults);
|
|
|
+ // }
|
|
|
|
|
|
- Double rate = 0d;
|
|
|
- Integer num = 0;
|
|
|
- for (ResultDetailDTO result : results2) {
|
|
|
- if (retResults.size() < 5) {
|
|
|
- rate = BigDecimal.valueOf(rate)
|
|
|
- .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
|
|
|
- .doubleValue();
|
|
|
- retResults.add(result);
|
|
|
- } else {
|
|
|
- num += result.getNum();
|
|
|
- }
|
|
|
- }
|
|
|
- ResultDetailDTO retResult = new ResultDetailDTO();
|
|
|
- retResult.setName("其他");
|
|
|
- retResult.setNum(num);
|
|
|
- retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
|
|
|
- retResults.add(retResult);
|
|
|
- }
|
|
|
- retResults.forEach(result -> {
|
|
|
- DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
- String percentStr
|
|
|
- = df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- result.setPercentStr(percentStr);
|
|
|
- });
|
|
|
- retMap.put("各科室缺陷占比", retResults);
|
|
|
+ try {
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
+ invokeParams.put("filterVO", filterVO);
|
|
|
+ retMap
|
|
|
+ = dataBeanAggregateQueryFacade.get("setAllResult", invokeParams, Map.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|