|
|
@@ -55,33 +55,37 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
public boolean save(BusDeviceAlarmEntity entity) {
|
|
|
log.info("新增报警信息【{}】", JSONUtil.toJsonStr(entity));
|
|
|
BusInfusionHistoryEntity infusionHistoryEntity = infusionHistoryService.getById(entity.getInfusionId());
|
|
|
- if(entity.getDeviceType()==null){
|
|
|
- entity.setDeviceType(infusionHistoryEntity.getType());
|
|
|
- }
|
|
|
- if(entity.getAlarmState()==null
|
|
|
- || ObjectUtil.equal(entity.getAlarmState(),infusionHistoryEntity.getAlarm())){
|
|
|
- entity.setAlarmState(DeviceAlarmEnum.None);
|
|
|
- }
|
|
|
- if(entity.getWarnAnalgesicPoor()==null
|
|
|
- || ObjectUtil.equal(entity.getWarnAnalgesicPoor(),infusionHistoryEntity.getWarnAnalgesicPoor())){
|
|
|
- entity.setWarnAnalgesicPoor(false);
|
|
|
- }
|
|
|
- if(entity.getWarnFlow()==null
|
|
|
- || ObjectUtil.equal(entity.getWarnFlow(),infusionHistoryEntity.getWarnFlow())){
|
|
|
- entity.setWarnFlow(FlowStatusEnum.None);
|
|
|
- }
|
|
|
- if(entity.getWarnWillFinished()==null
|
|
|
- || ObjectUtil.equal(entity.getWarnWillFinished(),infusionHistoryEntity.getWarnWillFinished())){
|
|
|
- entity.setWarnWillFinished(false);
|
|
|
- }
|
|
|
- if(entity.getWarnLowBattery()==null
|
|
|
- || ObjectUtil.equal(entity.getWarnLowBattery(),infusionHistoryEntity.getWarnLowBattery())){
|
|
|
- entity.setWarnLowBattery(false);
|
|
|
- }
|
|
|
- if(entity.getWarnAnalgesicPoor()==null
|
|
|
- || ObjectUtil.equal(entity.getWarnAnalgesicPoor(),infusionHistoryEntity.getWarnAnalgesicPoor())){
|
|
|
- entity.setWarnAnalgesicPoor(false);
|
|
|
+ if(infusionHistoryEntity!=null){
|
|
|
+ //没有输注信息即此刻事务还未完成,则认为该信息为第一次报警信息,无需再次判断
|
|
|
+ if(entity.getDeviceType()==null){
|
|
|
+ entity.setDeviceType(infusionHistoryEntity.getType());
|
|
|
+ }
|
|
|
+ if(entity.getAlarmState()==null
|
|
|
+ || ObjectUtil.equal(entity.getAlarmState(),infusionHistoryEntity.getAlarm())){
|
|
|
+ entity.setAlarmState(DeviceAlarmEnum.None);
|
|
|
+ }
|
|
|
+ if(entity.getWarnAnalgesicPoor()==null
|
|
|
+ || ObjectUtil.equal(entity.getWarnAnalgesicPoor(),infusionHistoryEntity.getWarnAnalgesicPoor())){
|
|
|
+ entity.setWarnAnalgesicPoor(false);
|
|
|
+ }
|
|
|
+ if(entity.getWarnFlow()==null
|
|
|
+ || ObjectUtil.equal(entity.getWarnFlow(),infusionHistoryEntity.getWarnFlow())){
|
|
|
+ entity.setWarnFlow(FlowStatusEnum.None);
|
|
|
+ }
|
|
|
+ if(entity.getWarnWillFinished()==null
|
|
|
+ || ObjectUtil.equal(entity.getWarnWillFinished(),infusionHistoryEntity.getWarnWillFinished())){
|
|
|
+ entity.setWarnWillFinished(false);
|
|
|
+ }
|
|
|
+ if(entity.getWarnLowBattery()==null
|
|
|
+ || ObjectUtil.equal(entity.getWarnLowBattery(),infusionHistoryEntity.getWarnLowBattery())){
|
|
|
+ entity.setWarnLowBattery(false);
|
|
|
+ }
|
|
|
+ if(entity.getWarnAnalgesicPoor()==null
|
|
|
+ || ObjectUtil.equal(entity.getWarnAnalgesicPoor(),infusionHistoryEntity.getWarnAnalgesicPoor())){
|
|
|
+ entity.setWarnAnalgesicPoor(false);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if(!entity.alarmOrWarn()){
|
|
|
//无警报信息,存储失败
|
|
|
return false;
|