18339543638 hace 3 años
padre
commit
32708c5696

+ 3 - 1
nb-service/iot-service/src/main/java/com/nb/mq/entity/PcPumpEntity.java

@@ -148,7 +148,7 @@ public class PcPumpEntity implements Serializable {
     private String viewState;
 
     @ApiModelProperty(value = "最后上传时间")
-    private LocalDateTime lastUploadTime;
+    private Long lastUploadTime;
 
 
     public BusDeviceRunningEntity toDevice(){
@@ -166,6 +166,7 @@ public class PcPumpEntity implements Serializable {
                 break;
             default:break;
         }
+        result.setAlarm(DeviceAlarmEnum.None);
 
         result.setUploadTime(new Date());
         result.setDeviceId(this.getPumpCode());
@@ -185,6 +186,7 @@ public class PcPumpEntity implements Serializable {
         result.setContinueDose(this.getContinueQuantity());
         result.setType(deviceType);
 
+        result.setUploadTime(new Date(this.getLastUploadTime()*1000));
         result.setPcaInvalidCount(this.getInvalidTime());
         result.setPcaValidCount(this.getValidTime());
         result.setPcaTotalCount(this.getTotalCount());

+ 8 - 2
nb-service/iot-service/src/main/java/com/nb/mq/listener/RabbitMqListener.java

@@ -70,18 +70,24 @@ public class RabbitMqListener {
         //当上一个临床状态为已结束时,对比临床信息是否发生改变,生成新的临床信息
         boolean sameClinic=false;
         if(StrUtil.isNotEmpty(existClinic.getId())){
-            sameClinic=(clinic.getSurgeryName()+clinic.getStartTime()).equals(existClinic.getSurgeryName()+existClinic.getStartTime());
+            sameClinic=(clinic.getSurgeryName()+
+                    Optional.ofNullable(clinic.getWard()).orElse("")+
+                    Optional.ofNullable(clinic.getBedNo()).orElse("")).equals(
+                    existClinic.getSurgeryName()+
+                            Optional.ofNullable(existClinic.getWard()).orElse("")+
+                            Optional.ofNullable(existClinic.getBedNo()).orElse(""));
         }
-
         if(!sameClinic){
             //为了避免网络延迟,开始时间往前推1个小时
             clinic.setStartTime(DateUtil.offsetHour(new Date(),0));
+
             clinic=clinicClient.insertFromHis(clinic);
             clinicClient.setCurrentClinicByHis(clinic,Boolean.TRUE.equals(existClinic.getFinished()));
         }else {
             clinic.setStartTime(existClinic.getStartTime());
             clinicClient.update(existClinic.getId(),clinic);
         }
+
     }
 
     /**

+ 6 - 6
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusClinicService.java

@@ -97,12 +97,12 @@ public class LocalBusClinicService extends BaseService<BusClinicMapper, BusClini
      * @return void
      */
     private void publishPatientInfo(BusClinicEntity entity){
-        BusClinicEntity clnic = this.getById(entity.getId());
-        if(Boolean.TRUE.equals(clnic.getMonitorType())){
-            PatientInfoEvent event = new PatientInfoEvent(this,clnic.getPatientId(),clnic.getPatientCode());
-            event.setPatientAge(clnic.getPatientAge());
-            event.setPatientName(clnic.getPatientName());
-            event.setPatientSex(clnic.getPatientGender());
+        BusClinicEntity clinic = this.getById(entity.getId());
+        if(Boolean.TRUE.equals(clinic.getMonitorType())){
+            PatientInfoEvent event = new PatientInfoEvent(this,clinic.getPatientId(),clinic.getPatientCode());
+            event.setPatientAge(clinic.getPatientAge());
+            event.setPatientName(clinic.getPatientName());
+            event.setPatientSex(clinic.getPatientGender());
             SpringUtil.publishEvent(event);
         }
     }

+ 25 - 8
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusPatientService.java

@@ -8,8 +8,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.nb.core.Value;
 import com.nb.web.api.entity.BusClinicEntity;
+import com.nb.web.api.entity.BusDeviceEntity;
 import com.nb.web.api.entity.BusInfusionHistoryEntity;
 import com.nb.web.api.enums.ClinicManageEnum;
 import com.nb.web.api.feign.IPatientClient;
@@ -243,7 +246,21 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
             patient.setTenantId(tenantId);
             patient.setCode(patientCode);
             patient.setOriginCode(patientCode);
+            patient.setId(IdWorker.getIdStr());
+
+            BusClinicEntity clinic=new BusClinicEntity();
+            clinic.setPatientId(patient.getId());
+            clinic.setId(IdWorker.getIdStr());
+            clinic.setPatientCode(patientCode);
+            clinic.setPatientId(patient.getId());
+            clinic.setTenantId(tenantId);
+            clinic.setMonitorType(true);
+            clinic.setMonitorStartTime(new Date());
+
+            patient.setClinicId(clinic.getId());
+
             this.save(patient);
+            clinicService.save(clinic);
         }
         return patient;
     }
@@ -478,17 +495,17 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
         BusClinicEntity clinic = clinicService.getById(patient.getClinicId());
         String infusionId=patient.getInfusionId();
 
-        BusInfusionHistoryEntity infusion =infusionService.getById(infusionId);
+        BusInfusionHistoryEntity infusion =null;
 
+        if(StrUtil.isNotEmpty(infusionId)){
+            infusion=infusionService.getById(infusionId);
+        }
         if(infusion!=null){
-            Optional.ofNullable(deviceService.getByDeviceId(infusion.getDeviceId()))
-                    .map(device-> {
-                        //填充泵别名
-                        infusion.setAlias(device.getAlias());
-                        return device;
-                    });
+            BusDeviceEntity device = deviceService.getByDeviceId(infusion.getDeviceId());
+            if(device!=null){
+                infusion.setAlias(device.getAlias());
+            }
         }
-
         clinic.setPatientCode(patient.getCode());
 
         result.setInfusion(infusion);