|
|
@@ -77,10 +77,18 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public List<DeviceUse> selectCountAlarm(DeviceAlarmQuery query){
|
|
|
QueryWrapper<BusHospitalEntity> busHospitalEntityQueryWrapper = new QueryWrapper<>();
|
|
|
+ if(busHospitalEntityQueryWrapper.getEntity() == null) {
|
|
|
+ BusHospitalEntity hospitalEntity = new BusHospitalEntity();
|
|
|
+ busHospitalEntityQueryWrapper.setEntity(hospitalEntity);
|
|
|
+ }
|
|
|
if(query.getHositalName()!=null){
|
|
|
busHospitalEntityQueryWrapper.getEntity().setName(query.getHositalName());
|
|
|
}
|
|
|
+ if(query.getTenantId()!=null){
|
|
|
+ busHospitalEntityQueryWrapper.getEntity().setId(query.getTenantId());
|
|
|
+ }
|
|
|
List<BusHospitalEntity> hospitalEntities = hospitalMapper.selectList(busHospitalEntityQueryWrapper);
|
|
|
+
|
|
|
List<DeviceUse> deviceUseList = new ArrayList<>();
|
|
|
|
|
|
// 获取 报警所有信息数量
|
|
|
@@ -93,10 +101,18 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
Map<String, String> map = alarmMap.get(deviceAlarmResult.getTenantId());
|
|
|
if(map == null){
|
|
|
map = new HashMap<>();
|
|
|
+ for (DeviceAlarmEnum deviceAlarmEnum:
|
|
|
+ DeviceAlarmEnum.values()) {
|
|
|
+ map.put(deviceAlarmEnum.toString(),"0");
|
|
|
+ }
|
|
|
}
|
|
|
- map.put(deviceAlarmResult.toString(),deviceAlarmResult.getAlarmCount());
|
|
|
+ map.put(deviceAlarmResult.getAlarmState().toString(),deviceAlarmResult.getAlarmCount());
|
|
|
alarmMap.put(deviceAlarmResult.getTenantId(),map);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 获取告警信息
|
|
|
List<DeviceWarnCountResult> warnResults = busDeviceAlarmMapper.selectWarnCount(query);
|
|
|
//处理告警信息
|
|
|
@@ -105,6 +121,10 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
Map<String, String> map = alarmMap.get(deviceWarnCountResult.getTenantId());
|
|
|
if(map == null){
|
|
|
map = new HashMap<>();
|
|
|
+ for (DeviceAlarmEnum deviceAlarmEnum:
|
|
|
+ DeviceAlarmEnum.values()) {
|
|
|
+ map.put(deviceAlarmEnum.toString(),"0");
|
|
|
+ }
|
|
|
}
|
|
|
map.put("warnWillFinished",deviceWarnCountResult.getWarnWillFinished());
|
|
|
map.put("warnLowBattery",deviceWarnCountResult.getWarnLowBattery());
|
|
|
@@ -113,13 +133,27 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
|
|
|
alarmMap.put(deviceWarnCountResult.getTenantId(),map);
|
|
|
}
|
|
|
- System.out.println("++"+alarmMap.get(1));
|
|
|
+
|
|
|
// 遍历医院
|
|
|
for (BusHospitalEntity hospital:hospitalEntities
|
|
|
) {
|
|
|
DeviceUse deviceUse = new DeviceUse();
|
|
|
+ deviceUse.setTenantId(hospital.getId());
|
|
|
deviceUse.setAddress(hospital.getAddress());
|
|
|
deviceUse.setName(hospital.getName());
|
|
|
+ Map<String, String> map = alarmMap.get(hospital.getId());
|
|
|
+ if (map == null){
|
|
|
+ map = new HashMap<>();
|
|
|
+ for (DeviceAlarmEnum deviceAlarmEnum:
|
|
|
+ DeviceAlarmEnum.values()) {
|
|
|
+ map.put(deviceAlarmEnum.toString(),"0");
|
|
|
+ }
|
|
|
+ map.put("warnWillFinished","0");
|
|
|
+ map.put("warnLowBattery","0");
|
|
|
+ map.put("warnAnalgesicPoor","0");
|
|
|
+
|
|
|
+ }
|
|
|
+ deviceUse.setMap(map);
|
|
|
deviceUseList.add(deviceUse);
|
|
|
}
|
|
|
|