Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wujunjie 8 years ago
parent
commit
de85badea1

+ 429 - 0
patient-co-analysis/pom.xml

@ -0,0 +1,429 @@
<?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">
    <artifactId>patient-co-analysis</artifactId>
    <groupId>com.yihu</groupId>
    <version>1.0.0</version>
    <modelVersion>4.0.0</modelVersion>
    <name>patient-co-analysis</name>
    <packaging>jar</packaging>
    <!--<packaging>war</packaging>-->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>${version.spring-framework}</spring.version>
        <version.commons-bean-utils>1.9.2</version.commons-bean-utils>
        <version.commons-codec>1.9</version.commons-codec>
        <version.commons-collections>3.2.1</version.commons-collections>
        <version.commons-compress>1.9</version.commons-compress>
        <version.commons-dbcp2>2.1.1</version.commons-dbcp2>
        <version.commons-dbutils>1.6</version.commons-dbutils>
        <version.commons-io>2.4</version.commons-io>
        <version.commons-lang3>3.2.1</version.commons-lang3>
        <version.commons-pool2>2.4.2</version.commons-pool2>
        <version.hibernate>4.3.11.Final</version.hibernate>
        <version.hibernate-annotations>4.0.5.Final</version.hibernate-annotations>
        <version.hibernate-jpa-api>1.0.0.Final</version.hibernate-jpa-api>
        <version.http-client>4.5.1</version.http-client>
        <version.http-core>4.4.3</version.http-core>
        <version.java>1.8</version.java>
        <version.jackson>2.6.6</version.jackson>
        <version.jedis>2.9.0</version.jedis>
        <version.jcl-over-slf4j>1.7.19</version.jcl-over-slf4j>
        <version.jul-over-slf4j>1.7.21</version.jul-over-slf4j>
        <version.joda-time>2.8.2</version.joda-time>
        <version.junit>4.12</version.junit>
        <version.log4j2>2.4.1</version.log4j2>
        <version.logback>1.1.7</version.logback>
        <version.mysql>5.1.38</version.mysql>
        <version.quartz>2.2.3</version.quartz>
        <version.servlet-api>3.1.0</version.servlet-api>
        <version.slf4j>1.7.21</version.slf4j>
        <version.spring-boot>1.3.5.RELEASE</version.spring-boot>
        <version.spring-framework>4.2.5.RELEASE</version.spring-framework>
        <version.spring-session>1.2.0.RELEASE</version.spring-session>
        <version.swagger>2.4.0</version.swagger>
        <version.swagger-ui>2.4.0</version.swagger-ui>
        <version.tomcat-embed>8.0.28</version.tomcat-embed>
    </properties>
    <dependencies>
        <!--Jackson library-->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${version.jackson}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${version.jackson}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${version.jackson}</version>
        </dependency>
        <!--Apache commons library-->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${version.commons-lang3}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${version.http-core}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${version.http-client}</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>${version.commons-bean-utils}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
            <version>${version.commons-pool2}</version>
        </dependency>
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>${version.commons-dbutils}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>${version.commons-dbcp2}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${version.commons-io}</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>${version.commons-collections}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>${version.commons-compress}</version>
        </dependency>
        <!--Hibernate framework-->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>${version.hibernate-jpa-api}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${version.hibernate}</version>
        </dependency>
        <!--Miscellaneous-->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>${version.quartz}</version>
        </dependency>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz-jobs</artifactId>
            <version>${version.quartz}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${version.servlet-api}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.slf4j}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${version.swagger-ui}</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${version.mysql}</version>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${version.joda-time}</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>redis.clients</groupId>-->
            <!--<artifactId>jedis</artifactId>-->
            <!--<version>${version.jedis}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${version.commons-codec}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
            <version>1.1.0.RELEASE</version>
        </dependency>
        <!--Log framework-->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${version.log4j2}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${version.log4j2}</version>
        </dependency>
        <!--Log framework to SLF4J bridge: x-over-slf4j-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${version.jcl-over-slf4j}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jdk14</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${version.jul-over-slf4j}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--SLF4J api-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.slf4j}</version>
        </dependency>
        <!--The single log BACKEND-->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${version.logback}</version>
        </dependency>
        <!--Spring framework family-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <!--Spring session family-->
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session</artifactId>
            <version>${version.spring-session}</version>
        </dependency>
        <!--Spring integration family-->
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-jmx</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <!--Spring batch family-->
        <!--Spring boot family-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-docs</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-devtools</artifactId>-->
        <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-security</artifactId>-->
        <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>${version.spring-boot}</version>
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20151123</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.data</groupId>-->
            <!--<artifactId>spring-data-redis</artifactId>-->
            <!--<version>1.7.2.RELEASE</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>4.1.8.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!--打成war包需要的配置-->
            <!--<plugin>-->
                <!--<artifactId>maven-war-plugin</artifactId>-->
                <!--<configuration>-->
                    <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
                <!--</configuration>-->
            <!--</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <version>3.1</version>
            </plugin>
        </plugins>
    </build>
