|
@@ -8,7 +8,6 @@ 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;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.FilterVO;
|
|
|
import com.diagbot.vo.QcresultFilterVO;
|
|
@@ -224,8 +223,6 @@ public class ConsoleFacade {
|
|
|
*/
|
|
|
public Map<String, Object> averageStatistics(FilterVO filterVO) {
|
|
|
Map<String, Object> retMap = new LinkedHashMap<>();
|
|
|
- List<AverageStatisticsDTO> retAverageDayNumList = Lists.newLinkedList();
|
|
|
- List<AverageStatisticsDTO> retAverageFeeList = Lists.newLinkedList();
|
|
|
retMap.put("平均住院日", Lists.newLinkedList());
|
|
|
retMap.put("平均住院费用", Lists.newLinkedList());
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
@@ -233,6 +230,9 @@ public class ConsoleFacade {
|
|
|
String startDate = getStartDateStr(filterVO.getType());
|
|
|
filterVO.setStartDate(startDate);
|
|
|
|
|
|
+ /*
|
|
|
+ List<AverageStatisticsDTO> retAverageDayNumList = Lists.newLinkedList();
|
|
|
+ List<AverageStatisticsDTO> retAverageFeeList = Lists.newLinkedList();
|
|
|
List<AverageStatisticsDTO> averageDayNumList = homePageFacade.getAverageDayNum(filterVO);
|
|
|
List<AverageStatisticsDTO> averageFeeList = homePageFacade.getAverageFee(filterVO);
|
|
|
|
|
@@ -251,6 +251,15 @@ public class ConsoleFacade {
|
|
|
if (ListUtil.isNotEmpty(averageFeeList)) {
|
|
|
retAverageFeeList = getLimitAverageList(averageFeeList, limitCount);
|
|
|
retMap.put("平均住院费用", retAverageFeeList);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ try {
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
+ invokeParams.put("filterVO", filterVO);
|
|
|
+ retMap
|
|
|
+ = dataBeanAggregateQueryFacade.get("setAllAverage", invokeParams, Map.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
|
|
|
}
|
|
|
|
|
|
return retMap;
|
|
@@ -289,29 +298,29 @@ public class ConsoleFacade {
|
|
|
if (averageList.size() < limitCount) {
|
|
|
retAverageList = BeanUtil.listCopyTo(averageList, AverageStatisticsDTO.class);
|
|
|
} else {
|
|
|
- Double averageValue = 0d;
|
|
|
- Double totleValue = 0d;
|
|
|
- Integer num = 0;
|
|
|
- for (AverageStatisticsDTO averageStatisticsDTO : averageList) {
|
|
|
- if (retAverageList.size() < limitCount - 1) {
|
|
|
- retAverageList.add(averageStatisticsDTO);
|
|
|
- } else {
|
|
|
- totleValue = BigDecimal
|
|
|
- .valueOf(totleValue)
|
|
|
- .add(BigDecimal.valueOf(averageStatisticsDTO.getTotleValue()))
|
|
|
- .doubleValue();
|
|
|
- num += averageStatisticsDTO.getNum();
|
|
|
- }
|
|
|
+ if (averageList.size() > limitCount) {
|
|
|
+ retAverageList = averageList.subList(0, limitCount - 1);
|
|
|
+ List<AverageStatisticsDTO> otherList = averageList.subList(limitCount - 1, averageList.size());
|
|
|
+ Double totleValue = otherList
|
|
|
+ .stream()
|
|
|
+ .map(i -> BigDecimal.valueOf(i.getTotleValue()))
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
|
|
|
+ Integer num = otherList
|
|
|
+ .stream()
|
|
|
+ .map(AverageStatisticsDTO::getNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ Double averageValue = BigDecimal.valueOf(totleValue)
|
|
|
+ .divide(BigDecimal.valueOf(num), 2, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
|
|
|
+ retAverageStatistics.setDeptName("其他");
|
|
|
+ retAverageStatistics.setNum(num);
|
|
|
+ retAverageStatistics.setAverageValue(averageValue);
|
|
|
+ retAverageStatistics.setTotleValue(totleValue);
|
|
|
+ retAverageList.add(retAverageStatistics);
|
|
|
+ } else {
|
|
|
+ retAverageList = averageList;
|
|
|
}
|
|
|
- averageValue = BigDecimal.valueOf(totleValue)
|
|
|
- .divide(BigDecimal.valueOf(num), 2, RoundingMode.HALF_UP)
|
|
|
- .doubleValue();
|
|
|
- AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
|
|
|
- retAverageStatistics.setDeptName("其他");
|
|
|
- retAverageStatistics.setNum(num);
|
|
|
- retAverageStatistics.setAverageValue(averageValue);
|
|
|
- retAverageStatistics.setTotleValue(totleValue);
|
|
|
- retAverageList.add(retAverageStatistics);
|
|
|
}
|
|
|
return retAverageList;
|
|
|
}
|