|
|
@@ -11,8 +11,6 @@ import com.coffee.bus.service.LocalBusDeviceService;
|
|
|
import com.coffee.bus.service.LocalBusInfusionHistoryService;
|
|
|
import com.coffee.common.cache.value.Value;
|
|
|
import com.coffee.common.util.RedissonUtil;
|
|
|
-import org.redisson.api.LocalCachedMapOptions;
|
|
|
-import org.redisson.api.RMap;
|
|
|
import org.redisson.api.RMapCache;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
@@ -49,7 +47,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setExist(Boolean exist) {
|
|
|
- mapCache.put(DeviceKeyConstant.IS_EXIST,wrapperValue(exist),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.IS_EXIST,wrapperValue(exist));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -70,7 +68,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setEnable(Boolean enable) {
|
|
|
- mapCache.put(DeviceKeyConstant.ENABLE,wrapperValue(enable),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.ENABLE,wrapperValue(enable) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -86,7 +84,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setTenantId(String tenantId) {
|
|
|
- mapCache.put(DeviceKeyConstant.TENANT_ID,wrapperValue(tenantId),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.TENANT_ID,wrapperValue(tenantId) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -103,7 +101,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setStartTime(Date startTime) {
|
|
|
- mapCache.put(DeviceKeyConstant.START_TIME,wrapperValue(startTime),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.START_TIME,wrapperValue(startTime) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -111,15 +109,20 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
Value value = getValue(DeviceKeyConstant.START_TIME);
|
|
|
if(value==null){
|
|
|
BusInfusionHistoryEntity lastInfusion = getLastInfusion();
|
|
|
- value=Value.simple(lastInfusion.getStartTime());
|
|
|
- setStartTime(lastInfusion.getStartTime());
|
|
|
+ if(lastInfusion!=null){
|
|
|
+ value=Value.simple(lastInfusion.getStartTime());
|
|
|
+ setStartTime(lastInfusion.getStartTime());
|
|
|
+ }else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return value.asDate();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void setPatientCode(String patientCode) {
|
|
|
- mapCache.put(DeviceKeyConstant.PATIENT_CODE,wrapperValue(patientCode),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.PATIENT_CODE,wrapperValue(patientCode) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -135,7 +138,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setAlarmOrWarn(String alarm) {
|
|
|
- mapCache.put(DeviceKeyConstant.ALARM,wrapperValue(alarm),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.ALARM,wrapperValue(alarm) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -152,7 +155,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setInfusionId(String infusionId) {
|
|
|
- mapCache.put(DeviceKeyConstant.INFUSION_ID,wrapperValue(infusionId),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.INFUSION_ID,wrapperValue(infusionId) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -168,7 +171,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setInfusionParam(String infusionParam) {
|
|
|
- mapCache.put(DeviceKeyConstant.INFUSION_PARAM,wrapperValue(infusionParam),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.INFUSION_PARAM,wrapperValue(infusionParam) );
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -191,7 +194,7 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setClassification(String classification) {
|
|
|
- mapCache.put(DeviceKeyConstant.CLASSIFY,wrapperValue(classification),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.CLASSIFY,wrapperValue(classification));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -220,7 +223,39 @@ public class ClusterDeviceOperator implements DeviceOperator {
|
|
|
|
|
|
@Override
|
|
|
public void setContinueDose(BigDecimal continueDose) {
|
|
|
- mapCache.put(DeviceKeyConstant.CONTINUE_DOSE,wrapperValue(continueDose),DEFAULT_TTL, TimeUnit.HOURS);
|
|
|
+ put(DeviceKeyConstant.CONTINUE_DOSE,wrapperValue(continueDose) );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setLastPcaValidCount(Integer pcaValidCount) {
|
|
|
+ put(DeviceKeyConstant.VALID_PCA,wrapperValue(pcaValidCount) );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer getLastPcaValidCount() {
|
|
|
+ Value value = getValue(DeviceKeyConstant.VALID_PCA);
|
|
|
+ if(value==null){
|
|
|
+ BusInfusionHistoryEntity lastInfusion = getLastInfusion();
|
|
|
+ value=Value.simple(lastInfusion.getPcaValidCount());
|
|
|
+ setLastPcaValidCount(lastInfusion.getPcaValidCount());
|
|
|
+ }
|
|
|
+ return value.asInt();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setTotalAppendDose(BigDecimal totalAppendDose) {
|
|
|
+ put(DeviceKeyConstant.APPEND_DOSE,wrapperValue(totalAppendDose) );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public BigDecimal getTotalAppendDose() {
|
|
|
+ Value value = getValue(DeviceKeyConstant.APPEND_DOSE);
|
|
|
+ if(value==null){
|
|
|
+ BusInfusionHistoryEntity lastInfusion = getLastInfusion();
|
|
|
+ value=Value.simple(lastInfusion.getTotalAppendDose());
|
|
|
+ setTotalAppendDose(lastInfusion.getTotalAppendDose());
|
|
|
+ }
|
|
|
+ return value.as(BigDecimal.class);
|
|
|
}
|
|
|
|
|
|
@Override
|