BusDeviceRunningEntity.java 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. import java.util.Optional;
  19. /**
  20. * @Author lifang
  21. * @Date 16:02 2022/4/8
  22. * @Description
  23. * @Param
  24. * @return
  25. **/
  26. @ToString
  27. @Data
  28. @EqualsAndHashCode(callSuper = true)
  29. @Accessors(chain = true)
  30. @TableName(value = "bus_device_running",autoResultMap = true)
  31. @ApiModel(value="设备运行状态", description="设备运行状态")
  32. public class BusDeviceRunningEntity extends CommonDeviceParam<String,String> {
  33. @ApiModelProperty(value = "输注记录")
  34. private String infusionId;
  35. @ApiModelProperty(value = "临床号")
  36. private String clinicId;
  37. /***************临床固定数据*****************/
  38. @ApiModelProperty(value = "病人名称")
  39. private String patientName;
  40. @ApiModelProperty(value = "病人性别")
  41. private SexEnum patientSex;
  42. /***************临床固定数据*****************/
  43. @ApiModelProperty(value = "设备别名")
  44. private String alias;
  45. @ApiModelProperty(value = "输注开始时间,即本次运行开机时间",accessMode = ApiModelProperty.AccessMode.READ_ONLY)
  46. private Date startTime;
  47. @ApiModelProperty(value = "是否已撤泵,0、未撤泵1、已撤泵")
  48. @JsonIgnoreProperties(allowSetters = true)
  49. private Boolean isUndo;
  50. @ApiModelProperty(value = "备注")
  51. private String remark;
  52. @ApiModelProperty(value = "监护类型,1、有泵监护 0、无泵监护")
  53. @JsonIgnoreProperties
  54. private Boolean monitorType;
  55. @ApiModelProperty(value = "是否为主泵数据, 0、副泵 1、主泵(即当前临床绑定的泵)")
  56. @JsonIgnoreProperties(allowSetters = true)
  57. private Boolean master;
  58. @ApiModelProperty(value = "数据上传时间",accessMode = ApiModelProperty.AccessMode.READ_ONLY,hidden = true)
  59. @JsonIgnoreProperties(allowSetters = true)
  60. private Date uploadTime;
  61. /**
  62. * 当前运行状态所绑定的输注修改记录id,只在设备上传解析过程中使用,其他地方无用处
  63. */
  64. @TableField(exist = false)
  65. @JsonIgnoreProperties
  66. private String infusionModifyId;
  67. /**
  68. * 当前运行状态所绑定的历史记录id,只在设备上传解析过程中使用,其他地方无用处
  69. */
  70. @TableField(exist = false)
  71. @JsonIgnoreProperties
  72. private String historyId;
  73. @TableField(exist = false)
  74. @JsonIgnoreProperties
  75. private Date modifyTime;
  76. /**
  77. * 当前运行状态是否开启了新的输注,只在设备上传解析过程中使用,其他地方无用处
  78. */
  79. @TableField(exist = false)
  80. @JsonIgnoreProperties
  81. private boolean newInfusion;
  82. /**
  83. * 当前运行状态输注信息是否发生了变化,只在设备上传解析过程中使用,其他地方无用处
  84. */
  85. @TableField(exist = false)
  86. @JsonIgnoreProperties
  87. private boolean infusionModify;
  88. /**
  89. *当设备输注过程已撤泵被重新开启时,只在设备上传解析过程中使用,其他地方无用处
  90. */
  91. @TableField(exist = false)
  92. @JsonIgnoreProperties
  93. private boolean resetUndo;
  94. /**
  95. * 患者id
  96. */
  97. @TableField(exist = false)
  98. @JsonIgnoreProperties
  99. private String patientId;
  100. /**
  101. * 重新开启临床信息
  102. */
  103. @TableField(exist = false)
  104. @JsonIgnoreProperties
  105. private boolean resetClinic;
  106. /**
  107. * 格式化之后的住院号
  108. */
  109. @TableField(exist = false)
  110. @JsonIgnoreProperties
  111. private String formatPatientCode;
  112. /**
  113. * @author 龙三郎
  114. * 根据阿里云传回数据的items,设置输注的属性
  115. * @param deviceName
  116. * @param items
  117. */
  118. public void updateFieldsByItems(String deviceName, Items items) {
  119. // 属性上传时间
  120. this.setUploadTime(items.getDate());
  121. this.setDeviceId(deviceName);
  122. this.setClassification( items.getString(PumpParams.classification));
  123. this.setDataNumber(items.getInteger(PumpParams.dataNumber));
  124. this.setPatientCode( items.getString(PumpParams.patientCode));
  125. this.setWard(items.getString(PumpParams.ward));
  126. this.setBedNo(items.getString(PumpParams.bedNo));
  127. this.setTotalDose( items.getInteger(PumpParams.totalDose));
  128. this.setInputDose(items.getBigDecimal(PumpParams.finishedDose));
  129. this.setRemainDose(BigDecimal.valueOf(this.getTotalDose()).subtract(this.getInputDose()));
  130. this.setFirstDose( items.getInteger(PumpParams.firstDosis));
  131. this.setMaxDose(items.getBigDecimal(PumpParams.maxDose));
  132. this.setAppendDose(items.getBigDecimal(PumpParams.singleDosis));
  133. this.setAppendLockTime(items.getBigDecimal(PumpParams.lockTime));
  134. this.setContinueDose(items.getBigDecimal(PumpParams.flow));
  135. this.setType( DeviceTypeUtils.getDeviceType(items.getInteger(PumpParams.pumpType)));
  136. this.setPcaValidCount(items.getInteger(PumpParams.pcaValid));
  137. this.setPcaInvalidCount(items.getInteger(PumpParams.pcaInvalid));
  138. this.setPcaTotalCount(this.getPcaInvalidCount()+this.getPcaValidCount());
  139. this.setElectricQuantity(items.getInteger(PumpParams.electricQuantity));
  140. this.setRunState(DeviceRunStatusUtils.getRunStatus(items.getInteger(PumpParams.runStatus)));
  141. this.setAlarm(DeviceAlarmUtils.getAlarm(Optional.ofNullable(items.getInteger(PumpParams.alarmStatus)).orElse(0)));
  142. // 预报
  143. // 镇痛不足预报
  144. this.setWarnAnalgesicPoor(Optional.ofNullable(items.getBoolean(PumpParams.warnAnalgesicPoor)).orElse(false));
  145. // 电量偏低预报
  146. this.setWarnLowBattery(Optional.ofNullable(items.getBoolean(PumpParams.warnLowBattery)).orElse(false));
  147. // 输液将结束预报
  148. this.setWarnWillFinished(Optional.ofNullable(items.getBoolean(PumpParams.warnWillFinished)).orElse(false));
  149. // 设置脉冲泵参数
  150. if (this.getType() == DeviceTypeEnum.pulse){
  151. // 脉冲锁时
  152. this.setPulseLockTime(items.getInteger(PumpParams.pulseLockTime));
  153. // 首次锁时
  154. this.setPulseFirstLockTime(items.getInteger(PumpParams.firstLockTime));
  155. // 脉冲量
  156. this.setPulseDose(items.getInteger(PumpParams.pulseDose));
  157. }else if (this.getType() == DeviceTypeEnum.intelligent){
  158. // 设置智能泵参数
  159. // 重设参数标识
  160. // 减档时间
  161. this.setFlowDownCycle(items.getBigDecimal(PumpParams.flowDownTime));
  162. // 加档时间
  163. this.setFlowUpCycle(items.getBigDecimal(PumpParams.flowUpTime));
  164. // 触发加档pca有效次数
  165. this.setFlowCount(items.getBigDecimal(PumpParams.flowUpPcaValid));
  166. // 加减档百分比
  167. this.setFlowAdjustRate(items.getBigDecimal(PumpParams.flowAdjuseRate));
  168. // 减档下限
  169. this.setFlowDownLimit(items.getBigDecimal(PumpParams.minFlow));
  170. // 加档上限
  171. this.setFlowUpLimit(items.getBigDecimal(PumpParams.maxFlow));
  172. // 加减档预报
  173. this.setWarnFlow(WarnFlowUtils.getAlarm(items.getInteger(PumpParams.warnFlow)));
  174. }
  175. }
  176. }