Просмотр исходного кода

创建光疗仪项目,添加临床表

zhouzeyu 2 недель назад
Родитель
Сommit
f981e97722
20 измененных файлов с 857 добавлено и 226 удалено
  1. 17 0
      tr-dependencies/pom.xml
  2. 2 1
      tr-modules/pom.xml
  3. 0 163
      tr-modules/tr-module-system/src/main/resources/application.yml
  4. 0 56
      tr-modules/tr-module-system/src/main/resources/log4j2.xml
  5. 111 0
      tr-modules/tr-modules-phototherapy/pom.xml
  6. 45 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttConfiguration.java
  7. 75 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttInboundConfiguration.java
  8. 58 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttOutBoundConfiguration.java
  9. 71 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/controller/BusClinicController.java
  10. 68 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/dto/BusClinicDTO.java
  11. 55 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/dto/BusClinicQueryDTO.java
  12. 32 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/handle/ReceiverMessageHandler.java
  13. 27 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/mapper/BusClinicMapper.java
  14. 77 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/po/BusClinicPO.java
  15. 25 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/properties/MqttProperties.java
  16. 17 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/repository/BusClinicRepository.java
  17. 55 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/service/IBusClinicService.java
  18. 106 0
      tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/service/impl/BusClinicServiceImpl.java
  19. 1 1
      tr-test/.flattened-pom.xml
  20. 15 5
      tr-test/src/main/resources/application.yml

+ 17 - 0
tr-dependencies/pom.xml

@@ -58,6 +58,9 @@
         <langchain4j.version>1.8.0-beta15</langchain4j.version>
         <kuaishou.version>1.0.6</kuaishou.version>
         <httpclient.version>4.5.13</httpclient.version>
+
+        <spring-integration.version>6.2.4</spring-integration.version>
+        <fastjson.version>1.2.83</fastjson.version>
     </properties>
 
 
@@ -482,6 +485,20 @@
                 <artifactId>kwai-open-sdk</artifactId>
                 <version>${kuaishou.version}</version>
             </dependency>
+
+            <!--mqtt java客户端依赖-->
+            <dependency>
+                <groupId>org.springframework.integration</groupId>
+                <artifactId>spring-integration-mqtt</artifactId>
+                <version>${spring-integration.version}</version>
+            </dependency>
+
+            <!-- fastJson依赖 -->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 </project>

+ 2 - 1
tr-modules/pom.xml

@@ -15,7 +15,8 @@
     <modules>
         <module>tr-module-system</module>
         <module>tr-module-export</module>
-<!--        <module>tr-module-ai</module>-->
+        <module>tr-modules-phototherapy</module>
+        <!--        <module>tr-module-ai</module>-->
 <!--        <module>tr-module-jgliu</module>-->
 <!--        <module>tr-module-platform</module>-->
     </modules>

+ 0 - 163
tr-modules/tr-module-system/src/main/resources/application.yml

