|
|
@@ -3,6 +3,7 @@ package com.nb.bus.stats.analyse;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
|
import com.nb.bus.enums.DeviceAlarmEnum;
|
|
|
+import com.nb.bus.enums.FlowStatusEnum;
|
|
|
import com.nb.bus.enums.StatsAnalyseEnum;
|
|
|
import com.nb.bus.enums.StatsTimeUnit;
|
|
|
import com.nb.bus.service.LocalBusInfusionHistoryService;
|
|
|
@@ -73,8 +74,8 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
* @return LineResult
|
|
|
*/
|
|
|
private LineResult alarmScatter(Map<String, List<CombineAlarmResult>> groupByTime) {
|
|
|
- LineResult<BigDecimal> result = LineResult.of("alarmScatter", false, false, true,"报警均数走势分析图");
|
|
|
- LineResult.LineContent<BigDecimal> scatterLine = new LineResult.LineContent("报警均值");
|
|
|
+ LineResult<BigDecimal> result = LineResult.of("alarmScatter", false, false, true,"提示均数走势分析图");
|
|
|
+ LineResult.LineContent<BigDecimal> scatterLine = new LineResult.LineContent("提示均值");
|
|
|
AlarmScatter alarmScatter = new AlarmScatter();
|
|
|
groupByTime.forEach((timeRange,combineResults)->{
|
|
|
for (CombineAlarmResult combineResult : combineResults) {
|
|
|
@@ -112,7 +113,7 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
* @return LineResult
|
|
|
*/
|
|
|
private LineResult ratioLine(Map<String, List<CombineAlarmResult>> results) {
|
|
|
- LineResult<BigDecimal> result =LineResult.of("ratio",true,false,"报警率分布图");
|
|
|
+ LineResult<BigDecimal> result =LineResult.of("ratio",true,false,"提示率分布图");
|
|
|
List<String> time = result.getTime();
|
|
|
Map<String, AlarmTotalPieResult> groupByTime = new HashMap<>();
|
|
|
//根据时间区间对镇痛方式进行统计
|
|
|
@@ -125,25 +126,37 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
Map<String, LineResult.LineContent<BigDecimal>> lineContentMap=new HashMap<>();
|
|
|
groupByTime.forEach((timeRange,totalResult)->{
|
|
|
BigDecimal total = BigDecimal.valueOf(totalResult.getTotal());
|
|
|
- lineContentMap.computeIfAbsent("堵塞率",k->new LineResult.LineContent<>("堵塞")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("堵塞率",k->new LineResult.LineContent<>(DeviceAlarmEnum.Jam.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getJam().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("极限率",k->new LineResult.LineContent<>("极限")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("极限率",k->new LineResult.LineContent<>(DeviceAlarmEnum.Limit.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getLimit().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("未装药盒率",k->new LineResult.LineContent<>("未装药盒")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("未装药盒率",k->new LineResult.LineContent<>(DeviceAlarmEnum.NotBox.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getNoBox().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("电机失控率",k->new LineResult.LineContent<>("电机失控")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("电机失控率",k->new LineResult.LineContent<>(DeviceAlarmEnum.OutOfControl.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getOutOfControl().getValue()),total));
|
|
|
lineContentMap.computeIfAbsent("镇痛不足率",k->new LineResult.LineContent<>("镇痛不足")).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getAnalgesicPoor().getValue()),total));
|
|
|
lineContentMap.computeIfAbsent("不在服务区率",k->new LineResult.LineContent<>("不在服务区")).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getNoSignal().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("机械故障率",k->new LineResult.LineContent<>("机械故障")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("机械故障率",k->new LineResult.LineContent<>(DeviceAlarmEnum.Machine.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getMachine().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("电量耗尽率",k->new LineResult.LineContent<>("电量耗尽")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("低电量率",k->new LineResult.LineContent<>("低电量")).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getLowBattery().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("气泡无液率",k->new LineResult.LineContent<>("气泡无液")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("气泡无液率",k->new LineResult.LineContent<>(DeviceAlarmEnum.Bubble.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getBubble().getValue()),total));
|
|
|
- lineContentMap.computeIfAbsent("低输注率",k->new LineResult.LineContent<>("低输注")).getValue()
|
|
|
+ lineContentMap.computeIfAbsent("输注总量报警率",k->new LineResult.LineContent<>(DeviceAlarmEnum.InfusionMax.getText())).getValue()
|
|
|
+ .add(computeRatio(BigDecimal.valueOf(totalResult.getInfusionMax().getValue()),total));
|
|
|
+
|
|
|
+ //智能泵专属
|
|
|
+ lineContentMap.computeIfAbsent("加档率",k->new LineResult.LineContent<>(FlowStatusEnum.Up.getText())).getValue()
|
|
|
+ .add(computeRatio(BigDecimal.valueOf(totalResult.getFlowUp().getValue()),total));
|
|
|
+ lineContentMap.computeIfAbsent("减档率",k->new LineResult.LineContent<>(FlowStatusEnum.Down.getText())).getValue()
|
|
|
+ .add(computeRatio(BigDecimal.valueOf(totalResult.getFlowDown().getValue()),total));
|
|
|
+ lineContentMap.computeIfAbsent("流速已达上限率",k->new LineResult.LineContent<>(FlowStatusEnum.MaxFlow.getText())).getValue()
|
|
|
+ .add(computeRatio(BigDecimal.valueOf(totalResult.getFlowMax().getValue()),total));
|
|
|
+ lineContentMap.computeIfAbsent("加档受限率",k->new LineResult.LineContent<>(FlowStatusEnum.Limited.getText())).getValue()
|
|
|
+ .add(computeRatio(BigDecimal.valueOf(totalResult.getFlowLimited().getValue()),total));
|
|
|
+ lineContentMap.computeIfAbsent("低输注率",k->new LineResult.LineContent<>(FlowStatusEnum.Lowest.getText())).getValue()
|
|
|
.add(computeRatio(BigDecimal.valueOf(totalResult.getLowInfusion().getValue()),total));
|
|
|
});
|
|
|
result.setContent(new ArrayList<>(lineContentMap.values()));
|
|
|
@@ -158,7 +171,7 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
* @return LineResult
|
|
|
*/
|
|
|
private LineResult countLine(Map<String, List<CombineAlarmResult>> results) {
|
|
|
- LineResult<Long> result = LineResult.of("count",false,false,"报警次数分布图");
|
|
|
+ LineResult<Long> result = LineResult.of("count",false,false,"提示次数分布图");
|
|
|
List<String> time = result.getTime();
|
|
|
Map<String, AlarmTotalPieResult> groupByTime = new HashMap<>();
|
|
|
//根据时间区间对镇痛方式进行统计
|
|
|
@@ -170,16 +183,23 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
//将每一时区的报警数量进行分类汇总
|
|
|
Map<String, LineResult.LineContent<Long>> lineContentMap=new HashMap<>();
|
|
|
groupByTime.forEach((timeRange,totalResult)->{
|
|
|
- lineContentMap.computeIfAbsent("堵塞",k->new LineResult.LineContent<>("堵塞")).getValue().add(totalResult.getJam().getValue());
|
|
|
- lineContentMap.computeIfAbsent("极限",k->new LineResult.LineContent<>("极限")).getValue().add(totalResult.getLimit().getValue());
|
|
|
- lineContentMap.computeIfAbsent("未装药盒",k->new LineResult.LineContent<>("未装药盒")).getValue().add(totalResult.getNoBox().getValue());
|
|
|
- lineContentMap.computeIfAbsent("电机失控",k->new LineResult.LineContent<>("电机失控")).getValue().add(totalResult.getOutOfControl().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.Jam.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.Jam.getText())).getValue().add(totalResult.getJam().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.Limit.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.Limit.getText())).getValue().add(totalResult.getLimit().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.NotBox.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.NotBox.getText())).getValue().add(totalResult.getNoBox().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.OutOfControl.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.OutOfControl.getText())).getValue().add(totalResult.getOutOfControl().getValue());
|
|
|
lineContentMap.computeIfAbsent("镇痛不足",k->new LineResult.LineContent<>("镇痛不足")).getValue().add(totalResult.getAnalgesicPoor().getValue());
|
|
|
lineContentMap.computeIfAbsent("不在服务区",k->new LineResult.LineContent<>("不在服务区")).getValue().add(totalResult.getNoSignal().getValue());
|
|
|
- lineContentMap.computeIfAbsent("机械故障",k->new LineResult.LineContent<>("机械故障")).getValue().add(totalResult.getMachine().getValue());
|
|
|
- lineContentMap.computeIfAbsent("电量耗尽",k->new LineResult.LineContent<>("电量耗尽")).getValue().add(totalResult.getLowBattery().getValue());
|
|
|
- lineContentMap.computeIfAbsent("气泡无液",k->new LineResult.LineContent<>("气泡无液")).getValue().add(totalResult.getBubble().getValue());
|
|
|
- lineContentMap.computeIfAbsent("低输注",k->new LineResult.LineContent<>("低输注")).getValue().add(totalResult.getLowInfusion().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.Machine.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.Machine.getText())).getValue().add(totalResult.getMachine().getValue());
|
|
|
+ lineContentMap.computeIfAbsent("低电量",k->new LineResult.LineContent<>("低电量")).getValue().add(totalResult.getLowBattery().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.Bubble.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.Bubble.getText())).getValue().add(totalResult.getBubble().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(DeviceAlarmEnum.InfusionMax.getText(),k->new LineResult.LineContent<>(DeviceAlarmEnum.InfusionMax.getText())).getValue().add(totalResult.getLowInfusion().getValue());
|
|
|
+
|
|
|
+ //智能泵专属
|
|
|
+ lineContentMap.computeIfAbsent(FlowStatusEnum.Up.getText(), k->new LineResult.LineContent<>(FlowStatusEnum.Up.getText())).getValue().add(totalResult.getFlowUp().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(FlowStatusEnum.Down.getText(),k->new LineResult.LineContent<>(FlowStatusEnum.Down.getText())).getValue().add(totalResult.getFlowDown().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(FlowStatusEnum.MaxFlow.getText(),k->new LineResult.LineContent<>(FlowStatusEnum.MaxFlow.getText())).getValue().add(totalResult.getFlowMax().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(FlowStatusEnum.Limited.getText(),k->new LineResult.LineContent<>(FlowStatusEnum.Limited.getText())).getValue().add(totalResult.getFlowLimited().getValue());
|
|
|
+ lineContentMap.computeIfAbsent(FlowStatusEnum.Lowest.getText(),k->new LineResult.LineContent<>(FlowStatusEnum.Lowest.getText())).getValue().add(totalResult.getLowInfusion().getValue());
|
|
|
});
|
|
|
result.setContent(new ArrayList<>(lineContentMap.values()));
|
|
|
result.setSampleCount(CollUtil.size(results));
|
|
|
@@ -193,8 +213,28 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
TableResult result = new TableResult();
|
|
|
//根据时间对结果进行区分统计
|
|
|
Map<String, List<CombineAlarmResult>> groupByTimeResults = groupByTime(results, unit);
|
|
|
+ List<String> columnNames = Arrays.asList(
|
|
|
+ DeviceAlarmEnum.Jam.getText(),
|
|
|
+ DeviceAlarmEnum.Limit.getText(),
|
|
|
+ DeviceAlarmEnum.NotBox.getText(),
|
|
|
+ DeviceAlarmEnum.OutOfControl.getText(),
|
|
|
+ "镇痛不足",
|
|
|
+ "不在服务区",
|
|
|
+ DeviceAlarmEnum.Machine.getText(),
|
|
|
+ "低电量",
|
|
|
+ DeviceAlarmEnum.Bubble.getText(),
|
|
|
+ DeviceAlarmEnum.InfusionMax.getText());
|
|
|
+ //智能泵专属
|
|
|
+ columnNames=CollUtil.unionAll(columnNames,Arrays.asList(
|
|
|
+ FlowStatusEnum.Up.getText(),
|
|
|
+ FlowStatusEnum.Down.getText(),
|
|
|
+ FlowStatusEnum.MaxFlow.getText(),
|
|
|
+ FlowStatusEnum.Limited.getText(),
|
|
|
+ FlowStatusEnum.Lowest.getText()
|
|
|
+ ));
|
|
|
//顺序不可错! 先数量后比率
|
|
|
- List<StatsColumn> allColumn = getAllColumn(Arrays.asList("堵塞","极限","未装药盒","电机失控","镇痛不足","不在服务区","机械故障","电量耗尽","气泡无液","输入总量报警","低输注"));
|
|
|
+ List<StatsColumn> allColumn = getAllColumn(columnNames);
|
|
|
+
|
|
|
allColumn.add(1,StatsColumn.of("输注总数","输注总数"));
|
|
|
allColumn.add(2,StatsColumn.of("提示总数","提示总数"));
|
|
|
List<Map<String, Object>> contents = new ArrayList<>();
|
|
|
@@ -215,28 +255,42 @@ public class AlarmStatsAnalyse implements CommonStats<CombineAlarmResult> {
|
|
|
contentValues.put("时间",timeRange);
|
|
|
contentValues.put("输注总数",totalResult.getInfusionCount());
|
|
|
contentValues.put("提示总数",total);
|
|
|
- contentValues.put("堵塞",totalResult.getJam().getValue());
|
|
|
- contentValues.put("极限",totalResult.getLimit().getValue());
|
|
|
- contentValues.put("未装药盒",totalResult.getNoBox().getValue());
|
|
|
- contentValues.put("电机失控",totalResult.getOutOfControl().getValue());
|
|
|
+ contentValues.put( DeviceAlarmEnum.Jam.getText(),totalResult.getJam().getValue());
|
|
|
+ contentValues.put( DeviceAlarmEnum.Limit.getText(),totalResult.getLimit().getValue());
|
|
|
+ contentValues.put(DeviceAlarmEnum.NotBox.getText(),totalResult.getNoBox().getValue());
|
|
|
+ contentValues.put(DeviceAlarmEnum.OutOfControl.getText(),totalResult.getOutOfControl().getValue());
|
|
|
contentValues.put("镇痛不足",totalResult.getAnalgesicPoor().getValue());
|
|
|
contentValues.put("不在服务区",totalResult.getNoSignal().getValue());
|
|
|
- contentValues.put("机械故障",totalResult.getMachine().getValue());
|
|
|
- contentValues.put("电量耗尽",totalResult.getLowBattery().getValue());
|
|
|
- contentValues.put("气泡无液",totalResult.getBubble().getValue());
|
|
|
- contentValues.put("低输注",totalResult.getLowInfusion().getValue());
|
|
|
- contentValues.put("输入总量报警",totalResult.getInfusionMax().getValue());
|
|
|
- contentValues.put("堵塞比率",computeRatio(BigDecimal.valueOf(totalResult.getJam().getValue()),total));
|
|
|
- contentValues.put("极限比率",computeRatio(BigDecimal.valueOf(totalResult.getLimit().getValue()),total));
|
|
|
- contentValues.put("未装药盒比率",computeRatio(BigDecimal.valueOf(totalResult.getNoBox().getValue()),total));
|
|
|
- contentValues.put("电机失控比率",computeRatio(BigDecimal.valueOf(totalResult.getOutOfControl().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.Machine.getText(),totalResult.getMachine().getValue());
|
|
|
+ contentValues.put("低电量",totalResult.getLowBattery().getValue());
|
|
|
+ contentValues.put(DeviceAlarmEnum.Bubble.getText(),totalResult.getBubble().getValue());
|
|
|
+ contentValues.put(DeviceAlarmEnum.InfusionMax.getText(),totalResult.getInfusionMax().getValue());
|
|
|
+
|
|
|
+ contentValues.put(DeviceAlarmEnum.Jam.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getJam().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.Limit.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getLimit().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.NotBox.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getNoBox().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.OutOfControl.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getOutOfControl().getValue()),total));
|
|
|
contentValues.put("镇痛不足比率",computeRatio(BigDecimal.valueOf(totalResult.getAnalgesicPoor().getValue()),total));
|
|
|
contentValues.put("不在服务区比率",computeRatio(BigDecimal.valueOf(totalResult.getNoSignal().getValue()),total));
|
|
|
- contentValues.put("机械故障比率",computeRatio(BigDecimal.valueOf(totalResult.getMachine().getValue()),total));
|
|
|
- contentValues.put("电量耗尽比率",computeRatio(BigDecimal.valueOf(totalResult.getLowBattery().getValue()),total));
|
|
|
- contentValues.put("气泡无液比率",computeRatio(BigDecimal.valueOf(totalResult.getBubble().getValue()),total));
|
|
|
- contentValues.put("低输注比率",computeRatio(BigDecimal.valueOf(totalResult.getLowInfusion().getValue()),total));
|
|
|
- contentValues.put("输入总量报警比率",computeRatio(BigDecimal.valueOf(totalResult.getInfusionMax().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.Machine.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getMachine().getValue()),total));
|
|
|
+ contentValues.put("低电量比率",computeRatio(BigDecimal.valueOf(totalResult.getLowBattery().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.Bubble.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getBubble().getValue()),total));
|
|
|
+ contentValues.put(DeviceAlarmEnum.InfusionMax.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getInfusionMax().getValue()),total));
|
|
|
+
|
|
|
+ //智能泵专属
|
|
|
+ contentValues.put( FlowStatusEnum.Up.getText(),totalResult.getFlowUp().getValue());
|
|
|
+ contentValues.put( FlowStatusEnum.Down.getText(),totalResult.getFlowDown().getValue());
|
|
|
+ contentValues.put(FlowStatusEnum.Limited.getText(),totalResult.getFlowLimited().getValue());
|
|
|
+ contentValues.put(FlowStatusEnum.MaxFlow.getText(),totalResult.getFlowMax().getValue());
|
|
|
+ contentValues.put(FlowStatusEnum.Lowest.getText(),totalResult.getLowInfusion().getValue());
|
|
|
+
|
|
|
+ contentValues.put( FlowStatusEnum.Up.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getFlowUp().getValue()),total));
|
|
|
+ contentValues.put( FlowStatusEnum.Down.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getFlowDown().getValue()),total));
|
|
|
+ contentValues.put(FlowStatusEnum.Limited.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getFlowLimited().getValue()),total));
|
|
|
+ contentValues.put(FlowStatusEnum.MaxFlow.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getFlowMax().getValue()),total));
|
|
|
+ contentValues.put(FlowStatusEnum.Lowest.getText()+"比率",computeRatio(BigDecimal.valueOf(totalResult.getLowInfusion().getValue()),total));
|
|
|
+
|
|
|
+
|
|
|
contents.add(contentValues);
|
|
|
});
|
|
|
return Arrays.asList(result);
|