diff --git a/docker/生产环境服务部署文档.md b/docker/生产环境服务部署文档.md index 2f423d81..d655b261 100644 --- a/docker/生产环境服务部署文档.md +++ b/docker/生产环境服务部署文档.md @@ -161,7 +161,7 @@ mv virtual-patient-bucket-prod /data/vp/minio/data # 验证镜像是否存在 docker images | grep virtual-patient-rasa-manager # 运行容器 - docker run --name virtual-patient-rasa-manager -p 8990:8890 -d virtual-patient-rasa-manager:1.0.0 + docker run --name virtual-patient-rasa-manager -p 8990:8890 -v /data/vp:/data/vp -d virtual-patient-rasa-manager:1.0.0 # **启用网络环境服务,生产环境请使用** docker run --name virtual-patient-rasa-manager -p 8990:8890 -v /data/vp:/data/vp --network virtual-patient-network -d virtual-patient-rasa-manager:1.0.0 --spring.profiles.active=prod # 验证容器运行 @@ -194,7 +194,7 @@ mv virtual-patient-bucket-prod /data/vp/minio/data # 验证镜像是否存在 docker images | grep virtual-patient-web # 运行容器 - docker run --name virtual-patient-web -p 8899:8899 -d virtual-patient-web + docker run --name virtual-patient-web -p 8899:8899 -v /data/vp:/data/vp -d virtual-patient-web # **启用网络环境服务,生产环境请使用** docker run --name virtual-patient-web -p 8899:8899 -v /data/vp:/data/vp --network virtual-patient-network -d virtual-patient-web:1.0.0 --spring.profiles.active=prod # 验证容器运行 @@ -227,7 +227,7 @@ mv virtual-patient-bucket-prod /data/vp/minio/data # 验证镜像是否存在 docker images | grep virtual-patient-manage # 运行容器 - docker run --name virtual-patient-manage -p 8891:8891 -d virtual-patient-manage:1.0.0 + docker run --name virtual-patient-manage -p 8891:8891 -v /data/vp:/data/vp -d virtual-patient-manage:1.0.0 # **启用网络环境服务,生产环境请使用** docker run --name virtual-patient-manage -p 8891:8891 -v /data/vp:/data/vp --network virtual-patient-network -d virtual-patient-manage:1.0.0 --spring.profiles.active=prod # 验证容器运行 @@ -260,7 +260,7 @@ mv virtual-patient-bucket-prod /data/vp/minio/data # 验证镜像是否存在 docker images | grep virtual-patient-graph # 运行容器 - docker run --name virtual-patient-graph -p 8892:8892 -d virtual-patient-graph:1.0.0 + docker run --name virtual-patient-graph -p 8892:8892 -v /data/vp:/data/vp -d virtual-patient-graph:1.0.0 # **启用网络环境服务,生产环境请使用** docker run --name virtual-patient-graph -p 8892:8892 -v /data/vp:/data/vp --network virtual-patient-network -d virtual-patient-manage:1.0.0 --spring.profiles.active=prod # 验证容器运行 @@ -288,7 +288,7 @@ mv virtual-patient-bucket-prod /data/vp/minio/data # 验证镜像是否存在 docker images | grep virtual-patient-nginx # 运行容器 - docker run --name virtual-patient-nginx -p 443:443 -d -e UPSTREAM_WEB_SERVERS={ip}:{port} -e UPSTREAM_MANAGE_SERVERS={ip}:{port} virtual-patient-nginx:1.0.0 + docker run --name virtual-patient-nginx -p 443:443 -v /data/vp/dist:/usr/share/nginx/html/dist -d -e UPSTREAM_WEB_SERVERS={ip}:{port} -e UPSTREAM_MANAGE_SERVERS={ip}:{port} virtual-patient-nginx:1.0.0 # UPSTREAM_WEB_SERVERS:虚拟病人问诊系统服务的ip:port # UPSTREAM_MANAGE_SERVERS:虚拟病人后端管理系统服务的ip:port diff --git a/virtual-patient-graph/pom.xml b/virtual-patient-graph/pom.xml index 11c19597..847186f2 100644 --- a/virtual-patient-graph/pom.xml +++ b/virtual-patient-graph/pom.xml @@ -20,6 +20,36 @@ + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba + fastjson + + + com.alibaba.nacos + nacos-common + + + + + + com.alibaba.nacos + nacos-common + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + org.nebula-contrib ngbatis @@ -83,4 +113,21 @@ + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + \ No newline at end of file diff --git a/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java b/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java index 35c473c3..10965b97 100644 --- a/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java +++ b/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java @@ -3,11 +3,13 @@ package com.supervision; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.scheduling.annotation.EnableScheduling; @EnableScheduling @SpringBootApplication(scanBasePackages = {"com.supervision", "org.nebula"}) @MapperScan(basePackages = {"com.supervision.**.mapper"}) +@EnableDiscoveryClient public class VirtualPatientGraphApplication { public static void main(String[] args) { diff --git a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java index bafce50c..b9fe54c7 100644 --- a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java +++ b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java @@ -247,6 +247,11 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { @Override public GraphVO queryGraph(String processId) { Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到对应的问诊流程")); + // 如果图谱ID为空,则创建图谱 + if (StrUtil.isEmpty(process.getGraphId())) { + creatGraphByNebula(processId); + process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到对应的问诊流程")); + } List> subgraphList = medicalRecDao.selectSubgraph(process.getGraphId()); List nodeList = new ArrayList<>(); diff --git a/virtual-patient-graph/src/main/resources/application-dev.yml b/virtual-patient-graph/src/main/resources/application-dev.yml deleted file mode 100644 index b3cc9b2f..00000000 --- a/virtual-patient-graph/src/main/resources/application-dev.yml +++ /dev/null @@ -1,105 +0,0 @@ -#服务器端口 -server: - port: 8897 - servlet: - context-path: /virtual-patient-graph - undertow: - # HTTP post内容的最大大小。当值为-1时,默认值为大小是无限的 - max-http-post-size: -1 - # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理 - # 每块buffer的空间大小,越小的空间被利用越充分 - buffer-size: 512 - # 是否分配的直接内存 - direct-buffers: true - -spring: - application: - name: virtual-patient-graph - servlet: - multipart: - max-file-size: 100MB - max-request-size: 100MB - ##数据源配置 - datasource: - type: com.alibaba.druid.pool.DruidDataSource - druid: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://192.168.10.137:3306/virtual_patient?useUnicode=true&characterEncoding=utf-8&useSSL=true&nullCatalogMeansCurrent=true&serverTimezone=GMT%2B8 - username: root - password: '123456' - initial-size: 5 # 初始化大小 - min-idle: 10 # 最小连接数 - max-active: 20 # 最大连接数 - max-wait: 60000 # 获取连接时的最大等待时间 - min-evictable-idle-time-millis: 300000 # 一个连接在池中最小生存的时间,单位是毫秒 - time-between-eviction-runs-millis: 60000 # 多久才进行一次检测需要关闭的空闲连接,单位是毫秒 - filters: stat,wall # 配置扩展插件:stat-监控统计,log4j-日志,wall-防火墙(防止SQL注入),去掉后,监控界面的sql无法统计 - validation-query: SELECT 1 # 检测连接是否有效的 SQL语句,为空时以下三个配置均无效 - test-on-borrow: true # 申请连接时执行validationQuery检测连接是否有效,默认true,开启后会降低性能 - test-on-return: true # 归还连接时执行validationQuery检测连接是否有效,默认false,开启后会降低性能 - test-while-idle: true # 申请连接时如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效,默认false,建议开启,不影响性能 - stat-view-servlet: - enabled: false # 是否开启 StatViewServlet - filter: - stat: - enabled: true # 是否开启 FilterStat,默认true - log-slow-sql: true # 是否开启 慢SQL 记录,默认false - slow-sql-millis: 5000 # 慢 SQL 的标准,默认 3000,单位:毫秒 - merge-sql: false # 合并多个连接池的监控数据,默认false - redis: - host: 192.168.10.138 - port: 6379 - password: 123456 - -nebula: - ngbatis: - use-session-pool: true - # 127.0.0.1:9669, ip:port, .... - hosts: 192.168.10.137:9669 - username: root - password: 123456 - # 注意,新建使用的时候,必须有一个库 - space: virtual_patient - # http客户端使用 - minConnSize: 5 - maxConnSize: 10 - timeout: 300000 - idleTime: 180000 - # ngbatis使用连接池配置 - pool-config: - # 连接池中最小空闲连接数 - min-conns-size: 0 - # 连接池中最大空闲连接数 - max-conns-size: 10 - # 客户端同服务端建立连接的超时时间设置,单位为 ms;超过设定时间未建立起连接,则报错 - timeout: 0 - # 连接空闲时间,为 0 表示连接永不删除,单位为 ms - idle-time: 0 - # 连接池检测空闲连接的时间间隔,为 -1 表示不进行检测 - interval-idle: -1 - # 连接等候时间,超过则不再等候连接 - wait-time: 0 - # 集群允许最小的服务可用率,1.0 表示为所有机器 graphd 可用,0.25 表示集群中 1/4 机器可用即可 - min-cluster-health-rate: 1.0 - # 是否允许 SSL 连接,目前暂不支持 - enable-ssl: false -cql: - parser: - # 更换开发者自定义的 xml 所在位置 - mapper-locations: nebulaMapper/**/*.xml # 默认为 mapper/**/*.xml -# nebula上传文件使用 -path: - uploadFilePath: /opt/project/java/graphFile - importerPath: /data1/opt - -mybatis-plus: - mapper-locations: classpath*:mapper/**/*.xml - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - -logging: - level: - org.nebula.contrib: DEBUG - - - diff --git a/virtual-patient-graph/src/main/resources/application.yml b/virtual-patient-graph/src/main/resources/application.yml index caf4dfcd..e77fd98f 100644 --- a/virtual-patient-graph/src/main/resources/application.yml +++ b/virtual-patient-graph/src/main/resources/application.yml @@ -1,3 +1,48 @@ +#服务器端口 +server: + port: 8892 + servlet: + context-path: /virtual-patient-graph + undertow: + # HTTP post内容的最大大小。当值为-1时,默认值为大小是无限的 + max-http-post-size: -1 + # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理 + # 每块buffer的空间大小,越小的空间被利用越充分 + buffer-size: 512 + # 是否分配的直接内存 + direct-buffers: true + spring: - profiles: - active: dev \ No newline at end of file + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + ##数据源配置 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + initial-size: 5 # 初始化大小 + min-idle: 10 # 最小连接数 + max-active: 20 # 最大连接数 + max-wait: 60000 # 获取连接时的最大等待时间 + min-evictable-idle-time-millis: 300000 # 一个连接在池中最小生存的时间,单位是毫秒 + time-between-eviction-runs-millis: 60000 # 多久才进行一次检测需要关闭的空闲连接,单位是毫秒 + filters: stat,wall # 配置扩展插件:stat-监控统计,log4j-日志,wall-防火墙(防止SQL注入),去掉后,监控界面的sql无法统计 + validation-query: SELECT 1 # 检测连接是否有效的 SQL语句,为空时以下三个配置均无效 + test-on-borrow: true # 申请连接时执行validationQuery检测连接是否有效,默认true,开启后会降低性能 + test-on-return: true # 归还连接时执行validationQuery检测连接是否有效,默认false,开启后会降低性能 + test-while-idle: true # 申请连接时如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效,默认false,建议开启,不影响性能 + stat-view-servlet: + enabled: false # 是否开启 StatViewServlet + filter: + stat: + enabled: true # 是否开启 FilterStat,默认true + log-slow-sql: true # 是否开启 慢SQL 记录,默认false + slow-sql-millis: 5000 # 慢 SQL 的标准,默认 3000,单位:毫秒 + merge-sql: false # 合并多个连接池的监控数据,默认false + + +mybatis-plus: + mapper-locations: classpath*:mapper/**/*.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file diff --git a/virtual-patient-graph/src/main/resources/bootstrap-dev.yml b/virtual-patient-graph/src/main/resources/bootstrap-dev.yml new file mode 100644 index 00000000..b43e8800 --- /dev/null +++ b/virtual-patient-graph/src/main/resources/bootstrap-dev.yml @@ -0,0 +1,10 @@ +spring: + cloud: + nacos: + config: + server-addr: 192.168.10.137:8848 + file-extension: yml + namespace: b9eea377-79ec-4ba5-9cc2-354f7bd5181e + discovery: + server-addr: 192.168.10.137:8848 + namespace: b9eea377-79ec-4ba5-9cc2-354f7bd5181e diff --git a/virtual-patient-graph/src/main/resources/bootstrap-test.yml b/virtual-patient-graph/src/main/resources/bootstrap-test.yml new file mode 100644 index 00000000..71468fab --- /dev/null +++ b/virtual-patient-graph/src/main/resources/bootstrap-test.yml @@ -0,0 +1,10 @@ +spring: + cloud: + nacos: + config: + server-addr: 192.168.10.137:8848 + file-extension: yml + namespace: 88e1f674-1fbc-4021-9ff1-60b94ee13ef0 + discovery: + server-addr: 192.168.10.137:8848 + namespace: 88e1f674-1fbc-4021-9ff1-60b94ee13ef0 \ No newline at end of file diff --git a/virtual-patient-graph/src/main/resources/bootstrap.yml b/virtual-patient-graph/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..524e3266 --- /dev/null +++ b/virtual-patient-graph/src/main/resources/bootstrap.yml @@ -0,0 +1,5 @@ +spring: + profiles: + active: dev + application: + name: virtual-patient-graph \ No newline at end of file diff --git a/virtual-patient-graph/src/main/resources/logback-spring.xml b/virtual-patient-graph/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..88cefa73 --- /dev/null +++ b/virtual-patient-graph/src/main/resources/logback-spring.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + /data/vp/log/virtual-patient-graph.log + + + /data/vp/log/history/virtual-patient-graph-%d{yyyy-MM-dd}.log + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + + \ No newline at end of file diff --git a/virtual-patient-graph/src/main/resources/知识图谱test-1.xlsx b/virtual-patient-graph/src/main/resources/知识图谱test-1.xlsx deleted file mode 100644 index e81adf83..00000000 Binary files a/virtual-patient-graph/src/main/resources/知识图谱test-1.xlsx and /dev/null differ