|
@@ -1,6 +1,7 @@
|
|
|
package com.coffee.bus.websocket.listener;
|
|
package com.coffee.bus.websocket.listener;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
+import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SignUtil;
|
|
import cn.hutool.crypto.SignUtil;
|
|
@@ -268,7 +269,6 @@ public class DeviceInfoListener {
|
|
|
log.warn("病号:【{}】临床发生无泵报警",patientCode);
|
|
log.warn("病号:【{}】临床发生无泵报警",patientCode);
|
|
|
patientService.update(new UpdateWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getCode,patientCode)
|
|
patientService.update(new UpdateWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getCode,patientCode)
|
|
|
.eq(BusPatientEntity::getTenantId,hospitalId)
|
|
.eq(BusPatientEntity::getTenantId,hospitalId)
|
|
|
-// .set(BusPatientEntity::getInfusionId,null)
|
|
|
|
|
.set(BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
.set(BusPatientEntity::getAlarm, PatientAlarmEnum.DEVICE_NONE)
|
|
|
);
|
|
);
|
|
|
suppliers.add(()->{
|
|
suppliers.add(()->{
|
|
@@ -332,12 +332,12 @@ 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())) {
|
|
|
log.warn("病号:[{}],之前主泵为:[{}],现在主泵为:[{}]",device.getPatientCode(),bindDeviceId,deviceId);
|
|
log.warn("病号:[{}],之前主泵为:[{}],现在主泵为:[{}]",device.getPatientCode(),bindDeviceId,deviceId);
|
|
|
- //设置当前上传信息的泵为主泵,将旧泵设置为副泵,并更新病人绑定泵的消息 todo 更新缓存信息
|
|
|
|
|
|
|
+ //设置当前上传信息的泵为主泵,将旧泵设置为副泵,并更新病人绑定泵的消息
|
|
|
device.setMaster(true);
|
|
device.setMaster(true);
|
|
|
deviceRunningService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,bindDeviceId).set(BusDeviceRunningEntity::getMaster,false));
|
|
deviceRunningService.update(new UpdateWrapper<BusDeviceRunningEntity>().lambda().eq(BusDeviceRunningEntity::getDeviceId,bindDeviceId).set(BusDeviceRunningEntity::getMaster,false));
|
|
|
}else {
|
|
}else {
|
|
@@ -350,7 +350,7 @@ public class DeviceInfoListener {
|
|
|
.set(Boolean.TRUE.equals(device.getMaster()),BusPatientEntity::getInfusionId,device.getInfusionId())
|
|
.set(Boolean.TRUE.equals(device.getMaster()),BusPatientEntity::getInfusionId,device.getInfusionId())
|
|
|
.set(BusPatientEntity::getAlarm,PatientAlarmEnum.DEVICE_REPEAT));
|
|
.set(BusPatientEntity::getAlarm,PatientAlarmEnum.DEVICE_REPEAT));
|
|
|
suppliers.add(()->{
|
|
suppliers.add(()->{
|
|
|
- wsPublishUtils.publishDeviceRepeat(device.getPatientCode());
|
|
|
|
|
|
|
+ wsPublishUtils.publishDeviceRepeat(device.getTenantId());
|
|
|
return null;
|
|
return null;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -394,7 +394,7 @@ public class DeviceInfoListener {
|
|
|
* @param cacheOperation 缓存操作
|
|
* @param cacheOperation 缓存操作
|
|
|
*/
|
|
*/
|
|
|
private BusInfusionHistoryEntity handleInfusion(BusDeviceRunningEntity device, DeviceOperator<DeviceCacheInfo> deviceOperator, AtomicBoolean newInfusion, List<Supplier<?>> cacheOperation) {
|
|
private BusInfusionHistoryEntity handleInfusion(BusDeviceRunningEntity device, DeviceOperator<DeviceCacheInfo> deviceOperator, AtomicBoolean newInfusion, List<Supplier<?>> cacheOperation) {
|
|
|
- PatientOperator<PatientCacheInfo> operator = patientRegistry.getOperator(device.getTenantId(), device.getPatientCode());
|
|
|
|
|
|
|
+ PatientOperator<PatientCacheInfo> operator = patientRegistry.getOperator(device.getTenantId(), device.getPatientCode(),MapUtil.of("startTime", device.getStartTime()));
|
|
|
device.setClinicId(operator.getClinicId());
|
|
device.setClinicId(operator.getClinicId());
|
|
|
|
|
|
|
|
BusInfusionHistoryEntity infusionHistory = handleInfusionHistory(device, deviceOperator, newInfusion, cacheOperation);
|
|
BusInfusionHistoryEntity infusionHistory = handleInfusionHistory(device, deviceOperator, newInfusion, cacheOperation);
|