BusDeviceRunningEntity.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. /**
  67. * 当前运行状态所绑定的历史记录id,只在设备上传解析过程中使用,其他地方无用处
  68. */
  69. @TableField(exist = false)
  70. @JsonIgnoreProperties
  71. private String historyId;
  72. @TableField(exist = false)
  73. @JsonIgnoreProperties
  74. private Date modifyTime;
  75. /**
  76. * 当前运行状态是否开启了新的输注,只在设备上传解析过程中使用,其他地方无用处
  77. */
  78. @TableField(exist = false)
  79. @JsonIgnoreProperties
  80. private boolean newInfusion;
  81. /**
  82. * 当前运行状态输注信息是否发生了变化,只在设备上传解析过程中使用,其他地方无用处
  83. */
  84. @TableField(exist = false)
  85. @JsonIgnoreProperties
  86. private boolean infusionModify;
  87. /**
  88. * 患者id
  89. */
  90. @TableField(exist = false)
  91. @JsonIgnoreProperties
  92. private String patientId;
  93. /**
  94. * 重新开启临床信息
  95. */
  96. @TableField(exist = false)
  97. @JsonIgnoreProperties
  98. private boolean resetClinic;
  99. /**
  100. * @author 龙三郎
  101. * 根据阿里云传回数据的items,设置输注的属性
  102. * @param deviceName
  103. * @param items
  104. */
  105. public void updateFieldsByItems(String deviceName, Items items) {
  106. // 属性上传时间
  107. this.setUploadTime(items.getDate());
  108. this.setDeviceId(deviceName);
  109. this.setClassification( items.getString(PumpParams.classification));
  110. this.setDataNumber(items.getInteger(PumpParams.dataNumber));
  111. this.setPatientCode( items.getString(PumpParams.patientCode));
  112. this.setWard(items.getString(PumpParams.ward));
  113. this.setBedNo(items.getString(PumpParams.bedNo));
  114. this.setTotalDose( items.getInteger(PumpParams.totalDose));
  115. this.setInputDose(items.getBigDecimal(PumpParams.finishedDose));
  116. this.setRemainDose(BigDecimal.valueOf(this.getTotalDose()).subtract(this.getInputDose()));
  117. this.setFirstDose( items.getInteger(PumpParams.firstDosis));
  118. this.setMaxDose(items.getBigDecimal(PumpParams.maxDose));
  119. this.setAppendDose(items.getBigDecimal(PumpParams.singleDosis));
  120. this.setAppendLockTime(items.getBigDecimal(PumpParams.lockTime));
  121. this.setContinueDose(items.getBigDecimal(PumpParams.flow));
  122. this.setType( DeviceTypeUtils.getDeviceType(items.getInteger(PumpParams.pumpType)));
  123. this.setPcaValidCount(items.getInteger(PumpParams.pcaValid));
  124. this.setPcaInvalidCount(items.getInteger(PumpParams.pcaInvalid));
  125. this.setPcaTotalCount(this.getPcaInvalidCount()+this.getPcaValidCount());
  126. this.setElectricQuantity(items.getInteger(PumpParams.electricQuantity));
  127. this.setRunState(DeviceRunStatusUtils.getRunStatus(items.getInteger(PumpParams.runStatus)));
  128. this.setAlarm(DeviceAlarmUtils.getAlarm(items.getInteger(PumpParams.alarmStatus)));
  129. // 预报
  130. // 镇痛不足预报
  131. this.setWarnAnalgesicPoor(items.getBoolean(PumpParams.warnAnalgesicPoor));
  132. // 电量偏低预报
  133. this.setWarnLowBattery(items.getBoolean(PumpParams.warnLowBattery));
  134. // 输液将结束预报
  135. this.setWarnWillFinished(items.getBoolean(PumpParams.warnWillFinished));
  136. }
  137. /**
  138. * 描述: 开机处理,将无效参数置为空
  139. * @author lifang
  140. * @date 2022/5/14 10:51
  141. * @param
  142. * @return void
  143. */
  144. public BusDeviceRunningEntity startUpHandle(){
  145. if (DeviceStatusEnum.StartUp.equals(this.getRunState())&& DeviceTypeEnum.continuous.equals(this.getType())) {
  146. return this;
  147. }
  148. BusDeviceRunningEntity result = new BusDeviceRunningEntity();
  149. result.setId(this.getId());
  150. result.setAlias(this.getAlias());
  151. result.setDeviceId(this.getDeviceId());
  152. result.setRunState(this.getRunState());
  153. result.setClassification(this.getClassification());
  154. result.setDataNumber(this.getDataNumber());
  155. result.setType(this.getType());
  156. result.setMonitorType(this.getMonitorType());
  157. result.setUploadTime(this.getUploadTime());
  158. // runningEntity.setInfusionModifyId(this.getInfusionModifyId());
  159. // f
  160. // runningEntity.setRemark(this.getRemark());
  161. // runningEntity.setStartTime(this.getStartTime());
  162. // runningEntity.setClinicId(this.getClinicId());
  163. return result;
  164. }
  165. }