|
|
@@ -0,0 +1,121 @@
|
|
|
+package cn.tr.module.smart.web.dto;
|
|
|
+
|
|
|
+import cn.hutool.core.text.CharSequenceUtil;
|
|
|
+import cn.hutool.core.util.EnumUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.tr.module.smart.common.enums.FlowStatusEnum;
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
+import io.swagger.annotations.ApiModel;
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
+import lombok.Data;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author wangzl
|
|
|
+ * @description: TODO
|
|
|
+ * @date 2025/8/11 8:01
|
|
|
+ */
|
|
|
+
|
|
|
+@Data
|
|
|
+@ApiModel("泵表报警信息")
|
|
|
+public class BizDeviceAlarmInfoDTO {
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "泵id", position = 1)
|
|
|
+ private String deviceId;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "输注记录id", position = 2)
|
|
|
+ private String infusionId;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "上传时间", position = 3)
|
|
|
+ private Date uploadTime;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "是否报警", position = 4)
|
|
|
+ private Boolean alarm;
|
|
|
+
|
|
|
+ @ApiModelProperty("设备报警状态")
|
|
|
+ private String alarmState;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "报警信息", position = 5)
|
|
|
+ private String warns;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "输注即将结束提醒", position = 6, hidden = true)
|
|
|
+ @JsonIgnore
|
|
|
+ private Boolean warnWillFinished;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "镇痛不足提醒", position = 7, hidden = true)
|
|
|
+ @JsonIgnore
|
|
|
+ private Boolean warnAnalgesicPoor;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "电量偏低提醒", position = 8, hidden = true)
|
|
|
+ @JsonIgnore
|
|
|
+ private Boolean warnLowBattery;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "加减档提示", position = 9, hidden = true)
|
|
|
+ @JsonIgnore
|
|
|
+ private String warnFlow;
|
|
|
+
|
|
|
+ private void judgeWarnWillFinished() {
|
|
|
+ if (!Boolean.TRUE.equals(this.warnWillFinished)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (CharSequenceUtil.isEmpty(this.warns)) {
|
|
|
+ this.warns = "输注即将结束;";
|
|
|
+ } else {
|
|
|
+ this.warns = this.warns + "输注即将结束;";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void judgeWarnAnalgesicPoor() {
|
|
|
+ if (!Boolean.TRUE.equals(this.warnAnalgesicPoor)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (CharSequenceUtil.isEmpty(this.warns)) {
|
|
|
+ this.warns = "镇痛不足;";
|
|
|
+ } else {
|
|
|
+ this.warns = this.warns + "镇痛不足;";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void judgeWarnLowBattery() {
|
|
|
+ if (!Boolean.TRUE.equals(this.warnLowBattery)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (CharSequenceUtil.isEmpty(this.warns)) {
|
|
|
+ this.warns = "电量偏低;";
|
|
|
+ } else {
|
|
|
+ this.warns = this.warns + "电量偏低;";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void judgeWarnFlow() {
|
|
|
+ if (this.warnFlow == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ FlowStatusEnum flow = EnumUtil.likeValueOf(FlowStatusEnum.class, this.warns);
|
|
|
+ if (ObjectUtil.isNull(flow)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (CharSequenceUtil.isEmpty(this.warns)) {
|
|
|
+ this.warns = flow.getText() + ";";
|
|
|
+ } else {
|
|
|
+ this.warns = this.warns + flow.getText() + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void handleWarn() {
|
|
|
+ judgeWarnAnalgesicPoor();
|
|
|
+ judgeWarnFlow();
|
|
|
+ judgeWarnLowBattery();
|
|
|
+ judgeWarnWillFinished();
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getWarns() {
|
|
|
+ handleWarn();
|
|
|
+ if (StrUtil.isNotEmpty(warns)) {
|
|
|
+ return warns.endsWith(";") ? warns.substring(0, warns.length() - 1) : warns;
|
|
|
+ }
|
|
|
+ return warns;
|
|
|
+ }
|
|
|
+}
|