|
@@ -8,6 +8,7 @@ import com.diagbot.dto.AverageStatisticsDTO;
|
|
|
import com.diagbot.dto.CaseNumDTO;
|
|
|
import com.diagbot.dto.DeptNumDTO;
|
|
|
import com.diagbot.dto.EntryNumDTO;
|
|
|
+import com.diagbot.dto.HomePageNumDTO;
|
|
|
import com.diagbot.dto.LevelStatisticsDTO;
|
|
|
import com.diagbot.dto.NumDTO;
|
|
|
import com.diagbot.dto.QcResultPercentDTO;
|
|
@@ -23,7 +24,6 @@ import com.diagbot.vo.FilterPageVO;
|
|
|
import com.diagbot.vo.FilterVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
-import io.github.lvyahui8.spring.annotation.InvokeParameter;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -585,14 +585,18 @@ public class ConsoleFacade {
|
|
|
* @param filterOrderVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<LevelStatisticsDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
|
|
|
+ public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
|
|
|
String hosptialId = SysUserUtils.getCurrentHospitalID();
|
|
|
String startDate = filterFacade.getStartDateStr(filterOrderVO.getType(), null);
|
|
|
String endDate = filterFacade.getEndDateStr(filterOrderVO.getType(), null);
|
|
|
filterOrderVO.setStartDate(startDate);
|
|
|
filterOrderVO.setEndDate(endDate);
|
|
|
filterOrderVO.setHospitalId(hosptialId);
|
|
|
- List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
|
|
|
+ List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
|
|
|
+ HomePageNumDTO item = getGlobleRecord(records);
|
|
|
+ if (item != null) {
|
|
|
+ records.add(0, item);
|
|
|
+ }
|
|
|
return records;
|
|
|
}
|
|
|
|
|
@@ -602,8 +606,8 @@ public class ConsoleFacade {
|
|
|
* @param filterOrderVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<LevelStatisticsDTO> homePageLevelLimit(FilterOrderVO filterOrderVO) {
|
|
|
- DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ public List<HomePageNumDTO> homePageLevelLimit(FilterOrderVO filterOrderVO) {
|
|
|
+
|
|
|
String hosptialId = SysUserUtils.getCurrentHospitalID();
|
|
|
String startDate = filterFacade.getStartDateStr(filterOrderVO.getType(), null);
|
|
|
String endDate = filterFacade.getEndDateStr(filterOrderVO.getType(), null);
|
|
@@ -613,63 +617,121 @@ public class ConsoleFacade {
|
|
|
if (filterOrderVO.getLimitCount() == null || filterOrderVO.getLimitCount().equals(0)) {
|
|
|
filterOrderVO.setLimitCount(10);
|
|
|
}
|
|
|
- List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
|
|
|
+ List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
|
|
|
+ HomePageNumDTO item = getGlobleRecord(records);
|
|
|
+ if (item != null) {
|
|
|
+ records.add(0, item);
|
|
|
+ }
|
|
|
+ records = records
|
|
|
+ .stream()
|
|
|
+ .limit(filterOrderVO.getLimitCount())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return records;
|
|
|
+ }
|
|
|
|
|
|
- //增加全院
|
|
|
- LevelStatisticsDTO item = new LevelStatisticsDTO();
|
|
|
+ /**
|
|
|
+ * 增加全院记录
|
|
|
+ *
|
|
|
+ * @param records
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public HomePageNumDTO getGlobleRecord(List<HomePageNumDTO> records) {
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ HomePageNumDTO item = new HomePageNumDTO();
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //总病历数
|
|
|
Integer mrNum = records
|
|
|
.stream()
|
|
|
- .map(LevelStatisticsDTO::getMrNum)
|
|
|
+ .map(HomePageNumDTO::getMrNum)
|
|
|
.reduce(0, Integer::sum);
|
|
|
if (mrNum == null || mrNum == 0) {
|
|
|
- return Lists.newLinkedList();
|
|
|
+ return null;
|
|
|
}
|
|
|
+ //总缺陷数
|
|
|
Integer entryNum = records
|
|
|
.stream()
|
|
|
- .map(LevelStatisticsDTO::getEntryNum)
|
|
|
+ .map(HomePageNumDTO::getEntryNum)
|
|
|
.reduce(0, Integer::sum);
|
|
|
- Double totleFee = records
|
|
|
+ //总分
|
|
|
+ Double totleValue = records
|
|
|
.stream()
|
|
|
.map(i -> BigDecimal.valueOf(i.getTotleValue()))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
.doubleValue();
|
|
|
- Double averageFee = BigDecimal.valueOf(totleFee)
|
|
|
+ //平均分
|
|
|
+ Double averageValue = BigDecimal.valueOf(totleValue)
|
|
|
.divide(BigDecimal.valueOf(mrNum), 2, RoundingMode.HALF_UP)
|
|
|
.doubleValue();
|
|
|
+ //合格病历总数
|
|
|
Integer firstLevelNum = records
|
|
|
.stream()
|
|
|
- .map(LevelStatisticsDTO::getFirstLevelNum)
|
|
|
+ .map(HomePageNumDTO::getFirstLevelNum)
|
|
|
.reduce(0, Integer::sum);
|
|
|
+ //合格病历占比
|
|
|
Double firstLevelPercent = BigDecimal.valueOf(firstLevelNum)
|
|
|
.divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
|
|
|
.doubleValue();
|
|
|
String firstLevelPercentStr
|
|
|
= df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- Integer secondLevelNum = mrNum - firstLevelNum;
|
|
|
+ //不合格病历数
|
|
|
+ Integer secondLevelNum = records
|
|
|
+ .stream()
|
|
|
+ .map(HomePageNumDTO::getSecondLevelNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ //不合格病历占比
|
|
|
Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
|
|
|
.divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
|
|
|
.doubleValue();
|
|
|
String secondLevelPercentStr
|
|
|
= df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ //条目缺陷总数(模块下条目*病历数)
|
|
|
+ Integer entryTotleNum = records
|
|
|
+ .stream()
|
|
|
+ .map(HomePageNumDTO::getEntryTotleNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ //空项总数
|
|
|
+ Integer emptyNum = records
|
|
|
+ .stream()
|
|
|
+ .map(HomePageNumDTO::getEmptyNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ Double emptyPercent = BigDecimal.valueOf(emptyNum)
|
|
|
+ .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ String emptyPercentStr
|
|
|
+ = df.format(BigDecimal.valueOf(emptyPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ //错误项总数
|
|
|
+ Integer errorNum = records
|
|
|
+ .stream()
|
|
|
+ .map(HomePageNumDTO::getErrorNum)
|
|
|
+ .reduce(0, Integer::sum);
|
|
|
+ Double errorPercent = BigDecimal.valueOf(errorNum)
|
|
|
+ .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ String errorPercentStr
|
|
|
+ = df.format(BigDecimal.valueOf(errorPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+
|
|
|
item.setDeptName("全院");
|
|
|
item.setEntryNum(entryNum);
|
|
|
item.setMrNum(mrNum);
|
|
|
- item.setTotleValue(totleFee);
|
|
|
- item.setAverageValue(averageFee);
|
|
|
+ item.setTotleValue(totleValue);
|
|
|
+ item.setAverageValue(averageValue);
|
|
|
item.setFirstLevelNum(firstLevelNum);
|
|
|
item.setFirstLevelPercent(firstLevelPercent);
|
|
|
item.setFirstLevelPercentStr(firstLevelPercentStr);
|
|
|
item.setSecondLevelNum(secondLevelNum);
|
|
|
item.setSecondLevelPercent(secondLevelPercent);
|
|
|
item.setSecondLevelPercentStr(secondLevelPercentStr);
|
|
|
-
|
|
|
- records.add(0, item);
|
|
|
-
|
|
|
- records = records
|
|
|
- .stream()
|
|
|
- .limit(filterOrderVO.getLimitCount())
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- return records;
|
|
|
+ item.setEntryTotleNum(entryTotleNum);
|
|
|
+ item.setEmptyNum(emptyNum);
|
|
|
+ item.setEmptyPercent(emptyPercent);
|
|
|
+ item.setEmptyPercentStr(emptyPercentStr);
|
|
|
+ item.setErrorNum(errorNum);
|
|
|
+ item.setErrorPercent(errorPercent);
|
|
|
+ item.setErrorPercentStr(errorPercentStr);
|
|
|
+ return item;
|
|
|
}
|
|
|
}
|