@@ -1,163 +0,0 @@
-server:
-  shutdown: immediate
-  port: 8083
-  servlet:
-    context-path: /api
-spring:
-  lifecycle:
-    timeout-per-shutdown-phase: 10s
-  datasource:
-    type: com.zaxxer.hikari.HikariDataSource
-    driverClassName: org.postgresql.Driver
-    url: jdbc:postgresql://192.168.100.236:5632/hdis?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&useInformationSchema=true
-    username: root
-    password: A123456.
-    hikari:
-      minimum-idle: 5
-      maximum-pool-size: 20
-      connection-timeout: 5000
-      idle-timeout: 300000
-      max-lifetime: 600000
-      pool-name: HikariPool-1
-  data:
-    redis:
-      # Redis服务器地址
-      host: 192.168.100.32
-      # Redis服务器端口
-      port: 9736
-      # Redis数据库索引
-      database: 5
-      # Redis服务器密码(注意转义字符处理)
-      password: "6E6985E1F7CB40F24A\\."
-      # 连接超时时间
-      timeout: 30s
-      # 客户名称
-      client-name:
-      lettuce:
-        pool:
-          # 连接池中的最小空闲连接
-          min-idle: 16
-          # 连接池中的最大空闲连接
-          max-idle: 16
-          # 连接池的最大数据库连接数
-          max-active: 16
-          # 连接池最大阻塞等待时间(使用负值表示没有限制)
-          max-wait: -1ms
-        # 关闭超时时间
-        shutdown-timeout: 100ms
-  cache:
-    type: redis
-    redis:
-      # 缓存过期时间(7天)
-      time-to-live: 604800000
-      # 缓存键前缀
-      key-prefix: cache
-      # 是否使用键前缀
-      use-key-prefix: true
-      # 是否缓存空值
-      cache-null-values: true
-#mybatis配置
-mybatis-plus:
-  mapper-locations: classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml,classpath*:mapper/*/*.xml
-  configuration:
-    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
-  global-config:
-    db-config:
-      logic-delete-value: 1
-      logic-delete-field: deleted
-      logic-not-delete-value: 0
-
-
-tr:
-  storage:
-    previewUrl: https://exam.tuoren.com/onlinePreview?url=
-  oauth2:
-    psw:
-      client-id: 1234
-      client-secret: 7896
-  satoken:
-    enable: true
-    ignore-urls:
-      - /error
-      - /actuator/**
-      - /druid/**
-      - /*.html
-      - /**/*.html
-      - /swagger-resources/**
-      - /swagger-ui/**
-      - /v3/**
-      - /webjars/**
-  tenant:
-    ignore-tables:
-      - gen_config
-      - gen_basic
-      - sys_menu
-      - sys_role_menu
-      - sys_dict
-      - sys_dict_item
-      - sys_user_position
-#      租户模块
-      - sys_tenant
-      - sys_tenant_package
-      - sys_tenant_package_menu
-      - sys_user_role
-      - sys_portal_menu
-      - sys_user_portal
-#      短信模块
-      - sys_sms_temp
-      - sys_sms_channel
-      - sys_sms_log
-#      编号策略
-      - sys_numbering_strategy
-#      任务调度模块
-      - sys_job
-      - sys_job_log
-#      存储模块
-      - sys_storage_config
-      - sys_storage_file
-#      导入导出模块
-      - sys_export_sheet
-      - sys_export_row
-    enable: false
-sa-token:
-  is-read-header: true
-  # token名称 (同时也是cookie名称)
-  token-name: Authorization
-  # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
-  is-concurrent: true
-  # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
-  is-share: false
-  # 是否打开续签
-  auto-renew: true
-  # 是否输出操作日志
-  is-log: false
-  # 同一账号登录数量不做限制
-  max-login-count: -1
-  timeout: 86400
-logging:
-  config: classpath:log4j2.xml
-knife4j:
-  enable: false
-  production: false
-  basic:
-    enable: false
-  openapi:
-    title: 驼人基础设施功能开发文档
-    description: 该接口文档用于开发基础功能
-    contact:
-      name: lf
-    version: V2.0
-    license: Apache 2.0
-    group:
-      sys:
-        group-name: 系统管理
-        api-rule: package
-        api-rule-resources:
-          - cn.tr.module.sys
-          - cn.tr.module.excel
-          - cn.tr.module.gen.modular.basic.controller
-  setting:
-    enable-footer: false
-    enable-footer-custom: true
-    footer-custom-content: Apache License 2.0 | Copyright  2019-[驼人控股集团](https://www.tuoren.com/about/index.html)
-    enable-response-code: false

+ 0 - 56
tr-modules/tr-module-system/src/main/resources/log4j2.xml

@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN" shutdownHook="disable">
-    <Properties>
-        <Property name="LOG_DIR">./logs</Property>
-        <Property name="FILE_NAME">tr</Property>
-        <Property name="FILE_PATTERN">${FILE_NAME}-%d{yyyy-MM-dd}-%i.log.gz</Property>
-        <!-- 控制台彩色日志格式 -->
-        <Property name="CONSOLE_PATTERN">%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{[%t]}{magenta} %clr{%-5level}{highlight} %clr{%logger{36}}{cyan} - %msg%n</Property>
-        <!-- 文件日志格式 -->
-        <Property name="FILE_PATTERN_LAYOUT">%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</Property>
-    </Properties>
-
-    <Appenders>
-        <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout
-                    pattern="%style{%d{yyyy-MM-dd hh:mm:ss}}{cyan} %highlight{%-5level}{ERROR=red, WARN=yellow, INFO=green, DEBUG=blue} %style{[%t]}{magenta} %logger{36} - %msg%n%throwable"
-                    disableAnsi="false" />
-        </Console>
-
-        <RollingFile name="RollingFile"
-                     fileName="${LOG_DIR}/${FILE_NAME}.log"
-                     filePattern="${LOG_DIR}/$${date:yyyy-MM}/${FILE_PATTERN}">
-            <PatternLayout pattern="${FILE_PATTERN_LAYOUT}" />
-
-            <Policies>
-                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
-                <SizeBasedTriggeringPolicy size="100 MB"/>
-            </Policies>
-
-            <DefaultRolloverStrategy max="100">
-                <Delete basePath="${LOG_DIR}" maxDepth="2" followLinks="true">
-                    <IfFileName glob="**/*.log.gz" />
-                    <IfLastModified age="7d" />
-                </Delete>
-            </DefaultRolloverStrategy>
-        </RollingFile>
-    </Appenders>
-
-    <Loggers>
-        <!-- 添加更多特定包的日志控制 -->
-        <Logger name="org.springframework" level="INFO" additivity="false">
-            <AppenderRef ref="Console"/>
-            <AppenderRef ref="RollingFile"/>
-        </Logger>
-
-        <Logger name="com.baomidou.mybatisplus" level="WARN" additivity="false">
-            <AppenderRef ref="Console"/>
-            <AppenderRef ref="RollingFile"/>
-        </Logger>
-
-        <Root level="INFO">
-            <AppenderRef ref="Console"/>
-            <AppenderRef ref="RollingFile"/>
-        </Root>
-    </Loggers>
-</Configuration>