</project>

+ 18 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/Application.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.analysis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
/**
 * Created by Administrator on 2017/2/6.
 */
@SpringBootApplication
public class Application {
    public static ApplicationContext ctx = null;
    public static void main(String[] args) {
        ctx = SpringApplication.run(Application.class, args);
    }
}

+ 12 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/config/SchedulingConfig.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.analysis.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
 * Created by Administrator on 2017/2/6.
 */
//@EnableScheduling
//@Configuration
public class SchedulingConfig {
}

+ 62 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/config/kafka/KafkaConsumerConfig.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.analysis.config.kafka;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by Administrator on 2017/2/6.
 */
@EnableKafka
@Configuration
public class KafkaConsumerConfig {
    @Value("${kafka.broker.address}")
    private String kafkaBrokerAddress;
    @Value("${zookeeper.broker.address}")
    private String zookeeperBrokerAddress;
    @Bean
    KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() {
        ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
        factory.setConsumerFactory(consumerFactory());
        factory.setConcurrency(3);
        factory.getContainerProperties().setPollTimeout(3000);
        return factory;
    }
    @Bean
    public ConsumerFactory<String, String> consumerFactory() {
        return new DefaultKafkaConsumerFactory<>(consumerConfigs());
    }
    @Bean
    public Map<String, Object> consumerConfigs() {
        Map<String, Object> propsMap = new HashMap<>();
        propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.kafkaBrokerAddress);
        //如果设为true,consumer会定时向ZooKeeper发送已经获取到的消息的offset。当consumer进程挂掉时,已经提交的offset可以继续使用,让新的consumer继续工作
        propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
        //consumer向ZooKeeper发送offset的时间间隔。 1秒
        propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000");
        //socket请求的超时时间。实际的超时时间为max.fetch.wait + socket.timeout.ms  15秒
        propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "15000");
        //唯一的指明了consumer的group的名字,group名一样的进程属于同一个consumer group。
        propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
        propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
        propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, "wlyy-analysis-group");
        propsMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
        return propsMap;
    }
}

+ 48 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/config/kafka/KafkaProducerConfig.java

@ -0,0 +1,48 @@
package com.yihu.wlyy.analysis.config.kafka;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.core.ProducerFactory;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by Administrator on 2017/2/6.
 */
@Configuration
@EnableKafka
public class KafkaProducerConfig {
    @Value("${kafka.broker.address}")
    private String brokerAddress;
    @Bean
    public ProducerFactory<String, String> producerFactory() {
        return new DefaultKafkaProducerFactory<>(producerConfigs());
    }
    @Bean
    public Map<String, Object> producerConfigs() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, this.brokerAddress);
        props.put(ProducerConfig.RETRIES_CONFIG, 0);
        props.put(ProducerConfig.BATCH_SIZE_CONFIG, 16384);
        props.put(ProducerConfig.LINGER_MS_CONFIG, 1);
        props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 33554432);
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        return props;
    }
    @Bean
    public KafkaTemplate<String, String> kafkaTemplate() {
        return new KafkaTemplate<String, String>(producerFactory());
    }
}

+ 15 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/config/war/ServletInitializer.java

@ -0,0 +1,15 @@
package com.yihu.wlyy.analysis.config.war;
import com.yihu.wlyy.analysis.Application;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016.10.14.
 */
//public class ServletInitializer extends SpringBootServletInitializer {
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(Application.class);
//    }
//}

+ 35 - 0
patient-co-analysis/src/main/java/com/yihu/wlyy/analysis/listener/LabelDataListener.java

@ -0,0 +1,35 @@
package com.yihu.wlyy.analysis.listener;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Optional;
/**
 * Created by Administrator on 2017/2/6.
 */
@Component
public class LabelDataListener {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    //@Scheduled(cron = "0 0/1 * * * ?") //每分钟执行一次
    @KafkaListener(topics = "flumeLog1")
    public void labelData(ConsumerRecord<?, ?> record) {
        Optional<?> kafkaMessage = Optional.ofNullable(record.value());
        if (kafkaMessage.isPresent()) {
            Object message = kafkaMessage.get();
            try {
                System.out.println(message);
            } catch (Exception e) {
                logger.error("将接收到的消息保存到数据库时异常, 消息:{}, 异常:{}", message.toString(), e);
            }
        }
    }
//    @Scheduled(fixedRate=20000)//每20秒执行一次。开始
//    public void testTasks() {
//    }
}

