英德人医按需采集初始化

master
linjj 2 years ago
commit 4a5d8df44c

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: io.springfox:springfox-boot-starter:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-oas:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-annotations:2.1.2" level="project" />
<orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-models:2.1.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.github.classgraph:classgraph:4.8.83" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webmvc:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webflux:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:3.0.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.mapstruct:mapstruct:1.3.1.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-data-rest:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:3.0.0" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:3.0.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-guava:2.10.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
<orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
<orderEntry type="library" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
<orderEntry type="library" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
<orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.19" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.19" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
<orderEntry type="library" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-test:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" />
<orderEntry type="library" name="Maven: com.microsoft.sqlserver:sqljdbc6:6.4.0" level="project" />
<orderEntry type="library" name="Maven: com.oracle:ojdbc14:14.0.0" level="project" />
<orderEntry type="library" name="Maven: com.xdb:xdb:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-transports-http:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-core:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:3.1.8" level="project" />
<orderEntry type="library" name="Maven: xml-resolver:xml-resolver:1.2" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-soap:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-wsdl:3.1.8" level="project" />
<orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.6.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-databinding-jaxb:3.1.8" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.11" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.2.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-xml:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-simple:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-ws-addr:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-ws-policy:3.1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.neethi:neethi:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-transports-http-jetty:3.0.1" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.35.v20201120" level="project" />
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-servlet_3.0_spec:1.0" level="project" />
<orderEntry type="library" name="Maven: commons-net:commons-net:1.4.1" level="project" />
<orderEntry type="library" name="Maven: oro:oro:2.0.8" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.4" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.17" level="project" />
<orderEntry type="library" name="Maven: commons-dbutils:commons-dbutils:1.6" level="project" />
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:itextpdf:5.5.13" level="project" />
<orderEntry type="library" name="Maven: com.oracle.ojdbc:xmlparserv2:19.3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk16:1.46" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.3.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.13" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.41" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.41" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.12.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.6" level="project" />
</component>
</module>

@ -0,0 +1,233 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xjgs</groupId>
<artifactId>pacs</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!--新增-->
<!--springboot的swagger3的整合包-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-guava</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc6</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>14.0.0</version>
</dependency>
<dependency>
<groupId>com.xdb</groupId>
<artifactId>xdb</artifactId>
<version>1.0.0</version>
</dependency>
<!--WS-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.8</version>
</dependency>
<!--内置jetty web服务器-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
<!--日志实现-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.17</version>
</dependency>
<!--DBUtis-->
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!--itext-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>xmlparserv2</artifactId>
<version>19.3.0.0</version>
</dependency>
<!-- 导入DES对称加密包 -->
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk16 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>1.46</version>
</dependency>
<!--commons-lang3-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.4.2</version>
</dependency>
<!--mybatis-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--此处新增-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.8.RELEASE</version>
<configuration>
<mainClass>com.xjgs.Applicaltion</mainClass>
</configuration>
<executions>
<execution>
<goals>
<!--可以把依赖的包都打包到生成的Jar包中-->
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<!--此处为新增-->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
</build>
</project>

@ -0,0 +1,32 @@
package com.xjgs;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.oas.annotations.EnableOpenApi;
/**
* @description
* @authorChenJ
* @date2022/05/09
**/
@SpringBootApplication
public class Applicaltion extends SpringBootServletInitializer {
/**
* springbootjar,tomcat
* spring
* jarmain
* mainspringboot
*
* @param args
*/
public static void main(String[] args) {
SpringApplication.run(Applicaltion.class, args);
}
}

@ -0,0 +1,34 @@
//package com.xjgs;
//
//import com.xjgs.service.PacsService;
//import com.xjgs.service.RadiateService;
//
//import java.util.concurrent.ScheduledThreadPoolExecutor;
//import java.util.concurrent.TimeUnit;
//
//public class Application3 {
// static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = null;
// public static void main(String[] args) {
// final PacsService pacsService = new PacsService ();
// final RadiateService radiateService = new RadiateService ();
// scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(5);
// scheduledThreadPoolExecutor.scheduleWithFixedDelay(new Runnable() {
// @Override
// public void run() {
// pacsService.uploadRadiation ();
// }
// },0,5, TimeUnit.MINUTES);
// scheduledThreadPoolExecutor.scheduleWithFixedDelay(new Runnable() {
// @Override
// public void run() {
// pacsService.fanshe ();
// }
// },2,5, TimeUnit.MINUTES);
// scheduledThreadPoolExecutor.scheduleWithFixedDelay(new Runnable() {
// @Override
// public void run() {
// radiateService.fangsheInfo ();
// }
// },4,5, TimeUnit.MINUTES);
// }
//}

@ -0,0 +1,65 @@
package com.xjgs.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
/**
* @ClassName RecordConfig
* @Description Pacs
* @Author linjj
* @Date 2023/8/2 16:48
* @Version 1.0
*/
@Configuration
// 指定主数据库扫描对应的Mapper文件生成代理对象
@MapperScan(basePackages ="com.xjgs.pacsDao" ,sqlSessionFactoryRef = "pacsSqlSessionFactory")
public class PacsConfig {
// mapper.xml所在地址
private static final String MAPPER_LOCATION = "classpath*:mapper2/*.xml";
/**
* Primary
*
*/
@Bean(name = "pacsDataSource")
// 读取spring.datasource.master前缀的配置文件映射成对应的配置对象
@ConfigurationProperties(prefix = "spring.datasource.db2")
public DataSource dataSource() {
DataSource build = DataSourceBuilder.create().build();
return build;
}
/**
* Primary
*/
@Bean(name = "pacsTransactionManager")
public PlatformTransactionManager dataSourceTransactionManager(@Qualifier("pacsDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
/**
* sessionPrimary
*/
@Bean(name = "pacsSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("pacsDataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(PacsConfig.MAPPER_LOCATION));
return sessionFactoryBean.getObject();
}
}

@ -0,0 +1,70 @@
package com.xjgs.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
/**
* @ClassName RecordConfig
* @Description
* @Author linjj
* @Date 2023/8/2 16:48
* @Version 1.0
*/
@Configuration
// 指定主数据库扫描对应的Mapper文件生成代理对象
@MapperScan(basePackages ="com.xjgs.recordDao" ,sqlSessionFactoryRef = "recordSqlSessionFactory")
public class RecordConfig {
// mapper.xml所在地址
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
/**
* Primary
*
*/
@Primary
@Bean(name = "recordDataSource")
// 读取spring.datasource.master前缀的配置文件映射成对应的配置对象
@ConfigurationProperties(prefix = "spring.datasource.db1")
public DataSource dataSource() {
DataSource build = DataSourceBuilder.create().build();
return build;
}
/**
* Primary
*/
@Bean(name = "recordTransactionManager")
@Primary
public PlatformTransactionManager dataSourceTransactionManager(@Qualifier("recordDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
/**
* sessionPrimary
*/
@Bean(name = "recordSqlSessionFactory")
@Primary
public SqlSessionFactory sqlSessionFactory(@Qualifier("recordDataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(RecordConfig.MAPPER_LOCATION));
return sessionFactoryBean.getObject();
}
}

@ -0,0 +1,109 @@
package com.xjgs.controller;
import com.xjgs.pacsDao.PacsMapper;
import com.xjgs.recordDao.ArchiveDetailMapper;
import com.xjgs.exception.BusinessException;
import com.xjgs.exception.ExceptionCode;
import com.xjgs.service.MakeUpPacsService;
import com.xjgs.service.PacsService;
import com.xjgs.util.JsonResult;
import com.xjgs.util.StringUtil;
import com.xjgs.vo.ArchiveMaster;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* @BelongsProject: pacs
* @BelongsPackage: com.xjgs.controller
* @Author: ChenJ
* @CreateTime: 2022-05-11 17:00
*/
@Api("补偿采集的相关接口")
@Controller
@ResponseBody
@RequestMapping("/makeUp")
public class MakeUpPacs {
@Autowired
ArchiveDetailMapper archiveDetailMapper;
@Autowired
PacsMapper pacsMapper;
@Autowired
MakeUpPacsService makeUpPacsService;
/**
* @description:
* @author: ChenJ
* @date: 2022/5/11 17:24
* @param:
* @param patient
* @return: java.util.Map<java.lang.String,java.lang.Object>
**/
// @ApiOperation("按需采集")
// @GetMapping("/makeUpByPacs")
// public Map<String, Object> makeUpByNeed(String patient) throws BusinessException {
//
// // 先对参数进行校验,如果为空则抛出异常
// if (StringUtil.isEmpty(patient)){
// throw new BusinessException(ExceptionCode.WRONG_PARAMS);
// }
// // 声明Pacs操作类
// PacsService pacsService = new PacsService();
// // 调用采集
// pacsService.fanshe(patient);
// pacsService.uploadRadiation(patient);
//
//
// // 声明返回
// JsonResult jsonResult = new JsonResult();
// jsonResult.setCode("200");
// jsonResult.setMsg("调用成功,请稍等下载文件");
// return jsonResult.getDataMap();
// }
/**
* @description:
* @params: startTime
* @params: endTime
* @author linjj
* @date: 2023/7/25 14:34
*/
@ApiOperation("按需采集")
@GetMapping("/makeUpByPacsAndTime")
public Map<String, Object> makeUpByNeed(String startTime,String endTime) throws BusinessException {
//返回类
JsonResult jsonResult = new JsonResult();
// 先对参数进行校验,如果为空则抛出异常
if (StringUtil.isEmpty(startTime)){
throw new BusinessException(ExceptionCode.WRONG_PARAMS);
}
// 先对参数进行校验,如果为空则抛出异常
if (StringUtil.isEmpty(endTime)){
throw new BusinessException(ExceptionCode.WRONG_PARAMS);
}
//查询时间段内需要按需采集病历信息
List<ArchiveMaster> archiveMasterList = archiveDetailMapper.getArchiveMasterList(startTime, endTime);
if (archiveMasterList.size()==0){
jsonResult.setCode("100");
jsonResult.setMsg("该时间段内无采集病历");
return jsonResult.getDataMap();
}
//循环执行
for (ArchiveMaster list:archiveMasterList){
makeUpPacsService.getPacsPathList(list);
}
// 声明返回
jsonResult.setCode("200");
jsonResult.setMsg("调用成功,请稍等下载文件");
return jsonResult.getDataMap();
}
}

@ -0,0 +1,69 @@
package com.xjgs.dao;
import com.mchange.v2.c3p0.C3P0ProxyConnection;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import javax.sql.DataSource;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCUtils {
//创建数据库连接池对象
private static ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource("his");
//获取连接的方法
public static Connection getConnection() throws SQLException {
return comboPooledDataSource.getConnection();
}
//提供数据库连接池对象的方法
public static DataSource getDataSource(){
return comboPooledDataSource;
}
//释放资源的方法
public static void release(ResultSet rs, Statement stmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
release(stmt, conn);
}
public static void release(Statement stmt, Connection conn) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
conn = null;
}
}
public static Connection getRawConnection(Connection conn) {
C3P0ProxyConnection cpCon = (C3P0ProxyConnection) conn;
Connection unwrappedCon = null;
try {
Method rawConnectionMethod = JDBCUtils.class.getMethod("getRawConnection", new Class[]{Connection.class});
unwrappedCon = (Connection) cpCon.rawConnectionOperation(rawConnectionMethod, null, new Object[]{C3P0ProxyConnection.RAW_CONNECTION});
} catch (Exception ex) {
//do something }
}
return conn;
}
}

@ -0,0 +1,56 @@
package com.xjgs.dao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCUtils3 {
//创建数据库连接池对象
private static ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource("sql");
//获取连接的方法
public static Connection getConnection() throws SQLException {
return comboPooledDataSource.getConnection();
}
//提供数据库连接池对象的方法
public static DataSource getDataSource(){
return comboPooledDataSource;
}
//释放资源的方法
public static void release(ResultSet rs, Statement stmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
release(stmt, conn);
}
public static void release(Statement stmt, Connection conn) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
conn = null;
}
}
}

@ -0,0 +1,56 @@
package com.xjgs.dao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCUtils4 {
//创建数据库连接池对象
private static ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource("chaosheng");
//获取连接的方法
public static Connection getConnection() throws SQLException {
return comboPooledDataSource.getConnection();
}
//提供数据库连接池对象的方法
public static DataSource getDataSource(){
return comboPooledDataSource;
}
//释放资源的方法
public static void release(ResultSet rs, Statement stmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
release(stmt, conn);
}
public static void release(Statement stmt, Connection conn) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
conn = null;
}
}
}

@ -0,0 +1,56 @@
package com.xjgs.dao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCUtils5 {
//创建数据库连接池对象
private static ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource("mysql");
//获取连接的方法
public static Connection getConnection() throws SQLException {
return comboPooledDataSource.getConnection();
}
//提供数据库连接池对象的方法
public static DataSource getDataSource(){
return comboPooledDataSource;
}
//释放资源的方法
public static void release(ResultSet rs, Statement stmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
release(stmt, conn);
}
public static void release(Statement stmt, Connection conn) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
conn = null;
}
}
}

@ -0,0 +1,26 @@
package com.xjgs.exception;
/**
* @description:
* @author: ChenJ
* @date: 2022/5/9 17:29
* @param:
* @return:
**/
public class BusinessException extends Exception {
/**
* ,codemsg
*/
private final ExceptionCode exceptionCode;
public ExceptionCode getExceptionCode() {
return exceptionCode;
}
public BusinessException(ExceptionCode exceptionCode) {
super(exceptionCode.getMessage());
this.exceptionCode = exceptionCode;
}
}

@ -0,0 +1,30 @@
package com.xjgs.exception;
/**
* @description:
* @author: ChenJ
* @date: 2022/5/9 17:31
**/
public enum ExceptionCode {
/**
*
*/
WRONG_PARAMS("参数不对", 1001);
private final String message;
private final Integer code;
ExceptionCode(String message, int code) {
this.message = message;
this.code = code;
}
public String getMessage() {
return message;
}
public Integer getCode() {
return code;
}
}

@ -0,0 +1,26 @@
package com.xjgs.pacsDao;
import com.xjgs.vo.ArchiveMaster;
import com.xjgs.vo.PacsVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @InterfaceName commomtableMapper
* @Description
* @Author linjj
* @Date 2023/8/2 17:49
* @Version 1.0
*/
@Mapper
public interface PacsMapper {
/**
* @description: pacs
* @params: ArchiveMaster
* @return: PacsVo
* @author linjj
* @date: 2023/8/3 11:08
*/
List<PacsVo> getPacsPathList(ArchiveMaster archiveMaster);
}

@ -0,0 +1,20 @@
package com.xjgs.recordDao;
import com.xjgs.vo.ArchiveMaster;
import com.xjgs.vo.Archive_Detail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ArchiveDetailMapper {
List<ArchiveMaster>getArchiveMasterList(@Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime);
List<Archive_Detail>pacsGetPatId();
List<ArchiveMaster> getIdAndJzh(@Param(value = "ids")String ids);
}