+ 111 - 0
tr-modules/tr-modules-phototherapy/pom.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>tr-modules</artifactId>
+        <groupId>cn.tr</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>tr-modules-phototherapy</artifactId>
+    <packaging>pom</packaging>
+    <version>${revisi on}</version>
+
+    <properties>
+        <maven.compiler.source>21</maven.compiler.source>
+        <maven.compiler.target>21</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-spring-boot-starter-plugin-mybatis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-spring-boot-starter-plugin-web</artifactId>
+            <version>${revision}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-spring-boot-starter-plugin-biz-tenant</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-module-system-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-module-export-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-spring-boot-starter-plugin-gen</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-system</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-http</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-mqtt</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+
+        <!--Quart定时任务-->
+        <dependency>
+            <groupId>cn.tr</groupId>
+            <artifactId>tr-spring-boot-starter-plugin-quartz</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>ch.qos.logback</groupId>
+                    <artifactId>logback-classic</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>cn.dev33</groupId>
+            <artifactId>sa-token-core</artifactId>
+            <version>1.44.0</version>
+            <scope>compile</scope>
+        </dependency>
+
+
+    </dependencies>
+
+</project>

+ 45 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttConfiguration.java

@@ -0,0 +1,45 @@
+package tr.cn.module.phototherapy.common.config;
+
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory;
+import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
+import tr.cn.module.phototherapy.common.properties.MqttProperties;
+
+/**
+ * @author zzy
+ * @version 1.0
+ * @description: TODO
+ * @date 2026/1/7 9:08
+ */
+@Configuration
+public class MqttConfiguration {
+
+    @Autowired
+    private MqttProperties mqttProperties;
+
+    /**
+     * 连接工厂配置
+     * @return
+     */
+    @Bean
+    public MqttPahoClientFactory mqttClientFactory() {
+        DefaultMqttPahoClientFactory mqttPahoClientFactory = new DefaultMqttPahoClientFactory();
+        //设置连接参数
+        MqttConnectOptions options  = new MqttConnectOptions();
+        //是否要创建一下新的连接
+        options.setCleanSession(true);
+        //设置用户名
+        options.setUserName(mqttProperties.getUsername());
+        //设置密码需要字符数组,转换成字符数组
+        options.setPassword(mqttProperties.getPassword().toCharArray());
+        //设置连接的URL 需要字符数据 转换成字符数组
+        options.setServerURIs(new String[]{mqttProperties.getUrl()});
+        mqttPahoClientFactory.setConnectionOptions(options);
+        return mqttPahoClientFactory;
+
+    }
+
+}

+ 75 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttInboundConfiguration.java

