|
@@ -12,6 +12,7 @@ import com.coffee.bus.mapper.BusDeviceAlarmMapper;
|
|
|
import com.coffee.bus.mapper.BusHospitalMapper;
|
|
import com.coffee.bus.mapper.BusHospitalMapper;
|
|
|
import com.coffee.bus.service.dto.AlarmQuery;
|
|
import com.coffee.bus.service.dto.AlarmQuery;
|
|
|
import com.coffee.bus.service.dto.DeviceAlarmQuery;
|
|
import com.coffee.bus.service.dto.DeviceAlarmQuery;
|
|
|
|
|
+import com.coffee.bus.service.dto.DeviceAlarmResult;
|
|
|
import com.coffee.bus.service.dto.DeviceUse;
|
|
import com.coffee.bus.service.dto.DeviceUse;
|
|
|
import com.coffee.common.crud.BaseService;
|
|
import com.coffee.common.crud.BaseService;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -85,40 +86,32 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
List<BusHospitalEntity> hospitalEntities = hospitalMapper.selectList(busHospitalEntityQueryWrapper);
|
|
List<BusHospitalEntity> hospitalEntities = hospitalMapper.selectList(busHospitalEntityQueryWrapper);
|
|
|
List<DeviceUse> deviceUseList = new ArrayList<>();
|
|
List<DeviceUse> deviceUseList = new ArrayList<>();
|
|
|
|
|
|
|
|
- for (BusHospitalEntity hospital:
|
|
|
|
|
- hospitalEntities) {
|
|
|
|
|
- DeviceUse deviceUse = new DeviceUse();
|
|
|
|
|
- Map<String, Integer> deviceAlarms = new HashMap<>();
|
|
|
|
|
-
|
|
|
|
|
- deviceUse.setName(hospital.getName());
|
|
|
|
|
- deviceUse.setAddress(hospital.getAddress());
|
|
|
|
|
- deviceUse.setDeviceAlarms(deviceAlarms);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 获取 报警所有信息数量
|
|
|
|
|
+ List<DeviceAlarmResult> alarmResults = busDeviceAlarmMapper.selectAlarmCount(query);
|
|
|
|
|
|
|
|
- query.setTenantId(hospital.getId());
|
|
|
|
|
|
|
+ Map<String,List<DeviceAlarmResult>> alarmMap= new HashMap<>();
|
|
|
|
|
|
|
|
- for (DeviceAlarmEnum alarmEnum:
|
|
|
|
|
- DeviceAlarmEnum.values()) {
|
|
|
|
|
- query.setAlarmState(alarmEnum.getValue());
|
|
|
|
|
- deviceAlarms.put(alarmEnum.getText(),busDeviceAlarmMapper.selectAlarmCount(query));
|
|
|
|
|
|
|
+ for (DeviceAlarmResult deviceAlarmResult : alarmResults
|
|
|
|
|
+ ) {
|
|
|
|
|
+ List<DeviceAlarmResult> list = alarmMap.get(deviceAlarmResult.getTenantId());
|
|
|
|
|
+ if(list == null){
|
|
|
|
|
+ list = new ArrayList<>();
|
|
|
}
|
|
}
|
|
|
- query.setAlarmState(null);
|
|
|
|
|
- /*输注即将结束提醒*/
|
|
|
|
|
- query.setWarnWillFinished(1);
|
|
|
|
|
- deviceAlarms.put("warnWillFinished",busDeviceAlarmMapper.selectAlarmCount(query));
|
|
|
|
|
- query.setWarnWillFinished(null);
|
|
|
|
|
- /*镇痛不足提醒*/
|
|
|
|
|
- query.setWarnAnalgesicPoor(1);
|
|
|
|
|
- deviceAlarms.put("warnAnalgesicPoor",busDeviceAlarmMapper.selectAlarmCount(query));
|
|
|
|
|
- query.setWarnAnalgesicPoor(null);
|
|
|
|
|
- /*电量偏低提醒*/
|
|
|
|
|
- query.setWarnWillFinished(1);
|
|
|
|
|
- deviceAlarms.put("warnLowBattery",busDeviceAlarmMapper.selectAlarmCount(query));
|
|
|
|
|
- query.setWarnWillFinished(null);
|
|
|
|
|
|
|
+ list.add(deviceAlarmResult);
|
|
|
|
|
+ alarmMap.put(deviceAlarmResult.getTenantId(),list);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 遍历医院
|
|
|
|
|
+ for (BusHospitalEntity hospital:hospitalEntities
|
|
|
|
|
+ ) {
|
|
|
|
|
+ DeviceUse deviceUse = new DeviceUse();
|
|
|
|
|
+ deviceUse.setAddress(hospital.getAddress());
|
|
|
|
|
+ deviceUse.setName(hospital.getName());
|
|
|
|
|
+ deviceUse.setList(alarmMap.get(hospital.getId()));
|
|
|
deviceUseList.add(deviceUse);
|
|
deviceUseList.add(deviceUse);
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
return deviceUseList;
|
|
return deviceUseList;
|
|
|
|
|
|
|
|
}
|
|
}
|