package com.coffee.bus.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.coffee.aliyun.utils.*; import com.coffee.bus.entity.common.CommonDeviceParam; import com.coffee.bus.enums.DeviceStatusEnum; import com.coffee.bus.enums.DeviceTypeEnum; import com.coffee.common.enums.SexEnum; import com.fasterxml.jackson.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; import java.math.BigDecimal; import java.util.Date; import java.util.Optional; /** * @Author lifang * @Date 16:02 2022/4/8 * @Description * @Param * @return **/ @ToString @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) @TableName(value = "bus_device_running",autoResultMap = true) @ApiModel(value="设备运行状态", description="设备运行状态") public class BusDeviceRunningEntity extends CommonDeviceParam { @ApiModelProperty(value = "输注记录") private String infusionId; @ApiModelProperty(value = "临床号") private String clinicId; /***************临床固定数据*****************/ @ApiModelProperty(value = "病人名称") private String patientName; @ApiModelProperty(value = "病人性别") private SexEnum patientSex; /***************临床固定数据*****************/ @ApiModelProperty(value = "设备别名") private String alias; @ApiModelProperty(value = "输注开始时间,即本次运行开机时间",accessMode = ApiModelProperty.AccessMode.READ_ONLY) private Date startTime; @ApiModelProperty(value = "是否已撤泵,0、未撤泵1、已撤泵") @JsonIgnoreProperties(allowSetters = true) private Boolean isUndo; @ApiModelProperty(value = "备注") private String remark; @ApiModelProperty(value = "监护类型,1、有泵监护 0、无泵监护") @JsonIgnoreProperties private Boolean monitorType; @ApiModelProperty(value = "是否为主泵数据, 0、副泵 1、主泵(即当前临床绑定的泵)") @JsonIgnoreProperties(allowSetters = true) private Boolean master; @ApiModelProperty(value = "数据上传时间",accessMode = ApiModelProperty.AccessMode.READ_ONLY,hidden = true) @JsonIgnoreProperties(allowSetters = true) private Date uploadTime; /** * 当前运行状态所绑定的输注修改记录id,只在设备上传解析过程中使用,其他地方无用处 */ @TableField(exist = false) @JsonIgnoreProperties private String infusionModifyId; /** * 当前运行状态所绑定的历史记录id,只在设备上传解析过程中使用,其他地方无用处 */ @TableField(exist = false) @JsonIgnoreProperties private String historyId; @TableField(exist = false) @JsonIgnoreProperties private Date modifyTime; /** * 当前运行状态是否开启了新的输注,只在设备上传解析过程中使用,其他地方无用处 */ @TableField(exist = false) @JsonIgnoreProperties private boolean newInfusion; /** * 当前运行状态输注信息是否发生了变化,只在设备上传解析过程中使用,其他地方无用处 */ @TableField(exist = false) @JsonIgnoreProperties private boolean infusionModify; /** *当设备输注过程已撤泵被重新开启时,只在设备上传解析过程中使用,其他地方无用处 */ @TableField(exist = false) @JsonIgnoreProperties private boolean resetUndo; /** * 患者id */ @TableField(exist = false) @JsonIgnoreProperties private String patientId; /** * 重新开启临床信息 */ @TableField(exist = false) @JsonIgnoreProperties private boolean resetClinic; /** * 格式化之后的住院号 */ @TableField(exist = false) @JsonIgnoreProperties private String formatPatientCode; /** * @author 龙三郎 * 根据阿里云传回数据的items,设置输注的属性 * @param deviceName * @param items */ public void updateFieldsByItems(String deviceName, Items items) { // 属性上传时间 this.setUploadTime(items.getDate()); this.setDeviceId(deviceName); this.setClassification( items.getString(PumpParams.classification)); this.setDataNumber(items.getInteger(PumpParams.dataNumber)); this.setPatientCode( items.getString(PumpParams.patientCode)); this.setWard(items.getString(PumpParams.ward)); this.setBedNo(items.getString(PumpParams.bedNo)); this.setTotalDose( items.getInteger(PumpParams.totalDose)); this.setInputDose(items.getBigDecimal(PumpParams.finishedDose)); this.setRemainDose(BigDecimal.valueOf(this.getTotalDose()).subtract(this.getInputDose())); this.setFirstDose( items.getInteger(PumpParams.firstDosis)); this.setMaxDose(items.getBigDecimal(PumpParams.maxDose)); this.setAppendDose(items.getBigDecimal(PumpParams.singleDosis)); this.setAppendLockTime(items.getBigDecimal(PumpParams.lockTime)); this.setContinueDose(items.getBigDecimal(PumpParams.flow)); this.setType( DeviceTypeUtils.getDeviceType(items.getInteger(PumpParams.pumpType))); this.setPcaValidCount(items.getInteger(PumpParams.pcaValid)); this.setPcaInvalidCount(items.getInteger(PumpParams.pcaInvalid)); this.setPcaTotalCount(this.getPcaInvalidCount()+this.getPcaValidCount()); this.setElectricQuantity(items.getInteger(PumpParams.electricQuantity)); this.setRunState(DeviceRunStatusUtils.getRunStatus(items.getInteger(PumpParams.runStatus))); this.setAlarm(DeviceAlarmUtils.getAlarm(Optional.ofNullable(items.getInteger(PumpParams.alarmStatus)).orElse(0))); // 预报 // 镇痛不足预报 this.setWarnAnalgesicPoor(Optional.ofNullable(items.getBoolean(PumpParams.warnAnalgesicPoor)).orElse(false)); // 电量偏低预报 this.setWarnLowBattery(Optional.ofNullable(items.getBoolean(PumpParams.warnLowBattery)).orElse(false)); // 输液将结束预报 this.setWarnWillFinished(Optional.ofNullable(items.getBoolean(PumpParams.warnWillFinished)).orElse(false)); // 设置脉冲泵参数 if (this.getType() == DeviceTypeEnum.pulse){ // 脉冲锁时 this.setPulseLockTime(items.getInteger(PumpParams.pulseLockTime)); // 首次锁时 this.setPulseFirstLockTime(items.getInteger(PumpParams.firstLockTime)); // 脉冲量 this.setPulseDose(items.getInteger(PumpParams.pulseDose)); }else if (this.getType() == DeviceTypeEnum.intelligent){ // 设置智能泵参数 // 重设参数标识 // 减档时间 this.setFlowDownCycle(items.getBigDecimal(PumpParams.flowDownTime)); // 加档时间 this.setFlowUpCycle(items.getBigDecimal(PumpParams.flowUpTime)); // 触发加档pca有效次数 this.setFlowCount(items.getBigDecimal(PumpParams.flowUpPcaValid)); // 加减档百分比 this.setFlowAdjustRate(items.getBigDecimal(PumpParams.flowAdjuseRate)); // 减档下限 this.setFlowDownLimit(items.getBigDecimal(PumpParams.minFlow)); // 加档上限 this.setFlowUpLimit(items.getBigDecimal(PumpParams.maxFlow)); // 加减档预报 this.setWarnFlow(WarnFlowUtils.getAlarm(items.getInteger(PumpParams.warnFlow))); } } }