@@ -0,0 +1,75 @@
+package tr.cn.module.phototherapy.common.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.core.MessageProducer;
+import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
+import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
+import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.MessageHandler;
+import tr.cn.module.phototherapy.common.handle.ReceiverMessageHandler;
+import tr.cn.module.phototherapy.common.properties.MqttProperties;
+
+/**
+ * @author zzy
+ * @version 1.0
+ * @description: 订阅接收消息的通道
+ * @date 2026/1/7 10:10
+ */
+@Configuration
+public class MqttInboundConfiguration {
+
+    @Autowired
+    private MqttProperties mqttProperties;
+
+    //连接工厂
+    @Autowired
+    private MqttPahoClientFactory mqttClientFactory;
+
+    @Autowired
+    private ReceiverMessageHandler receiverMessageHandler;
+
+    //配置消息通道 进行消息传输
+    @Bean
+    public MessageChannel mqttInboundChannel() {
+        return new DirectChannel();
+    }
+
+    //配置入站设备器  作用 设置订阅主题,指定消息的相关属性
+    @Bean
+    public MessageProducer messageProducer() {
+        //MqttPahoMessageDrivenChannelAdapter(String url, String clientId, MqttPahoClientFactory clientFactory,
+        //			String... topic)
+        MqttPahoMessageDrivenChannelAdapter messageProducer =
+                new MqttPahoMessageDrivenChannelAdapter(
+                        mqttProperties.getUrl(),
+                        mqttProperties.getSubClientId(),
+                        mqttClientFactory,
+                        mqttProperties.getSubTopic()
+                        //多个主题可以进行逗号切割
+//                        mqttConfigurationProperties.getSubTopic().split(",")
+                );
+
+        //设置消息质量等级
+        messageProducer.setQos(1);
+        //设置消息转换器
+        messageProducer.setConverter(new DefaultPahoMessageConverter());
+        //设置消息通道
+        messageProducer.setOutputChannel(mqttInboundChannel());
+
+        return messageProducer;
+    }
+
+    //配置消息转换器
+    @Bean
+    @ServiceActivator(inputChannel = "mqttInboundChannel") //指定消息通道
+    public MessageHandler messageHandler() {
+        return receiverMessageHandler;
+    }
+
+
+}

+ 58 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/config/MqttOutBoundConfiguration.java

@@ -0,0 +1,58 @@
+package tr.cn.module.phototherapy.common.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
+import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.MessageHandler;
+import tr.cn.module.phototherapy.common.properties.MqttProperties;
+
+/**
+ * @author zzy
+ * @version 1.0
+ * @description: 发送消息第一步配置出站消息处理器
+ * @date 2026/1/7 10:41
+ */
+@Configuration
+public class MqttOutBoundConfiguration {
+
+    @Autowired
+    private MqttProperties mqttProperties;
+
+    @Autowired
+    private MqttPahoClientFactory mqttClientFactory;
+
+
+    //配置消息发送通道 实现消息的传输
+    @Bean
+    public MessageChannel mqttOutboundChannel() {
+        return new DirectChannel();
+    }
+
+    //配置出站消息处理器
+    @Bean
+    @ServiceActivator(inputChannel = "mqttOutboundChannel")//指定处理器处理那个通道的消息
+    public MessageHandler mqttOutboundMessageHandler() {
+        //String url, String clientId, MqttPahoClientFactory clientFactory
+        MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(
+                mqttProperties.getUrl(),
+                mqttProperties.getPubClientId(),
+                mqttClientFactory
+        );
+        //设置默认消息等级
+        messageHandler.setDefaultQos(0);
+        //设置默认的消息名称
+        messageHandler.setDefaultTopic("default");
+        //设置异步发送方式
+        messageHandler.setAsync(true);
+
+        return messageHandler;
+
+    }
+
+
+}

+ 71 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/controller/BusClinicController.java

