|
@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.coffee.bus.entity.*;
|
|
import com.coffee.bus.entity.*;
|
|
|
import com.coffee.bus.enums.DeviceAlarmEnum;
|
|
import com.coffee.bus.enums.DeviceAlarmEnum;
|
|
|
import com.coffee.bus.enums.DeviceEnum;
|
|
import com.coffee.bus.enums.DeviceEnum;
|
|
|
|
|
+import com.coffee.bus.enums.PatientAlarmEnum;
|
|
|
import com.coffee.bus.listener.event.bean.HisEvent;
|
|
import com.coffee.bus.listener.event.bean.HisEvent;
|
|
|
import com.coffee.bus.registry.device.DeviceRegistry;
|
|
import com.coffee.bus.registry.device.DeviceRegistry;
|
|
|
import com.coffee.bus.listener.event.bean.DeviceInfoEvent;
|
|
import com.coffee.bus.listener.event.bean.DeviceInfoEvent;
|
|
@@ -71,6 +72,8 @@ public class DeviceInfoListener {
|
|
|
public static final Sign sign = SignUtil.sign(SignAlgorithm.MD5withRSA);
|
|
public static final Sign sign = SignUtil.sign(SignAlgorithm.MD5withRSA);
|
|
|
|
|
|
|
|
private final LocalBusDeviceHistoryService historyService;
|
|
private final LocalBusDeviceHistoryService historyService;
|
|
|
|
|
+
|
|
|
|
|
+ private final LocalBusPatientService patientService;
|
|
|
/**
|
|
/**
|
|
|
* 监听上传的数据信息,
|
|
* 监听上传的数据信息,
|
|
|
* 若设备详情发生变化,则及时通知相应的ws通道
|
|
* 若设备详情发生变化,则及时通知相应的ws通道
|
|
@@ -209,8 +212,12 @@ public class DeviceInfoListener {
|
|
|
if(!StrUtil.isNullOrUndefined(bindDeviceId)&&!deviceId.equals(bindDeviceId)){
|
|
if(!StrUtil.isNullOrUndefined(bindDeviceId)&&!deviceId.equals(bindDeviceId)){
|
|
|
handleConflictCurrentPatient(device,suppliers);
|
|
handleConflictCurrentPatient(device,suppliers);
|
|
|
}else if(StrUtil.isNullOrUndefined(bindDeviceId)){
|
|
}else if(StrUtil.isNullOrUndefined(bindDeviceId)){
|
|
|
- //之前的病号为无泵状态,无泵 -》 有泵 做处理 修改缓存信息
|
|
|
|
|
|
|
+ //当前的病号之前为无泵状态,无泵 -》 有泵 做处理 修改缓存信息
|
|
|
log.error("病号:【{}】临床发生由无泵转为有泵",device.getPatientCode());
|
|
log.error("病号:【{}】临床发生由无泵转为有泵",device.getPatientCode());
|
|
|
|
|
+ patientService.update(new UpdateWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getCode,device.getPatientCode())
|
|
|
|
|
+ .eq(BusPatientEntity::getTenantId,device.getTenantId())
|
|
|
|
|
+ .set(BusPatientEntity::getAlarm, null)
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
//更新泵所绑定当前病人缓存信息
|
|
//更新泵所绑定当前病人缓存信息
|
|
|
suppliers.add(()->{
|
|
suppliers.add(()->{
|
|
@@ -239,8 +246,11 @@ public class DeviceInfoListener {
|
|
|
if(CollectionUtils.isNotEmpty(allDevice)){
|
|
if(CollectionUtils.isNotEmpty(allDevice)){
|
|
|
Set<DeviceTimeSmallInfo> remainPatientBindDevices = allDevice.stream().filter(bindDevice -> !bindDevice.getDeviceId().equals(deviceId)).collect(Collectors.toSet());
|
|
Set<DeviceTimeSmallInfo> remainPatientBindDevices = allDevice.stream().filter(bindDevice -> !bindDevice.getDeviceId().equals(deviceId)).collect(Collectors.toSet());
|
|
|
if(CollectionUtil.isEmpty(remainPatientBindDevices)){
|
|
if(CollectionUtil.isEmpty(remainPatientBindDevices)){
|
|
|
-
|
|
|
|
|
log.error("病号:【{}】临床发生无泵报警",patientCode);
|
|
log.error("病号:【{}】临床发生无泵报警",patientCode);
|
|
|
|
|
+ patientService.update(new UpdateWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getCode,patientCode)
|
|
|
|
|
+ .eq(BusPatientEntity::getTenantId,hospitalId)
|
|
|
|
|
+ .set(BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
|
|
|
+ );
|
|
|
suppliers.add(()->{
|
|
suppliers.add(()->{
|
|
|
//todo 发起无泵报警,处理原先泵的无泵信息
|
|
//todo 发起无泵报警,处理原先泵的无泵信息
|
|
|
patientOperator.setBindDeviceId(null);
|
|
patientOperator.setBindDeviceId(null);
|
|
@@ -265,6 +275,13 @@ public class DeviceInfoListener {
|
|
|
return null;
|
|
return null;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ if(remainPatientBindDevices.size()==1){
|
|
|
|
|
+ //泵重复—>正常
|
|
|
|
|
+ patientService.update(new UpdateWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getCode,patientCode)
|
|
|
|
|
+ .eq(BusPatientEntity::getTenantId,hospitalId)
|
|
|
|
|
+ .set(BusPatientEntity::getAlarm, null)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
suppliers.add(()->{
|
|
suppliers.add(()->{
|
|
@@ -283,7 +300,7 @@ public class DeviceInfoListener {
|
|
|
PatientOperator<PatientCacheInfo> patientOperator = patientRegistry.getOperator(device.getTenantId(), device.getPatientCode());
|
|
PatientOperator<PatientCacheInfo> patientOperator = patientRegistry.getOperator(device.getTenantId(), device.getPatientCode());
|
|
|
String bindDeviceId = patientOperator.getBindDeviceId();
|
|
String bindDeviceId = patientOperator.getBindDeviceId();
|
|
|
if(!StrUtil.isNullOrUndefined(bindDeviceId)&&!deviceId.equals(bindDeviceId)){
|
|
if(!StrUtil.isNullOrUndefined(bindDeviceId)&&!deviceId.equals(bindDeviceId)){
|
|
|
- //泵号发生改变,获取病号绑定的泵信息,判断绑定的泵开始时间,将开始时间稍后的泵设置为主泵
|
|
|
|
|
|
|
+ //泵号发生改变,获取病号绑定的泵信息,判断绑定的泵开始时间,将开始时间稍后的泵设置为主泵 todo 发生病人绑定多个泵冲突
|
|
|
DeviceOperator<DeviceCacheInfo> patientCurrentBindDevice = deviceRegistry.getOperator(bindDeviceId);
|
|
DeviceOperator<DeviceCacheInfo> patientCurrentBindDevice = deviceRegistry.getOperator(bindDeviceId);
|
|
|
Date startTime = patientCurrentBindDevice.getStartTime();
|
|
Date startTime = patientCurrentBindDevice.getStartTime();
|
|
|
if (startTime==null||startTime.before(device.getStartTime())) {
|
|
if (startTime==null||startTime.before(device.getStartTime())) {
|
|
@@ -294,6 +311,11 @@ public class DeviceInfoListener {
|
|
|
}else {
|
|
}else {
|
|
|
device.setMaster(false);
|
|
device.setMaster(false);
|
|
|
}
|
|
}
|
|
|
|
|
+ log.error("病号:{}发生了泵重复",device.getPatientCode());
|
|
|
|
|
+ patientService.update(new UpdateWrapper<BusPatientEntity>().lambda()
|
|
|
|
|
+ .eq(BusPatientEntity::getCode,device.getPatientCode())
|
|
|
|
|
+ .eq(BusPatientEntity::getTenantId,device.getTenantId())
|
|
|
|
|
+ .set(BusPatientEntity::getAlarm,PatientAlarmEnum.DEVICE_REPEAT));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|