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; /** * @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 = "输注开始时间,即本次运行开机时间",readOnly = true) 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 = "数据上传时间",readOnly = true,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; /** * 患者id */ @TableField(exist = false) @JsonIgnoreProperties private String patientId; /** * 重新开启临床信息 */ @TableField(exist = false) @JsonIgnoreProperties private boolean resetClinic; /** * @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(items.getInteger(PumpParams.alarmStatus))); // 预报 // 镇痛不足预报 this.setWarnAnalgesicPoor(items.getBoolean(PumpParams.warnAnalgesicPoor)); // 电量偏低预报 this.setWarnLowBattery(items.getBoolean(PumpParams.warnLowBattery)); // 输液将结束预报 this.setWarnWillFinished(items.getBoolean(PumpParams.warnWillFinished)); } /** * 描述: 开机处理,将无效参数置为空 * @author lifang * @date 2022/5/14 10:51 * @param * @return void */ public BusDeviceRunningEntity startUpHandle(){ if (DeviceStatusEnum.StartUp.equals(this.getRunState())&& DeviceTypeEnum.continuous.equals(this.getType())) { return this; } BusDeviceRunningEntity result = new BusDeviceRunningEntity(); result.setId(this.getId()); result.setAlias(this.getAlias()); result.setDeviceId(this.getDeviceId()); result.setRunState(this.getRunState()); result.setClassification(this.getClassification()); result.setDataNumber(this.getDataNumber()); result.setType(this.getType()); result.setMonitorType(this.getMonitorType()); result.setUploadTime(this.getUploadTime()); // runningEntity.setInfusionModifyId(this.getInfusionModifyId()); // f // runningEntity.setRemark(this.getRemark()); // runningEntity.setStartTime(this.getStartTime()); // runningEntity.setClinicId(this.getClinicId()); return result; } }