commit f216144cf80c691434c0a32739253c08a2231897 Author: wyb <1977763549@qq.com> Date: Fri Mar 8 15:42:00 2024 +0800 init:初始化茂名数据同步项目 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a8a1e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +docus-services/docus-services-system1/ + +### IntelliJ IDEA ### +*.log +.idea +*.iws +*.iml +*.ipr +mvnw* +*.cmd +*.mvn +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ +logs* \ No newline at end of file diff --git a/assembly.xml b/assembly.xml new file mode 100644 index 0000000..b6fb827 --- /dev/null +++ b/assembly.xml @@ -0,0 +1,73 @@ + + + exe + + dir + + false + + + + + /lib + ${basedir}/target/lib + + + + /config + ${basedir}/target/resources + 0755 + + *.xml + *.yml + *.properties + + + + + /dataConfig + ${basedir}/target/dataConfig + 0755 + + *.json + + + + + / + ${basedir}/target/resources/bin + 0755 + + *.bat + + + + + / + ${basedir}/target/resources/bin + 0755 + + *.xml + + + + + / + ${basedir} + 0755 + + *.exe + + + + + ${basedir}/target + / + 0755 + + ${project.build.finalName}.jar + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7191804 --- /dev/null +++ b/pom.xml @@ -0,0 +1,343 @@ + + + + com.docus + docus-bom + 1.0-SNAPSHOT + + 4.0.0 + + docus-collect-mmry + + + + com.docus + docus-knife4j-starter + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + checker-qual + org.checkerframework + + + error_prone_annotations + com.google.errorprone + + + + + org.springframework.boot + spring-boot-starter-web + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.0 + + + com.baomidou + dynamic-datasource-spring-boot-starter + 3.4.0 + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + HdrHistogram + org.hdrhistogram + + + jsr305 + com.google.code.findbugs + + + + + mysql + mysql-connector-java + 8.0.28 + + + org.projectlombok + lombok + 1.18.16 + compile + + + org.projectlombok + lombok + 1.18.16 + compile + + + org.bgee.log4jdbc-log4j2 + log4jdbc-log4j2-jdbc4.1 + + + com.alibaba + druid + 1.2.4 + compile + + + com.baomidou + mybatis-plus-generator + 3.4.1 + compile + + + org.apache.velocity + velocity-engine-core + 2.0 + + + com.xuxueli + xxl-job-core + + + com.docus + docus-base-starter + + + knife4j-spring-boot-autoconfigure + com.github.xiaoymin + + + + + + com.docus + docus-tool-starter + + + + com.docus + docus-shiro-starter + + + + com.docus + docus-base-starter + + + springfox-core + io.springfox + + + springfox-schema + io.springfox + + + springfox-spi + io.springfox + + + knife4j-spring-boot-autoconfigure + com.github.xiaoymin + + + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + junit + junit + test + + + + + com.microsoft.sqlserver + sqljdbc4 + 4.0 + + + + + + + src/main/resources + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.4.4 + + ZIP + + + non-exists + non-exists + + + + + + + repackage + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + target/lib + false + false + runtime + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources + package + + copy-resources + + + + + src/main/resources + + **/*.* + + + + ${project.build.directory}/resources + + + + copy-bin + package + + copy-resources + + + + + src/main/resources + true + + bin/*.xml + *.yml + bin/*.bat + + + + ${project.build.directory}/resources + + + + copy-data-config + package + + copy-resources + + + + + ../../dataConfig + true + + + ${project.build.directory}/dataConfig + + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + **/*.yml + + + + + + maven-assembly-plugin + + + + ${project.artifactId} + false + + assembly.xml + + + make-assembly + package + + single + + + + + + + + + + + dev + + prod + + + true + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/docus/server/AppRunBootstrap.java b/src/main/java/com/docus/server/AppRunBootstrap.java new file mode 100644 index 0000000..14565b5 --- /dev/null +++ b/src/main/java/com/docus/server/AppRunBootstrap.java @@ -0,0 +1,22 @@ +package com.docus.server; + + +import lombok.extern.slf4j.Slf4j; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; + + +/** + * @author wyb + */ +@Slf4j +@SpringBootApplication(scanBasePackages ={"com.docus"}) +@MapperScan("com.docus.server.**.mapper") +@EnableFeignClients(basePackages = {"com.docus"}) +public class AppRunBootstrap { + public static void main(String[] args) { + SpringApplication.run(AppRunBootstrap.class, args); + } +} diff --git a/src/main/java/com/docus/server/XxlJobConfig.java b/src/main/java/com/docus/server/XxlJobConfig.java new file mode 100644 index 0000000..d9edbfa --- /dev/null +++ b/src/main/java/com/docus/server/XxlJobConfig.java @@ -0,0 +1,87 @@ +package com.docus.server; +import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2021/5/7 16:23 + * @UpdateUser: 曾文和 + * @UpdateDate: 2021/5/7 16:23 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + + + +@Configuration +public class XxlJobConfig { + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + + return xxlJobSpringExecutor; + } + + /** + * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; + * + * 1、引入依赖: + * + * org.springframework.cloud + * spring-cloud-commons + * ${version} + * + * + * 2、配置文件,或者容器启动变量 + * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' + * + * 3、获取IP + * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + *//* + +*/ +} diff --git a/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java new file mode 100644 index 0000000..965d0a7 --- /dev/null +++ b/src/main/java/com/docus/server/archive/mapper/TBasicMapper.java @@ -0,0 +1,9 @@ +package com.docus.server.archive.mapper; + + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TBasicMapper { + +} diff --git a/src/main/java/com/docus/server/trusthis/controller/ManualFunctionController.java b/src/main/java/com/docus/server/trusthis/controller/ManualFunctionController.java new file mode 100644 index 0000000..7771b5b --- /dev/null +++ b/src/main/java/com/docus/server/trusthis/controller/ManualFunctionController.java @@ -0,0 +1,57 @@ +package com.docus.server.trusthis.controller; + +import com.docus.infrastructure.web.api.CommonResult; +import com.docus.server.trusthis.mapper.JsOrdersMapper; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.List; + +/** + * @author YongBin Wen + * @date 2024/3/8 15:21 + */ +@Slf4j +@RequestMapping("/mmry-collect") +@RestController +public class ManualFunctionController { + @Resource + private JsOrdersMapper jsOrdersMapper; + + @ApiOperation(value = "测试获取医嘱序号", tags = "茂名采集控制-测试") + @ApiImplicitParams( + { + @ApiImplicitParam(name = "inpatientNo", value = "病案号", required = true, dataTypeClass = String.class), + @ApiImplicitParam(name = "admissionOrDisDate", value = "入院或者出院日期 yyyy-MM-dd", required = true, dataTypeClass = String.class), + @ApiImplicitParam(name = "disDate", value = "出院日期 yyyy-MM-dd", required = true, dataTypeClass = String.class) + } + ) + @GetMapping("/test/getOrderIndex") + public CommonResult> getOrderIndex(@RequestParam("inpatientNo") String inpatientNo, @RequestParam("admissionOrDisDate") String admissionOrDisDate, @RequestParam("disDate") String disDate) { + String pattern = "yyyy-MM-dd"; + int patternLen = pattern.length(); + if (admissionOrDisDate.length() != patternLen || disDate.length() != patternLen) { + return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd"); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + sdf.parse(admissionOrDisDate); + sdf.parse(disDate); + } catch (Exception ex) { + return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd"); + } + + List orderIndex = jsOrdersMapper.getOrderIndex(inpatientNo, admissionOrDisDate, disDate); + return CommonResult.success(orderIndex); + } + + +} diff --git a/src/main/java/com/docus/server/trusthis/mapper/JsOrdersMapper.java b/src/main/java/com/docus/server/trusthis/mapper/JsOrdersMapper.java new file mode 100644 index 0000000..66190e3 --- /dev/null +++ b/src/main/java/com/docus/server/trusthis/mapper/JsOrdersMapper.java @@ -0,0 +1,25 @@ +package com.docus.server.trusthis.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 查询存储过程 JsOrdersMapper + * @author YongBin Wen + * @date 2024/3/8 15:12 + */ +@Mapper +@DS("trusthis") +public interface JsOrdersMapper { + /** + * 根据住院号,入院或者出院日期查询当次住院的多个医嘱序号 + * @param inpatientNo 住院号 + * @param admissionOrDisDate 入院或者出院日期 yyyy-MM-dd + * @param disDate 出院日期 yyyy-MM-dd + * @return 当次住院多个医嘱序号 + */ + List getOrderIndex(@Param("inpatientNo") String inpatientNo,@Param("admissionOrDisDate") String admissionOrDisDate, @Param("disDate") String disDate); +} diff --git a/src/main/resources/bin/install.bat b/src/main/resources/bin/install.bat new file mode 100644 index 0000000..7a651bc --- /dev/null +++ b/src/main/resources/bin/install.bat @@ -0,0 +1,33 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +echo "restart....." +winsw stop +PING 127.0.0.1 -n 10 -w 30000 >NUL +winsw start +) + + + +if %str%==Stopped ( +echo "start....." +winsw start +) + + +if %str%==NonExistent ( +echo "deploy and start....." +winsw install +winsw start +echo c +) + + + + + diff --git a/src/main/resources/bin/start.bat b/src/main/resources/bin/start.bat new file mode 100644 index 0000000..58c25cb --- /dev/null +++ b/src/main/resources/bin/start.bat @@ -0,0 +1,21 @@ +set java_opts=-Xms512m -Xmx512m +set key="java_opts" + + +rem 文件不存在,就跳过 +if not exist java-ops.ini goto end + +for /f "tokens=1,2 delims==" %%i in (java-ops.ini) do ( + if "%%i"==%key% set java_opts=%%j) +echo java_opts is : %java_opts% + +:end + +rem 启动java + +java %java_opts% -Dfile.encoding=utf-8 -jar -Dspring.profiles.active=@profile.name@ -Dloader.path=config,lib @project.build.finalName@.jar + + + + + diff --git a/src/main/resources/bin/stop.bat b/src/main/resources/bin/stop.bat new file mode 100644 index 0000000..98468a0 --- /dev/null +++ b/src/main/resources/bin/stop.bat @@ -0,0 +1,13 @@ +@echo off + +for /f "delims=" %%t in ('winsw.exe status') do set str=%%t +echo %str% + + + +if %str%==Started ( +winsw stop +@echo wait program stop ..... +PING 127.0.0.1 -n 30 -w 10000 >NUL +) + diff --git a/src/main/resources/bin/update.bat b/src/main/resources/bin/update.bat new file mode 100644 index 0000000..7d37041 --- /dev/null +++ b/src/main/resources/bin/update.bat @@ -0,0 +1,19 @@ +@echo off + +set deployDir=%1\docus-collect-mmry +if %deployDir%=="" set deployDir=d:\webroot\docus-collect-mmry + +set curr_file=%cd% +cd /d %deployDir% +call stop.bat +cd %curr_file% +sc query docus-backup-sys |Find "RUNNING" && ping 127.0.0.1 -n 10 >nul +rd/s/q %deployDir%\lib +rd/s/q %deployDir%\dataConfig +rd/s/q %deployDir%\config +del /s/q %deployDir%\*.jar +xcopy /Y/E/I * %deployDir% + +cd /d %deployDir% +call install.bat + diff --git a/src/main/resources/bin/winsw.xml b/src/main/resources/bin/winsw.xml new file mode 100644 index 0000000..9576ba1 --- /dev/null +++ b/src/main/resources/bin/winsw.xml @@ -0,0 +1,8 @@ + + docus-collect-mmry + 生产-嘉时-茂名人医采集服务 + 生产-嘉时-茂名人医采集服务 + Automatic + %BASE%\start.bat + + \ No newline at end of file diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..ec753cf --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,107 @@ +server: + port: 9314 +ip: http://192.168.16.63 +spring: + application: + name: @artifactId@ + profiles: + active: test + datasource: + dynamic: + primary: master #设置默认的数据源,默认值为master + strict: false #是否用严格模式,如果启用在味匹配到指定数据源时抛出异常 + datasource: + master: + url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + username: docus + password: docus702 + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 15 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + trusthis: + url: jdbc:sqlserver://200.100.104.22:1433;DatabaseName=hq_framework + username: WZH + password: 123.WZH + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + type: com.alibaba.druid.pool.DruidDataSource + # 初始化配置 + initial-size: 3 + # 最小连接数 + min-idle: 3 + # 最大连接数 + max-active: 15 + # 获取连接超 时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 90000 + # 最大空闲时间 + min-evictable-idle-time-millis: 1800000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + validation-query: select 1 + redis: + host: redis.docus.cn + password: JSdocus@702 + cloud: + nacos: + discovery: + server-addr: nacos.docus.cn + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + config: + server-addr: ${spring.cloud.nacos.discovery.server-addr} + namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5 + file-extension: yml + shared-configs: + - comm.${spring.cloud.nacos.config.file-extension} + + +docus: + url: + # 采集任务补偿地址 + compensate-task-url: http://localhost:9295/ + # 下载地址 + down-url: http://localhost:9291/api/downplatform/report + medicalrecord: http://192.168.16.85:9102 + + + dbtype: mysql + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + call-setters-on-nulls: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + field-strategy: NOT_EMPTY + db-type: MYSQL +xxl: + job: + accessToken: + admin: + addresses: http://job.docus.cn:8180/xxl-job-admin + executor: + appname: docus-collect-mmry + address: + ip: + port: 19312 + logretentiondays: 30 + logpath: D:/xxl-job/docus-collect-mmry + + diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..5cb6f99 --- /dev/null +++ b/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,2 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..1e6efa2 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,77 @@ + + + docus-collect-mmry + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n + + + + + + + [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n + utf-8 + + + + + ${log.path}%d.%i.log + + 500MB + + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/JsOrdersMapper.xml b/src/main/resources/mapper/JsOrdersMapper.xml new file mode 100644 index 0000000..c661ef3 --- /dev/null +++ b/src/main/resources/mapper/JsOrdersMapper.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml new file mode 100644 index 0000000..8b84532 --- /dev/null +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/winsw.exe b/winsw.exe new file mode 100644 index 0000000..ba27e3f Binary files /dev/null and b/winsw.exe differ