|
@@ -1,8 +1,8 @@
|
|
|
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.dto.ResultStatisticsDTO;
|
|
|
import com.diagbot.entity.BehospitalInfo;
|
|
|
import com.diagbot.entity.QcresultInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
@@ -11,7 +11,6 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.FilterVO;
|
|
|
-import com.fasterxml.jackson.datatype.jsr310.DecimalUtils;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -37,6 +36,8 @@ public class ConsoleFacade {
|
|
|
private QcresultInfoFacade qcresultInfoFacade;
|
|
|
@Autowired
|
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private HomePageFacade homePageFacade;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -44,7 +45,7 @@ public class ConsoleFacade {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> mrStatistics() {
|
|
|
+ public Map<String, Object> mrStatistics(FilterVO filterVO) {
|
|
|
Map<String, Object> retMap = new HashMap<>();
|
|
|
retMap.put("本月病历数", 0);
|
|
|
retMap.put("本月质控数-人工", 0);
|
|
@@ -57,11 +58,10 @@ public class ConsoleFacade {
|
|
|
retMap.put("本月不合格病历-机器", 0);
|
|
|
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
|
+ String startDate = getStartDateStr(filterVO.getType());
|
|
|
+ filterVO.setStartDate(startDate);
|
|
|
+ filterVO.setHospitalId(hospitalId);
|
|
|
|
|
|
- Date date = new Date();
|
|
|
- String year = DateUtil.getYear(date);
|
|
|
- int month = DateUtil.getMonth(date);
|
|
|
- String startDate = year + "-" + month + "-1";
|
|
|
QueryWrapper<BehospitalInfo> behospitalInfoQueryWrapper = new QueryWrapper<>();
|
|
|
behospitalInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("hospital_id", hospitalId)
|
|
@@ -72,11 +72,7 @@ public class ConsoleFacade {
|
|
|
retMap.put("本月病历数", behospitalInfoList.size());
|
|
|
}
|
|
|
|
|
|
- QueryWrapper<QcresultInfo> qcresultInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- qcresultInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("hospital_id", hospitalId)
|
|
|
- .ge("gmt_create", startDate);
|
|
|
- List<QcresultInfo> qcresultInfoList = qcresultInfoFacade.list(qcresultInfoQueryWrapper);
|
|
|
+ List<QcresultInfo> qcresultInfoList = qcresultInfoFacade.getQcresultSelectively(filterVO);
|
|
|
if (ListUtil.isNotEmpty(qcresultInfoList)) {
|
|
|
retMap.put("本月质控数-人工", qcresultInfoList
|
|
|
.stream()
|
|
@@ -121,7 +117,6 @@ public class ConsoleFacade {
|
|
|
}
|
|
|
|
|
|
return retMap;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -135,17 +130,7 @@ public class ConsoleFacade {
|
|
|
retMap.put("缺陷排行列表", Lists.newLinkedList());
|
|
|
retMap.put("各科室缺陷占比", Lists.newLinkedList());
|
|
|
String hospitalId = SysUserUtils.getCurrentHospitalID();
|
|
|
- Date date = new Date();
|
|
|
- String startDate = "";
|
|
|
- String year = DateUtil.getYear(date);
|
|
|
- int month = DateUtil.getMonth(date);
|
|
|
- if (filterVO.getType().equals(1)) {
|
|
|
- //本月统计
|
|
|
- startDate = year + "-" + month + "-1";
|
|
|
- } else if (filterVO.getType().equals(2)) {
|
|
|
- //本年统计
|
|
|
- startDate = year + "-1-1";
|
|
|
- }
|
|
|
+ String startDate = getStartDateStr(filterVO.getType());
|
|
|
filterVO.setStartDate(startDate);
|
|
|
filterVO.setHospitalId(hospitalId);
|
|
|
filterVO.setLimitCount(10);
|
|
@@ -197,4 +182,108 @@ public class ConsoleFacade {
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 医院运营相关统计
|
|
|
+ *
|
|
|
+ * @param filterVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ 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();
|
|
|
+ filterVO.setHospitalId(hospitalId);
|
|
|
+ String startDate = getStartDateStr(filterVO.getType());
|
|
|
+ filterVO.setStartDate(startDate);
|
|
|
+
|
|
|
+ List<AverageStatisticsDTO> averageDayNumList = homePageFacade.getAverageDayNum(filterVO);
|
|
|
+ List<AverageStatisticsDTO> averageFeeList = homePageFacade.getAverageFee(filterVO);
|
|
|
+
|
|
|
+ if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
|
|
|
+ filterVO.setLimitCount(10);
|
|
|
+ }
|
|
|
+ Integer limitCount = filterVO.getLimitCount();
|
|
|
+
|
|
|
+ //平均住院日
|
|
|
+ if (ListUtil.isNotEmpty(averageDayNumList)) {
|
|
|
+ if (averageDayNumList.size() < limitCount) {
|
|
|
+ retAverageDayNumList = BeanUtil.listCopyTo(averageDayNumList, AverageStatisticsDTO.class);
|
|
|
+ } else {
|
|
|
+ Double averageValue = 0d;
|
|
|
+ Integer num = 0;
|
|
|
+ for (AverageStatisticsDTO averageStatisticsDTO : averageDayNumList) {
|
|
|
+ if (retAverageDayNumList.size() < limitCount - 1) {
|
|
|
+ retAverageDayNumList.add(averageStatisticsDTO);
|
|
|
+ } else {
|
|
|
+ averageValue = BigDecimal
|
|
|
+ .valueOf(averageValue)
|
|
|
+ .add(BigDecimal.valueOf(averageStatisticsDTO.getAverageValue()))
|
|
|
+ .doubleValue();
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ averageValue = BigDecimal.valueOf(averageValue).divide(BigDecimal.valueOf(num)).doubleValue();
|
|
|
+ AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
|
|
|
+ retAverageStatistics.setDeptName("其他");
|
|
|
+ retAverageStatistics.setAverageValue(averageValue);
|
|
|
+ retAverageDayNumList.add(retAverageStatistics);
|
|
|
+ }
|
|
|
+ retMap.put("平均住院日", retAverageDayNumList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //平均住院费用
|
|
|
+ if (ListUtil.isNotEmpty(averageFeeList)) {
|
|
|
+ if (averageFeeList.size() < limitCount) {
|
|
|
+ retAverageFeeList = BeanUtil.listCopyTo(averageFeeList, AverageStatisticsDTO.class);
|
|
|
+ } else {
|
|
|
+ Double averageValue = 0d;
|
|
|
+ Integer num = 0;
|
|
|
+ for (AverageStatisticsDTO averageStatisticsDTO : averageFeeList) {
|
|
|
+ if (retAverageFeeList.size() < limitCount - 1) {
|
|
|
+ retAverageFeeList.add(averageStatisticsDTO);
|
|
|
+ } else {
|
|
|
+ averageValue = BigDecimal
|
|
|
+ .valueOf(averageValue)
|
|
|
+ .add(BigDecimal.valueOf(averageStatisticsDTO.getAverageValue()))
|
|
|
+ .doubleValue();
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ averageValue = BigDecimal.valueOf(averageValue).divide(BigDecimal.valueOf(num)).doubleValue();
|
|
|
+ AverageStatisticsDTO retAverageStatistics = new AverageStatisticsDTO();
|
|
|
+ retAverageStatistics.setDeptName("其他");
|
|
|
+ retAverageStatistics.setAverageValue(averageValue);
|
|
|
+ retAverageFeeList.add(retAverageStatistics);
|
|
|
+ }
|
|
|
+ retMap.put("平均住院费用", retAverageFeeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选起始时间
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getStartDateStr(Integer type) {
|
|
|
+ Date date = new Date();
|
|
|
+ String startDate = "";
|
|
|
+ String year = DateUtil.getYear(date);
|
|
|
+ int month = DateUtil.getMonth(date);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ //本月统计
|
|
|
+ startDate = year + "-" + month + "-1";
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ //本年统计
|
|
|
+ startDate = year + "-1-1";
|
|
|
+ }
|
|
|
+ return startDate;
|
|
|
+ }
|
|
|
+
|
|
|
}
|