18339543638 2 jaren geleden
bovenliggende
commit
af40ee60a0

+ 6 - 4
nb-service/web-service/src/main/java/com/nb/web/service/bus/listener/DeviceInfoListener.java

@@ -1,5 +1,6 @@
 package com.nb.web.service.bus.listener;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -497,12 +498,10 @@ public class DeviceInfoListener implements IIotMsgHandler {
             device.setInfusionModifyId(modify.getId());
         }
         //判断临床是否已结束,若临床已结束,则采用当前输注作为主输注开启临床
+        BusPatientEntity patient = patientService.getById(device.getPatientId());
         if(clinicFinished){
             clinicService.resetClinic(device.getClinicId());
-            patientService.update(new UpdateWrapper<BusPatientEntity>()
-                    .lambda()
-                    .eq(BusPatientEntity::getId,device.getPatientId())
-                    .set(BusPatientEntity::getInfusionId,device.getInfusionId()));
+            patient.setInfusionId(device.getInfusionId());
             PatientOperator patientOperator = patientRegistry.getOperator(device.getTenantId(), device.getPatientCode());
             device.setMaster(true);
             device.setResetClinic(true);
@@ -510,7 +509,10 @@ public class DeviceInfoListener implements IIotMsgHandler {
                 patientOperator.setBindDeviceId(device.getDeviceId());
                 return null;
             });
+        } else if (StrUtil.isEmpty(patient.getInfusionId())) {
+            patient.setInfusionId(device.getInfusionId());
         }
+        patientService.updateById(patient);
     }