@ -0,0 +1,371 @@
package com.xjgs.service;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import com.xjgs.vo.Fangshe;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import java.io.File;
import java.io.FileOutputStream;
public class ItextPdfImpl{
public String[] convertMath(String str){
String[] s = str.split(" ");
return s;
}
public boolean writePdf(Fangshe source, String temp, String str, String str1, String prof) {
PdfWriter writer = null;
Document docPDF = null;
try {
docPDF = new Document (PageSize.A4, 25, 1.3F, 40, 0.74F);
//PageSize.A4.rotate () 为横向
writer = PdfWriter.getInstance (docPDF, new FileOutputStream (temp));
docPDF.open ();
BaseFont baseFont = BaseFont.createFont("C:\\Windows\\Fonts\\simsun.ttc,1", BaseFont.IDENTITY_H,BaseFont.EMBEDDED);
// 标题
Font font = new Font(baseFont,16,Font.NORMAL); //正常
Paragraph paragraph = new Paragraph(14);// 边距
// 1 2 3 中右左
paragraph.setAlignment(1); // 对齐方式
paragraph.setFont(font);// 设置段落字体
Chunk chunk = new Chunk("英德市人民医院影像中心");
paragraph.add(chunk);
docPDF.add(paragraph);
Paragraph paragraph1 = new Paragraph(14);
BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\simkai.ttf",
BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
// 1 2 3 中右左
Font font2 = new Font(bfComic,20,Font.NORMAL); //正常
paragraph1.setLeading(20f);// 行间距
paragraph1.setAlignment(1); // 对齐方式
paragraph1.setFont(font2);
Chunk chunk1 = new Chunk(prof);
paragraph1.add(chunk1);
docPDF.add(paragraph1);
PdfPTable t0 = CreateTable0 (source);
PdfPTable t1 = CreateTable1 (source);
PdfPTable t2 = CreateTable2 (source);
PdfPTable t3 = CreateTable3 (source,str,str1);
docPDF.add (t0);
docPDF.add (t1);
docPDF.add (t2);
docPDF.add (t3);
PdfPTable t4 = CreateTable4 (source);
docPDF.add (t4);
//PdfPTable t5 = AddImage2PDF ("C:\\1102.png");
//docPDF.add (t5);
}
catch (Exception e)
{
e.printStackTrace ();
}finally {
if(null!=docPDF){
docPDF.close ();
}
if(null !=writer){
writer.close ();
}
}
File file = new File (temp);
return file.exists ();
}
private final float RowHeight = 20F;
private final String FontName="宋体";
private PdfPTable CreateTable0(Fangshe obj) throws Exception {
PdfPTable pt = new PdfPTable (8);
float[] widthes = new float[]{3F,4F,3F,2F,3F,2F,4F,4F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "姓 名:");
PdfPCell p12 = CreateCell (RowHeight,FontName, -1, false,PdfPCell.ALIGN_LEFT , -1, obj.getFIRSTNAME ());
PdfPCell p13 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "性 别:");
PdfPCell p14 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getPATIENTSEX ());
PdfPCell p15 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "年 龄:");
PdfPCell p16 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getPATIENTAGE ());
PdfPCell p17 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "检 查 号:");
PdfPCell p18 = CreateCell (RowHeight,FontName, -1, false, PdfPCell.ALIGN_LEFT, -1, obj.getPATIENT_ID ());
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11, p12, p13, p14,p15,p16, p17,p18 });
pt.getRows ().add (pr1);
PdfPCell p21 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "申请科室:");
PdfPCell p22 = CreateCell (RowHeight,FontName, 10, false, PdfPCell.ALIGN_LEFT, -1, obj.getREQUESTINGDEPARTMENT ());
PdfPCell p23 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "床 号:");
PdfPCell p24 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getBEDID ());
PdfPCell p25 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "门诊号:");
PdfPCell p26 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getCLINICAL_ID());
PdfPCell p27 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "住 院 号:");
PdfPCell p28 = CreateCell (RowHeight,FontName, -1, false, PdfPCell.ALIGN_LEFT, -1, obj.getINPATIENT_ID());
PdfPRow pr2 = new PdfPRow (new PdfPCell[]{ p21, p22, p23, p24,p25,p26, p27,p28 });
pt.getRows ().add (pr2);
AppendLine (8,pt,false, 2F);
return pt;
}
private PdfPTable AddImage2PDF(String srcImg) throws Exception {
Image img = Image.getInstance(srcImg);
img.setScaleToFitHeight (true);
PdfPTable pt = new PdfPTable (1);
float[] widthes = new float[]{10F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (0.1F,FontName, -1, false,Element.ALIGN_RIGHT, -1, " ");
p11.addElement(img);
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11 });
pt.getRows ().add (pr1);
return pt;
}
private PdfPTable CreateTable1(Fangshe obj) throws Exception {
PdfPTable pt = new PdfPTable (2);
float[] widthes = new float[]{2F,8F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "检查部位:");
PdfPCell p12 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getREQUESTEDPROCEDUREDESCRIPTION ());
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11, p12 });
pt.getRows ().add (pr1);
return pt;
}
private PdfPTable CreateTable2(Fangshe obj) throws Exception {
PdfPTable pt = new PdfPTable (1);
float[] widthes = new float[]{2F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (RowHeight,FontName, 14, false, -1, -1, "检查所见:");
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11});
pt.getRows ().add (pr1);
//AppendEmptyLine (2,pt,2F);
PdfPCell p12 = CreateCell (RowHeight,FontName, -1, false, -1, -1, " "+obj.getEXAMINEDESCRIPTION ());
PdfPRow pr2 = new PdfPRow (new PdfPCell[]{ p12});
pt.getRows ().add (pr2);
//增加空表格
PdfPCell p122 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "");
PdfPRow pr122 = new PdfPRow (new PdfPCell[]{ p122});
p122.setMinimumHeight(150);
pt.getRows ().add (pr122);
AppendEmptyLine (2,pt,2F);
PdfPCell p13 = CreateCell (RowHeight,FontName, 14, false, -1, -1, "诊断提示:");
PdfPRow pr3 = new PdfPRow (new PdfPCell[]{ p13});
pt.getRows ().add (pr3);
String[] strings = convertMath(obj.getDIAGNOSISPROMPT());
PdfPCell p14 = null;
for(String s:strings){
p14 = CreateCell (RowHeight,FontName, -1, false, -1, -1, s);
PdfPRow pr4 = new PdfPRow (new PdfPCell[]{ p14});
pt.getRows ().add (pr4);
}
PdfPCell p144 = CreateCell (RowHeight,FontName, -1, false, -1, -1,"");
PdfPRow pr144 = new PdfPRow (new PdfPCell[]{ p144});
p144.setMinimumHeight(100);
pt.getRows ().add (pr144);
//AppendLine (1,pt,false,2F);
return pt;
}
private PdfPTable CreateTable3(Fangshe obj,String str,String str1) throws Exception {
PdfPTable pt = new PdfPTable (4);
float[] widthes = new float[]{3F,5F,3F,5F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "报告医师:");
PdfPCell p12 = CreateCell (5F,FontName, -1, false, Element.ALIGN_RIGHT, -1, "");
PdfPCell p13 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "审核医师:");
PdfPCell p14 = CreateCell (5F,FontName, -1, false, Element.ALIGN_RIGHT, -1, "");
if(StringUtils.isNoneBlank (str)){
Image img = Image.getInstance(str);
img.scalePercent (30);
p12.addElement (img);
}
//跨两行
p12.setRowspan(2);
if(StringUtils.isNoneBlank (str1)){
Image img1 = Image.getInstance(str1);
img1.scalePercent (30);
p14.addElement (img1);
}
//跨两行
p14.setRowspan(2);
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11, p12, p13, p14});
pt.getRows ().add (pr1);
//AppendLine (6,pt,false,2F);
PdfPCell p21 = CreateCell (RowHeight,FontName, -1, false, -1, -1,obj.getREPORTDOCTOR());
PdfPCell p22 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "");
PdfPCell p23 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getAUDITINGDOCTOR());
PdfPCell p24 = CreateCell (RowHeight,FontName, -1, false, -1, -1,"");
PdfPRow pr2 = new PdfPRow (new PdfPCell[]{ p21,p22,p23,p24});
pt.getRows ().add (pr2);
PdfPCell p31 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "报告日期:");
PdfPCell p32 = CreateCell (RowHeight,FontName, -1, false, -1, -1, obj.getREPORTDATE());
PdfPCell p33 = CreateCell (RowHeight,FontName, -1, false, -1, -1, "审核日期:");
PdfPCell p34 = CreateCell (RowHeight,FontName, -1, false, -1, -1,obj.getAUDITINGDATE());
PdfPRow pr3 = new PdfPRow (new PdfPCell[]{ p31,p32,p33,p34});
pt.getRows ().add (pr3);
AppendLine (4,pt,false,2F);
return pt;
}
private PdfPTable CreateTable4(Fangshe obj) throws Exception {
PdfPTable pt = new PdfPTable (1);
float[] widthes = new float[]{4F};
pt.setWidths(widthes);
pt.setWidthPercentage (95F);
PdfPCell p11 = CreateCell (5F,FontName, -1, false,-1, -1, "注:此报告仅供参考,不作任何证明。 电话:0763-2226116");
//img.scaleToFit (p13.getWidth (), p13.getHeight ());
PdfPRow pr1 = new PdfPRow (new PdfPCell[]{ p11});
pt.getRows ().add (pr1);
return pt;
}
private Font CreateFont(String fontName, float fontSize, boolean isBold) throws Exception {
String fontFile = "c:\\windows\\Fonts\\Simsun.ttc";
BaseFont bsFont = null;
try {
bsFont = BaseFont.createFont (fontFile+",0", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
}
catch (Exception e)
{
try {
bsFont = BaseFont.createFont ("宋体", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
} catch(Exception e2)
{
e2.printStackTrace ();
}
}
if(bsFont==null)
{
throw new Exception ("bsFont==null");
}
Font font =null;
if(fontSize>0)
{
font= new Font (bsFont, fontSize);
}
else
{
font= new Font (bsFont);
}
if(isBold)
{
font.setStyle (Font.BOLD);
}
return font;
}
private PdfPCell CreateCell(float H, String fontName, float fontSize, boolean isBold, int align, int colSpan, String text) throws Exception {
String sText = text;
sText = sText.replace ("\r", "").replace ("\n","");
PdfPCell p1 = new PdfPCell (new Phrase (sText, CreateFont (fontName,fontSize, isBold)));
p1.setMinimumHeight ((H>0?H:20F));
if(align== PdfPCell.ALIGN_LEFT ||align== PdfPCell.ALIGN_CENTER ||align== PdfPCell.ALIGN_RIGHT )
{
p1.setHorizontalAlignment (align);
}
else
{
p1.setHorizontalAlignment (PdfPCell.ALIGN_LEFT);
}
p1.setVerticalAlignment (PdfPCell.ALIGN_MIDDLE);
if(colSpan>0)
{
p1.setColspan (colSpan);
}
p1.setBorder (Rectangle.NO_BORDER);
return p1;
}
private void AppendEmptyLine(int cellCount , PdfPTable pt, float H)
{
PdfPCell[] cells = new PdfPCell[cellCount];
for (int i = 0; i < cellCount; i++)
{
cells[i] = new PdfPCell (new Paragraph (" "));
cells[i].setMinimumHeight (20F);
//cells[i].setFixedHeight (H);
cells[i].setUseVariableBorders (true);
cells[i].setBorderWidthBottom (1F);
cells[i].setBorderWidthTop (1F);
cells[i].setBorderWidthLeft (0F);
cells[i].setBorderWidthRight (0F);
cells[i].setBorderColorBottom (BaseColor.WHITE);
cells[i].setBorderColorTop (BaseColor.WHITE);
cells[i].setBorderColorLeft (BaseColor.WHITE);
cells[i].setBorderColorRight (BaseColor.WHITE);
}
PdfPRow prow = new PdfPRow(cells);
pt.getRows ().add (prow);
}
private void AppendLine(int cellCount , PdfPTable pt,boolean isTop, float H)
{
PdfPCell[] cells = new PdfPCell[cellCount];
for (int i = 0; i < cellCount; i++)
{
cells[i] = new PdfPCell (new Paragraph (" "));
cells[i].setFixedHeight (H);
cells[i].setUseVariableBorders (true);
cells[i].setBorderWidthBottom (1F);
cells[i].setBorderWidthTop (1F);
cells[i].setBorderWidthLeft (0F);
cells[i].setBorderWidthRight (0F);
if(isTop)
{
cells[i].setBorderColorBottom (BaseColor.WHITE);
cells[i].setBorderColorTop (BaseColor.BLACK);
cells[i].setBorderColorLeft (BaseColor.WHITE);
cells[i].setBorderColorRight (BaseColor.WHITE);
}
else
{
cells[i].setBorderColorBottom (BaseColor.BLACK);
cells[i].setBorderColorTop (BaseColor.WHITE);
cells[i].setBorderColorLeft (BaseColor.WHITE);
cells[i].setBorderColorRight (BaseColor.WHITE);
}
}
PdfPRow prow = new PdfPRow(cells);
pt.getRows ().add (prow);
}
public Fangshe source() {
return new Fangshe ("冯秋仪","女","61岁",
"CT162361","普通外科二区","10","187855","",
"上腹(CT)平扫 1 次"," 平扫腹盆腔内见巨大囊实性混杂信号包块影大小约37cmX27cmX16cm多房边界大致清楚实性部分形态不规则信号不均匀囊性部分局部内见间隔影局部可见壁结节子宫受压内膜、肌层未见异常信号影。膀胱无充盈未见明显异常。所见腹腔内见少量积液影未见明确淋巴结肿大。右肾轻度扩张积液。",
" 对比2020-3-21片 1、慢支肺气肿并肺部感染较前吸收。 2、右上肺外胸膜下、左肺下叶胸膜下结节并邻近增厚粘连大致同前。 3、主动脉、冠状动脉硬化.","2019年9月21日","2019年9月21日","朱玉莉",
"2019年9月21日","武义");
}
}

@ -0,0 +1,25 @@
package com.xjgs.service;
import com.xjgs.vo.ArchiveMaster;
import com.xjgs.vo.PacsVo;
import java.util.List;
/**
* @InterfaceName MakeUpPacsService
* @Description pacs
* @Author linjj
* @Date 2023/8/3 11:06
* @Version 1.0
*/
public interface MakeUpPacsService {
/**
* @description: pacs
* @params: ArchiveMaster
* @return: PacsVo
* @author linjj
* @date: 2023/8/3 11:08
*/
void getPacsPathList(ArchiveMaster archiveMaster);
}

@ -0,0 +1,724 @@
package com.xjgs.service;
import com.xjgs.dao.JDBCUtils;
import com.xjgs.dao.JDBCUtils3;
import com.xjgs.dao.JDBCUtils4;
import com.xjgs.dao.JDBCUtils5;
import com.xjgs.pacsDao.PacsMapper;
import com.xjgs.recordDao.ArchiveDetailMapper;
import com.xjgs.util.FileUtil;
import com.xjgs.util.FtpUtil;
import com.xjgs.util.Logger;
import com.xjgs.vo.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @ClassName MakeUpPacsServiceImpl
* @Description pacs
* @Author linjj
* @Date 2023/8/3 11:06
* @Version 1.0
*/
@Service
public class MakeUpPacsServiceImpl implements MakeUpPacsService {
private static Logger logger = new Logger();
@Autowired
PacsMapper pacsMapper;
@Autowired
ArchiveDetailMapper archiveDetailMapper;
@Override
public void getPacsPathList(ArchiveMaster archiveMaster) {
//病案主件id
String ids = archiveMaster.getId();
//根据入院前六小时出院后六小时住院号查询要下载pdf的路径
List<PacsVo> pacsPathList = pacsMapper.getPacsPathList(archiveMaster);
//判断文件表中是否存在
List<Archive_Detail> archiveDetails = archiveDetailMapper.pacsGetPatId();
//判断是否需要采集
if (!pacsPathList.isEmpty()) {
for (PacsVo list : pacsPathList) {
boolean flag = true;
for (Archive_Detail archive_detail : archiveDetails) {
if (archive_detail.getSubAssort().equals(list.getSOURCEID() + "_" + list.getACCESSIONNUMBER())) {
flag = false;
}
}
//不存在执行
if (flag) {
loadDcmToPdf(list, ids);
}
}
}
}
public void loadDcmToPdf(PacsVo pacsVo, String ids) {
String temp = System.getProperty("user.dir") + "\\temp";
File fs = new File(temp);
if (!fs.isDirectory()) {
fs.mkdirs();
}
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
FtpUtil ftpUtil = new FtpUtil();
File file = new File(temp + "\\" + id + ".pdf");
File file3 = new File(temp + "\\" + id + ".dcm");
System.out.println("temp" + temp);
ftpUtil.downloadFile(pacsVo.getDCMFile(), pacsVo.getDCMName(), temp, id + ".dcm");
File fd = new File(temp + "\\" + id + ".dcm");
boolean b = fd.exists();
try {
if (b) {
//DCM转pdf工具
DCM2PDF(temp + "\\" + id + ".dcm", temp + "\\" + id + ".pdf");
if (file.exists()) {
Archive_Detail archiveDetail = new Archive_Detail();
// ArchiveMaster archiveMaster = pacsGetHisId(pacsVo.getSOURCEID());
// ArchiveMaster archiveMaster1 = null;
// if (StringUtils.isNoneBlank(archiveMaster.getPatientId())) {
// System.out.println("112");
// archiveMaster1 = getMasterIdByPa(archiveMaster.getPatientId());
// if (StringUtils.isNoneBlank(archiveMaster1.getId())) {
// System.out.println("113");
// archiveMaster.setId(archiveMaster1.getId());
// } else {
// uploadHomePageByPid(archiveMaster.getPatientId());
// ArchiveMaster id1 = getMasterIdByPa(archiveMaster.getPatientId());
// archiveMaster.setId(id1.getId());
// System.out.println("114");
// }
// }
List<ArchiveMaster> list = archiveDetailMapper.getIdAndJzh(ids);
if (list.size()==0){
return ;
}
ArchiveMaster archiveMaster = list.get(0);
archiveDetail.setMasterId(ids);
archiveDetail.setUploadDateTime(new Date());
archiveDetail.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSource("pacs");
archiveDetail.setFlag("0");
archiveDetail.setTitle(pacsVo.getREQUESTEDPROCEDUREDESCRIPTION().replaceAll("\\s*", ""));
archiveDetail.setSubAssort(pacsVo.getSOURCEID() + "_" + pacsVo.getACCESSIONNUMBER());
archiveDetail.setPdfPath(getXmlPath("path") + "\\pacs\\" + archiveMaster.getPatientId() + "\\" + id + ".pdf");
File file2 = new File(getXmlPath("path") + "\\pacs\\" + archiveMaster.getPatientId());
if (!file2.isDirectory()) {
file2.mkdirs();
}
FileUtils.copyFile(file, new File(archiveDetail.getPdfPath()));
File file1 = new File(archiveDetail.getPdfPath());
logger.log("4");
if (file1.exists() && FileUtil.checkFileWritingOn(file1.getAbsolutePath())) {
logger.log("5");
writeArchiveDetail(archiveDetail);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(new Date());
logger.log("dcm转化成功,同步时间:" + format);
}
}
} else {
fanshe(pacsVo.getPATIENTID());
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
file.delete();
file3.delete();
}
}
//增加病例文件信息表记录
public int writeArchiveDetail(Archive_Detail archiveDetail) {
String sql = "insert into archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag)values(replace(newid(), '-', '')," +
"?,?,?,?,?,?,?,?)";
Connection connection = null;
PreparedStatement statement = null;
Object[] parms = new Object[]{archiveDetail.getPdfPath(), archiveDetail.getMasterId(), archiveDetail.getUploadDateTime(), archiveDetail.getAssortId(), archiveDetail.getSource(), archiveDetail.getSubAssort(), archiveDetail.getTitle(), archiveDetail.getFlag()};
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(null, statement, connection);
}
return j;
}
private void DCM2PDF(String dcmFile, String toPDFFile) throws Exception {
File oFile = null;
byte b1 = 37;
byte b2 = 80;
byte b3 = 68;
byte b4 = 70;
FileInputStream inputStream = null;
String pdfFile = toPDFFile;
File tFile = null;
FileOutputStream outputStream = null;
try {
oFile = new File(dcmFile);
if (!(oFile.isFile() && oFile.exists())) {
throw new Exception("DCM 文件读取失败=>" + dcmFile);
}
inputStream = new FileInputStream(oFile);
byte[] bs = new byte[(int) oFile.length()];
inputStream.read(bs, 0, bs.length);
int seekPos = -1;
for (int i = 0; i < bs.length; i++) {
byte B1 = bs[i];
byte B2 = 0;
byte B3 = 0;
byte B4 = 0;
if (i + 1 < bs.length) {
B2 = (byte) bs[i + 1];
}
if (i + 2 < bs.length) {
B3 = (byte) bs[i + 2];
}
if (i + 3 < bs.length) {
B4 = (byte) bs[i + 3];
}
if (b1 == B1 && b2 == B2 && B3 == b3 && b4 == B4) {
seekPos = i;
break;
}
}
if (seekPos == -1) {
System.out.println("未发现2550 4446");
throw new Exception("DCM 未读取到标志位=>" + dcmFile);
}
tFile = new File(pdfFile);
if (tFile.isFile() && tFile.exists()) {
throw new Exception("目标文件已经存在=>" + pdfFile);
}
outputStream = new FileOutputStream(tFile, true);
for (int i = seekPos; i < bs.length; i++) {
outputStream.write(bs[i]);
}
} catch (Exception ex) {
System.out.println("读写出错" + ex.getMessage());
throw ex;
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public ArchiveMaster pacsGetHisId(String sourceId) {
String sql = "select fvisit_id,fappnote_no from mp.smp_pacs_appnote where fappnote_no = ?";
Object[] parms = new Object[]{sourceId};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = JDBCUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
preparedStatement.setObject(i + 1, parms[i]);
}
}
resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
archiveMaster = new ArchiveMaster();
archiveMaster.setPatientId(resultSet.getString("fvisit_id"));
}
} catch (SQLException e) {
logger.log(e.toString());
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet, preparedStatement, connection);
}
return archiveMaster == null ? new ArchiveMaster() : archiveMaster;
}
public ArchiveMaster getMasterIdByPa(String jzh) {
String sql = "select ID,patient_id from archive_master where patient_id = ?";
Object[] parms = new Object[]{jzh};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
archiveMaster = new ArchiveMaster();
archiveMaster.setId(resultSet.getString("ID"));
archiveMaster.setPatientId(resultSet.getString("patient_id"));
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet, statement, connection);
}
return archiveMaster == null ? new ArchiveMaster() : archiveMaster;
}
public void uploadHomePageByPid(String patientId) {
String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.rycw as 入院床位,hp.fdrname as 主管医生 " +
"from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.jzh = ? order by t.jzh desc";
ArchiveMaster master = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
Object[] parms = new Object[]{patientId};
try {
connection = JDBCUtils.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
master = new ArchiveMaster();
master.setInpNo(resultSet.getString("住院号").trim());
master.setPatientId(resultSet.getString("记账号").trim());
master.setVisitId(resultSet.getString("住院次数"));
master.setName(resultSet.getString("姓名"));
master.setSex(resultSet.getString("性别"));
master.setAdmissionDateTime(resultSet.getString("入院日期"));
master.setDischargeDateTime(resultSet.getString("出院日期"));
master.setIdNo(resultSet.getString("身份证号"));
master.setDeptAdmissionTo(resultSet.getString("入院科室"));
master.setDeptName(resultSet.getString("出院科室"));
master.setDoctorInCharge(resultSet.getString("主管医生"));
master.setBedId(resultSet.getString("入院床位"));
if (null == master.getDischargeDateTime() || master.getDischargeDateTime().isEmpty()) {
master.setStatus("在院");
} else {
master.setStatus("归档中");
}
if ("2".equals(master.getSex())) {
master.setSex("女");
} else {
master.setSex("男");
}
writeHomeEntity(master);
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet, statement, connection);
}
}
//新增首页数据
int writeHomeEntity(ArchiveMaster archiveMaster) {
String sql = "insert into archive_master(id,patient_id,inp_no,visit_id,name,sex,dept_name,discharge_date_time," +
"archivestate,admission_date_time,dept_admission_to,doctor_in_charge,id_no,bed_id)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?)";
Object[] parms = new Object[]{archiveMaster.getPatientId(), archiveMaster.getInpNo(), archiveMaster.getVisitId(), archiveMaster.getName(), archiveMaster.getSex(), archiveMaster.getDeptName(), archiveMaster.getDischargeDateTime(), archiveMaster.getStatus(), archiveMaster.getAdmissionDateTime(), archiveMaster.getDeptAdmissionTo(), archiveMaster.getDoctorInCharge(), archiveMaster.getIdNo(), archiveMaster.getBedId()};
Connection connection = null;
PreparedStatement statement = null;
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(null, statement, connection);
}
return j;
}
public String getXmlPath(String elementName) {
Document doc = null;
try {
doc = new SAXReader().read(this.getClass().getResourceAsStream("/localPath.xml"));
} catch (DocumentException e) {
logger.log(e.toString());
}
Element root = doc.getRootElement();
Iterator itr = root.elementIterator();
while (itr.hasNext()) {
Element element = (Element) itr.next();
if (elementName.equals(element.getName())) {
return element.getTextTrim();
}
}
return "";
}
public void fanshe(String patient_id) {
String temp = System.getProperty("user.dir") + "\\temp";
File fs = new File(temp);
if (!fs.isDirectory()) {
fs.mkdirs();
}
String loccalPath = getXmlPath("path");
ItextPdfImpl itextPdf = new ItextPdfImpl();
List<Fangshe> fangsheList = getFangshe(patient_id);
List<Archive_Detail> archive_details = getAssortIdBySource("pacs");
Archive_Detail archiveDetail = null;
for (Fangshe fangshe : fangsheList) {
boolean flag = true;
for (Archive_Detail archive_detail : archive_details) {
if (archive_detail.getSubAssort().equals(fangshe.getSource_id() + "_" + fangshe.getACCESSIONNUMBER())) {
flag = false;
}
}
if (flag) {
String picPath = getPicPath(fangshe);
String picPath1 = getPicPath1(fangshe);
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
archiveDetail = new Archive_Detail();
archiveDetail.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSubAssort(fangshe.getSource_id() + "_" + fangshe.getACCESSIONNUMBER());
archiveDetail.setUploadDateTime(new Date());
archiveDetail.setSource("pacs");
archiveDetail.setFlag("0");
archiveDetail.setTitle(fangshe.getREQUESTEDPROCEDUREDESCRIPTION().replaceAll("\\s*", ""));
try {
ArchiveMaster archiveMaster = pacsGetHisId(fangshe.getSource_id());
if (StringUtils.isNoneBlank(archiveMaster.getPatientId())) {
ArchiveMaster archiveMaster1 = getMasterIdByPa(archiveMaster.getPatientId());
if (StringUtils.isNoneBlank(archiveMaster1.getId())) {
archiveMaster.setId(archiveMaster1.getId());
} else {
uploadHomePageByPid(archiveMaster.getPatientId());
ArchiveMaster id1 = getMasterIdByPa(archiveMaster.getPatientId());
archiveMaster.setId(id1.getId());
}
File file = new File(loccalPath + "\\pacs\\" + archiveMaster.getPatientId());
if (!file.isDirectory()) {
file.mkdirs();
}
boolean b = itextPdf.writePdf(fangshe, temp + "\\" + id + ".pdf", picPath, picPath1, fangshe.getProf());
if (b && FileUtil.checkFileWritingOn(temp + "\\" + id + ".pdf")) {
FileUtils.copyFile(new File(temp + "\\" + id + ".pdf"), new File(loccalPath + "\\pacs\\" + archiveMaster.getPatientId() + "\\" + id + ".pdf"));
archiveDetail.setPdfPath(loccalPath + "\\pacs\\" + archiveMaster.getPatientId() + "\\" + id + ".pdf");
archiveDetail.setMasterId(archiveMaster.getId());
File file1 = new File(archiveDetail.getPdfPath());
if (file1.exists() && FileUtil.checkFileWritingOn(file1.getAbsolutePath())) {
writeArchiveDetail(archiveDetail);
logger.log("模板打出报告>>>>>单号:" + patient_id);
}
}
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
File file2 = new File(temp + "\\" + id + ".pdf");
if (file2.exists()) {
file2.delete();
}
}
}
}
}
public List<Fangshe> getFangshe(String patient_id) {
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
String sql = "select ACCESSIONNUMBER,PROF,source_id,FIRSTNAME AS 姓名,PATIENTSEX AS 性别,PATIENTAGE AS 年龄,PATIENT_ID AS 检查号,\n" +
"REQUESTINGDEPARTMENT AS 申请科室,BEDID AS 床号,INPATIENT_ID AS 住院号,CLINICAL_ID AS 门诊号,\n" +
"REQUESTEDPROCEDUREDESCRIPTION AS 检查部位,EXAMINEDESCRIPTION AS 检查所见,DIAGNOSISPROMPT AS \n" +
"诊断提示,CONVERT(varchar, DATEPART(yy,EXAMINEDATE))+'年'+CONVERT(varchar, DATEPART(mm,EXAMINEDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,EXAMINEDATE))+'日'AS 检查日期,CONVERT(varchar, DATEPART(yy,REPORTDATE))+'年'+\n" +
"CONVERT(varchar, DATEPART(mm,REPORTDATE))+'月'+CONVERT(varchar, DATEPART(DD,REPORTDATE))+'日' AS 报告日期,\n" +
"REPORTDOCTOR AS 报告医生,CONVERT(varchar, DATEPART(yy,AUDITINGDATE))+'年'+CONVERT(varchar, DATEPART(mm,AUDITINGDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,AUDITINGDATE))+'日'AS 审核日期,AUDITINGDOCTOR AS 审核医生 from RIS_STUDIES\n" +
"where REPORTDATE is not null and PATIENT_ID=?";
Fangshe fangshe = null;
List<Fangshe> fangsheList = new ArrayList<>();
Object[] parms = new Object[]{patient_id};
try {
connection = JDBCUtils4.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
fangshe = new Fangshe();
fangshe.setACCESSIONNUMBER(resultSet.getString("ACCESSIONNUMBER"));
fangshe.setProf(convertProf(resultSet.getString("PROF")));
fangshe.setSource_id(resultSet.getString("source_id"));
fangshe.setFIRSTNAME(resultSet.getString("姓名"));
fangshe.setPATIENTSEX(resultSet.getString("性别"));
fangshe.setPATIENTAGE(resultSet.getString("年龄"));
fangshe.setPATIENT_ID(resultSet.getString("检查号"));
fangshe.setREQUESTINGDEPARTMENT(resultSet.getString("申请科室"));
fangshe.setBEDID(resultSet.getString("床号"));
fangshe.setINPATIENT_ID(resultSet.getString("门诊号"));
fangshe.setCLINICAL_ID(resultSet.getString("住院号"));
fangshe.setREQUESTEDPROCEDUREDESCRIPTION(resultSet.getString("检查部位"));
fangshe.setEXAMINEDESCRIPTION(resultSet.getString("检查所见"));
fangshe.setDIAGNOSISPROMPT(resultSet.getString("诊断提示"));
fangshe.setEXAMINEDATE(resultSet.getString("检查日期"));
fangshe.setREPORTDATE(resultSet.getString("报告日期"));
fangshe.setREPORTDOCTOR(convertName(resultSet.getString("报告医生")));
fangshe.setAUDITINGDATE(resultSet.getString("审核日期"));
fangshe.setAUDITINGDOCTOR(convertName(resultSet.getString("审核医生")));
fangsheList.add(fangshe);
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet, statement, connection);
}
return fangsheList;
}
public String convertProf(String profName) {
Map<String, String> profMap = new HashMap<>();
profMap.put("1", "B超检查报告单");
profMap.put("2", "CR检查报告单");
profMap.put("3", "CT检查报告单");
profMap.put("4", "MR检查报告单");
profMap.put("5", "放射检查报告单");
profMap.put("6", "DR检查报告单");
profMap.put("7", "数字胃肠检查报告单");
profMap.put("8", "DSA检查小C报告单");
profMap.put("9", "DSA检查大C报告单");
profMap.put("20", "骨密度检查报告单");
profMap.put("22", "胃镜检查报告单");
profMap.put("23", "肠镜检查报告单");
profMap.put("24", "鼻咽喉镜检查报告单");
profMap.put("25", "十二指肠镜检查报告单");
profMap.put("26", "TCD检查报告单");
profMap.put("27", "支气管检查报告单");
profMap.put("28", "肺功能检查报告单");
profMap.put("29", "心电图检查报告单");
profMap.put("30", "病理检查报告单");
profMap.put("32", "超声内镜报告单");
profMap.put("33", "胶囊内镜检查报告单");
profMap.put("34", "呼气试验检查报告单");
profMap.put("36", "液基检查报告单");
profMap.put("37", "细胞学检查报告单");
profMap.put("38", "HPV检查报告单");
profMap.put("39", "皮肤科检查报告单");
if (StringUtils.isNoneBlank(profName)) {
return profMap.get(profName);
}
return "";
}
public String convertName(String name) {
if (StringUtils.isNoneBlank(name)) {
String[] strings = name.split("/");
if (2 == strings.length) {
return strings[0];
} else {
return name;
}
} else {
return "";
}
}
public List<Archive_Detail> getAssortIdBySource(String source) {
String sql = "select SubAssort from archive_detail where Source = ? order by UpLoadDateTime desc";
Object[] parms = new Object[]{source};
Archive_Detail archive_detail = null;
List<Archive_Detail> details = new ArrayList<>();
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
archive_detail = new Archive_Detail();
archive_detail.setSubAssort(resultSet.getString("SubAssort"));
details.add(archive_detail);
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet, statement, connection);
}
return details;
}
public String getPicPath(Fangshe source) {
String path = getXmlPath("pic");
User user = getUserEntity(source.getREPORTDOCTOR());
String str = "";
if (null != user.getCode()) {
File file = new File(path + user.getCode() + ".png");
if (file.exists()) {
str = path + user.getCode() + ".png";
}
File file1 = new File(path + "介入科\\" + user.getCode() + ".png");
if (file1.exists()) {
str = path + "介入科\\" + user.getCode() + ".png";
}
File file2 = new File(path + "内镜中心\\" + user.getCode() + ".png");
if (file2.exists()) {
str = path + "内镜中心\\" + user.getCode() + ".png";
}
if (!StringUtils.isNoneBlank(str)) {
File file3 = new File(path + "B超\\" + source.getREPORTDOCTOR() + ".png");
if (file3.exists()) {
str = path + "B超\\" + source.getREPORTDOCTOR() + ".png";
}
File file4 = new File(path + "病理\\" + source.getREPORTDOCTOR() + ".png");
if (file4.exists()) {
str = path + "病理\\" + source.getREPORTDOCTOR() + ".png";
}
}
} else {
File file = new File(path + "B超\\" + source.getREPORTDOCTOR() + ".png");
if (file.exists()) {
str = path + "B超\\" + source.getREPORTDOCTOR() + ".png";
}
File file1 = new File(path + "病理\\" + source.getREPORTDOCTOR() + ".png");
if (file1.exists()) {
str = path + "病理\\" + source.getREPORTDOCTOR() + ".png";
}
}
if (!StringUtils.isNoneBlank(str)) {
logger.log("未签名医师:" + source.getProf() + "-:" + source.getREPORTDOCTOR());
}
return str;
}
public String getPicPath1(Fangshe source) {
String path = getXmlPath("pic");
User user = getUserEntity(source.getAUDITINGDOCTOR());
String str = "";
if (null != user.getCode()) {
File file = new File(path + user.getCode() + ".png");
if (file.exists()) {
str = path + user.getCode() + ".png";
}
File file1 = new File(path + "介入科\\" + user.getCode() + ".png");
if (file1.exists()) {
str = path + "介入科\\" + user.getCode() + ".png";
}
File file2 = new File(path + "内镜中心\\" + user.getCode() + ".png");
if (file2.exists()) {
str = path + "内镜中心\\" + user.getCode() + ".png";
}
if (!StringUtils.isNoneBlank(str)) {
File file3 = new File(path + "B超\\" + source.getAUDITINGDOCTOR() + ".png");
if (file3.exists()) {
str = path + "B超\\" + source.getAUDITINGDOCTOR() + ".png";
}
File file4 = new File(path + "病理\\" + source.getAUDITINGDOCTOR() + ".png");
if (file4.exists()) {
str = path + "病理\\" + source.getAUDITINGDOCTOR() + ".png";
}
}
} else {
File file = new File(path + "B超\\" + source.getAUDITINGDOCTOR() + ".png");
if (file.exists()) {
str = path + "B超\\" + source.getAUDITINGDOCTOR() + ".png";
}
File file1 = new File(path + "病理\\" + source.getAUDITINGDOCTOR() + ".png");
if (file1.exists()) {
str = path + "病理\\" + source.getAUDITINGDOCTOR() + ".png";
}
}
if (!StringUtils.isNoneBlank(str)) {
logger.log("未签名医师:" + source.getProf() + "-:" + source.getAUDITINGDOCTOR());
}
return str;
}
public User getUserEntity(String name) {
String sql = "select user_name from power_user where name=?";
Object[] parms = new Object[]{name};
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
User user = new User();
try {
connection = JDBCUtils5.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
user.setCode(resultSet.getString("user_name"));
}
} catch (Exception ex) {
} finally {
JDBCUtils.release(resultSet, statement, connection);
}
return user;
}
}

