18339543638 пре 4 месеци
родитељ
комит
690cc7f61e

+ 22 - 6
nb-admin/pom.xml

@@ -117,12 +117,28 @@
 
     <build>
         <finalName>${project.name}</finalName>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
+<!--        <resources>-->
+<!--            <resource>-->
+<!--                <directory>src/main/resources</directory>-->
+<!--                <filtering>true</filtering>-->
+<!--                <excludes>-->
+<!--                    <exclude>python/jython-standalone-2.7.1.jar</exclude>-->
+<!--                </excludes>-->
+<!--            </resource>-->
+<!--            <resource>-->
+<!--                <directory>src/main/resources</directory>-->
+<!--                <filtering>false</filtering>-->
+<!--                <includes>-->
+<!--                    <include>python/jython-standalone-2.7.1.jar</include>-->
+<!--                </includes>-->
+<!--            </resource>-->
+<!--        </resources>-->
+<!--        <resources>-->
+<!--            <resource>-->
+<!--                <directory>src/main/resources</directory>-->
+<!--                <filtering>true</filtering>-->
+<!--            </resource>-->
+<!--        </resources>-->
         <!--<pluginManagement>-->
             <plugins>
                 <plugin>

+ 8 - 23
nb-admin/src/main/resources/application-dev.yml

@@ -35,9 +35,9 @@ spring:
     password: 123456
     druid:
       # 初始连接数
-      initialSize: 5
+      initialSize: 16
       # 最小连接池数量
-      minIdle: 10
+      minIdle: 20
       # 最大连接池数量
       maxActive: 20
       # 配置获取连接等待超时的时间
@@ -57,27 +57,12 @@ spring:
         # 监控统计用的filter:stat
         # 日志用的filter:log4j2
         # 防御sql注入的filter:wall