@@ -0,0 +1,71 @@
+package tr.cn.module.phototherapy.common.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.tr.core.validation.Insert;
+import cn.tr.core.validation.Update;
+import cn.tr.core.pojo.CommonResult;
+import lombok.AllArgsConstructor;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+import tr.cn.module.phototherapy.common.dto.BusClinicDTO;
+import tr.cn.module.phototherapy.common.service.IBusClinicService;
+import tr.cn.module.phototherapy.common.dto.BusClinicQueryDTO;
+import java.util.*;
+import cn.tr.core.context.BaseController;
+import org.springframework.web.bind.annotation.*;
+import cn.tr.core.pojo.TableDataInfo;
+
+/**
+ * 临床表控制器
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ */
+@Tag(name = "临床表")
+@RestController
+@RequestMapping("/clinic")
+@AllArgsConstructor
+public class BusClinicController extends BaseController{
+
+    private final IBusClinicService busClinicService;
+
+    @Operation(summary = "根据条件查询临床表", description = "权限: 无")
+    @PostMapping("/query/page")
+    public TableDataInfo<BusClinicDTO> selectList(@RequestBody BusClinicQueryDTO query) {
+        startPage();
+        return getDataTable(busClinicService.selectBusClinicList(query));
+    }
+
+    @Operation(summary = "根据id查询临床表", description = "权限: phototherapy:clinic:query")
+    @GetMapping("/detail/{id}")
+    @SaCheckPermission("phototherapy:clinic:query")
+    public CommonResult<BusClinicDTO> findById(@PathVariable("id") String id){
+        return CommonResult.success(busClinicService.selectBusClinicById(id));
+    }
+
+    @Operation(summary = "添加临床表", description = "权限: phototherapy:clinic:add")
+    @PostMapping("/add")
+    @SaCheckPermission("phototherapy:clinic:add")
+    public CommonResult<Boolean> add(@RequestBody@Validated(Insert.class) BusClinicDTO source) {
+        return CommonResult.success(busClinicService.insertBusClinic(source));
+    }
+
+    @Operation(summary = "通过主键id编辑临床表", description = "权限: phototherapy:clinic:edit")
+    @PostMapping("/edit")
+    @SaCheckPermission("phototherapy:clinic:edit")
+    public CommonResult<Boolean> edit(@RequestBody@Validated(Update.class) BusClinicDTO source) {
+        return CommonResult.success(busClinicService.updateBusClinicById(source));
+    }
+
+    @Operation(summary = "删除临床表", description = "权限: phototherapy:clinic:remove")
+    @PostMapping("/removeByIds")
+    @SaCheckPermission("phototherapy:clinic:remove")
+    public CommonResult<Integer> delete(@RequestBody Collection<String> ids) {
+        return CommonResult.success(busClinicService.removeBusClinicByIds(ids));
+    }
+}

+ 68 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/dto/BusClinicDTO.java

@@ -0,0 +1,68 @@
+package tr.cn.module.phototherapy.common.dto;
+
+import cn.tr.core.pojo.BaseDTO;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import cn.tr.core.validation.Insert;
+import cn.tr.core.validation.Update;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import java.time.LocalDateTime;
+
+/**
+ * 临床表传输对象
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Data
+@Schema(description = "临床表传输对象")
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class BusClinicDTO extends BaseDTO  {
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "主键")
+    @NotBlank(message = "主键不能为空", groups = {Update.class})
+    private String id;
+
+    @Schema(description = "关联患者表主键")
+    @NotBlank(message = "关联患者表主键不能为空", groups = {Update.class, Insert.class})
+    private String patientId;
+
+    @Schema(description = "负责医生id")
+    @NotBlank(message = "负责医生id不能为空", groups = {Update.class, Insert.class})
+    private String userId;
+
+    @Schema(description = "患者上次治疗时间")
+    @NotNull(message = "患者上次治疗时间不能为空", groups = {Update.class, Insert.class})
+    private LocalDateTime lastTreatmentTime;
+
+    @Schema(description = "关联治疗方案表(当前阶段)")
+    @NotBlank(message = "关联治疗方案表(当前阶段)不能为空", groups = {Update.class, Insert.class})
+    private String therapyPlanId;
+
+    @Schema(description = "患者姓名")
+    private String patientName;
+
+    @Schema(description = "患者年龄")
+    private Integer patentAge;
+
+    @Schema(description = "患者性别(0女 1男 2未知)")
+    private Integer patientGender;
+
+    @Schema(description = "患者联系电话")
+    private String patentPhone;
+
+    @Schema(description = "患者地址")
+    private String patientAddress;
+
+    @Schema(description = "设备id")
+    @NotBlank(message = "设备id不能为空", groups = {Update.class, Insert.class})
+    private String deviceId;
+
+    @Schema(description = "治疗记录id")
+    private String therapyId;
+}

+ 55 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/dto/BusClinicQueryDTO.java

@@ -0,0 +1,55 @@
+package tr.cn.module.phototherapy.common.dto;
+
+import lombok.ToString;
+import lombok.Data;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.io.Serializable;
+
+/**
+ * 临床表查询参数
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Data
+@Schema(description = "临床表查询参数")
+@ToString
+public class BusClinicQueryDTO  implements Serializable{
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "主键")
+    private String id;
+
+    @Schema(description = "关联患者表主键")
+    private String patientId;
+
+    @Schema(description = "负责医生id")
+    private String userId;
+
+    @Schema(description = "患者上次治疗时间")
+    private java.time.LocalDateTime lastTreatmentTime;
+
+    @Schema(description = "关联治疗方案表(当前阶段)")
+    private String therapyPlanId;
+
+    @Schema(description = "患者姓名")
+    private String patientName;
+
+    @Schema(description = "患者年龄")
+    private Integer patentAge;
+
+    @Schema(description = "患者性别(0女 1男 2未知)")
+    private Integer patientGender;
+
+    @Schema(description = "患者联系电话")
+    private String patentPhone;
+
+    @Schema(description = "患者地址")
+    private String patientAddress;
+
+    @Schema(description = "设备id")
+    private String deviceId;
+
+    @Schema(description = "治疗记录id")
+    private String therapyId;
+}

+ 32 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/handle/ReceiverMessageHandler.java

@@ -0,0 +1,32 @@
+package tr.cn.module.phototherapy.common.handle;
+
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.messaging.MessageHeaders;
+import org.springframework.messaging.MessagingException;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zzy
+ * @version 1.0
+ * @description: 消息处理器
+ * @date 2026/1/7 10:26
+ */
+@Component
+public class ReceiverMessageHandler implements MessageHandler {
+
+
+    //如果主题里面有消息了,就会出发这个方法handleMessage
+    @Override
+    public void handleMessage(Message<?> message) throws MessagingException {
+        //触发这个方法就可以在message中获取到消息
+        String payload = message.getPayload().toString();
+        MessageHeaders headers = message.getHeaders();
+        String topicName = headers.get("mqtt_receivedTopic").toString();
+//        if (mqttProperties.getSubTopic().equals(topicName)){
+//            tbLampService.updateLampOnlineStatus(payload);
+//        }
+
+
+    }
+}

