BusInfusionModifyEntity.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. package com.coffee.bus.entity;
  2. import cn.hutool.crypto.asymmetric.Sign;
  3. import cn.hutool.json.JSONObject;
  4. import com.baomidou.mybatisplus.annotation.FieldStrategy;
  5. import com.baomidou.mybatisplus.annotation.TableField;
  6. import com.baomidou.mybatisplus.annotation.TableName;
  7. import com.coffee.bus.entity.common.CommonDeviceParam;
  8. import com.coffee.bus.enums.DeviceTypeEnum;
  9. import com.coffee.common.entity.TenantGenericEntity;
  10. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  11. import io.swagger.annotations.ApiModel;
  12. import io.swagger.annotations.ApiModelProperty;
  13. import lombok.Data;
  14. import lombok.EqualsAndHashCode;
  15. import lombok.ToString;
  16. import lombok.experimental.Accessors;
  17. import javax.validation.constraints.DecimalMax;
  18. import javax.validation.constraints.DecimalMin;
  19. import javax.validation.constraints.Max;
  20. import javax.validation.constraints.Min;
  21. import java.math.BigDecimal;
  22. import java.util.Date;
  23. /**
  24. * @author 龙三郎
  25. * @version 1.0.0
  26. * @ClassName BusDeviceUseEntity.java
  27. * @Description TODO
  28. * @createTime 2022年03月30日 11:01:00
  29. */
  30. @ToString
  31. @Data
  32. @EqualsAndHashCode(callSuper = true)
  33. @Accessors(chain = true)
  34. @TableName(value = "bus_infusion_modify",autoResultMap = true)
  35. @ApiModel(value="设备输注参数修改记录", description="当输注参数发生修改时,在此表中进行记录")
  36. public class BusInfusionModifyEntity extends CommonDeviceParam<String,String> {
  37. // @ApiModelProperty(value = "网络泵id",readOnly = true)
  38. // private String deviceId;
  39. @ApiModelProperty(value = "输注记录")
  40. private String infusionId;
  41. // @ApiModelProperty(value = "泵类型",readOnly = true)
  42. // @TableField(updateStrategy = FieldStrategy.NEVER)
  43. // private DeviceTypeEnum type;
  44. // @ApiModelProperty(value = "总量",readOnly = true)
  45. // @Max(value = 999,message = "总量最大值不得超过999")
  46. // @Min(value = 0,message ="总量最小值不得超过0" )
  47. // private Integer totalDose;
  48. //
  49. // @ApiModelProperty(value = "公共参数-首次量",readOnly = true)
  50. // @Max(value = 50,message = "首次量最大值不得超过50")
  51. // @Min(value = 0,message ="首次量最小值不得超过0" )
  52. // private Integer firstDose;
  53. //
  54. // @ApiModelProperty(value = "公共参数-剩余量",readOnly = true)
  55. // private BigDecimal remainDose;
  56. //
  57. // @ApiModelProperty(value = "公共参数-已输入量",readOnly = true)
  58. // private BigDecimal inputDose;
  59. //
  60. // @ApiModelProperty(value = "公共参数-追加量",readOnly = true)
  61. // @DecimalMax(value = "10",message = "PCA追加量最大值不得超过10")
  62. // @DecimalMin(value = "0",message ="PCA追加量最小值不得超过0" )
  63. // private BigDecimal appendDose;
  64. //
  65. // @ApiModelProperty(value = "公共参数-追加锁时",readOnly = true)
  66. // @DecimalMax(value = "99",message = "PCA追加量最大值不得超过99")
  67. // @DecimalMin(value = "1",message ="PCA追加量最小值不得超过0" )
  68. // private BigDecimal appendLockTime;
  69. //
  70. // @ApiModelProperty(value = "公共参数-极限量",readOnly = true)
  71. // @DecimalMax(value = "90",message = "PCA追加量最大值不得超过90")
  72. // @DecimalMin(value = "0",message ="PCA追加量最小值不得超过0" )
  73. // private BigDecimal maxDose;
  74. //
  75. // @ApiModelProperty(value = "公共参数-自控锁时",readOnly = true)
  76. // private Integer selfControlLockTime;
  77. //
  78. // @ApiModelProperty(value = "公共参数-自控次数",readOnly = true)
  79. // private Integer selfControlCount;
  80. //
  81. // @ApiModelProperty(value = "公共参数-pca有效次数",readOnly = true)
  82. // private Integer pcaValidCount;
  83. //
  84. // @ApiModelProperty(value = "公共参数-pca无效次数",readOnly = true)
  85. // private Integer pcaInvalidCount;
  86. //
  87. // @ApiModelProperty(value = "公共参数-pca总按次数",readOnly = true)
  88. // private Integer pcaTotalCount;
  89. //
  90. // @ApiModelProperty(value = "持续泵参数-持续量",readOnly = true)
  91. // @DecimalMax(value = "50",message = "持续给液量最大值不得超过50")
  92. // @DecimalMin(value = "0",message ="持续给液量最小值不得超过0" )
  93. // private BigDecimal continueDose;
  94. //
  95. // @ApiModelProperty(value = "脉冲泵参数-脉冲量",readOnly = true)
  96. // @Max(value = 20,message = "脉冲量最大值不得超过20")
  97. // @Min(value = 0,message ="脉冲量最小值不得超过0" )
  98. // private Integer pulseDose;
  99. //
  100. // @ApiModelProperty(value = "脉冲泵参数-脉冲锁时",readOnly = true)
  101. // @Max(value = 90,message = "脉冲锁时最大值不得超过90")
  102. // @Min(value = 30,message ="脉冲锁时最小值不得超过30" )
  103. // private Integer pulseLockTime;
  104. //
  105. // @ApiModelProperty(value = "脉冲泵参数-脉冲首次锁时",readOnly = true)
  106. // @Max(value = 60,message = "脉冲首次锁时最大值不得超过60")
  107. // @Min(value = 0,message ="脉冲首次锁时最小值不得超过0" )
  108. // private Integer pulseFirstLockTime;
  109. //
  110. // @ApiModelProperty(value = "智能泵参数-加档周期",readOnly = true)
  111. // @DecimalMax(value = "10",message = "加档周期最大值不得超过10")
  112. // @DecimalMin(value = "0.5",message ="加档周期最小值不得超过0.5" )
  113. // private BigDecimal flowUpCycle;
  114. //
  115. // @ApiModelProperty(value = "智能泵参数-减档周期",readOnly = true)
  116. // @DecimalMax(value = "10",message = "减档周期最大值不得超过10")
  117. // @DecimalMin(value = "0.5",message ="减档周期最小值不得超过0.5" )
  118. // private BigDecimal flowDownCycle;
  119. //
  120. // @ApiModelProperty(value = "智能泵参数-计次",readOnly = true)
  121. // @DecimalMax(value = "10",message = "PCA追加量最大值不得超过10")
  122. // @DecimalMin(value = "1",message ="PCA追加量最小值不得超过1" )
  123. // private BigDecimal flowCount;
  124. //
  125. // @ApiModelProperty(value = "智能泵参数-上限",readOnly = true)
  126. // @DecimalMax(value = "50",message = "智能泵上限值最大值不得超过90")
  127. // @DecimalMin(value = "1",message ="智能泵上限值最小值不得超过0" )
  128. // private BigDecimal flowUpLimit;
  129. //
  130. // @ApiModelProperty(value = "智能泵参数-下限",readOnly = true)
  131. // @DecimalMax(value = "50",message = "智能泵下限值最大值不得超过50")
  132. // @DecimalMin(value = "0.1",message ="智能泵下限值最小值不得超过0.1" )
  133. // private BigDecimal flowDownLimit;
  134. //
  135. // @ApiModelProperty(value = "智能泵参数-自调比例",readOnly = true)
  136. // @DecimalMax(value = "95",message = "自调比例不得超过95")
  137. // @DecimalMin(value = "0",message ="自调比例最小值不得超过0" )
  138. // private BigDecimal flowAdjustRate;
  139. @ApiModelProperty(value = "参数修改时间")
  140. private Date modifyTime;
  141. // @ApiModelProperty(value = "分包标记位",readOnly = true)
  142. // @JsonIgnoreProperties(allowSetters = true)
  143. // private String classification;
  144. public static BusInfusionModifyEntity parseRunningInfo(BusDeviceRunningEntity running){
  145. BusInfusionModifyEntity entity = new BusInfusionModifyEntity();
  146. entity.setDeviceId(running.getDeviceId());
  147. entity.setTenantId(running.getTenantId());
  148. entity.setInfusionId(running.getInfusionId());
  149. entity.setType(running.getType());
  150. entity.setClassification(running.getClassification());
  151. entity.setTotalDose(running.getTotalDose());
  152. entity.setFirstDose(running.getFirstDose());
  153. entity.setRemainDose(running.getRemainDose());
  154. entity.setInputDose(running.getInputDose());
  155. entity.setContinueDose(running.getContinueDose());
  156. entity.setAppendDose(running.getAppendDose());
  157. entity.setMaxDose(running.getMaxDose());
  158. entity.setSelfControlLockTime(running.getSelfControlLockTime());
  159. entity.setSelfControlCount(running.getSelfControlCount());
  160. entity.setPcaValidCount(running.getPcaValidCount());
  161. entity.setPcaInvalidCount(running.getPcaInvalidCount());
  162. entity.setPcaTotalCount(running.getPcaTotalCount());
  163. /**
  164. * 脉冲泵参数
  165. */
  166. entity.setPulseDose(running.getPulseDose());
  167. entity.setPulseFirstLockTime(running.getPulseFirstLockTime());
  168. entity.setPulseLockTime(running.getPulseLockTime());
  169. /**
  170. * 智能泵参数
  171. */
  172. entity.setFlowAdjustRate(running.getFlowAdjustRate());
  173. entity.setFlowCount(running.getFlowCount());
  174. entity.setFlowDownCycle(running.getFlowDownCycle());
  175. entity.setFlowUpCycle(running.getFlowUpCycle());
  176. entity.setFlowDownLimit(running.getFlowDownLimit());
  177. entity.setFlowUpLimit(running.getFlowUpLimit());
  178. entity.setModifyTime(running.getUploadTime());
  179. return entity;
  180. }
  181. public String signParam(Sign sign){
  182. //保证参数有序
  183. JSONObject param = new JSONObject(true);
  184. //加密过程中,加入分包标识,保证新的输注的输注参数必定发生改变
  185. switch (this.getType()){
  186. case continuous:
  187. param.putOpt("continueDose",this.getContinueDose());
  188. param.putOpt("firstDose",this.getFirstDose());
  189. param.putOpt("appendDose",this.getAppendDose());
  190. param.putOpt("appendLockTime",this.getAppendLockTime());
  191. param.putOpt("maxDose",this.getMaxDose());
  192. param.putOpt("classification",this.getClassification());
  193. break;
  194. case pulse:
  195. param.putOpt("firstDose",this.getFirstDose());
  196. param.putOpt("firstLockTime",this.getPulseFirstLockTime());
  197. param.putOpt("continueDose",this.getContinueDose());
  198. param.putOpt("pulseDose",this.getPulseDose());
  199. param.putOpt("lockTime",this.getPulseLockTime());
  200. param.putOpt("appendDose",this.getAppendDose());
  201. param.putOpt("appendLockTime",this.getAppendLockTime());
  202. param.putOpt("maxDose",this.getMaxDose());
  203. param.putOpt("classification",this.getClassification());
  204. break;
  205. case intelligent:
  206. param.putOpt("firstDose",this.getFirstDose());
  207. param.putOpt("appendDose",this.getAppendDose());
  208. param.putOpt("appendLockTime",this.getAppendLockTime());
  209. param.putOpt("flowUpCycle",this.getFlowUpCycle());
  210. param.putOpt("flowCount",this.getFlowCount());
  211. param.putOpt("flowDownCycle",this.getFlowDownCycle());
  212. param.putOpt("flowAdjustRate",this.getFlowAdjustRate());
  213. param.putOpt("flowUpLimit",this.getFlowUpLimit());
  214. param.putOpt("flowDownLimit",this.getFlowDownLimit());
  215. param.putOpt("continueDose",this.getContinueDose());
  216. param.putOpt("maxDose",this.getMaxDose());
  217. param.putOpt("classification",this.getClassification());
  218. break;
  219. default:break;
  220. }
  221. return sign.signHex(param.toString());
  222. }
  223. }