Ver código fonte

Merge branch 'dev' into nb-pc-rabbitmq

# Conflicts:
#	nb-service/web-service/src/main/java/com/nb/web/service/bus/hospital/HospitalManager.java
18339543638 3 anos atrás
pai
commit
6ecb4a9f09

+ 5 - 0
nb-service/iot-service/pom.xml

@@ -22,6 +22,11 @@
             <version>1.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.tuoren</groupId>
+            <artifactId>mq-common</artifactId>
+            <version>1.0</version>
+        </dependency>
         <dependency>
             <groupId>com.tuoren</groupId>
             <artifactId>web-service-api</artifactId>

+ 51 - 21
nb-service/iot-service/src/main/java/com/nb/mq/entity/PcAnalgesicScoreEntity.java

@@ -1,21 +1,18 @@
 package com.nb.mq.entity;
 
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.math.BigDecimal;
 import java.io.Serializable;
-import io.swagger.annotations.ApiModel;
+import java.util.Date;
+
+import com.nb.web.api.entity.BusEvaluationEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  *
- * 
+ *
  * </p>
  *
  * @author fanfan
@@ -23,15 +20,11 @@ import lombok.experimental.Accessors;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@TableName("bus_analgesic_score")
-@ApiModel(value="BusAnalgesicScoreEntity对象", description="")
 public class PcAnalgesicScoreEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
     @ApiModelProperty(value = "主键",hidden = true)
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     @ApiModelProperty(value = "病人ID")
@@ -98,13 +91,13 @@ public class PcAnalgesicScoreEntity implements Serializable {
     private Integer satisfaction;
 
     @ApiModelProperty(value = "创建时间",hidden = true)
-    private LocalDateTime gmtCreate;
+    private Date gmtCreate;
 
     @ApiModelProperty(value = "更新时间",hidden = true)
-    private LocalDateTime gmtModified;
+    private Date gmtModified;
 
     @ApiModelProperty(value = "评价时间",hidden = true)
-    private LocalDateTime followDate;
+    private Date followDate;
 
     @ApiModelProperty(value = "评价人")
     private String creator;
@@ -113,22 +106,59 @@ public class PcAnalgesicScoreEntity implements Serializable {
     private String productCode;
 
     @ApiModelProperty(value = "评价传输ID",hidden = true)
-    @TableField(exist = false)
     private String analgesicScoreId;
 
     @ApiModelProperty(value = "收缩压")
-    private String  SBP;
+    private BigDecimal SBP;
 
 
     @ApiModelProperty(value = "舒张压")
-    private String  DBP;
+    private BigDecimal  DBP;
 
     @ApiModelProperty(value = "心率")
-    private String HR;
+    private BigDecimal HR;
 
     @ApiModelProperty(value = "呼吸频率")
-    private String RR;
+    private BigDecimal RR;
 
     @ApiModelProperty(value = "血氧饱和度")
-    private String SpO2;
+    private BigDecimal SpO2;
+
+
+    public BusEvaluationEntity toEval(String patientId,String deviceId,String infusionId,String clinicId){
+        BusEvaluationEntity result = new BusEvaluationEntity();
+        result.setPatientId(patientId);
+        result.setInfusionId(infusionId);
+        result.setClinicId(clinicId);
+        result.setDeviceId(deviceId);
+
+
+        result.setPatientCode(this.getPatientCode());
+        result.setStatics(this.getStatics());
+        result.setActivity(this.getActivity());
+        result.setCalm(this.getCalm());
+        result.setLeftArm(this.getLeftArm());
+        result.setLeftLeg(this.getLeftLeg());
+        result.setRightArm(this.getRightArm());
+        result.setRightLeg(this.getRightLeg());
+        result.setNauseaVomit(this.getNauseaVomit());
+        result.setItch(this.getItch());
+        result.setVertigo(this.getVertigo());
+        result.setSoreThroat(this.getSoreThroat());
+        result.setUroschesis(this.getUroschesis());
+        result.setBreathDepression(this.getBreathDepression());
+        result.setHoarseness(this.getHoarseness());
+        result.setCognitionObstacle(this.getCognitionObstacle());
+        result.setOther(this.getOther());
+        result.setSatisfaction(this.getSatisfaction());
+        result.setEvaluateTime(this.getFollowDate());
+        result.setEvaluator(this.getCreator());
+        result.setShrinkPressure(this.getSBP());
+        result.setDiastensPressure(this.getDBP());
+        result.setHeartRate(this.getHR());
+        //todo 没有胎心
+        result.setBreathRate(this.getRR());
+        result.setBloodOxygenSaturation(this.getSpO2());
+        return result;
+    }
 }

+ 64 - 1
nb-service/iot-service/src/main/java/com/nb/mq/listener/RabbitMqListener.java

@@ -1,11 +1,74 @@
 package com.nb.mq.listener;
 
+import cn.hutool.json.JSONUtil;
+import com.nb.mq.entity.PcAnalgesicScoreEntity;
+import com.nb.mq.entity.PcPatientEntity;
+import com.nb.mq.entity.PcPumpEntity;
+import com.nb.web.api.feign.IClinicEvalClient;
+import com.nb.web.api.feign.IDeviceClient;
+import com.nb.web.api.feign.IIotMsgHandler;
+import com.nb.web.api.feign.IPatientClient;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.messaging.handler.annotation.Payload;
+import org.springframework.stereotype.Component;
+
 /**
  * @author lifang
  * @version 1.0.0
  * @ClassName RabbitMqListener.java
- * @Description TODO
+ * @Description
  * @createTime 2022年09月07日 13:40:00
  */
+@Component
+@Slf4j
+@AllArgsConstructor
 public class RabbitMqListener {
+    private final IIotMsgHandler iotMsgHandler;
+    private final  IDeviceClient deviceService;
+    private final IPatientClient patientClient;
+    private final IClinicEvalClient clinicEvalClient;
+    /**
+     * 描述: 监听病人队列
+     * @author lifang
+     * @date 2022/9/7 13:49
+     * @param body
+     * @return void
+     */
+    @RabbitListener(queuesToDeclare = @Queue("cloud.patient"))
+    public void patientQueue(@Payload String body) {
+        log.info("消息队列中,病人队列{cloud.patient},接受消息:{}",body);
+        PcPatientEntity source = JSONUtil.toBean(body, PcPatientEntity.class);
+
+    }
+
+    /**
+     * 描述: 监听网络泵队列
+     * @author lifang
+     * @date 2022/9/7 13:49
+     * @param body
+     * @return void
+     */
+    @RabbitListener(queuesToDeclare = @Queue("cloud.pump"))
+    public void pumpQueue(@Payload String body) {
+        log.info("消息队列中,网络泵队列{cloud.pump},接受消息:{}",body);
+        PcPumpEntity source = JSONUtil.toBean(body, PcPumpEntity.class);
+    }
+
+    /**
+     * 描述: 监听评分队列
+     * @author lifang
+     * @date 2022/9/7 13:49
+     * @param body
+     * @return void
+     */
+    @RabbitListener(queuesToDeclare = @Queue("cloud.analgesicScore"))
+    public void analgesicScoreQueue(@Payload String body) {
+        log.info("消息队列中,评分队列{cloud.analgesicScore},接受消息:{}",body);
+        PcAnalgesicScoreEntity source = JSONUtil.toBean(body, PcAnalgesicScoreEntity.class);
+
+    }
+
 }