+ 27 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/mapper/BusClinicMapper.java

@@ -0,0 +1,27 @@
+package tr.cn.module.phototherapy.common.mapper;
+
+import tr.cn.module.phototherapy.common.po.BusClinicPO;
+import tr.cn.module.phototherapy.common.dto.BusClinicDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+import java.util.List;
+
+/**
+* 临床表映射工具
+*
+* @author CodeGenerator
+* @date 2026-01-12
+**/
+@Mapper
+public interface BusClinicMapper {
+    BusClinicMapper INSTANCE = Mappers.getMapper(BusClinicMapper.class);
+
+    BusClinicPO convertPO(BusClinicDTO source);
+
+    BusClinicDTO convertDto(BusClinicPO source);
+
+    List<BusClinicDTO> convertDtoList(List<BusClinicPO> source);
+
+    List<BusClinicPO> convertPOList(List<BusClinicDTO> source);
+}

+ 77 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/po/BusClinicPO.java

@@ -0,0 +1,77 @@
+package tr.cn.module.phototherapy.common.po;
+
+import cn.tr.core.pojo.TenantPO;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 临床表实体
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Data
+@TableName(value = "bus_clinic", autoResultMap = true)
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class BusClinicPO extends TenantPO {
+
+    /** 主键 */
+    @TableId
+    @Schema(description = "主键")
+    private String id;
+
+    /** 关联患者表主键 */
+    @Schema(description = "关联患者表主键")
+    private String patientId;
+
+    /** 负责医生id */
+    @Schema(description = "负责医生id")
+    private String userId;
+
+    /** 患者上次治疗时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "患者上次治疗时间")
+    private LocalDateTime lastTreatmentTime;
+
+    /** 关联治疗方案表(当前阶段) */
+    @Schema(description = "关联治疗方案表(当前阶段)")
+    private String therapyPlanId;
+
+    /** 患者姓名 */
+    @Schema(description = "患者姓名")
+    private String patientName;
+
+    /** 患者年龄 */
+    @Schema(description = "患者年龄")
+    private Integer patentAge;
+
+    /** 患者性别(0女 1男 2未知) */
+    @Schema(description = "患者性别(0女 1男 2未知)")
+    private Integer patientGender;
+
+    /** 患者联系电话 */
+    @Schema(description = "患者联系电话")
+    private String patentPhone;
+
+    /** 患者地址 */
+    @Schema(description = "患者地址")
+    private String patientAddress;
+
+    /** 设备id */
+    @Schema(description = "设备id")
+    private String deviceId;
+
+    /** 治疗记录id */
+    @Schema(description = "治疗记录id")
+    private String therapyId;
+}

+ 25 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/properties/MqttProperties.java

@@ -0,0 +1,25 @@
+package tr.cn.module.phototherapy.common.properties;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zzy
+ * @version 1.0
+ * @description: TODO
+ * @date 2026/1/7 9:03
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "spring.mqtt")
+public class MqttProperties {
+    private String username;
+    private String password;
+    private String url;
+    private String subClientId;
+    private String pubClientId;
+    private String subTopic;
+
+
+}

