BusDeviceRunningEntity.java 7.6 KB

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