BusDeviceRunningEntity.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. package com.coffee.bus.entity;
  2. import com.baomidou.mybatisplus.annotation.TableField;
  3. import com.baomidou.mybatisplus.annotation.TableName;
  4. import com.coffee.aliyun.utils.*;
  5. import com.coffee.bus.entity.common.CommonDeviceParam;
  6. import com.coffee.bus.enums.DeviceStatusEnum;
  7. import com.coffee.bus.enums.DeviceTypeEnum;
  8. import com.coffee.common.enums.SexEnum;
  9. import com.fasterxml.jackson.annotation.*;
  10. import io.swagger.annotations.ApiModel;
  11. import io.swagger.annotations.ApiModelProperty;
  12. import lombok.Data;
  13. import lombok.EqualsAndHashCode;
  14. import lombok.ToString;
  15. import lombok.experimental.Accessors;
  16. import java.math.BigDecimal;
  17. import java.util.Date;
  18. /**
  19. * @Author lifang
  20. * @Date 16:02 2022/4/8
  21. * @Description
  22. * @Param
  23. * @return
  24. **/
  25. @ToString
  26. @Data
  27. @EqualsAndHashCode(callSuper = true)
  28. @Accessors(chain = true)
  29. @TableName(value = "bus_device_running",autoResultMap = true)
  30. @ApiModel(value="设备运行状态", description="设备运行状态")
  31. public class BusDeviceRunningEntity extends CommonDeviceParam<String,String> {
  32. @ApiModelProperty(value = "输注记录")
  33. private String infusionId;
  34. @ApiModelProperty(value = "临床号")
  35. private String clinicId;
  36. /***************临床固定数据*****************/
  37. @ApiModelProperty(value = "病人名称")
  38. private String patientName;
  39. @ApiModelProperty(value = "病人性别")
  40. private SexEnum patientSex;
  41. /***************临床固定数据*****************/
  42. @ApiModelProperty(value = "设备别名")
  43. private String alias;
  44. @ApiModelProperty(value = "输注开始时间,即本次运行开机时间",readOnly = true)
  45. private Date startTime;
  46. @ApiModelProperty(value = "是否已撤泵,0、未撤泵1、已撤泵")
  47. @JsonIgnoreProperties(allowSetters = true)
  48. private Boolean isUndo;
  49. @ApiModelProperty(value = "备注")
  50. private String remark;
  51. @ApiModelProperty(value = "监护类型,1、有泵监护 0、无泵监护")
  52. @JsonIgnoreProperties
  53. private Boolean monitorType;
  54. @ApiModelProperty(value = "是否为主泵数据, 0、副泵 1、主泵(即当前临床绑定的泵)")
  55. @JsonIgnoreProperties(allowSetters = true)
  56. private Boolean master;
  57. @ApiModelProperty(value = "数据上传时间",readOnly = true,hidden = true)
  58. @JsonIgnoreProperties(allowSetters = true)
  59. private Date uploadTime;
  60. /**
  61. * 当前运行状态所绑定的输注修改记录id,只在设备上传解析过程中使用,其他地方无用处
  62. */
  63. @TableField(exist = false)
  64. @JsonIgnoreProperties
  65. private String infusionModifyId;
  66. @TableField(exist = false)
  67. @JsonIgnoreProperties
  68. private Date modifyTime;
  69. /**
  70. * 当前运行状态是否开启了新的输注,只在设备上传解析过程中使用,其他地方无用处
  71. */
  72. @TableField(exist = false)
  73. @JsonIgnoreProperties
  74. private boolean newInfusion;
  75. /**
  76. * @author 龙三郎
  77. * 根据阿里云传回数据的items,设置输注的属性
  78. * @param deviceName
  79. * @param items
  80. */
  81. public void setFiledsByItems(String deviceName, Items items) {
  82. // 属性上传时间
  83. this.setUploadTime(items.getDate());
  84. this.setDeviceId(deviceName);
  85. this.setClassification( items.getString(PumpParams.classification));
  86. this.setDataNumber(items.getInteger(PumpParams.dataNumber));
  87. this.setPatientCode( items.getString(PumpParams.patientCode));
  88. this.setWard(items.getString(PumpParams.ward));
  89. this.setBedNo(items.getString(PumpParams.bedNo));
  90. this.setTotalDose( items.getInteger(PumpParams.totalDose));
  91. this.setInputDose(items.getBigDecimal(PumpParams.finishedDose));
  92. this.setRemainDose(BigDecimal.valueOf(this.getTotalDose()).subtract(this.getInputDose()));
  93. this.setFirstDose( items.getInteger(PumpParams.firstDosis));
  94. this.setMaxDose(items.getBigDecimal(PumpParams.maxDose));
  95. this.setAppendDose(items.getBigDecimal(PumpParams.singleDosis));
  96. this.setAppendLockTime(items.getBigDecimal(PumpParams.lockTime));
  97. this.setContinueDose(items.getBigDecimal(PumpParams.flow));
  98. this.setType( DeviceTypeUtils.getDeviceType(items.getInteger(PumpParams.pumpType)));
  99. this.setPcaValidCount(items.getInteger(PumpParams.pcaValid));
  100. this.setPcaInvalidCount(items.getInteger(PumpParams.pcaInvalid));
  101. this.setPcaTotalCount(this.getPcaInvalidCount()+this.getPcaValidCount());
  102. this.setElectricQuantity(items.getInteger(PumpParams.electricQuantity));
  103. this.setRunState(DeviceRunStatusUtils.getRunStatus(items.getInteger(PumpParams.runStatus)));
  104. this.setAlarm(DeviceAlarmUtils.getAlarm(items.getInteger(PumpParams.alarmStatus)));
  105. // 预报
  106. }
  107. /**
  108. * 描述: 开机处理,将无效参数置为空
  109. * @author lifang
  110. * @date 2022/5/14 10:51
  111. * @param
  112. * @return void
  113. */
  114. public BusDeviceRunningEntity startUpHandle(){
  115. if (DeviceStatusEnum.StartUp.equals(this.getRunState())&& DeviceTypeEnum.continuous.equals(this.getType())) {
  116. return this;
  117. }
  118. BusDeviceRunningEntity runningEntity = new BusDeviceRunningEntity();
  119. runningEntity.setId(this.getId());
  120. runningEntity.setAlias(this.getAlias());
  121. runningEntity.setDeviceId(this.getDeviceId());
  122. runningEntity.setRunState(this.getRunState());
  123. runningEntity.setClassification(this.getClassification());
  124. runningEntity.setDataNumber(this.getDataNumber());
  125. runningEntity.setType(this.getType());
  126. runningEntity.setMonitorType(this.getMonitorType());
  127. runningEntity.setUploadTime(this.getUploadTime());
  128. // runningEntity.setInfusionModifyId(this.getInfusionModifyId());
  129. // f
  130. // runningEntity.setRemark(this.getRemark());
  131. // runningEntity.setStartTime(this.getStartTime());
  132. // runningEntity.setClinicId(this.getClinicId());
  133. return runningEntity;
  134. }
  135. }