+ 17 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/repository/BusClinicRepository.java

@@ -0,0 +1,17 @@
+package tr.cn.module.phototherapy.common.repository;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import java.util.*;
+import tr.cn.module.phototherapy.common.po.BusClinicPO;
+
+/**
+ * 临床表Mapper接口
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Mapper
+public interface BusClinicRepository extends BaseMapper<BusClinicPO> {
+}

+ 55 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/service/IBusClinicService.java

@@ -0,0 +1,55 @@
+package tr.cn.module.phototherapy.common.service;
+
+import tr.cn.module.phototherapy.common.dto.BusClinicDTO;
+import tr.cn.module.phototherapy.common.dto.BusClinicQueryDTO;
+import java.util.*;
+import java.util.Collection;
+
+/**
+ * 临床表Service接口
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+public interface IBusClinicService{
+
+    /**
+     * 根据条件查询临床表
+     * @param    query 查询参数
+     * @author   CodeGenerator
+     * @date     2026-01-12
+     */
+    List<BusClinicDTO> selectBusClinicList(BusClinicQueryDTO query);
+
+    /**
+     * 根据id查询临床表
+     * @param    id 主键id
+     * @author   CodeGenerator
+     * @date     2026-01-12
+     */
+    BusClinicDTO selectBusClinicById(String id);
+
+    /**
+     * 编辑临床表
+     * @param   source 编辑实体类
+     * @author  CodeGenerator
+     * @date    2026-01-12
+     */
+    boolean updateBusClinicById(BusClinicDTO source);
+
+    /**
+     * 新增临床表
+     * @param   source 新增实体类
+     * @author CodeGenerator
+     * @date 2026-01-12
+     */
+    boolean insertBusClinic(BusClinicDTO source);
+
+    /**
+     * 删除临床表详情
+     * @param  ids 删除主键集合
+     * @author CodeGenerator
+     * @date   2026-01-12
+     */
+    int removeBusClinicByIds(Collection<String> ids);
+}

+ 106 - 0
tr-modules/tr-modules-phototherapy/src/main/java/tr/cn/module/phototherapy/common/service/impl/BusClinicServiceImpl.java

