|
|
@@ -27,6 +27,7 @@ import com.nb.web.service.bus.registry.device.DeviceRegistry;
|
|
|
import com.nb.web.api.entity.BusDeviceEntity;
|
|
|
import com.nb.web.service.bus.mapper.BusDeviceMapper;
|
|
|
import com.nb.web.service.bus.registry.device.DeviceOperator;
|
|
|
+import com.nb.web.service.bus.registry.patient.PatientRegistry;
|
|
|
import com.nb.web.service.bus.service.dto.DeviceQuery;
|
|
|
import com.nb.web.service.bus.service.dto.DeviceResult;
|
|
|
import com.nb.common.crud.BaseService;
|
|
|
@@ -403,8 +404,42 @@ public class LocalBusDeviceService extends BaseService<BusDeviceMapper, BusDevic
|
|
|
.filter(Objects::nonNull)
|
|
|
.forEach(deviceOperator -> {
|
|
|
RMapCache<String, Value> cache = deviceOperator.getCache();
|
|
|
- cache.clear();
|
|
|
- cache.put(DeviceKeyConstant.CLASSIFY,Value.simple(DeviceKeyConstant.DEFAULT_CLASSIFY));
|
|
|
+ cache.remove(DeviceKeyConstant.TENANT_ID);
|
|
|
});
|
|
|
+
|
|
|
+ List<PatientMonitorResult> results = patientService.selectAll(new PatientMonitorQuery());
|
|
|
+ if(CollectionUtil.isEmpty(results)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, PatientMonitorResult> deviceIdMap = results
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.groupingBy(PatientMonitorResult::getDeviceId, Collectors.collectingAndThen(Collectors.toList(), CollectionUtil::getFirst)));
|
|
|
+ //输注信息需要变化的设备
|
|
|
+ Collection<String> changeDeviceIds = CollectionUtil.intersection(deviceIdMap.keySet(), deviceIds);
|
|
|
+ if(CollectionUtil.isEmpty(changeDeviceIds)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PatientMonitorResult> patientMonitorResults = results
|
|
|
+ .stream()
|
|
|
+ .filter(patientMonitorResult -> changeDeviceIds.contains(patientMonitorResult.getDeviceId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ //输注切换
|
|
|
+ infusionHistoryService.update(new UpdateWrapper<BusInfusionHistoryEntity>().lambda()
|
|
|
+ .in(BusInfusionHistoryEntity::getId,patientMonitorResults
|
|
|
+ .stream()
|
|
|
+ .map(PatientMonitorResult::getInfusionId)
|
|
|
+ .collect(Collectors.toList()))
|
|
|
+ .set(BusInfusionHistoryEntity::getTenantId,afterTenantId));
|
|
|
+
|
|
|
+
|
|
|
+ //结束临床
|
|
|
+ clinicService.update(new UpdateWrapper<BusClinicEntity>().lambda()
|
|
|
+ .in(BusClinicEntity::getId,patientMonitorResults
|
|
|
+ .stream()
|
|
|
+ .map(PatientMonitorResult::getClinicId)
|
|
|
+ .collect(Collectors.toList()))
|
|
|
+ .set(BusClinicEntity::getFinished,true));
|
|
|
}
|
|
|
}
|