|
@@ -1,11 +1,19 @@
|
|
|
package com.coffee.bus.entity;
|
|
package com.coffee.bus.entity;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.crypto.asymmetric.Sign;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
|
|
|
|
+import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
|
|
|
+import com.coffee.bus.entity.common.CommonDeviceParam;
|
|
|
import com.coffee.bus.enums.DeviceAlarmEnum;
|
|
import com.coffee.bus.enums.DeviceAlarmEnum;
|
|
|
|
|
+import com.coffee.bus.enums.DeviceStatusEnum;
|
|
|
|
|
+import com.coffee.bus.enums.FlowStatusEnum;
|
|
|
import com.coffee.common.entity.TenantGenericEntity;
|
|
import com.coffee.common.entity.TenantGenericEntity;
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
import io.swagger.annotations.ApiModel;
|
|
import io.swagger.annotations.ApiModel;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
|
+import jdk.nashorn.internal.ir.EmptyNode;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
import lombok.EqualsAndHashCode;
|
|
|
import lombok.ToString;
|
|
import lombok.ToString;
|
|
@@ -28,23 +36,15 @@ public class BusDeviceAlarmEntity extends TenantGenericEntity<String,String> {
|
|
|
@ApiModelProperty(value = "设备唯一编码",readOnly = true)
|
|
@ApiModelProperty(value = "设备唯一编码",readOnly = true)
|
|
|
private String deviceId;
|
|
private String deviceId;
|
|
|
|
|
|
|
|
- @ApiModelProperty(value = "报警信息")
|
|
|
|
|
- private DeviceAlarmEnum alarm;
|
|
|
|
|
-
|
|
|
|
|
@ApiModelProperty(value = "报警时间")
|
|
@ApiModelProperty(value = "报警时间")
|
|
|
- private Date alarmTime;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private Date uploadTime;
|
|
|
|
|
|
|
|
@ApiModelProperty(value = "报警原因")
|
|
@ApiModelProperty(value = "报警原因")
|
|
|
private String cause;
|
|
private String cause;
|
|
|
|
|
|
|
|
- @ApiModelProperty(value = "报警是否正在进行",hidden = true)
|
|
|
|
|
- @JsonIgnoreProperties(allowSetters = true)
|
|
|
|
|
- private Boolean doing;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @ApiModelProperty(value = "是否已处理 0、未处理,1、已处理,暂未使用")
|
|
|
|
|
- private Boolean dealing;
|
|
|
|
|
|
|
+ @ApiModelProperty(value = "是否为报警信息",hidden = true)
|
|
|
|
|
+ @JsonIgnoreProperties
|
|
|
|
|
+ private Boolean alarm;
|
|
|
|
|
|
|
|
@ApiModelProperty(value = "报警记录所绑定的历史记录id,后续用于更新操作",hidden = true)
|
|
@ApiModelProperty(value = "报警记录所绑定的历史记录id,后续用于更新操作",hidden = true)
|
|
|
@JsonIgnoreProperties(allowSetters = true)
|
|
@JsonIgnoreProperties(allowSetters = true)
|
|
@@ -53,20 +53,95 @@ public class BusDeviceAlarmEntity extends TenantGenericEntity<String,String> {
|
|
|
@ApiModelProperty(value = "输注记录")
|
|
@ApiModelProperty(value = "输注记录")
|
|
|
private String infusionId;
|
|
private String infusionId;
|
|
|
|
|
|
|
|
|
|
+ @ApiModelProperty(value = "泵运行状态",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private DeviceStatusEnum runState;
|
|
|
|
|
|
|
|
- @ApiModelProperty(value = "设备标识",readOnly = true,hidden = true)
|
|
|
|
|
- @JsonIgnoreProperties(allowSetters = true)
|
|
|
|
|
- private String classification;
|
|
|
|
|
|
|
+ @ApiModelProperty(value = "报警信息",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private DeviceAlarmEnum alarmState;
|
|
|
|
|
+
|
|
|
|
|
+ @ApiModelProperty(value = "输注即将结束提醒",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private Boolean warnWillFinished;
|
|
|
|
|
+
|
|
|
|
|
+ @ApiModelProperty(value = "镇痛不足提醒",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private Boolean warnAnalgesicPoor;
|
|
|
|
|
+
|
|
|
|
|
+ @ApiModelProperty(value = "电量偏低提醒",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private Boolean warnLowBattery;
|
|
|
|
|
|
|
|
- public static BusDeviceAlarmEntity parseRunningInfo(BusDeviceHistoryEntity history){
|
|
|
|
|
|
|
+ @ApiModelProperty(value = "加减档提示",readOnly = true)
|
|
|
|
|
+ @TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
|
|
|
+ private FlowStatusEnum warnFlow;
|
|
|
|
|
+
|
|
|
|
|
+ public static BusDeviceAlarmEntity parseHistory(BusDeviceHistoryEntity history){
|
|
|
BusDeviceAlarmEntity entity = new BusDeviceAlarmEntity();
|
|
BusDeviceAlarmEntity entity = new BusDeviceAlarmEntity();
|
|
|
entity.setDeviceId(history.getDeviceId());
|
|
entity.setDeviceId(history.getDeviceId());
|
|
|
- entity.setAlarm(history.getAlarm());
|
|
|
|
|
- entity.setAlarmTime(history.getUploadTime());
|
|
|
|
|
|
|
+ entity.setUploadTime(history.getUploadTime());
|
|
|
|
|
+ if (history.getAlarm() != null && !DeviceAlarmEnum.None.equals(history.getAlarm())) {
|
|
|
|
|
+ entity.setAlarm(true);
|
|
|
|
|
+ }
|
|
|
entity.setHistoryId(history.getId());
|
|
entity.setHistoryId(history.getId());
|
|
|
entity.setInfusionId(history.getInfusionId());
|
|
entity.setInfusionId(history.getInfusionId());
|
|
|
- entity.setClassification(history.getClassification());
|
|
|
|
|
|
|
+ entity.setRunState(history.getRunState());
|
|
|
|
|
+ entity.setAlarmState(history.getAlarm());
|
|
|
|
|
+ entity.setWarnWillFinished(history.getWarnWillFinished());
|
|
|
|
|
+ entity.setWarnAnalgesicPoor(history.getWarnAnalgesicPoor());
|
|
|
|
|
+ entity.setWarnLowBattery(history.getWarnLowBattery());
|
|
|
|
|
+ entity.setWarnFlow(history.getWarnFlow());
|
|
|
entity.setTenantId(history.getTenantId());
|
|
entity.setTenantId(history.getTenantId());
|
|
|
return entity;
|
|
return entity;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public static BusDeviceAlarmEntity parseRunning(BusDeviceRunningEntity source){
|
|
|
|
|
+ BusDeviceAlarmEntity entity = new BusDeviceAlarmEntity();
|
|
|
|
|
+ entity.setDeviceId(source.getDeviceId());
|
|
|
|
|
+ entity.setUploadTime(source.getUploadTime());
|
|
|
|
|
+ if (source.getAlarm() != null && !DeviceAlarmEnum.None.equals(source.getAlarm())) {
|
|
|
|
|
+ entity.setAlarm(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.setHistoryId(source.getId());
|
|
|
|
|
+ entity.setInfusionId(source.getInfusionId());
|
|
|
|
|
+ entity.setRunState(source.getRunState());
|
|
|
|
|
+ entity.setAlarmState(source.getAlarm());
|
|
|
|
|
+ entity.setWarnWillFinished(source.getWarnWillFinished());
|
|
|
|
|
+ entity.setWarnAnalgesicPoor(source.getWarnAnalgesicPoor());
|
|
|
|
|
+ entity.setWarnLowBattery(source.getWarnLowBattery());
|
|
|
|
|
+ entity.setWarnFlow(source.getWarnFlow());
|
|
|
|
|
+ entity.setTenantId(source.getTenantId());
|
|
|
|
|
+ return entity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String signParm(Sign sign){
|
|
|
|
|
+ JSONObject param = new JSONObject(true);
|
|
|
|
|
+ param.putOpt("runState",String.valueOf(this.getRunState()));
|
|
|
|
|
+ param.putOpt("alarmState",String.valueOf(this.getAlarmState()));
|
|
|
|
|
+ param.putOpt("warnWillFinished",String.valueOf(this.getWarnWillFinished()));
|
|
|
|
|
+ param.putOpt("warnAnalgesicPoor",String.valueOf(this.getWarnAnalgesicPoor()));
|
|
|
|
|
+ param.putOpt("warnLowBattery",String.valueOf(this.getWarnLowBattery()));
|
|
|
|
|
+ param.putOpt("warnFlow",String.valueOf(this.getWarnFlow()));
|
|
|
|
|
+ return sign.signHex(param.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static boolean alarmOrWarn(CommonDeviceParam history){
|
|
|
|
|
+ if (history.getAlarm() != null && !DeviceAlarmEnum.None.equals(history.getAlarm())) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Boolean.TRUE.equals(history.getWarnAnalgesicPoor())) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Boolean.TRUE.equals(history.getWarnLowBattery())) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Boolean.TRUE.equals(history.getWarnWillFinished())) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (history.getWarnFlow()!=null) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|