|
@@ -21,8 +21,10 @@ import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -241,14 +243,14 @@ public class EvalStatsAnalyse implements CommonStats<CombineEvalResult> {
|
|
|
result.setColumn(allColumn);
|
|
result.setColumn(allColumn);
|
|
|
//根据时间区间对镇痛方式进行统计
|
|
//根据时间区间对镇痛方式进行统计
|
|
|
groupByTime.forEach((timeRange,combineResult)->{
|
|
groupByTime.forEach((timeRange,combineResult)->{
|
|
|
- BigDecimal totalSize = BigDecimal.valueOf(CollectionUtil.size(combineResult));
|
|
|
|
|
|
|
+ RatioResult ratioResult = computeEvalRatio(combineResult);
|
|
|
//表格内容
|
|
//表格内容
|
|
|
long evalCount = combineResult.stream().filter(r -> StrUtil.isNotEmpty(r.getEvalId())).count();
|
|
long evalCount = combineResult.stream().filter(r -> StrUtil.isNotEmpty(r.getEvalId())).count();
|
|
|
LinkedHashMap<String, Object> contentValues = new LinkedHashMap<>();
|
|
LinkedHashMap<String, Object> contentValues = new LinkedHashMap<>();
|
|
|
contentValues.put("时间",timeRange);
|
|
contentValues.put("时间",timeRange);
|
|
|
- contentValues.put("输注次数",totalSize);
|
|
|
|
|
|
|
+ contentValues.put("输注次数",ratioResult.getTotalSize());
|
|
|
contentValues.put("评价次数",evalCount);
|
|
contentValues.put("评价次数",evalCount);
|
|
|
- contentValues.put("评价比率",computeRatio(BigDecimal.valueOf(evalCount),totalSize));
|
|
|
|
|
|
|
+ contentValues.put("评价比率",ratioResult.getRatio());
|
|
|
//获取特定时间区间内
|
|
//获取特定时间区间内
|
|
|
EvalTableResult evalTableResult = new EvalTableResult();
|
|
EvalTableResult evalTableResult = new EvalTableResult();
|
|
|
combineResult.stream()
|
|
combineResult.stream()
|
|
@@ -347,10 +349,7 @@ public class EvalStatsAnalyse implements CommonStats<CombineEvalResult> {
|
|
|
|
|
|
|
|
//根据时间区间对镇痛方式进行统计
|
|
//根据时间区间对镇痛方式进行统计
|
|
|
groupByTime.forEach((timeRange,combineResult)->{
|
|
groupByTime.forEach((timeRange,combineResult)->{
|
|
|
- BigDecimal totalSize = BigDecimal.valueOf(CollectionUtil.size(combineResult));
|
|
|
|
|
- //获取特定时间区间内 评价次数
|
|
|
|
|
- long evalCount = combineResult.stream().filter(r -> StrUtil.isNotEmpty(r.getEvalId())).count();
|
|
|
|
|
- ratioLine.addValue(computeRatio(BigDecimal.valueOf(evalCount),totalSize));
|
|
|
|
|
|
|
+ ratioLine.addValue(computeEvalRatio(combineResult).getRatio());
|
|
|
time.add(timeRange);
|
|
time.add(timeRange);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -547,9 +546,29 @@ public class EvalStatsAnalyse implements CommonStats<CombineEvalResult> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ private RatioResult computeEvalRatio(List<CombineEvalResult> results){
|
|
|
|
|
+ Map<String, List<CombineEvalResult>> resultMap = results.stream().collect(Collectors.groupingBy(CombineEvalResult::getId));
|
|
|
|
|
+ BigDecimal totalSize = BigDecimal.valueOf(CollectionUtil.size(resultMap.keySet()));
|
|
|
|
|
+ AtomicInteger evalCount=new AtomicInteger(0);
|
|
|
|
|
+ resultMap.forEach((id,evalResult)->{
|
|
|
|
|
+ if (evalResult.stream().anyMatch(r-> StrUtil.isNotEmpty(r.getEvalId()))) {
|
|
|
|
|
+ evalCount.addAndGet(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return RatioResult.of(totalSize,BigDecimal.valueOf(evalCount.get()), computeRatio(totalSize,BigDecimal.valueOf(evalCount.get())));
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
private BusHospitalConfigEntity evalConfig(){
|
|
private BusHospitalConfigEntity evalConfig(){
|
|
|
return configService.getOne(new QueryWrapper<BusHospitalConfigEntity>().lambda().eq(BusHospitalConfigEntity::getType, ConfigEnum.eval));
|
|
return configService.getOne(new QueryWrapper<BusHospitalConfigEntity>().lambda().eq(BusHospitalConfigEntity::getType, ConfigEnum.eval));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Data
|
|
|
|
|
+ @AllArgsConstructor(staticName = "of")
|
|
|
|
|
+ static class RatioResult{
|
|
|
|
|
+ BigDecimal totalSize;
|
|
|
|
|
+ BigDecimal evalCount;
|
|
|
|
|
+ BigDecimal ratio;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|