-      filters: stat,wall,lo4j2 #log4j
-      webStatFilter:
-        enabled: true
-      statViewServlet:
-        enabled: true
-        # 设置白名单,不填则允许所有访问
-        allow:
-        url-pattern: /druid/*
-        # 控制台管理用户名和密码
-        login-username: tuoren
-        login-password: Tuoren123.
-      filter:
-        stat:
-          enabled: true
-          # 慢SQL记录
-          log-slow-sql: true
-          slow-sql-millis: 1000
-          merge-sql: true
-        wall:
-          config:
-            multi-statement-allow: true
+  rabbitmq:
+    host: 192.168.100.32
+    port: 5672
+    username: guest
+    password: guest
+    virtual-host: /
   # redis 配置
   redis:
     # 地址

+ 7 - 0
nb-admin/src/main/resources/application-prod.yml

@@ -114,6 +114,13 @@ spring:
         max-active: 16
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
+  rabbitmq:
+    #    host: 172.18.0.1
+    host: 39.99.215.130
+    port: 5672
+    username: tuoren
+    password: tuoren123
+    virtual-host: netpump
 request:
   check:
     enable: false

+ 1 - 6
nb-admin/src/main/resources/application.yml

@@ -92,9 +92,4 @@ captcha:
   height: 38
   #验证码过期时间 5min
 
-  expire: 300
-management:
-  endpoints:
-    web:
-      exposure:
-        include: heapdump,metrics
+  expire: 300

+ 1 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/feign/result/DoctorPatientMonitorResult.java

@@ -221,6 +221,7 @@ public class DoctorPatientMonitorResult implements Serializable {
     }
 
     public String getWarns() {
+        handleWarn();
         if (StrUtil.isNotEmpty(warns)) {
             return warns.endsWith(";")?warns.substring(0,warns.length()-1):warns;
         }

+ 2 - 5
nb-service-api/web-service-api/src/main/java/com/nb/web/api/feign/result/PatientMonitorResult.java

@@ -137,7 +137,6 @@ public class PatientMonitorResult implements Serializable {
     @ApiModelProperty(value = "智能泵参数-自调比例")
     private BigDecimal flowAdjustRate;
 
-
     @ApiModelProperty(value = "泵运行状态")
     private DeviceStatusEnum deviceRunState;
 
@@ -185,19 +184,15 @@ public class PatientMonitorResult implements Serializable {
     private Date evalTime;
 
     @ApiModelProperty(value = "输注即将结束提醒",hidden = true)
-    @JsonIgnore
     private Boolean warnWillFinished;
 
     @ApiModelProperty(value = "镇痛不足提醒",hidden = true)
-    @JsonIgnore
     private Boolean warnAnalgesicPoor;
 
     @ApiModelProperty(value = "电量偏低提醒",hidden = true)
-    @JsonIgnore
     private Boolean warnLowBattery;
 
     @ApiModelProperty(value = "加减档提示",accessMode = ApiModelProperty.AccessMode.READ_ONLY)
-    @JsonIgnore
     private FlowStatusEnum warnFlow;
 
     @ApiModelProperty(value = "管理类型",example = "0、院内管理 1、居家管理")
@@ -209,6 +204,8 @@ public class PatientMonitorResult implements Serializable {
     @ApiModelProperty("最后上传时间")
     private Date lastUploadTime;
 
+    @ApiModelProperty("医院编码")
+    private String hospitalCode;
 
     @ApiModelProperty("运行时电机的压力值")
     private Integer block1;

+ 0 - 2
nb-service/app-doctor/src/main/java/com/nb/app/doctor/controller/PatientMonitorController.java

@@ -43,11 +43,9 @@ import com.nb.web.service.bus.enums.AnaTypeEnum;
 import com.nb.web.service.bus.enums.ConstantEnum;
 import com.nb.web.service.bus.service.LocalBusDeviceHistoryService;
 import com.nb.web.service.bus.service.LocalBusInfusionHistoryService;
-import com.nb.web.service.bus.service.LocalBusInfusionModifyService;
 import com.nb.web.service.bus.service.LocalBusPatientService;
 import com.nb.web.service.bus.service.constant.AbstractConstantService;
 import com.nb.web.service.bus.service.constant.LocalBusConMixService;
-import com.nb.web.service.bus.service.dto.DeviceHistoryQuery;
 import com.nb.web.service.bus.service.dto.DeviceInfusionHistoryQuery;
 import com.nb.web.service.bus.service.dto.EditModifyQuery;
 import com.nb.web.service.bus.service.dto.ManualUndoConfig;

+ 4 - 0
nb-service/web-service/pom.xml

@@ -104,6 +104,10 @@
             <artifactId>app-assistant-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
 
     </dependencies>
 </project>

+ 9 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/constant/RabbitMQConstant.java

@@ -0,0 +1,9 @@
+package com.nb.web.service.bus.constant;
+
+
+public class RabbitMQConstant{
+    // 定义队列、交换机和路由键名称
+    public static final String TOPIC_EXCHANGE_NAME = "nb.exchange";
+
+    public static final String ROUTING_KEY_PATIENT_MONITOR = "patient.monitor";
+}

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

@@ -824,7 +824,7 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
                 result.setEvaluate(3);
             }else {
                 DateTime date = DateUtil.offset(result.getEvalTime(), DateField.MINUTE, interval);
-                result.setEvaluate(ObjectUtil.compare(date,now)>0?2:1);
+                result.setEvaluate(ObjectUtil.compare(date,now)<0?2:1);
             }
         }
         return results;

+ 29 - 6
nb-service/web-service/src/main/java/com/nb/web/service/bus/utils/WsPublishUtils.java

@@ -4,7 +4,7 @@ package com.nb.web.service.bus.utils;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-import com.nb.web.api.enums.PatientAlarmEnum;
+import com.nb.web.service.bus.constant.RabbitMQConstant;
 import com.nb.web.service.bus.mapper.BusPatientMapper;
 import com.nb.web.service.bus.service.LocalBusPatientService;
 import com.nb.web.service.bus.service.dto.MonitorStatusStatsCountResult;
@@ -12,9 +12,11 @@ import com.nb.web.api.feign.result.PatientMonitorResult;
 import com.nb.common.websocket.TopicMessage;
 import com.nb.common.websocket.WebSocketConstant;
 import com.nb.common.config.utils.RedissonUtil;
-import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.util.Assert;
 
@@ -29,13 +31,20 @@ import java.util.Collection;
  * @createTime 2022年05月07日 11:34:00
  */
 @Configuration