@ -0,0 +1,665 @@
package com.xjgs.service;
import com.xjgs.dao.JDBCUtils;
import com.xjgs.dao.JDBCUtils3;
import com.xjgs.dao.JDBCUtils4;
import com.xjgs.dao.JDBCUtils5;
import com.xjgs.util.FileUtil;
import com.xjgs.util.FtpUtil;
import com.xjgs.util.Logger;
import com.xjgs.util.PDFHelper;
import com.xjgs.vo.ArchiveMaster;
import com.xjgs.vo.Archive_Detail;
import com.xjgs.vo.Fangshe;
import com.xjgs.vo.User;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
public class PacsService {
private static Logger logger = new Logger();
//下载超声pdf并填入文件表
public void uploadRadiation(String patientId) {
SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd");
String format1 = dateFormat.format (new Date ());
String rootPath = System.getProperty ("user.dir");
rootPath = rootPath+"\\logs\\"+format1;
File fs = new File (rootPath);
if(!fs.isDirectory ()){
fs.mkdirs ();
}
System.setProperty ("log.base",rootPath);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(new Date ());
List<Archive_Detail> archive_details = getAssortIdBySource ("pacs");
List<Fangshe> fangsheList = getRadiEntity (patientId);
for(Fangshe fangshe : fangsheList){
boolean flag = true;
for (Archive_Detail archive_detail:archive_details) {
if(archive_detail.getSubAssort ().equals (fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER())){
flag = false;
}
}
if(flag){
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
Date date = new Date();
writeRadiEntity(fangshe,id,getXmlPath("path"), date);
}
}
logger.log("患者记账号为:"+patientId+"的超声数据已同步,同步时间:"+format);
}
public List<Fangshe> getRadiEntity(String patientId) {
String sql = "select ACCESSIONNUMBER,PROF,REQUESTEDPROCEDUREDESCRIPTION AS 检查部位,source_id,CLINICAL_ID, REPORTDATE as 报告日期,\n" +
"AUDITINGDATE as 审核日期,PATIENT_ID as 检查号,INPATIENT_ID as 住院号,FIRSTNAME as 患者姓名,EXAMINEDATE \n" +
"as 开始检查时间@,CONVERT(varchar, DATEPART(yy,REGISTERDATE))+'/'+\n" +
"CONVERT(varchar,DATEPART(mm,REGISTERDATE))+'/'+CONVERT(varchar,DATEPART(dd,REGISTERDATE)) +'/'+RTRIM(ACCESSIONNUMBER)\n" +
" +'/zip/' as path,REPORTDOCTOR AS 报告医生,AUDITINGDOCTOR AS 审核医生 from RIS_STUDIES where ACCESSIONNUMBER like'J%'\n" +
"AND REPORTDATE is not null and SOURCE_ID is not null and (PATIENTTYPE = '住院' or PATIENTTYPE='急诊') and CLINICAL_ID = ? order by REPORTDATE desc";
Fangshe fangshe = null;
List<Fangshe>fangsheList = new ArrayList<> ();
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
Object[]parms = new Object[]{patientId};
try {
connection = JDBCUtils4.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
fangshe = new Fangshe ();
fangshe.setACCESSIONNUMBER (resultSet.getString ("ACCESSIONNUMBER"));
fangshe.setSource_id (resultSet.getString ("source_id"));
fangshe.setINPATIENT_ID (resultSet.getString ("住院号"));
fangshe.setProf (convertProf (resultSet.getString ("PROF")));
fangshe.setREQUESTEDPROCEDUREDESCRIPTION (resultSet.getString ("检查部位"));
fangshe.setREPORTDOCTOR (convertName (resultSet.getString ("报告医生")));
fangshe.setAUDITINGDOCTOR (convertName (resultSet.getString ("审核医生")));
fangshe.setREPORTDATE(resultSet.getString("报告日期"));
fangshe.setPath (resultSet.getString ("path"));
if(null !=fangshe.getPath()){
fangsheList.add(fangshe);
}
}
} catch (Exception e) {
logger.log(e.toString());
}
finally {
JDBCUtils.release(resultSet,statement,connection);
}
return fangsheList;
}
public void fanshe(String patientId){
String temp = System.getProperty("user.dir")+"\\temp";
File fs = new File (temp);
if(!fs.isDirectory ()){
fs.mkdirs ();
}
String loccalPath = getXmlPath("path");
ItextPdfImpl itextPdf = new ItextPdfImpl();
List<Fangshe>fangsheList= getFangshe(patientId);
List<Archive_Detail> archive_details = getAssortIdBySource ("pacs");
Archive_Detail archiveDetail = null;
for(Fangshe fangshe:fangsheList){
boolean flag = true;
for(Archive_Detail archive_detail:archive_details){
if(archive_detail.getSubAssort ().equals(fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER())){
flag = false;
}
}
if(flag){
String picPath = getPicPath(fangshe);
String picPath1 = getPicPath1 (fangshe);
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
archiveDetail = new Archive_Detail();
archiveDetail.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSubAssort(fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER());
archiveDetail.setUploadDateTime(new Date());
archiveDetail.setSource("pacs");
archiveDetail.setFlag("0");
archiveDetail.setTitle(fangshe.getREQUESTEDPROCEDUREDESCRIPTION().replaceAll ("\\s*",""));
try {
ArchiveMaster archiveMaster = pacsGetHisId(fangshe.getSource_id());
if(StringUtils.isNoneBlank(archiveMaster.getPatientId ())){
ArchiveMaster archiveMaster1 = getMasterIdByPa(archiveMaster.getPatientId());
if(StringUtils.isNoneBlank(archiveMaster1.getId())){
archiveMaster.setId(archiveMaster1.getId());
}
else{
uploadHomePageByPid(archiveMaster.getPatientId());
ArchiveMaster id1 = getMasterIdByPa(archiveMaster.getPatientId());
archiveMaster.setId(id1.getId());
}
File file = new File("Z:\\pacs\\"+archiveMaster.getPatientId());
if(!file.isDirectory ()){
file.mkdirs();
}
boolean b = itextPdf.writePdf (fangshe,temp + "\\" + id + ".pdf",picPath,picPath1,fangshe.getProf ());
if(b && FileUtil.checkFileWritingOn(temp + "\\" + id + ".pdf")){
FileUtils.copyFile (new File (temp+"\\"+id+".pdf"),new File (/*loccalPath+"\\pacs\\"+*/"Z:\\pacs\\"+archiveMaster.getPatientId()+"\\"+id+".pdf"));
archiveDetail.setPdfPath(/*loccalPath+"\\pacs\\"*/"G:\\pdf\\pacs\\"+archiveMaster.getPatientId()+"\\"+id+".pdf");
archiveDetail.setMasterId(archiveMaster.getId());
File file1 = new File (archiveDetail.getPdfPath ());
if(file1.exists () && FileUtil.checkFileWritingOn(file1.getAbsolutePath())){
writeArchiveDetail(archiveDetail);
}
}
}
}catch (Exception e){
logger.log(e.toString());
}finally {
File file2 = new File (temp+"\\"+id+".pdf");
file2.delete ();
}
}
}
}
public int writeArchiveDetail(Archive_Detail archiveDetail) {
String sql = "insert into archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag)values(replace(newid(), '-', '')," +
"?,?,?,?,?,?,?,?)";
Connection connection = null;
PreparedStatement statement = null;
Object[] parms = new Object[]{archiveDetail.getPdfPath(), archiveDetail.getMasterId(), archiveDetail.getUploadDateTime(), archiveDetail.getAssortId(), archiveDetail.getSource(), archiveDetail.getSubAssort(), archiveDetail.getTitle(), archiveDetail.getFlag()};
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
if(parms[i] instanceof Date) {
parms[i] = new java.sql.Timestamp(((Date) parms[i]).getTime());
}
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(null,statement,connection);
}
return j;
}
public List<Fangshe> getFangshe(String patientId){
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
String sql = "select ACCESSIONNUMBER,PROF,source_id,FIRSTNAME AS 姓名,PATIENTSEX AS 性别,PATIENTAGE AS 年龄,PATIENT_ID AS 检查号,\n" +
"REQUESTINGDEPARTMENT AS 申请科室,BEDID AS 床号,INPATIENT_ID AS 住院号,CLINICAL_ID AS 门诊号,\n" +
"REQUESTEDPROCEDUREDESCRIPTION AS 检查部位,EXAMINEDESCRIPTION AS 检查所见,DIAGNOSISPROMPT AS \n" +
"诊断提示,CONVERT(varchar, DATEPART(yy,EXAMINEDATE))+'年'+CONVERT(varchar, DATEPART(mm,EXAMINEDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,EXAMINEDATE))+'日'AS 检查日期,CONVERT(varchar, DATEPART(yy,REPORTDATE))+'年'+\n" +
"CONVERT(varchar, DATEPART(mm,REPORTDATE))+'月'+CONVERT(varchar, DATEPART(DD,REPORTDATE))+'日' AS 报告日期,\n" +
"REPORTDOCTOR AS 报告医生,CONVERT(varchar, DATEPART(yy,AUDITINGDATE))+'年'+CONVERT(varchar, DATEPART(mm,AUDITINGDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,AUDITINGDATE))+'日'AS 审核日期,AUDITINGDOCTOR AS 审核医生 from RIS_STUDIES\n" +
"where CLINICAL_ID = ? order by REPORTDATE desc";
Fangshe fangshe = null;
List<Fangshe>fangsheList = new ArrayList<>();
Object[]parms= new Object[]{patientId};;
try {
connection = JDBCUtils4.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
fangshe = new Fangshe();
fangshe.setACCESSIONNUMBER (resultSet.getString ("ACCESSIONNUMBER"));
fangshe.setProf (convertProf (resultSet.getString ("PROF")));
fangshe.setSource_id(resultSet.getString("source_id"));
fangshe.setFIRSTNAME(resultSet.getString("姓名"));
fangshe.setPATIENTSEX(resultSet.getString("性别"));
fangshe.setPATIENTAGE(resultSet.getString("年龄"));
fangshe.setPATIENT_ID(resultSet.getString("检查号"));
fangshe.setREQUESTINGDEPARTMENT(resultSet.getString("申请科室"));
fangshe.setBEDID(resultSet.getString("床号"));
fangshe.setINPATIENT_ID(resultSet.getString("门诊号"));
fangshe.setCLINICAL_ID(resultSet.getString("住院号"));
fangshe.setREQUESTEDPROCEDUREDESCRIPTION(resultSet.getString("检查部位"));
fangshe.setEXAMINEDESCRIPTION(resultSet.getString("检查所见"));
fangshe.setDIAGNOSISPROMPT(resultSet.getString("诊断提示"));
fangshe.setEXAMINEDATE(resultSet.getString("检查日期"));
fangshe.setREPORTDATE(resultSet.getString("报告日期"));
fangshe.setREPORTDOCTOR(convertName (resultSet.getString("报告医生")));
fangshe.setAUDITINGDATE(resultSet.getString("审核日期"));
fangshe.setAUDITINGDOCTOR(convertName (resultSet.getString("审核医生")));
fangsheList.add(fangshe);
}
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(resultSet,statement,connection);
}
return fangsheList;
}
public String convertName(String name){
if(StringUtils.isNoneBlank (name)){
String[] strings = name.split ("/");
if(2 == strings.length){
return strings[0];
}else {
return name;
}
}else {
return "";
}
}
public ArchiveMaster pacsGetHisId(String sourceId){
String sql = "select fvisit_id,fappnote_no from mp.smp_pacs_appnote where fappnote_no = ?";
Object[]parms = new Object[]{sourceId};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = JDBCUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
preparedStatement.setObject(i + 1, parms[i]);
}
}
resultSet = preparedStatement.executeQuery();
while (resultSet.next()){
archiveMaster = new ArchiveMaster();
archiveMaster.setPatientId(resultSet.getString("fvisit_id"));
}
} catch (SQLException e) {
logger.log(e.toString());
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet,preparedStatement,connection);
}
return archiveMaster == null ? new ArchiveMaster():archiveMaster;
}
public Integer writeRadiEntity(Fangshe fangshe, String id, String localPath, Date date) {
String temp = System.getProperty("user.dir")+"\\temp";
File fs = new File (temp);
if(!fs.isDirectory ()){
fs.mkdirs ();
}
int j = 0;
Connection connection = null;
PreparedStatement statement = null;
Archive_Detail archiveDetail = new Archive_Detail ();
archiveDetail.setSubAssort (fangshe.getSource_id ());
ArchiveMaster archiveMaster = pacsGetHisId (fangshe.getSource_id ());
ArchiveMaster archiveMaster1 = null;
if(StringUtils.isNoneBlank (archiveMaster.getPatientId ())) {
try {
archiveMaster1 = getMasterIdByPa (archiveMaster.getPatientId ());
if (StringUtils.isNoneBlank(archiveMaster1.getId ())) {
archiveMaster.setId (archiveMaster1.getId ());
} else {
uploadHomePageByPid (archiveMaster.getPatientId ());
ArchiveMaster id1 = getMasterIdByPa (archiveMaster.getPatientId ());
archiveMaster.setId (id1.getId ());
}
FtpUtil ftpUtil = new FtpUtil ();
ftpUtil.downloadFile (fangshe.getPath (), "yun.pdf", temp, id + ".pdf");
File fd = new File (temp+"\\"+id + ".pdf");
if (fd.exists() && FileUtil.checkFileWritingOn(temp+"\\"+id + ".pdf")) {
String picPath = getPicPath (fangshe);
String picPath1 = getPicPath1 (fangshe);
archiveDetail.setPdfPath ((localPath + "\\pacs\\" + archiveMaster.getPatientId () + "\\" + id + ".pdf"));
File file = new File (localPath + "\\pacs\\" + archiveMaster.getPatientId ());
if (!file.isDirectory ()) {
file.mkdirs ();
}
PDFHelper.AddWatermark (temp + "\\" + id + ".pdf", picPath, picPath1, archiveDetail.getPdfPath ());
if (new File (archiveDetail.getPdfPath ()).exists () && FileUtil.checkFileWritingOn(archiveDetail.getPdfPath())) {
logger.log("准备添加文件信息");
archiveDetail.setMasterId (archiveMaster.getId ());
archiveDetail.setUploadDateTime (date);
archiveDetail.setAssortId ("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSource ("pacs");
archiveDetail.setFlag ("0");
archiveDetail.setSubAssort (fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER());
archiveDetail.setTitle (fangshe.getREQUESTEDPROCEDUREDESCRIPTION ().replaceAll ("\\s*",""));
String sql = "insert into archive_detail(ID,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,flag,title,SubAssort)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?)";
Object[] parms = new Object[]{archiveDetail.getPdfPath (), archiveDetail.getMasterId (), archiveDetail.getUploadDateTime (), archiveDetail.getAssortId (), archiveDetail.getSource (), archiveDetail.getFlag (), archiveDetail.getTitle (), archiveDetail.getSubAssort ()};
connection = JDBCUtils3.getConnection ();
statement = connection.prepareStatement (sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject (i + 1, parms[i]);
}
}
j = statement.executeUpdate ();
}
}
} catch (Exception e) {
logger.log ("超声数据未同步_____"+archiveMaster.getPatientId ());
} finally {
File file = new File (temp + "\\" + id + ".pdf");
file.delete ();
JDBCUtils.release (null, statement, connection);
}
}
return j;
}
public void uploadHomePageByPid(String patientId){
String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.rycw as 入院床位,hp.fdrname as 主管医生 " +
"from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.jzh = ? order by t.jzh desc";
ArchiveMaster master = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
Object[]parms = new Object[]{patientId};
try {
connection = JDBCUtils.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
master = new ArchiveMaster();
master.setInpNo(resultSet.getString("住院号").trim());
master.setPatientId(resultSet.getString("记账号").trim());
master.setVisitId(resultSet.getString("住院次数"));
master.setName(resultSet.getString("姓名"));
master.setSex(resultSet.getString("性别"));
master.setAdmissionDateTime(resultSet.getString("入院日期"));
master.setDischargeDateTime(resultSet.getString("出院日期"));
master.setIdNo(resultSet.getString("身份证号"));
master.setDeptAdmissionTo(resultSet.getString("入院科室"));
master.setDeptName(resultSet.getString("出院科室"));
master.setDoctorInCharge(resultSet.getString("主管医生"));
master.setBedId(resultSet.getString ("入院床位"));
if(null == master.getDischargeDateTime()|| master.getDischargeDateTime().isEmpty()){
master.setStatus("在院");
}else{
master.setStatus("归档中");
}
if ("2".equals(master.getSex())) {
master.setSex("女");
} else {
master.setSex("男");
}
writeHomeEntity(master);
}
} catch (Exception e) {
logger.log(e.toString());
}
finally {
JDBCUtils.release(resultSet,statement,connection);
}
}
//新增首页数据
int writeHomeEntity(ArchiveMaster archiveMaster) {
String sql = "insert into archive_master(id,patient_id,inp_no,visit_id,name,sex,dept_name,discharge_date_time," +
"archivestate,admission_date_time,dept_admission_to,doctor_in_charge,id_no,bed_id)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?)";
Object[] parms = new Object[]{archiveMaster.getPatientId(), archiveMaster.getInpNo(), archiveMaster.getVisitId(), archiveMaster.getName(), archiveMaster.getSex(), archiveMaster.getDeptName(), archiveMaster.getDischargeDateTime(), archiveMaster.getStatus(), archiveMaster.getAdmissionDateTime(), archiveMaster.getDeptAdmissionTo(), archiveMaster.getDoctorInCharge(), archiveMaster.getIdNo(),archiveMaster.getBedId ()};
Connection connection = null;
PreparedStatement statement = null;
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(null,statement,connection);
}
return j;
}
public ArchiveMaster getMasterIdByPa(String jzh){
String sql = "select ID,patient_id from archive_master where patient_id = ?";
Object[]parms = new Object[]{jzh};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
archiveMaster = new ArchiveMaster();
archiveMaster.setId(resultSet.getString("ID"));
archiveMaster.setPatientId(resultSet.getString("patient_id"));
}
} catch (Exception e) {
logger.log(e.toString());
}
finally {
JDBCUtils.release(resultSet,statement,connection);
}
return archiveMaster == null ? new ArchiveMaster():archiveMaster;
}
public String getPicPath(Fangshe source){
String path = getXmlPath("pic");
User user = getUserEntity (source.getREPORTDOCTOR ());
String str = "";
if(StringUtils.isNoneBlank(user.getCode())){
File file = new File (path+user.getCode ()+".png");
if(file.exists ()){
str = path+user.getCode ()+".png";
}
File file1 = new File (path+"介入科\\"+user.getCode ()+".png");
if(file1.exists ()){
str = path+"介入科\\"+user.getCode ()+".png";
}
File file2 = new File (path+"内镜中心\\"+user.getCode ()+".png");
if(file2.exists ()){
str = path+"内镜中心\\"+user.getCode ()+".png";
}
if(!StringUtils.isNoneBlank (str)){
File file3 = new File (path+"B超\\"+source.getREPORTDOCTOR ()+".png");
if(file3.exists ()){
str = path+"B超\\"+source.getREPORTDOCTOR ()+".png";
}
File file4 = new File (path+"病理\\"+source.getREPORTDOCTOR ()+".png");
if(file4.exists ()){
str = path+"病理\\"+source.getREPORTDOCTOR ()+".png";
}
}
}else{
File file = new File (path+"B超\\"+source.getREPORTDOCTOR ()+".png");
if(file.exists ()){
str = path+"B超\\"+source.getREPORTDOCTOR ()+".png";
}
File file1 = new File (path+"病理\\"+source.getREPORTDOCTOR ()+".png");
if(file1.exists ()){
str = path+"病理\\"+source.getREPORTDOCTOR ()+".png";
}
}
if(!StringUtils.isNoneBlank (str)){
logger.log ("未签名医师:"+source.getProf ()+"-:"+source.getREPORTDOCTOR ());
}
return str;
}
public String getPicPath1(Fangshe source){
String path = getXmlPath("pic");
User user = getUserEntity (source.getAUDITINGDOCTOR ());
String str = "";
if(StringUtils.isNoneBlank(user.getCode())){
File file = new File (path+user.getCode ()+".png");
if(file.exists ()){
str = path+user.getCode ()+".png";
}
File file1 = new File (path+"介入科\\"+user.getCode ()+".png");
if(file1.exists ()){
str = path+"介入科\\"+user.getCode ()+".png";
}
File file2 = new File (path+"内镜中心\\"+user.getCode ()+".png");
if(file2.exists ()){
str = path+"内镜中心\\"+user.getCode ()+".png";
}
if(!StringUtils.isNoneBlank (str)){
File file3 = new File (path+"B超\\"+source.getAUDITINGDOCTOR ()+".png");
if(file3.exists ()){
str = path+"B超\\"+source.getAUDITINGDOCTOR ()+".png";
}
File file4 = new File (path+"病理\\"+source.getAUDITINGDOCTOR ()+".png");
if(file4.exists ()){
str = path+"病理\\"+source.getAUDITINGDOCTOR ()+".png";
}
}
}else{
File file = new File (path+"B超\\"+source.getAUDITINGDOCTOR ()+".png");
if(file.exists ()){
str = path+"B超\\"+source.getAUDITINGDOCTOR ()+".png";
}
File file1 = new File (path+"病理\\"+source.getAUDITINGDOCTOR ()+".png");
if(file1.exists ()){
str = path+"病理\\"+source.getAUDITINGDOCTOR ()+".png";
}
}
if(!StringUtils.isNoneBlank (str)){
logger.log ("未签名医师:"+source.getProf ()+"-:"+source.getAUDITINGDOCTOR ());
}
return str;
}
public User getUserEntity(String name){
String sql = "select user_name from power_user where name=?";
Object[]parms = new Object[]{name};
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
User user = new User ();
try {
connection = JDBCUtils5.getConnection ();
statement = connection.prepareStatement (sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery ();
while (resultSet.next ()){
user.setCode (resultSet.getString ("user_name"));
}
}catch (Exception ex){
logger.log(ex.toString());
}finally {
JDBCUtils.release (resultSet,statement,connection);
}
return user;
}
public String convertProf(String profName){
Map<String,String>profMap = new HashMap<> ();
profMap.put ("1","B超检查报告单");
profMap.put ("2","CR检查报告单");
profMap.put ("3","CT检查报告单");
profMap.put ("4","MR检查报告单");
profMap.put ("5","放射检查报告单");
profMap.put ("6","DR检查报告单");
profMap.put ("7","数字胃肠检查报告单");
profMap.put ("8","DSA检查小C报告单");
profMap.put ("9","DSA检查大C报告单");
profMap.put ("20","骨密度检查报告单");
profMap.put ("22","胃镜检查报告单");
profMap.put ("23","肠镜检查报告单");
profMap.put ("24","鼻咽喉镜检查报告单");
profMap.put ("25","十二指肠镜检查报告单");
profMap.put ("26","TCD检查报告单");
profMap.put ("27","支气管检查报告单");
profMap.put ("28","肺功能检查报告单");
profMap.put ("29","心电图检查报告单");
profMap.put ("30","病理检查报告单");
profMap.put ("32","超声内镜报告单");
profMap.put ("33","胶囊内镜检查报告单");
profMap.put ("34","呼气试验检查报告单");
profMap.put ("36","液基检查报告单");
profMap.put ("37","细胞学检查报告单");
profMap.put ("38","HPV检查报告单");
profMap.put ("39","皮肤科检查报告单");
if(StringUtils.isNoneBlank (profName)){
return profMap.get (profName);
}
return "";
}
public List<Archive_Detail>getAssortIdBySource(String source){
String sql = "select SubAssort from archive_detail where Source = ? order by UpLoadDateTime desc";
Object[]parms = new Object[]{source};
Archive_Detail archive_detail = null;
List<Archive_Detail>details = new ArrayList<>();
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
archive_detail = new Archive_Detail();
archive_detail.setSubAssort(resultSet.getString("SubAssort"));
details.add(archive_detail);
}
}catch (Exception e){
logger.log(e.toString());
}finally {
JDBCUtils.release(resultSet,statement,connection);
}
return details;
}
public String getXmlPath(String elementName) {
Document doc = null;
try {
doc = new SAXReader ().read(this.getClass().getResourceAsStream("/localPath.xml"));
} catch (DocumentException e) {
e.printStackTrace();
}
Element root = doc.getRootElement();
Iterator itr = root.elementIterator();
while(itr.hasNext()){
Element element = (Element)itr.next();
if(elementName.equals(element.getName())){
return element.getTextTrim();
}
}
return "";
}
public String pacs(ArchiveMaster archiveMaster){
return "";
}
}