+ 61 - 0
patient-co-analysis/src/main/resources/application.yml

@ -0,0 +1,61 @@
server:
  port: 8080
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
    max-idle: 50 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 30000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
security:
  basic:
    username: jkzl
    password: jkzlehr
logging:
  level:
    root: INFO
---
spring:
  profiles: test
---
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
kafka:
  broker:
    address: 172.17.110.201:9092
zookeeper:
  broker:
    address: 172.17.110.201:2181
---
spring:
  profiles: prod
  datasource:
    url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123

+ 0 - 2
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -192,7 +192,6 @@ public class CurrentDayAllQuotaJob implements Job {
                    "  wlyy_sign_family sf " +
                    " WHERE " +
                    "   p.idcard = sf.idcard " +
                    " AND sf.expenses_status = 1 " +
                    " AND sf.type = 2 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND p.openid is not null  " +
@ -225,7 +224,6 @@ public class CurrentDayAllQuotaJob implements Job {
                    "  wlyy_sign_family sf " +
                    " WHERE " +
                    "  pd.user_idcard = sf.idcard " +
                    " AND sf.expenses_status = 1 " +
                    " AND sf.type = 2 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND pd.czrq <' "+tomorrow+"' ";

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java

@ -33,6 +33,8 @@ public class BusinessLogs {
        , label
        // 签约
        , register
        // 健康档案
        , archive
    }
    /**

+ 33 - 56
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.archives;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.patient.PatientEvent;
import com.yihu.wlyy.entity.patient.PatientEventImg;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.PatientEventDao;
import com.yihu.wlyy.repository.patient.PatientEventImgDao;
import com.yihu.wlyy.util.DateUtil;
@ -32,22 +33,17 @@ public class PatientEventService {
    private PatientEventImgDao patientEventImgDao;
    /**
     * 获取就诊事件详情
     */
    public JSONObject getEventDetail(String id) throws Exception
    {
    public JSONObject getEventDetail(String id) throws Exception {
        JSONObject re = new JSONObject();
        PatientEvent event = patientEventDao.findOne(Long.valueOf(id));
        if(event!=null)
        {
            re =  new JSONObject(event);
        if (event != null) {
            re = new JSONObject(event);
            List<PatientEventImg> list = patientEventImgDao.findByEventId(event.getId());
            re.put("eventImg",list);
        }
        else{
            re.put("eventImg", list);
        } else {
            throw new Exception("不存在该就诊事件!");
        }
@ -59,19 +55,15 @@ public class PatientEventService {
     * 删除就诊事件
     */
    @Transactional
    public void deleteEvent(Long eventId) throws Exception
    {
    public void deleteEvent(Long eventId) throws Exception {
        PatientEvent event = patientEventDao.findOne(eventId);
        if(event!=null)
        {
        if (event != null) {
            List<PatientEventImg> list = patientEventImgDao.findByEventId(eventId);
            if(list!=null && list.size()>0)
            {
            if (list != null && list.size() > 0) {
                patientEventImgDao.delete(list);
            }
            patientEventDao.delete(event);
        }
        else{
        } else {
            throw new Exception("不存在该就诊事件!");
        }
    }
@ -80,20 +72,16 @@ public class PatientEventService {
     * 保存就诊事件详情
     */
    @Transactional
    public void saveEventDetail(String data) throws Exception
    {
    public void saveEventDetail(String data) throws Exception {
        JSONObject json = new JSONObject(data);
        PatientEvent event = new PatientEvent();
        if(!StringUtils.isEmpty(json.optString("id")))
        {
        if (!StringUtils.isEmpty(json.optString("id"))) {
            //判断是否存在
            event =patientEventDao.findOne(json.getLong("id"));
            if(event==null)
            {
            event = patientEventDao.findOne(json.getLong("id"));
            if (event == null) {
                throw new Exception("不存在该就诊事件!");
            }
        }
        else{
        } else {
            event.setCreateTime(new Date());
        }
        event.setPatient(json.optString("patient"));
@ -108,24 +96,21 @@ public class PatientEventService {
        event.setDoctorName(json.optString("doctorName"));
        //保存就诊记录
        patientEventDao.save(event);
        PatientEvent es = patientEventDao.save(event);
        if(event.getId() != null) {
        if (event.getId() != null) {
            //修改时先删除原有图片
            List<PatientEventImg> imgList = patientEventImgDao.findByEventId(event.getId());
            if(imgList!=null && imgList.size()>0)
            {
            if (imgList != null && imgList.size() > 0) {
                patientEventImgDao.delete(imgList);
            }
        }
        //保存就诊记录相关图片
        JSONArray array = json.getJSONArray("eventImg");
        if(array!=null && array.length()>0)
        {
        if (array != null && array.length() > 0) {
            List<PatientEventImg> imgList = new ArrayList<>();
            for(int i=0;i<array.length();i++)
            {
            for (int i = 0; i < array.length(); i++) {
                JSONObject item = array.getJSONObject(i);
                PatientEventImg img = new PatientEventImg();
                img.setCreateTime(new Date());
@ -143,21 +128,18 @@ public class PatientEventService {
            }
            patientEventImgDao.save(imgList);
        }
        BusinessLogs.info(BusinessLogs.BusinessType.archive, es.getPatient(), new JSONObject(es));
    }
    /**
     * 删除就诊事件图片
     */
    public void deleteEventImg(Long id) throws Exception
    {
    public void deleteEventImg(Long id) throws Exception {
        PatientEventImg eventImg = patientEventImgDao.findOne(id);
        if(eventImg!=null)
        {
        if (eventImg != null) {
            patientEventImgDao.delete(eventImg);
        }
        else{
            throw new Exception("not exit image!id:"+id);
        } else {
            throw new Exception("not exit image!id:" + id);
        }
    }
@ -165,10 +147,9 @@ public class PatientEventService {
    /**
     * 新增就诊事件图片
     */
    public void addEventImg(Long eventId,String imgType,String imgLabel,String imgUrl) throws Exception
    {
    public void addEventImg(Long eventId, String imgType, String imgLabel, String imgUrl) throws Exception {
        PatientEvent event = patientEventDao.findOne(eventId);
        if(event!=null) {
        if (event != null) {
            PatientEventImg img = new PatientEventImg();
            img.setCreateTime(new Date());
@ -181,28 +162,24 @@ public class PatientEventService {
            img.setImgUrl(imgUrl);
            patientEventImgDao.save(img);
        }
        else{
            throw new Exception("not exit event!id:"+eventId);
        } else {
            throw new Exception("not exit event!id:" + eventId);
        }
    }
    /**
     * 修改就诊事件图片
     */
    public void editEventImg(Long id,String imgType,String imgLabel) throws Exception
    {
    public void editEventImg(Long id, String imgType, String imgLabel) throws Exception {
        PatientEventImg img = patientEventImgDao.findOne(id);
        if(img!=null)
        {
        if (img != null) {
            // 图片类型(病历/处方/病理报告/检查报告/检验报告/其他)
            img.setImgType(imgType);
            // 图片标签
            img.setImgLabel(imgLabel);
            patientEventImgDao.save(img);
        }
        else{
            throw new Exception("not exit image!id:"+id);
        } else {
            throw new Exception("not exit image!id:" + id);
        }
    }
}

+ 0 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -1621,7 +1621,6 @@ public class ConsultTeamService extends ConsultService {
        consultTeam.setEndMsgId(obj.getString("id"));
        cons.setEndTime(new Date());
        consultTeam.setEndTime(new Date());
        cons.setDel("0");
        consultTeam.setStatus(1);
        consultDao.save(cons);
        consultTeamDao.save(consultTeam);

+ 26 - 6
patient-co-wlyy/src/main/resources/logback.xml

@ -16,19 +16,37 @@
		</encoder>
	</appender>
	<appender name="business" class="ch.qos.logback.core.rolling.RollingFileAppender">
	<appender name="business_m" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/usr/local/wlyy_logs/business_m.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>/usr/local/wlyy_logs/rolling/business_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
		</encoder>
	</appender>
	<appender name="business_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/usr/local/wlyy_logs/business.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>/usr/local/wlyy_logs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
			<fileNamePattern>/usr/local/wlyy_logs/dayLogs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
		</encoder>
	</appender>
	<appender name="interface_call_m" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/usr/local/wlyy_logs/interface_call_m.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>/usr/local/wlyy_logs/rolling/interface_call_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
		</encoder>
	</appender>
	<appender name="interface_call" class="ch.qos.logback.core.rolling.RollingFileAppender">
	<appender name="interface_call_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/usr/local/wlyy_logs/interface_call.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>/usr/local/wlyy_logs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
			<fileNamePattern>/usr/local/wlyy_logs/dayLogs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
@ -42,10 +60,12 @@
	<logger name="jdbc.sqltiming" level="INFO"/>
	<logger name="com.yihu.wlyy.logs.BusinessLogs" level="INFO" additivity="false">
		<appender-ref ref="business" />
		<appender-ref ref="business_m" />
		<appender-ref ref="business_d" />
	</logger>
	<logger name="com.yihu.wlyy.logs.InterfaceCallLogs" level="INFO" additivity="false">
		<appender-ref ref="interface_call" />
		<appender-ref ref="interface_call_m" />
		<appender-ref ref="interface_call_d" />
	</logger>
	<root level="WARN">