@@ -0,0 +1,106 @@
+package tr.cn.module.phototherapy.common.service.impl;
+
+import org.springframework.stereotype.Service;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import org.springframework.transaction.annotation.Transactional;
+import cn.tr.core.exception.ServiceException;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import tr.cn.module.phototherapy.common.repository.BusClinicRepository;
+import tr.cn.module.phototherapy.common.po.BusClinicPO;
+import tr.cn.module.phototherapy.common.dto.BusClinicDTO;
+import tr.cn.module.phototherapy.common.dto.BusClinicQueryDTO;
+import java.util.*;
+import tr.cn.module.phototherapy.common.service.IBusClinicService;
+import tr.cn.module.phototherapy.common.mapper.BusClinicMapper;
+import jakarta.annotation.Resource;
+import cn.tr.core.exception.TRExcCode;
+
+/**
+ * 临床表Service接口实现类
+ *
+ * @author CodeGenerator
+ * @date 2026-01-12
+ **/
+@Service
+public class BusClinicServiceImpl implements IBusClinicService {
+    @Resource
+    private BusClinicRepository baseRepository;
+
+
+    /**
+    * 根据条件查询临床表
+    * @param    query 查询参数
+    * @author   CodeGenerator
+    * @date     2026-01-12
+    */
+    @Override
+    public List<BusClinicDTO> selectBusClinicList(BusClinicQueryDTO query){
+        return BusClinicMapper.INSTANCE.convertDtoList(
+                baseRepository.selectList(new LambdaQueryWrapper<BusClinicPO>()
+                    .eq(ObjectUtil.isNotNull(query.getId()), BusClinicPO::getId, query.getId())
+                    .eq(ObjectUtil.isNotNull(query.getPatientId()), BusClinicPO::getPatientId, query.getPatientId())
+                    .eq(ObjectUtil.isNotNull(query.getUserId()), BusClinicPO::getUserId, query.getUserId())
+                    .eq(ObjectUtil.isNotNull(query.getLastTreatmentTime()), BusClinicPO::getLastTreatmentTime, query.getLastTreatmentTime())
+                    .eq(ObjectUtil.isNotNull(query.getTherapyPlanId()), BusClinicPO::getTherapyPlanId, query.getTherapyPlanId())
+                    .like(ObjectUtil.isNotNull(query.getPatientName()), BusClinicPO::getPatientName, query.getPatientName())
+                    .eq(ObjectUtil.isNotNull(query.getPatentAge()), BusClinicPO::getPatentAge, query.getPatentAge())
+                    .eq(ObjectUtil.isNotNull(query.getPatientGender()), BusClinicPO::getPatientGender, query.getPatientGender())
+                    .like(ObjectUtil.isNotNull(query.getPatentPhone()), BusClinicPO::getPatentPhone, query.getPatentPhone())
+                    .like(ObjectUtil.isNotNull(query.getPatientAddress()), BusClinicPO::getPatientAddress, query.getPatientAddress())
+                    .eq(ObjectUtil.isNotNull(query.getDeviceId()), BusClinicPO::getDeviceId, query.getDeviceId())
+                    .eq(ObjectUtil.isNotNull(query.getTherapyId()), BusClinicPO::getTherapyId, query.getTherapyId())
+                )
+        );
+    };
+
+    /**
+    * 根据id查询临床表
+    * @param    id 主键id
+    * @author   CodeGenerator
+    * @date     2026-01-12
+    */
+    @Override
+    public BusClinicDTO selectBusClinicById(String id){
+        return BusClinicMapper.INSTANCE.convertDto(baseRepository.selectById(id));
+    };
+
+    /**
+    * 编辑临床表
+    * @param   source 编辑实体类
+    * @author  CodeGenerator
+    * @date    2026-01-12
+    */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean updateBusClinicById(BusClinicDTO source){
+            return baseRepository.updateById(BusClinicMapper.INSTANCE.convertPO(source))!=0;
+    };
+
+    /**
+    * 新增临床表
+    * @param   source 新增实体类
+    * @author CodeGenerator
+    * @date 2026-01-12
+    */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean insertBusClinic(BusClinicDTO source){
+        return baseRepository.insert(BusClinicMapper.INSTANCE.convertPO(source))!=0;
+    };
+
+    /**
+    * 删除临床表详情
+    * @param  ids 删除主键集合
+    * @author CodeGenerator
+    * @date   2026-01-12
+    */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int removeBusClinicByIds(Collection<String> ids){
+        if(CollectionUtil.isEmpty(ids)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"请选择要删除的数据");
+        }
+        return baseRepository.deleteByIds(ids);
+    };
+}

+ 1 - 1
tr-test/.flattened-pom.xml

@@ -4,7 +4,7 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>cn.tr</groupId>
-    <artifactId>tr-footstone</artifactId>
+    <artifactId>phototherapy</artifactId>
     <version>2.0.0</version>
   </parent>
   <groupId>cn.tr</groupId>

+ 15 - 5
tr-test/src/main/resources/application.yml

@@ -9,9 +9,9 @@ spring:
   datasource:
     type: com.zaxxer.hikari.HikariDataSource
     driverClassName: org.postgresql.Driver
-    url: jdbc:postgresql://47.116.169.131:35432/jgliu?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&useInformationSchema=true&stringtype=unspecified
+    url: jdbc:postgresql://172.31.18.78:5432/phototherapy?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&useInformationSchema=true&stringtype=unspecified
     username: postgres
-    password: PhZ7mNWmwW4SiB3b
+    password: Qwepostgres
     hikari:
       minimum-idle: 5
       maximum-pool-size: 20
@@ -22,13 +22,13 @@ spring:
   data:
     redis:
       # 地址
-      host: 47.116.169.131
+      host: 192.168.100.102
       # 端口,默认为6379
-      port: 26739
+      port: 6379
       # 数据库索引
       database: 0
       # 密码
-      password: XjJYriDjFnr5mrCk
+      password: foobared
       # 连接超时时间
       timeout: 30s
       # 客户端名称
@@ -58,6 +58,16 @@ spring:
       cache-null-values: true
   profiles:
     active: flyway,sys
+
+#MQTT配置
+    mqtt:
+      username: admin
+      password: tr123456.
+      url: tcp://192.168.100.102:1883
+      subClientId: sub_client_id_123
+      subTopic: atguigu/iot/lamp/line
+      pubClientId: pub_client_id_123
+
 #mybatis配置
 mybatis-plus:
   mapper-locations: classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml,classpath*:mapper/*/*.xml