@ -0,0 +1,737 @@
package com.xjgs.service;
import com.xjgs.dao.JDBCUtils;
import com.xjgs.dao.JDBCUtils3;
import com.xjgs.dao.JDBCUtils4;
import com.xjgs.dao.JDBCUtils5;
import com.xjgs.util.FileUtil;
import com.xjgs.util.FtpUtil;
import com.xjgs.util.Logger;
import com.xjgs.vo.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
public class RadiateService {
private static Logger logger = new Logger();
public List<Ris_Study> getFansheEntity(){
String sql = "select PATIENT_ID,REQUESTEDPROCEDUREDESCRIPTION,ACCESSIONNUMBER,STUDYUID,REPORTDATE,SOURCE_ID\n" +
",\n" +
"( CAST( DATEPART(year,REPORTDATE) as nvarchar(4)) +'/' + CAST( DATEPART(MONTH,REPORTDATE) as nvarchar(2))+'/'+ CAST(DATEPART(DAY,REPORTDATE) as nvarchar(2))\n" +
"+'/1.2.277.0.10.'+rtrim(ACCESSIONNUMBER)+'/'\n" +
"+'1.2.277.0.10.'+rtrim(ACCESSIONNUMBER)+'/')\n" +
"as 'DCMFile',\n" +
"('1.2.277.0.10.5.1.4.1.1.88.11.'+rtrim(ACCESSIONNUMBER)+'.dcm')\n" +
"as 'DCMName' \n" +
"from RIS_STUDIES where \n" +
"PROF in (2,3,4,5,6) \n" +
"and REPORTDATE is not null\n" +
"and SOURCE_ID is not null\n" +
"and AUDITINGDATE between DATEADD(SS,-1036800,getdate()) and CONVERT(varchar(100), GETDATE(), 21) and (PATIENTTYPE = '住院' or PATIENTTYPE='急诊')\n" +
"order by REPORTDATE DESC";
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
List<Ris_Study>ris_studies = new ArrayList<> ();
Ris_Study ris_study = null;
try {
connection = JDBCUtils4.getConnection ();
statement = connection.prepareStatement (sql);
resultSet = statement.executeQuery ();
while (resultSet.next ()){
ris_study = new Ris_Study ();
ris_study.setPatientId(resultSet.getString("PATIENT_ID"));
ris_study.setACCESSIONNUMBER(resultSet.getString("ACCESSIONNUMBER"));
ris_study.setRecord_name (resultSet.getString ("REQUESTEDPROCEDUREDESCRIPTION"));
ris_study.setSource_id (resultSet.getString("SOURCE_ID"));
ris_study.setReportdate (resultSet.getString ("REPORTDATE"));
ris_study.setPath (resultSet.getString ("DCMFile"));
ris_study.setFirstname (resultSet.getString ("DCMName"));
ris_studies.add (ris_study);
}
}catch (Exception ex){
logger.log(ex.toString());
}finally {
JDBCUtils.release (resultSet,statement,connection);
}
return ris_studies;
}
public void loadDcmToPdf(Ris_Study ris_study) {
String temp = System.getProperty("user.dir") + "\\temp";
File fs = new File(temp);
if (!fs.isDirectory()) {
fs.mkdirs();
}
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
FtpUtil ftpUtil = new FtpUtil();
File file = new File(temp + "\\" + id + ".pdf");
File file3 = new File(temp + "\\" + id + ".dcm");
ftpUtil.downloadFile(ris_study.getPath(), ris_study.getFirstname(), temp, id + ".dcm");
File fd = new File(temp + "\\" + id + ".dcm");
boolean b = fd.exists();
try {
if (b) {
DCM2PDF(temp + "\\" + id + ".dcm", temp + "\\" + id + ".pdf");
if (file.exists()) {
Archive_Detail archiveDetail = new Archive_Detail();
ArchiveMaster archiveMaster = pacsGetHisId(ris_study.getSource_id());
ArchiveMaster archiveMaster1 = null;
if (StringUtils.isNoneBlank(archiveMaster.getPatientId())) {
archiveMaster1 = getMasterIdByPa(archiveMaster.getPatientId());
if (StringUtils.isNoneBlank(archiveMaster1.getId())) {
archiveMaster.setId(archiveMaster1.getId());
} else {
uploadHomePageByPid(archiveMaster.getPatientId());
ArchiveMaster id1 = getMasterIdByPa(archiveMaster.getPatientId());
archiveMaster.setId(id1.getId());
}
archiveDetail.setMasterId(archiveMaster.getId());
archiveDetail.setUploadDateTime(new Date());
archiveDetail.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSource("pacs");
archiveDetail.setFlag("0");
archiveDetail.setTitle(ris_study.getRecord_name().replaceAll("\\s*", ""));
archiveDetail.setSubAssort(ris_study.getSource_id() + "_" + ris_study.getACCESSIONNUMBER());
archiveDetail.setPdfPath(getXmlPath("path") + "\\pacs\\" + archiveMaster.getPatientId() + "\\" + id + ".pdf");
File file2 = new File(getXmlPath("path") + "\\pacs\\" + archiveMaster.getPatientId());
if (!file2.isDirectory()) {
file2.mkdirs();
}
FileUtils.copyFile(file, new File(archiveDetail.getPdfPath()));
File file1 = new File(archiveDetail.getPdfPath());
if (file1.exists() && FileUtil.checkFileWritingOn(file1.getAbsolutePath())) {
writeArchiveDetail(archiveDetail);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(new Date());
logger.log("dcm转化成功,同步时间:"+format);
}
}
}
} else {
fanshe(ris_study.getPatientId());
}
} catch (Exception e) {
logger.log(e.toString());
} finally {
file.delete();
file3.delete();
}
}
public void fanshe(String patient_id){
String temp = System.getProperty("user.dir")+"\\temp";
File fs = new File (temp);
if(!fs.isDirectory ()){
fs.mkdirs ();
}
String loccalPath = getXmlPath("path");
ItextPdfImpl itextPdf = new ItextPdfImpl();
List<Fangshe>fangsheList= getFangshe(patient_id);
List<Archive_Detail> archive_details = getAssortIdBySource ("pacs");
Archive_Detail archiveDetail = null;
for(Fangshe fangshe:fangsheList){
boolean flag = true;
for(Archive_Detail archive_detail:archive_details){
if(archive_detail.getSubAssort ().equals(fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER())){
flag = false;
}
}
if(flag){
String picPath = getPicPath(fangshe);
String picPath1 = getPicPath1 (fangshe);
UUID uuid = UUID.randomUUID();//UUID唯一识别
String id = uuid.toString();
id = id.replace("-", "");
archiveDetail = new Archive_Detail();
archiveDetail.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
archiveDetail.setSubAssort(fangshe.getSource_id ()+"_"+fangshe.getACCESSIONNUMBER());
archiveDetail.setUploadDateTime(new Date());
archiveDetail.setSource("pacs");
archiveDetail.setFlag("0");
archiveDetail.setTitle(fangshe.getREQUESTEDPROCEDUREDESCRIPTION().replaceAll ("\\s*",""));
try {
ArchiveMaster archiveMaster = pacsGetHisId(fangshe.getSource_id());
if(StringUtils.isNoneBlank(archiveMaster.getPatientId ())){
ArchiveMaster archiveMaster1 = getMasterIdByPa(archiveMaster.getPatientId());
if(StringUtils.isNoneBlank(archiveMaster1.getId())){
archiveMaster.setId(archiveMaster1.getId());
}
else{
uploadHomePageByPid(archiveMaster.getPatientId());
ArchiveMaster id1 = getMasterIdByPa(archiveMaster.getPatientId());
archiveMaster.setId(id1.getId());
}
File file = new File(loccalPath+"\\pacs\\"+archiveMaster.getPatientId());
if(!file.isDirectory ()){
file.mkdirs();
}
boolean b = itextPdf.writePdf (fangshe,temp + "\\" + id + ".pdf",picPath,picPath1,fangshe.getProf ());
if(b && FileUtil.checkFileWritingOn(temp + "\\" + id + ".pdf")){
FileUtils.copyFile (new File (temp+"\\"+id+".pdf"),new File (loccalPath+"\\pacs\\"+archiveMaster.getPatientId()+"\\"+id+".pdf"));
archiveDetail.setPdfPath(loccalPath+"\\pacs\\"+archiveMaster.getPatientId()+"\\"+id+".pdf");
archiveDetail.setMasterId(archiveMaster.getId());
File file1 = new File (archiveDetail.getPdfPath ());
if(file1.exists () && FileUtil.checkFileWritingOn(file1.getAbsolutePath())){
writeArchiveDetail(archiveDetail);
logger.log("模板打出报告>>>>>单号:"+patient_id);
}
}
}
}catch (Exception e){
logger.log(e.toString());
}finally {
File file2 = new File (temp+"\\"+id+".pdf");
if(file2.exists()){
file2.delete ();
}
}
}
}
}
public String getPicPath(Fangshe source){
String path = getXmlPath("pic");
User user = getUserEntity (source.getREPORTDOCTOR ());
String str = "";
if(null != user.getCode ()){
File file = new File (path+user.getCode ()+".png");
if(file.exists ()){
str = path+user.getCode ()+".png";
}
File file1 = new File (path+"介入科\\"+user.getCode ()+".png");
if(file1.exists ()){
str = path+"介入科\\"+user.getCode ()+".png";
}
File file2 = new File (path+"内镜中心\\"+user.getCode ()+".png");
if(file2.exists ()){
str = path+"内镜中心\\"+user.getCode ()+".png";
}
if(!StringUtils.isNoneBlank (str)){
File file3 = new File (path+"B超\\"+source.getREPORTDOCTOR ()+".png");
if(file3.exists ()){
str = path+"B超\\"+source.getREPORTDOCTOR ()+".png";
}
File file4 = new File (path+"病理\\"+source.getREPORTDOCTOR ()+".png");
if(file4.exists ()){
str = path+"病理\\"+source.getREPORTDOCTOR ()+".png";
}
}
}else{
File file = new File (path+"B超\\"+source.getREPORTDOCTOR ()+".png");
if(file.exists ()){
str = path+"B超\\"+source.getREPORTDOCTOR ()+".png";
}
File file1 = new File (path+"病理\\"+source.getREPORTDOCTOR ()+".png");
if(file1.exists ()){
str = path+"病理\\"+source.getREPORTDOCTOR ()+".png";
}
}
if(!StringUtils.isNoneBlank (str)){
logger.log ("未签名医师:"+source.getProf ()+"-:"+source.getREPORTDOCTOR ());
}
return str;
}
public String getPicPath1(Fangshe source){
String path = getXmlPath("pic");
User user = getUserEntity (source.getAUDITINGDOCTOR ());
String str = "";
if(null != user.getCode ()){
File file = new File (path+user.getCode ()+".png");
if(file.exists ()){
str = path+user.getCode ()+".png";
}
File file1 = new File (path+"介入科\\"+user.getCode ()+".png");
if(file1.exists ()){
str = path+"介入科\\"+user.getCode ()+".png";
}
File file2 = new File (path+"内镜中心\\"+user.getCode ()+".png");
if(file2.exists ()){
str = path+"内镜中心\\"+user.getCode ()+".png";
}
if(!StringUtils.isNoneBlank (str)){
File file3 = new File (path+"B超\\"+source.getAUDITINGDOCTOR ()+".png");
if(file3.exists ()){
str = path+"B超\\"+source.getAUDITINGDOCTOR ()+".png";
}
File file4 = new File (path+"病理\\"+source.getAUDITINGDOCTOR ()+".png");
if(file4.exists ()){
str = path+"病理\\"+source.getAUDITINGDOCTOR ()+".png";
}
}
}else{
File file = new File (path+"B超\\"+source.getAUDITINGDOCTOR ()+".png");
if(file.exists ()){
str = path+"B超\\"+source.getAUDITINGDOCTOR ()+".png";
}
File file1 = new File (path+"病理\\"+source.getAUDITINGDOCTOR ()+".png");
if(file1.exists ()){
str = path+"病理\\"+source.getAUDITINGDOCTOR ()+".png";
}
}
if(!StringUtils.isNoneBlank (str)){
logger.log ("未签名医师:"+source.getProf ()+"-:"+source.getAUDITINGDOCTOR ());
}
return str;
}
public User getUserEntity(String name){
String sql = "select user_name from power_user where name=?";
Object[]parms = new Object[]{name};
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
User user = new User ();
try {
connection = JDBCUtils5.getConnection ();
statement = connection.prepareStatement (sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery ();
while (resultSet.next ()){
user.setCode (resultSet.getString ("user_name"));
}
}catch (Exception ex){
}finally {
JDBCUtils.release (resultSet,statement,connection);
}
return user;
}
public List<Archive_Detail>getAssortIdBySource(String source){
String sql = "select SubAssort from archive_detail where Source = ? order by UpLoadDateTime desc";
Object[]parms = new Object[]{source};
Archive_Detail archive_detail = null;
List<Archive_Detail>details = new ArrayList<>();
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
archive_detail = new Archive_Detail();
archive_detail.setSubAssort(resultSet.getString("SubAssort"));
details.add(archive_detail);
}
}catch (Exception e){
logger.log(e.toString());
}finally {
JDBCUtils.release(resultSet,statement,connection);
}
return details;
}
public List<Fangshe> getFangshe(String patient_id){
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
String sql = "select ACCESSIONNUMBER,PROF,source_id,FIRSTNAME AS 姓名,PATIENTSEX AS 性别,PATIENTAGE AS 年龄,PATIENT_ID AS 检查号,\n" +
"REQUESTINGDEPARTMENT AS 申请科室,BEDID AS 床号,INPATIENT_ID AS 住院号,CLINICAL_ID AS 门诊号,\n" +
"REQUESTEDPROCEDUREDESCRIPTION AS 检查部位,EXAMINEDESCRIPTION AS 检查所见,DIAGNOSISPROMPT AS \n" +
"诊断提示,CONVERT(varchar, DATEPART(yy,EXAMINEDATE))+'年'+CONVERT(varchar, DATEPART(mm,EXAMINEDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,EXAMINEDATE))+'日'AS 检查日期,CONVERT(varchar, DATEPART(yy,REPORTDATE))+'年'+\n" +
"CONVERT(varchar, DATEPART(mm,REPORTDATE))+'月'+CONVERT(varchar, DATEPART(DD,REPORTDATE))+'日' AS 报告日期,\n" +
"REPORTDOCTOR AS 报告医生,CONVERT(varchar, DATEPART(yy,AUDITINGDATE))+'年'+CONVERT(varchar, DATEPART(mm,AUDITINGDATE))+'月'+\n" +
"CONVERT(varchar, DATEPART(DD,AUDITINGDATE))+'日'AS 审核日期,AUDITINGDOCTOR AS 审核医生 from RIS_STUDIES\n" +
"where REPORTDATE is not null and PATIENT_ID=?";
Fangshe fangshe = null;
List<Fangshe>fangsheList = new ArrayList<>();
Object[]parms= new Object[]{patient_id};
try {
connection = JDBCUtils4.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
fangshe = new Fangshe();
fangshe.setACCESSIONNUMBER (resultSet.getString ("ACCESSIONNUMBER"));
fangshe.setProf (convertProf (resultSet.getString ("PROF")));
fangshe.setSource_id(resultSet.getString("source_id"));
fangshe.setFIRSTNAME(resultSet.getString("姓名"));
fangshe.setPATIENTSEX(resultSet.getString("性别"));
fangshe.setPATIENTAGE(resultSet.getString("年龄"));
fangshe.setPATIENT_ID(resultSet.getString("检查号"));
fangshe.setREQUESTINGDEPARTMENT(resultSet.getString("申请科室"));
fangshe.setBEDID(resultSet.getString("床号"));
fangshe.setINPATIENT_ID(resultSet.getString("门诊号"));
fangshe.setCLINICAL_ID(resultSet.getString("住院号"));
fangshe.setREQUESTEDPROCEDUREDESCRIPTION(resultSet.getString("检查部位"));
fangshe.setEXAMINEDESCRIPTION(resultSet.getString("检查所见"));
fangshe.setDIAGNOSISPROMPT(resultSet.getString("诊断提示"));
fangshe.setEXAMINEDATE(resultSet.getString("检查日期"));
fangshe.setREPORTDATE(resultSet.getString("报告日期"));
fangshe.setREPORTDOCTOR(convertName (resultSet.getString("报告医生")));
fangshe.setAUDITINGDATE(resultSet.getString("审核日期"));
fangshe.setAUDITINGDOCTOR(convertName (resultSet.getString("审核医生")));
fangsheList.add(fangshe);
}
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(resultSet,statement,connection);
}
return fangsheList;
}
public void fangsheInfo(){
List<Archive_Detail> archive_details = pacsGetPatId ();
List<Ris_Study> fansheEntity = getFansheEntity ();
for(Ris_Study risStudy:fansheEntity){
boolean flag = true;
for(Archive_Detail archive_detail:archive_details){
if(archive_detail.getSubAssort().equals(risStudy.getSource_id()+"_"+risStudy.getACCESSIONNUMBER())){
flag = false;
}
}
if(flag){
loadDcmToPdf (risStudy);
}
}
}
public List<Archive_Detail> pacsGetPatId(){
String sql = "select SubAssort from archive_detail where Source = 'pacs'order by UpLoadDateTime desc";
Archive_Detail archive_detail = null;
List<Archive_Detail>details = new ArrayList<>();
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()){
archive_detail = new Archive_Detail();
archive_detail.setSubAssort(resultSet.getString("SubAssort"));
details.add(archive_detail);
}
}catch (Exception e){
logger.log(e.toString());
}finally {
JDBCUtils.release(resultSet,statement,connection);
}
return details;
}
//增加病例文件信息表记录
public int writeArchiveDetail(Archive_Detail archiveDetail) {
String sql = "insert into archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag)values(replace(newid(), '-', '')," +
"?,?,?,?,?,?,?,?)";
Connection connection = null;
PreparedStatement statement = null;
Object[] parms = new Object[]{archiveDetail.getPdfPath(), archiveDetail.getMasterId(), archiveDetail.getUploadDateTime(), archiveDetail.getAssortId(), archiveDetail.getSource(), archiveDetail.getSubAssort(), archiveDetail.getTitle(), archiveDetail.getFlag()};
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(null,statement,connection);
}
return j;
}
public ArchiveMaster getMasterIdByPa(String jzh){
String sql = "select ID,patient_id from archive_master where patient_id = ?";
Object[]parms = new Object[]{jzh};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()){
archiveMaster = new ArchiveMaster();
archiveMaster.setId(resultSet.getString("ID"));
archiveMaster.setPatientId(resultSet.getString("patient_id"));
}
} catch (Exception e) {
logger.log(e.toString());
}
finally {
JDBCUtils.release(resultSet,statement,connection);
}
return archiveMaster == null ? new ArchiveMaster():archiveMaster;
}
public ArchiveMaster pacsGetHisId(String sourceId){
String sql = "select fvisit_id,fappnote_no from mp.smp_pacs_appnote where fappnote_no = ?";
Object[]parms = new Object[]{sourceId};
ArchiveMaster archiveMaster = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = JDBCUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
preparedStatement.setObject(i + 1, parms[i]);
}
}
resultSet = preparedStatement.executeQuery();
while (resultSet.next()){
archiveMaster = new ArchiveMaster();
archiveMaster.setPatientId(resultSet.getString("fvisit_id"));
}
} catch (SQLException e) {
logger.log(e.toString());
} catch (Exception e) {
logger.log(e.toString());
} finally {
JDBCUtils.release(resultSet,preparedStatement,connection);
}
return archiveMaster == null ? new ArchiveMaster():archiveMaster;
}
public void uploadHomePageByPid(String patientId){
String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.rycw as 入院床位,hp.fdrname as 主管医生 " +
"from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.jzh = ? order by t.jzh desc";
ArchiveMaster master = null;
ResultSet resultSet = null;
Connection connection = null;
PreparedStatement statement = null;
Object[]parms = new Object[]{patientId};
try {
connection = JDBCUtils.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
resultSet = statement.executeQuery();
while (resultSet.next()) {
master = new ArchiveMaster();
master.setInpNo(resultSet.getString("住院号").trim());
master.setPatientId(resultSet.getString("记账号").trim());
master.setVisitId(resultSet.getString("住院次数"));
master.setName(resultSet.getString("姓名"));
master.setSex(resultSet.getString("性别"));
master.setAdmissionDateTime(resultSet.getString("入院日期"));
master.setDischargeDateTime(resultSet.getString("出院日期"));
master.setIdNo(resultSet.getString("身份证号"));
master.setDeptAdmissionTo(resultSet.getString("入院科室"));
master.setDeptName(resultSet.getString("出院科室"));
master.setDoctorInCharge(resultSet.getString("主管医生"));
master.setBedId(resultSet.getString ("入院床位"));
if(null == master.getDischargeDateTime()|| master.getDischargeDateTime().isEmpty()){
master.setStatus("在院");
}else{
master.setStatus("归档中");
}
if ("2".equals(master.getSex())) {
master.setSex("女");
} else {
master.setSex("男");
}
writeHomeEntity(master);
}
} catch (Exception e) {
logger.log(e.toString());
}
finally {
JDBCUtils.release(resultSet,statement,connection);
}
}
public String convertProf(String profName){
Map<String,String>profMap = new HashMap<> ();
profMap.put ("1","B超检查报告单");
profMap.put ("2","CR检查报告单");
profMap.put ("3","CT检查报告单");
profMap.put ("4","MR检查报告单");
profMap.put ("5","放射检查报告单");
profMap.put ("6","DR检查报告单");
profMap.put ("7","数字胃肠检查报告单");
profMap.put ("8","DSA检查小C报告单");
profMap.put ("9","DSA检查大C报告单");
profMap.put ("20","骨密度检查报告单");
profMap.put ("22","胃镜检查报告单");
profMap.put ("23","肠镜检查报告单");
profMap.put ("24","鼻咽喉镜检查报告单");
profMap.put ("25","十二指肠镜检查报告单");
profMap.put ("26","TCD检查报告单");
profMap.put ("27","支气管检查报告单");
profMap.put ("28","肺功能检查报告单");
profMap.put ("29","心电图检查报告单");
profMap.put ("30","病理检查报告单");
profMap.put ("32","超声内镜报告单");
profMap.put ("33","胶囊内镜检查报告单");
profMap.put ("34","呼气试验检查报告单");
profMap.put ("36","液基检查报告单");
profMap.put ("37","细胞学检查报告单");
profMap.put ("38","HPV检查报告单");
profMap.put ("39","皮肤科检查报告单");
if(StringUtils.isNoneBlank (profName)){
return profMap.get (profName);
}
return "";
}
public String convertName(String name){
if(StringUtils.isNoneBlank (name)){
String[] strings = name.split ("/");
if(2 == strings.length){
return strings[0];
}else {
return name;
}
}else {
return "";
}
}
//新增首页数据
int writeHomeEntity(ArchiveMaster archiveMaster) {
String sql = "insert into archive_master(id,patient_id,inp_no,visit_id,name,sex,dept_name,discharge_date_time," +
"archivestate,admission_date_time,dept_admission_to,doctor_in_charge,id_no,bed_id)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?)";
Object[] parms = new Object[]{archiveMaster.getPatientId(), archiveMaster.getInpNo(), archiveMaster.getVisitId(), archiveMaster.getName(), archiveMaster.getSex(), archiveMaster.getDeptName(), archiveMaster.getDischargeDateTime(), archiveMaster.getStatus(), archiveMaster.getAdmissionDateTime(), archiveMaster.getDeptAdmissionTo(), archiveMaster.getDoctorInCharge(), archiveMaster.getIdNo(),archiveMaster.getBedId ()};
Connection connection = null;
PreparedStatement statement = null;
int j = 0;
try {
connection = JDBCUtils3.getConnection();
statement = connection.prepareStatement(sql);
if (parms != null && parms.length > 0) {
for (int i = 0; i < parms.length; i++) {
statement.setObject(i + 1, parms[i]);
}
}
j = statement.executeUpdate();
} catch (Exception e) {
logger.log(e.toString());
}finally {
JDBCUtils.release(null,statement,connection);
}
return j;
}
private void DCM2PDF( String dcmFile, String toPDFFile) throws Exception
{
File oFile = null;
byte b1 = 37;
byte b2 = 80;
byte b3 = 68;
byte b4 = 70;
FileInputStream inputStream = null;
String pdfFile = toPDFFile;
File tFile = null;
FileOutputStream outputStream = null;
try {
oFile = new File(dcmFile);
if(!(oFile.isFile() && oFile.exists()))
{
throw new Exception("DCM 文件读取失败=>"+dcmFile);
}
inputStream = new FileInputStream(oFile);
byte[] bs = new byte[(int) oFile.length()];
inputStream.read(bs, 0, bs.length);
int seekPos = -1;
for (int i = 0; i < bs.length; i++) {
byte B1 = bs[i];
byte B2 = 0;
byte B3 = 0;
byte B4 = 0;
if (i + 1 < bs.length) {
B2 = (byte)bs[i + 1];
}
if (i + 2 < bs.length) {
B3 = (byte)bs[i + 2];
}
if (i + 3 < bs.length) {
B4 = (byte)bs[i + 3];
}
if (b1 == B1 && b2 == B2 && B3 == b3 && b4 == B4) {
seekPos = i;
break;
}
}
if (seekPos == -1) {
System.out.println("未发现2550 4446");
throw new Exception("DCM 未读取到标志位=>"+dcmFile);
}
tFile = new File(pdfFile);
if(tFile.isFile() && tFile.exists())
{
throw new Exception("目标文件已经存在=>"+pdfFile);
}
outputStream = new FileOutputStream(tFile, true);
for (int i = seekPos; i < bs.length; i++) {
outputStream.write(bs[i]);
}
} catch (Exception ex) {
System.out.println("读写出错" + ex.getMessage());
throw ex;
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public String getXmlPath(String elementName) {
Document doc = null;
try {
doc = new SAXReader ().read(this.getClass().getResourceAsStream("/localPath.xml"));
} catch (DocumentException e) {
logger.log(e.toString());
}
Element root = doc.getRootElement();
Iterator itr = root.elementIterator();
while(itr.hasNext()){
Element element = (Element)itr.next();
if(elementName.equals(element.getName())){
return element.getTextTrim();
}
}
return "";
}
}

@ -0,0 +1,25 @@
package com.xjgs.util;
import java.io.File;
/**
* <p>
* CLASS_NAME
* </p>
*
* @author ly
* @since 2020/7/15 14:46
*/
public class FileUtil {
public static boolean checkFileWritingOn(String fileName) throws Exception {
long oldLen = 0;
long newLen = 0;
File file = new File(fileName);
newLen = file.length();
if ((newLen - oldLen) > 0) {
return true;
} else {
return false;
}
}
}

@ -0,0 +1,299 @@
package com.xjgs.util;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import java.io.*;
import java.net.MalformedURLException;
public class FtpUtil {
private static Logger logger = new Logger();
//ftp服务器地址
//public String hostname = "10.36.116.102";
public String hostname = "10.36.116.101";
//ftp服务器端口号默认为21
//public Integer port = 22 ;
public Integer port = 21 ;
//ftp登录账号
//public String username = "docus_archive";//匿名登录
public String username = "anonymous";//匿名登录
//ftp登录密码
//public String password = "sucod@904";
public String password = "sucod@904";
public FTPClient ftpClient = null;
/**
* ftp
*/
public void initFtpClient() {
ftpClient = new FTPClient();
ftpClient.setControlEncoding("utf-8");
try {
System.out.println("connecting...ftp服务器:"+this.hostname+":"+this.port);
ftpClient.connect(hostname, port); //连接ftp服务器
ftpClient.login(username, password); //登录ftp服务器
int replyCode = ftpClient.getReplyCode(); //是否成功登录服务器
if(!FTPReply.isPositiveCompletion(replyCode)){
System.out.println("connect failed...ftp服务器:"+this.hostname+":"+this.port);
}
System.out.println("connect successfu...ftp服务器:"+this.hostname+":"+this.port);
}catch (MalformedURLException e) {
logger.log(e.toString());
}catch (IOException e) {
logger.log(e.toString());
}
}
/**
*
* @param pathname ftp
* @param fileName ftp
* @param originfilename *
* @return
*/
public boolean uploadFile( String pathname, String fileName,String originfilename){
boolean flag = false;
InputStream inputStream = null;
try{
System.out.println("开始上传文件");
inputStream = new FileInputStream(new File(originfilename));
initFtpClient();
ftpClient.setFileType(ftpClient.BINARY_FILE_TYPE);
CreateDirecroty(pathname);
ftpClient.makeDirectory(pathname);
ftpClient.changeWorkingDirectory(pathname);
ftpClient.storeFile(fileName, inputStream);
inputStream.close();
ftpClient.logout();
flag = true;
System.out.println("上传文件成功");
}catch (Exception e) {
System.out.println("上传文件失败");
logger.log(e.toString());
}finally{
if(ftpClient.isConnected()){
try{
ftpClient.disconnect();
}catch(IOException e){
logger.log(e.toString());
}
}
if(null != inputStream){
try {
inputStream.close();
} catch (IOException e) {
logger.log(e.toString());
}
}
}
return true;
}
/**
*
* @param pathname ftp
* @param fileName ftp
* @param inputStream
* @return
*/
public boolean uploadFile( String pathname, String fileName,InputStream inputStream){
boolean flag = false;
try{
System.out.println("开始上传文件");
initFtpClient();
ftpClient.setFileType(ftpClient.BINARY_FILE_TYPE);
CreateDirecroty(pathname);
ftpClient.makeDirectory(pathname);
ftpClient.changeWorkingDirectory(pathname);
ftpClient.storeFile(fileName, inputStream);
inputStream.close();
ftpClient.logout();
flag = true;
System.out.println("上传文件成功");
}catch (Exception e) {
System.out.println("上传文件失败");
logger.log(e.toString());
}finally{
if(ftpClient.isConnected()){
try{
ftpClient.disconnect();
}catch(IOException e){
logger.log(e.toString());
}
}
if(null != inputStream){
try {
inputStream.close();
} catch (IOException e) {
logger.log(e.toString());
}
}
}
return true;
}
//改变目录路径
public boolean changeWorkingDirectory(String directory) {
boolean flag = true;
try {
flag = ftpClient.changeWorkingDirectory(directory);
if (flag) {
System.out.println("进入文件夹" + directory + " 成功!");
} else {
System.out.println("进入文件夹" + directory + " 失败!开始创建文件夹");
}
} catch (IOException ioe) {
logger.log(ioe.toString());
}
return flag;
}
//创建多层目录文件如果有ftp服务器已存在该文件则不创建如果无则创建
public boolean CreateDirecroty(String remote) throws IOException {
boolean success = true;
String directory = remote + "/";
// 如果远程目录不存在,则递归创建远程服务器目录
if (!directory.equalsIgnoreCase("/") && !changeWorkingDirectory(new String(directory))) {
int start = 0;
int end = 0;
if (directory.startsWith("/")) {
start = 1;
} else {
start = 0;
}
end = directory.indexOf("/", start);
String path = "";
String paths = "";
while (true) {
String subDirectory = new String(remote.substring(start, end).getBytes("GBK"), "iso-8859-1");
path = path + "/" + subDirectory;
if (!existFile(path)) {
if (makeDirectory(subDirectory)) {
changeWorkingDirectory(subDirectory);
} else {
System.out.println("创建目录[" + subDirectory + "]失败");
changeWorkingDirectory(subDirectory);
}
} else {
changeWorkingDirectory(subDirectory);
}
paths = paths + "/" + subDirectory;
start = end + 1;
end = directory.indexOf("/", start);
// 检查所有目录是否创建完毕
if (end <= start) {
break;
}
}
}
return success;
}
//判断ftp服务器文件是否存在
public boolean existFile(String path) throws IOException {
boolean flag = false;
FTPFile[] ftpFileArr = ftpClient.listFiles(path);
if (ftpFileArr.length > 0) {
flag = true;
}
return flag;
}
//创建目录
public boolean makeDirectory(String dir) {
boolean flag = true;
try {
flag = ftpClient.makeDirectory(dir);
if (flag) {
System.out.println("创建文件夹" + dir + " 成功!");
} else {
System.out.println("创建文件夹" + dir + " 失败!");
}
} catch (Exception e) {
logger.log(e.toString());
}
return flag;
}
/** * *
* @param pathname FTP *
* @param filename *
* @param localpath *
* @return */
public boolean downloadFile(String pathname, String filename, String localpath,String localname){
boolean flag = false;
OutputStream os=null;
try {
System.out.println("开始下载文件");
initFtpClient();
//切换FTP目录
ftpClient.changeWorkingDirectory(pathname);
ftpClient.enterLocalPassiveMode();
FTPFile[] ftpFiles = ftpClient.listFiles();
for(FTPFile file : ftpFiles){
if(filename.equalsIgnoreCase(file.getName())){
File localFile = new File(localpath + "\\" + localname);
os = new FileOutputStream(localFile);
boolean b = ftpClient.retrieveFile(file.getName(), os);
if(b){
flag = true;
System.out.println("下载文件成功");
}
os.close();
}
}
ftpClient.logout();
} catch (Exception e) {
System.out.println("下载文件失败");
logger.log(e.toString());
} finally{
if(ftpClient.isConnected()){
try{
ftpClient.disconnect();
}catch(IOException e){
logger.log(e.toString());
}
}
if(null != os){
try {
os.close();
} catch (IOException e) {
logger.log(e.toString());
}
}
}
return flag;
}
/** * *
* @param pathname FTP *
* @param filename *
* @return */
public boolean deleteFile(String pathname, String filename){
boolean flag = false;
try {
System.out.println("开始删除文件");
initFtpClient();
//切换FTP目录
ftpClient.changeWorkingDirectory(pathname);
ftpClient.dele(filename);
ftpClient.logout();
flag = true;
System.out.println("删除文件成功");
} catch (Exception e) {
System.out.println("删除文件失败");
logger.log(e.toString());
} finally {
if(ftpClient.isConnected()){
try{
ftpClient.disconnect();
}catch(IOException e){
logger.log(e.toString());
}
}
}
return flag;
}
}

@ -0,0 +1,51 @@
package com.xjgs.util;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* fastJSON/jackson
*/
public class JsonResult implements Serializable {
private Map<String, Object> dataMap = new HashMap<>(3);
public JsonResult() {
}
public String getCode() {
return dataMap.get("code").toString();
}
public void setCode(String code) {
this.dataMap.put("code", code);
}
public String getMsg() {
return dataMap.get("msg").toString();
}
public void setMsg(String msg) {
this.dataMap.put("msg", msg);
}
public Object getData() {
return dataMap.get("data");
}
public void setData(Object data) {
this.dataMap.put("data", data);
}
public Map<String, Object> getDataMap() {
return dataMap;
}
public void setDataMap(Map<String, Object> dataMap) {
this.dataMap = dataMap;
}
public void put(String name, Object value) {
this.dataMap.put(name, value);
}
}

@ -0,0 +1,38 @@
package com.xjgs.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Logger {
public void log(String info){
SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd");
String format = dateFormat.format (new Date());
File file = new File (System.getProperty("user.dir")+"\\logs\\"+format);
if(!file.isDirectory ()){
file.mkdirs ();
}
OutputStream out = null;
try {
out = getOutputStream(file.getAbsolutePath ()+"\\log.log");
out.write(info.getBytes("utf-8"));
out.write("\r\n".getBytes());
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public OutputStream getOutputStream(String localpath) throws IOException {
File file = new File(localpath);
if (!file.exists()) {
file.createNewFile();
return new FileOutputStream(file);
} else {
return new FileOutputStream(file, true);
}
}
}

@ -0,0 +1,127 @@
package com.xjgs.util;
import com.itextpdf.text.Image;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfTemplate;
import com.sun.glass.ui.Size;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import java.awt.*;
import java.io.*;
import java.util.UUID;
public class PDFHelper {
public static void AddWatermark(String pdfPath, String img1, String img2, String toPath) throws Exception
{
String sFile = UUID.randomUUID().toString().replace("-", "").replace("{","").replace("}","")+".pdf";
File tmpFile = new File(sFile);
FileOutputStream outputStream = new FileOutputStream(tmpFile);
PdfReader reader = new PdfReader(pdfPath);
PdfStamper pdfStamper = new PdfStamper(reader, outputStream);
try
{
float scaleP = 50;
//这里是加第一个签名
Image pImg1 = null;
if(StringUtils.isNoneBlank (img1)){
pImg1 = Image.getInstance(img1);
pImg1.scalePercent(scaleP);
}
//第二个签名
Image pImg2 = null;
if(StringUtils.isNoneBlank (img2)){
pImg2 = Image.getInstance(img2);
pImg2.scalePercent(scaleP);
}
for (int i = 1; i <= reader.getNumberOfPages(); i++)
{
Rectangle pageSize = reader.getPageSize(i);
PdfContentByte cb = pdfStamper.getOverContent(i);
//设置签名位置
if(null!=pImg1){
Point pt = new Point((int)(pageSize.getWidth() / 2 - pImg1.getScaledWidth() / 2-40), 45);
pImg1.setAbsolutePosition((float)pt.getX(), (float)pt.getY());
cb.addImage(pImg1);
Point pt2 = new Point((int)(pageSize.getWidth() - pImg1.getScaledWidth() / 2-55), 45);
pImg2.setAbsolutePosition((float)pt2.getX(), (float)pt2.getY());
cb.addImage(pImg2);
}
}
}
finally
{
if(pdfStamper!= null)
{
pdfStamper.close();
}
if(outputStream!=null)
{
outputStream.close();
}
if(reader !=null) {
reader.close();
}
}
//复制文件到toFile
copy(sFile, toPath);
}
private static int bufferSize = 10;
public static void copy(String source, String dest) throws Exception {
File fDest = new File(dest);
if(fDest.isFile()&& fDest.exists())
{
fDest.delete();
}
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(new File(source));
out = new FileOutputStream(fDest);
byte[] buffer = new byte[bufferSize];
int len;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
} catch (Exception e) {
} finally {
if(in!=null)
{
in.close();
}
if(out!=null)
{
out.close();
}
}
}
private static void AddBackImageTemplate(PdfContentByte cb, Size ptSize, String srcImgPath, float x, float y) throws Exception
{
PdfTemplate pdfTemplate = cb.createTemplate(ptSize.width, ptSize.height);
Image pimg = Image.getInstance(srcImgPath);
pimg.setAbsolutePosition(0, 0);
pimg.scaleToFit(ptSize.width, ptSize.height);
pdfTemplate.addImage(pimg);
cb.addTemplate(pdfTemplate, x, y);
}
}

@ -0,0 +1,213 @@
package com.xjgs.util;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.regex.Pattern;
/**
* @description:
* @author: ChenJ
* @date: 2022/5/9 17:32
**/
public class StringUtil {
/**
*
*
* @param str
* @return true
*/
public static boolean isEmpty(String str) {
// 通过str.trim去掉字符串多余的空格
return str == null || "".equals(str.trim());
}
/**
*
*
* @param phone
* @return true
*/
public static boolean isPhoneNumber(String phone) {
return phone.matches("^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
}
/**
*
*
* @param s
* @return true
*/
public static boolean isBlankOrNull(String s) {
return StringUtils.isBlank(s) && StringUtils.isEmpty(s);
}
/**
* 1.@
* az
* 09线
* 318
*
* 2.@
* "@"
* 09线
* 线
*
* @param email
* @return true
*/
public static boolean isEmail(String email) {
return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email);
}
public static boolean isIDNumber(String IDNumber) {
if (IDNumber == null || "".equals(IDNumber)) {
return false;
}
// 定义判别用户身份证号的正则表达式15位或者18位最后一位可以为字母
String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
//假设18位身份证号码:41000119910101123X 410001 19910101 123X
//^开头
//[1-9] 第一位1-9中的一个 4
//\\d{5} 五位数字 10001前六位省市县地区
//(18|19|20) 19现阶段可能取值范围18xx-20xx年
//\\d{2} 91年份
//((0[1-9])|(10|11|12)) 01月份
//(([0-2][1-9])|10|20|30|31)01日期
//\\d{3} 三位数字 123第十七位奇数代表男偶数代表女
//[0-9Xx] 0123456789Xx其中的一个 X第十八位为校验值
//$结尾
//假设15位身份证号码:410001910101123 410001 910101 123
//^开头
//[1-9] 第一位1-9中的一个 4
//\\d{5} 五位数字 10001前六位省市县地区
//\\d{2} 91年份
//((0[1-9])|(10|11|12)) 01月份
//(([0-2][1-9])|10|20|30|31)01日期
//\\d{3} 三位数字 123第十五位奇数代表男偶数代表女15位身份证不含X
//$结尾
boolean matches = IDNumber.matches(regularExpression);
//判断第18位校验值
int num = 18;
if (matches) {
if (IDNumber.length() == num) {
try {
char[] charArray = IDNumber.toCharArray();
//前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
//这是除以11后可能产生的11位余数对应的验证码
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
int sum = 0;
for (int i = 0; i < idCardWi.length; i++) {
int current = Integer.parseInt(String.valueOf(charArray[i]));
int count = current * idCardWi[i];
sum += count;
}
char idCardLast = charArray[17];
int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
return true;
} else {
return false;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
return matches;
}
/**
* Thu Dec 14 00:00:00 CST 2017
*
* @param date
* @param pattern yyyy-MM-dd
* @return
*/
public static String dateStringFormat(String date, String pattern) {
if (date == null || pattern == null) {
return null;
}
try {
Date formDate = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US).parse(date);
return new SimpleDateFormat(pattern, Locale.CHINA).format(formDate);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* yyyy-MM-dd HH:mm:ss date
*
* @param date
* @return Date
*/
public static Date StringFormatDate(String date) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return simpleDateFormat.parse(date);
}
/**
*
*
* @param sInputString
* @return
*/
public static InputStream getStringStream(String sInputString) {
if (sInputString != null && !"".equals(sInputString.trim())) {
try {
ByteArrayInputStream tInputStringStream = new ByteArrayInputStream(sInputString.getBytes());
return tInputStringStream;
} catch (Exception ex) {
ex.printStackTrace();
}
}
return null;
}
/**
*
*
* @param inputStream
* @return
*/
public static String inputStreamToString(InputStream inputStream) {
StringBuffer buffer = new StringBuffer();
InputStreamReader inputStreamReader;
try {
inputStreamReader = new InputStreamReader(inputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
// 释放资源
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return buffer.toString();
}
public static Boolean isNum(String s) {
return Pattern.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$", s);
}
}

@ -0,0 +1,219 @@
package com.xjgs.vo;
/**
*
* */
public class ArchiveMaster {
private String id;
private String patientId;
private String inpNo;
private String visitId;
private String name;
private String sex;
private String deptName;
private String dischargeDateTime;
private String archiveState;
private String admissionDateTime;
private String deptAdmissionTo;
private String checkDoctor;
private String checkDatetime;
private String checkedDoctor;
private String checkedDatetime;
private String lockInfo;
private String doctorInCharge;
private String idNo;
private String dischargeDisposition;
private String deptCodeLend;
private String status;
private String bedId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null:id.trim();
}
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId == null ? null : patientId.trim();
}
public String getInpNo() {
return inpNo;
}
public void setInpNo(String inpNo) {
this.inpNo = inpNo == null ? null : inpNo.trim();
}
public String getVisitId() {
return visitId;
}
public void setVisitId(String visitId) {
this.visitId = visitId == null ? null : visitId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex == null ? null : sex.trim();
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName == null ? null : deptName.trim();
}
public String getArchiveState() {
return archiveState;
}
public void setArchiveState(String archiveState) {
this.archiveState = archiveState == null ? null : archiveState.trim();
}
public String getDeptAdmissionTo() {
return deptAdmissionTo;
}
public void setDeptAdmissionTo(String deptAdmissionTo) {
this.deptAdmissionTo = deptAdmissionTo == null ? null : deptAdmissionTo.trim();
}
public String getCheckDoctor() {
return checkDoctor;
}
public void setCheckDoctor(String checkDoctor) {
this.checkDoctor = checkDoctor == null ? null : checkDoctor.trim();
}
public String getCheckedDoctor() {
return checkedDoctor;
}
public void setCheckedDoctor(String checkedDoctor) {
this.checkedDoctor = checkedDoctor == null ? null : checkedDoctor.trim();
}
public String getLockInfo() {
return lockInfo;
}
public void setLockInfo(String lockInfo) {
this.lockInfo = lockInfo == null ? null : lockInfo.trim();
}
public String getDoctorInCharge() {
return doctorInCharge;
}
public void setDoctorInCharge(String doctorInCharge) {
this.doctorInCharge = doctorInCharge == null ? null : doctorInCharge.trim();
}
public String getIdNo() {
return idNo;
}
public void setIdNo(String idNo) {
this.idNo = idNo == null ? null : idNo.trim();
}
public String getDischargeDisposition() {
return dischargeDisposition;
}
public void setDischargeDisposition(String dischargeDisposition) {
this.dischargeDisposition = dischargeDisposition == null ? null : dischargeDisposition.trim();
}
public String getDeptCodeLend() {
return deptCodeLend;
}
public void setDeptCodeLend(String deptCodeLend) {
this.deptCodeLend = deptCodeLend == null ? null : deptCodeLend.trim();
}
public String getDischargeDateTime() {
return dischargeDateTime;
}
public void setDischargeDateTime(String dischargeDateTime) {
this.dischargeDateTime = dischargeDateTime == null ? null:dischargeDateTime.trim();
}
public String getAdmissionDateTime() {
return admissionDateTime;
}
public void setAdmissionDateTime(String admissionDateTime) {
this.admissionDateTime = admissionDateTime == null ? null : admissionDateTime.trim();
}
public String getCheckDatetime() {
return checkDatetime;
}
public void setCheckDatetime(String checkDatetime) {
this.checkDatetime = checkDatetime == null ? null : checkDatetime.trim();
}
public String getCheckedDatetime() {
return checkedDatetime;
}
public void setCheckedDatetime(String checkedDatetime) {
this.checkedDatetime = checkedDatetime == null ? null : checkedDatetime.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null :status.trim();
}
public String getBedId() {
return bedId;
}
public void setBedId(String bedId) {
this.bedId = bedId == null ? null : bedId.trim ();
}
}

@ -0,0 +1,112 @@
package com.xjgs.vo;
import java.util.Date;
/**
*
* */
public class Archive_Detail {
private String id;
private String pdfPath;
private String masterId;
private Date uploadDateTime;
private String assortId;
private String source;
private String subAssort;
private String title;
private String flag;
private String sys;
public Archive_Detail(){}
public Archive_Detail(String id, String pdfPath, String masterId, Date uploadDateTime, String assortId, String source, String subAssort, String title, String flag, String sys) {
this.id = id;
this.pdfPath = pdfPath;
this.masterId = masterId;
this.uploadDateTime = uploadDateTime;
this.assortId = assortId;
this.source = source;
this.subAssort = subAssort;
this.title = title;
this.flag = flag;
this.sys = sys;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getPdfPath() {
return pdfPath;
}
public void setPdfPath(String pdfPath) {
this.pdfPath = pdfPath == null ? null : pdfPath.trim();
}
public String getMasterId() {
return masterId;
}
public void setMasterId(String masterId) {
this.masterId = masterId == null ? null : masterId.trim();
}
public String getAssortId() {
return assortId;
}
public void setAssortId(String assortId) {
this.assortId = assortId == null ? null : assortId.trim();
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
public String getSubAssort() {
return subAssort;
}
public void setSubAssort(String subAssort) {
this.subAssort = subAssort == null ? null : subAssort.trim();
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag == null ? null : flag.trim();
}
public String getSys() {
return sys;
}
public void setSys(String sys) {
this.sys = sys == null ? null : sys.trim();
}
public Date getUploadDateTime() {
return uploadDateTime;
}
public void setUploadDateTime(Date uploadDateTime) {
this.uploadDateTime = uploadDateTime;
}
}

@ -0,0 +1,225 @@
package com.xjgs.vo;
/**
* pacs
* */
public class Fangshe {
private String ACCESSIONNUMBER;
/** 路径 */
private String path;
/** 类型 */
private String prof;
private String source_id;
/** 姓名 */
private String FIRSTNAME;
/** 性别 */
private String PATIENTSEX;
/** 年龄 */
private String PATIENTAGE;
/** 检查号 */
private String PATIENT_ID;
/** 申请科室 */
private String REQUESTINGDEPARTMENT;
/** 床号 */
private String BEDID;
/** 住院 号 */
private String INPATIENT_ID;
/** 门诊号 */
private String CLINICAL_ID;
/** 检查部位 */
private String REQUESTEDPROCEDUREDESCRIPTION;
/** 检查所见 */
private String EXAMINEDESCRIPTION;
/** 诊断提示 */
private String DIAGNOSISPROMPT;
/** 检查日期 */
private String EXAMINEDATE;
/** 报告日期 */
private String REPORTDATE;
/** 报告医生 */
private String REPORTDOCTOR;
/** 审核日期 */
private String AUDITINGDATE;
/** 审核医生 */
private String AUDITINGDOCTOR;
public Fangshe(){
}
public Fangshe(String FIRSTNAME, String PATIENTSEX, String PATIENTAGE, String PATIENT_ID, String REQUESTINGDEPARTMENT, String BEDID, String INPATIENT_ID, String CLINICAL_ID, String REQUESTEDPROCEDUREDESCRIPTION, String EXAMINEDESCRIPTION, String DIAGNOSISPROMPT, String EXAMINEDATE, String REPORTDATE, String REPORTDOCTOR, String AUDITINGDATE, String AUDITINGDOCTOR) {
this.FIRSTNAME = FIRSTNAME;
this.PATIENTSEX = PATIENTSEX;
this.PATIENTAGE = PATIENTAGE;
this.PATIENT_ID = PATIENT_ID;
this.REQUESTINGDEPARTMENT = REQUESTINGDEPARTMENT;
this.BEDID = BEDID;
this.INPATIENT_ID = INPATIENT_ID;
this.CLINICAL_ID = CLINICAL_ID;
this.REQUESTEDPROCEDUREDESCRIPTION = REQUESTEDPROCEDUREDESCRIPTION;
this.EXAMINEDESCRIPTION = EXAMINEDESCRIPTION;
this.DIAGNOSISPROMPT = DIAGNOSISPROMPT;
this.EXAMINEDATE = EXAMINEDATE;
this.REPORTDATE = REPORTDATE;
this.REPORTDOCTOR = REPORTDOCTOR;
this.AUDITINGDATE = AUDITINGDATE;
this.AUDITINGDOCTOR = AUDITINGDOCTOR;
}
public String getFIRSTNAME() {
return FIRSTNAME;
}
public void setFIRSTNAME(String FIRSTNAME) {
this.FIRSTNAME = FIRSTNAME == null? " ":FIRSTNAME.trim();
}
public String getPATIENTSEX() {
return PATIENTSEX;
}
public void setPATIENTSEX(String PATIENTSEX) {
this.PATIENTSEX = PATIENTSEX == null?" ":PATIENTSEX.trim();
}
public String getPATIENTAGE() {
return PATIENTAGE;
}
public void setPATIENTAGE(String PATIENTAGE) {
this.PATIENTAGE = PATIENTAGE == null?" ":PATIENTAGE.trim();
}
public String getPATIENT_ID() {
return PATIENT_ID;
}
public void setPATIENT_ID(String PATIENT_ID) {
this.PATIENT_ID = PATIENT_ID == null?" ":PATIENT_ID.trim();
}
public String getREQUESTINGDEPARTMENT() {
return REQUESTINGDEPARTMENT;
}
public void setREQUESTINGDEPARTMENT(String REQUESTINGDEPARTMENT) {
this.REQUESTINGDEPARTMENT = REQUESTINGDEPARTMENT == null?" ":REQUESTINGDEPARTMENT.trim();
}
public String getBEDID() {
return BEDID;
}
public void setBEDID(String BEDID) {
this.BEDID = BEDID == null?" ":BEDID.trim();
}
public String getINPATIENT_ID() {
return INPATIENT_ID;
}
public void setINPATIENT_ID(String INPATIENT_ID) {
this.INPATIENT_ID = INPATIENT_ID == null?"": INPATIENT_ID.trim();
}
public String getCLINICAL_ID() {
return CLINICAL_ID;
}
public void setCLINICAL_ID(String CLINICAL_ID) {
this.CLINICAL_ID = CLINICAL_ID == null ? " " :CLINICAL_ID.trim();
}
public String getREQUESTEDPROCEDUREDESCRIPTION() {
return REQUESTEDPROCEDUREDESCRIPTION;
}
public void setREQUESTEDPROCEDUREDESCRIPTION(String REQUESTEDPROCEDUREDESCRIPTION) {
this.REQUESTEDPROCEDUREDESCRIPTION = REQUESTEDPROCEDUREDESCRIPTION == null ? " ":REQUESTEDPROCEDUREDESCRIPTION.trim();
}
public String getEXAMINEDESCRIPTION() {
return EXAMINEDESCRIPTION;
}
public void setEXAMINEDESCRIPTION(String EXAMINEDESCRIPTION) {
this.EXAMINEDESCRIPTION =EXAMINEDESCRIPTION == null? " ":EXAMINEDESCRIPTION;
}
public String getDIAGNOSISPROMPT() {
return DIAGNOSISPROMPT;
}
public void setDIAGNOSISPROMPT(String DIAGNOSISPROMPT) {
this.DIAGNOSISPROMPT = DIAGNOSISPROMPT== null? " ":DIAGNOSISPROMPT;
}
public String getEXAMINEDATE() {
return EXAMINEDATE;
}
public void setEXAMINEDATE(String EXAMINEDATE) {
this.EXAMINEDATE = EXAMINEDATE == null ? " " :EXAMINEDATE.trim();
}
public String getREPORTDATE() {
return REPORTDATE;
}
public void setREPORTDATE(String REPORTDATE) {
this.REPORTDATE = REPORTDATE == null ? " ":REPORTDATE.trim();
}
public String getREPORTDOCTOR() {
return REPORTDOCTOR;
}
public void setREPORTDOCTOR(String REPORTDOCTOR) {
this.REPORTDOCTOR = REPORTDOCTOR == null ? " ":REPORTDOCTOR.trim();
}
public String getAUDITINGDATE() {
return AUDITINGDATE;
}
public void setAUDITINGDATE(String AUDITINGDATE) {
this.AUDITINGDATE = AUDITINGDATE == null ? " ":AUDITINGDATE.trim();
}
public String getAUDITINGDOCTOR() {
return AUDITINGDOCTOR;
}
public void setAUDITINGDOCTOR(String AUDITINGDOCTOR) {
this.AUDITINGDOCTOR = AUDITINGDOCTOR == null ? " ":AUDITINGDOCTOR.trim();
}
public String getSource_id() {
return source_id;
}
public void setSource_id(String source_id) {
this.source_id = source_id == null ? "" : source_id.trim();
}
public String getProf() {
return prof;
}
public void setProf(String prof) {
this.prof = prof;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getACCESSIONNUMBER() {
return ACCESSIONNUMBER;
}
public void setACCESSIONNUMBER(String ACCESSIONNUMBER) {
this.ACCESSIONNUMBER = ACCESSIONNUMBER.trim();
}
}

@ -0,0 +1,100 @@
package com.xjgs.vo;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @ClassName PacsVo
* @Description pacs
* @Author linjj
* @Date 2023/8/3 10:59
* @Version 1.0
*/
public class PacsVo {
private String PATIENTID;
/**
*/
private String REQUESTEDPROCEDUREDESCRIPTION;
private String ACCESSIONNUMBER;
private String STUDYUID;
private String REPORTDATE;
private String SOURCEID;
/**
*/
private String DCMFile;
/**
*/
private String DCMName;
public String getPATIENTID() {
return PATIENTID;
}
public void setPATIENTID(String PATIENTID) {
this.PATIENTID = PATIENTID;
}
public String getREQUESTEDPROCEDUREDESCRIPTION() {
return REQUESTEDPROCEDUREDESCRIPTION;
}
public void setREQUESTEDPROCEDUREDESCRIPTION(String REQUESTEDPROCEDUREDESCRIPTION) {
this.REQUESTEDPROCEDUREDESCRIPTION = REQUESTEDPROCEDUREDESCRIPTION;
}
public String getACCESSIONNUMBER() {
return ACCESSIONNUMBER;
}
public void setACCESSIONNUMBER(String ACCESSIONNUMBER) {
this.ACCESSIONNUMBER = ACCESSIONNUMBER;
}
public String getSTUDYUID() {
return STUDYUID;
}
public void setSTUDYUID(String STUDYUID) {
this.STUDYUID = STUDYUID;
}
public String getREPORTDATE() {
return REPORTDATE;
}
public void setREPORTDATE(String REPORTDATE) {
this.REPORTDATE = REPORTDATE;
}
public String getSOURCEID() {
return SOURCEID;
}
public void setSOURCEID(String SOURCEID) {
this.SOURCEID = SOURCEID;
}
public String getDCMFile() {
return DCMFile;
}
public void setDCMFile(String DCMFile) {
this.DCMFile = DCMFile;
}
public String getDCMName() {
return DCMName;
}
public void setDCMName(String DCMName) {
this.DCMName = DCMName;
}
}

@ -0,0 +1,99 @@
package com.xjgs.vo;
/**
*
* */
public class Ris_Study {
private String record_name;
private String source_id;
private String uuid;
private String reportdate;
private String patientId;
private String inpatientId;
private String firstname;
private String ACCESSIONNUMBER;
public String getInpatientId() {
return inpatientId;
}
public void setInpatientId(String inpatientId) {
this.inpatientId = inpatientId;
}
private String Examinedate;
private String path;
public String getReportdate() {
return reportdate;
}
public void setReportdate(String reportdate) {
this.reportdate = reportdate;
}
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getExaminedate() {
return Examinedate;
}
public void setExaminedate(String examinedate) {
Examinedate = examinedate;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getSource_id() {
return source_id;
}
public void setSource_id(String source_id) {
this.source_id = source_id == null ? "" : source_id.trim();
}
public String getRecord_name() {
return record_name;
}
public void setRecord_name(String record_name) {
this.record_name = record_name;
}
public String getACCESSIONNUMBER() {
return ACCESSIONNUMBER;
}
public void setACCESSIONNUMBER(String ACCESSIONNUMBER) {
this.ACCESSIONNUMBER = ACCESSIONNUMBER == null ? "" : ACCESSIONNUMBER.trim();
}
}

@ -0,0 +1,61 @@
package com.xjgs.vo;
/**
*
* */
public class User {
private String id;
private String code;
private String name;
private String password;
private String createDate;
private String departmentId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
}

@ -0,0 +1,43 @@
server:
port: 8023
#数据库
spring:
datasource:
# db1: # 数据源1
# jdbc-url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=gm_record
# username: sa
# password: admin123
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# db2: # 数据源2
# jdbc-url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=qf_record
# username: sa
# password: admin123
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
db1: # 数据源1
jdbc-url: jdbc:sqlserver://10.36.116.108:1433;DatabaseName=emr_record
username: sa
password: xjgs+docus911
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
db2: # 数据源2
jdbc-url: jdbc:sqlserver://10.36.116.100:1433;DatabaseName=pacsdb
username: BLGD
password: Blgd_123
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
jpa:
hibernate:
dialect: org.hibernate.dialect.SQLServer2008Dialect
hikari:
#是否为只读数据库
read-only: false
# 等待连接池分配链接的最大时长
connection-timeout: 60000
# 一个链接idle状态最大时长
idle-timeout: 60000
validation-timeout: 3000
# 一个链接最长的生命时长,超时没有被使用则被释放掉 简易比数据库超时时长少 30s
max-lifetime: 70000
login-timeout: 5
# 连接池允许的最大连接数
maximum-pool-size: 60
# 连接池维护的最小空闲连接数
minimum-idle: 10

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<!--默认配置-->
<default-config>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">0</property>
<property name="maxPoolSize">60</property>
<property name="minPoolSize">10</property>
<property name="maxStatements">200</property>
</default-config>
<!--电子病历-->
<named-config name="his">
<property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
<property name="jdbcUrl">jdbc:oracle:thin:@192.168.10.6:1521/orc1</property>
<property name="user">pacs</property>
<property name="password">pacs</property>
</named-config>
<!--归档-->
<named-config name="sql">
<property name="driverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="jdbcUrl">jdbc:sqlserver://10.36.116.108:1433;databaseName=emr_record</property>
<property name="user">sa</property>
<property name="password">xjgs+docus911</property>
</named-config>
<!--pacs-->
<named-config name="chaosheng">
<property name="driverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="jdbcUrl">jdbc:sqlserver://10.36.116.100:1433;databaseName=pacsdb</property>
<property name="user">BLGD</property>
<property name="password">Blgd_123</property>
</named-config>
<!--权限系统-->
<named-config name="mysql">
<property name="driverClass">com.mysql.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://10.36.116.108:3306/power?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;autoReconnect=true&amp;failOverReadOnly=false</property>
<property name="user">root</property>
<property name="password">docus@702</property>
<property name="initialPoolSize">5</property>
<property name="maxIdleTime">0</property>
<property name="maxPoolSize">30</property>
<property name="minPoolSize">5</property>
<property name="maxStatements">200</property>
</named-config>
</c3p0-config>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<path>f:\pdf</path>
<pic>D:\JSWorking\SignedPictures\</pic>
</CONFIG>

@ -0,0 +1,18 @@
#设置日志的级别,定义日志信息的输出目的
log4j.rootLogger=DEBUG, CA ,RFA
#定义CA的输出目的地为控制台
log4j.appender.CA=org.apache.log4j.ConsoleAppender
#布局为 PatternLayout 可以灵活地指定布局模式。
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
#设置输出格式
log4j.appender.CA.layout.ConversionPattern=%-d{yyyy-MM-dd HH\:mm\:ss} [%c]-[%p] %m%n
#定义R的输出目的地为文件并且文件大小到达指定尺寸的时候产生一个新的文件
log4j.appender.RFA=org.apache.log4j.RollingFileAppender
#设置输出的文件地址
log4j.appender.RFA.File=${log.base}\\info.log
#设置文件大小为100 kb 文件到达100时产生一个新文件
#MaxBackupIndex 最大记录的文件数为1 超过删除较早的。
log4j.appender.RFA.MaxFileSize=30720KB log4j.appender.RFA.MaxBackupIndex=1
#以下和上面一样
log4j.appender.RFA.layout=org.apache.log4j.PatternLayout
log4j.appender.RFA.layout.ConversionPattern=%p %t %c - %m%n

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xjgs.recordDao.ArchiveDetailMapper" >
<select id="getArchiveMasterList" resultType="com.xjgs.vo.ArchiveMaster">
select id,name,inp_no as inpNo,admission_date_time as admissionDateTime,discharge_date_time as dischargeDateTime from archive_master where discharge_date_time BETWEEN #{startTime} AND #{endTime}
</select>
<select id="pacsGetPatId" resultType="com.xjgs.vo.Archive_Detail">
select SubAssort from archive_detail where Source = 'pacs'order by UpLoadDateTime desc
</select>
<select id="getIdAndJzh" resultType="com.xjgs.vo.ArchiveMaster">
select id,patient_id as patientId from archive_master where id=#{ids}
</select>
</mapper>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xjgs.pacsDao.PacsMapper" >
<select id="getPacsPathList" resultType="com.xjgs.vo.PacsVo">
SELECT
PATIENT_ID,
REQUESTEDPROCEDUREDESCRIPTION,
ACCESSIONNUMBER,
STUDYUID,
REPORTDATE,
SOURCE_ID,
(
CAST (
DATEPART(YEAR, REPORTDATE) AS nvarchar (4)
) + '/' + CAST (
DATEPART(MONTH, REPORTDATE) AS nvarchar (2)
) + '/' + CAST (
DATEPART(DAY, REPORTDATE) AS nvarchar (2)
) + '/1.2.277.0.10.' + rtrim(ACCESSIONNUMBER) + '/' + '1.2.277.0.10.' + rtrim(ACCESSIONNUMBER) + '/'
) AS 'DCMFile',
(
'1.2.277.0.10.5.1.4.1.1.88.11.' + rtrim(ACCESSIONNUMBER) + '.dcm'
) AS 'DCMName'
FROM
RIS_STUDIES
WHERE
(CLINICAL_ID = #{inpNo} or INPATIENT_ID = #{inpNo})
and ADMITTINGDATE BETWEEN DATEADD(hh, -6,#{admissionDateTime}) and DATEADD(hh, 6,#{dischargeDateTime})
and FIRSTNAME = #{name}
and PATIENTTYPE = '住院'
</select>
</mapper>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 列自动映射 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- 打印查询语句 -->
<!--<setting name="logImpl" value="STDOUT_LOGGING"/>-->
</settings>
<typeAliases>
<package name="com.emr.entity"/>
</typeAliases>
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!--分页参数合理化-->
<property name="reasonable" value="true"/>
</plugin>
</plugins>
<!-- Oracle的配置 -->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"></transactionManager>
<dataSource type="POOLED">
<property name="driver" value="oracle.jdbc.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@10.6.0.150:1521:jhemr"/>
<property name="username" value="jswzh"/>
<property name="password" value="jswzh123"/>
</dataSource>
</environment>
</environments>
<!-- Oracle的mapper文件扫描 ,单独测试使用-->
<mappers>
<mapper resource="mapper/FinishedDateTimeMapperTest.xml"></mapper>
</mappers>
</configuration>
Loading…
Cancel
Save