-@AllArgsConstructor
 @Slf4j
 public class WsPublishUtils implements Serializable{
-    private final LocalBusPatientService patientService;
-    private final BusPatientMapper patientMapper;
-    private final RedissonUtil redissonUtil;
+    @Autowired
+    private LocalBusPatientService patientService;
+    @Autowired
+    private BusPatientMapper patientMapper;
+    @Autowired
+    private RedissonUtil redissonUtil;
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
 
+    @Autowired
+    @Lazy
+    private WsPublishUtils self;
     private void publish(String topic,TopicMessage msg){
         redissonUtil.getTopic(topic).publishAsync(msg);
     }
@@ -56,14 +65,28 @@ public class WsPublishUtils implements Serializable{
         if (log.isDebugEnabled()) {
             log.debug("推送病号当前状态,【{}】",JSONUtil.toJsonStr(message));
         }
+        //输注消息 发送至消息队列
+
         if(message!=null){
             message.handleWarn();
             this.publish(WebSocketConstant.getPatientMonitor(null, patientId, tenantId).getTopic(),
                     TopicMessage.of(message,patientId)
             );
+            self.asyncSendPatientMonitorMessage(message);
         }
     }
 
+    @Async
+    public void asyncSendPatientMonitorMessage(Object message) {
+        String msg = JSONUtil.toJsonStr(message);
+        log.debug("发送患者监护信息到队列:  message={}", msg);
+        rabbitTemplate.convertAndSend(
+                RabbitMQConstant.TOPIC_EXCHANGE_NAME,
+                RabbitMQConstant.ROUTING_KEY_PATIENT_MONITOR,
+                msg
+        );
+    }
+
     @Async
     public void asyncPublishPatientMonitor(String patientId,String tenantId){
         this.publishPatientMonitor(patientId,tenantId);

+ 11 - 6
nb-service/web-service/src/main/resources/mapper/bus/BusPatientMapper.xml

@@ -347,7 +347,10 @@
                 </foreach>
             </if>
             <if test="query.timeRange != null and query.timeRange.size >0">
-                and monitor_start_time &gt;= #{query.timeRange[0]} and  monitor_start_time &lt;= #{query.timeRange[1]}
+                and monitor_start_time &gt;= #{query.timeRange[0]}
+            </if>
+            <if test="query.timeRange != null and query.timeRange.size >1">
+                and  monitor_start_time &lt;= #{query.timeRange[1]}
             </if>
             <if test="query.tenantId!=null">
                 and tenant_id=#{query.tenantId}
@@ -452,7 +455,8 @@
         c.surgery_name as surgery_name,
         c.ward as ward,
         c.bed_no as bed_no,
-        c.eval_time as eval_time
+        c.eval_time as eval_time,
+        bh.code as hospital_code
         from
         (select * from bus_patient
         <where>
@@ -469,6 +473,7 @@
         bus_infusion_history as i on p.infusion_id=i.id
         left join (select device_id,alias,product_no from bus_device) as d on d.device_id=i.device_id
         left join (select * from bus_clinic where monitor_type=1) c on p.clinic_id=c.id
+        left join bus_hospital as bh on bh.tenant_id=p.tenant_id
         limit 1
     </select>
 
@@ -670,14 +675,14 @@
 
             <!--无提醒-->
             <if test="query.warn != null and query.warn == false">
-                AND (i.warn_flow is null and i.warn_low_battery = 0 and i.warn_will_finished =0 and i.warn_analgesic_poor=0)
+                AND ((i.warn_flow is null or i.warn_flow = 0) and i.warn_low_battery = 0 and i.warn_will_finished =0 and i.warn_analgesic_poor=0)
             </if>
             <!--有提醒-->
             <if test="query.warn != null and query.warn == true">
-                AND (i.warn_flow = 1 or i.warn_low_battery = 1 or i.warn_will_finished=1 or i.warn_analgesic_poor=1)
+                AND ((i.warn_flow is not  null and i.warn_flow != 0) or i.warn_low_battery = 1 or i.warn_will_finished=1 or i.warn_analgesic_poor=1)
             </if>
 
-            <if test="query.timeRange != null and query.timeRange.size == 1">
+            <if test="query.timeRange != null and query.timeRange.size > 0">
                 AND c.monitor_start_time &gt;= #{query.timeRange[0]}
             </if>
             <!-- 时间区间查询 -->
@@ -690,7 +695,7 @@
             </if>
             <!-- 待评价 -->
             <if test="query.evaluate != null and query.evaluate  == 2">
-                and c.eval_time is not null and  DATE_ADD(c.eval_time,INTERVAL #{query.interval} MINUTE) &gt; NOW()
+                and c.eval_time is not null and  DATE_ADD(c.eval_time,INTERVAL #{query.interval} MINUTE) &lt; NOW()
             </if>
             <!-- 未评价 -->
             <if test="query.evaluate != null and query.evaluate  == 3">