소스 검색

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

yeshijie 6 년 전
부모
커밋
595a26e82d
24개의 변경된 파일753개의 추가작업 그리고 67개의 파일을 삭제
  1. 9 9
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemDO.java
  2. 14 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/house/HealthyHouseMapping.java
  3. 25 0
      svr/svr-healthy-house/.gitignore
  4. 97 0
      svr/svr-healthy-house/pom.xml
  5. 1 0
      svr/svr-healthy-house/readme.MD
  6. 17 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/HealthyHouseApplication.java
  7. 49 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/SwaggerConfig.java
  8. 29 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/jpa/HibernateProperties.java
  9. 58 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/jpa/WlyyHouseJpa.java
  10. 88 0
      svr/svr-healthy-house/src/main/resources/application.yml
  11. 14 0
      svr/svr-healthy-house/src/main/resources/banner.txt
  12. 45 0
      svr/svr-healthy-house/src/main/resources/bootstrap.yml
  13. 16 0
      svr/svr-healthy-house/src/test/java/com/yihu/jw/healthyhouse/HealthyHouseApplicationTests.java
  14. 38 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistHospitalServiceItemController.java
  15. 65 6
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistServiceItemController.java
  16. 6 3
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  17. 0 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistServiceItemDao.java
  18. 2 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java
  19. 4 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationDetailDao.java
  20. 53 20
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistHospitalServiceItemService.java
  21. 41 12
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  22. 7 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java
  23. 71 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/DataUtils.java
  24. 4 4
      svr/svr-wlyy-specialist/src/main/resources/application.yml

+ 9 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemDO.java

@ -53,13 +53,13 @@ public class SpecialistServiceItemDO extends UuidIdentityEntityWithOperator impl
    private Integer hospitalGrade; //医院等级
    @Column(name = "three_hospitals")
    private Double threeHospitals; //三级医院收费标准
    private Integer threeHospitals; //三级医院收费标准
    @Column(name = "two_hospitals")
    private Double twoHospitals; //二级医院收费标准
    private Integer twoHospitals; //二级医院收费标准
    @Column(name = "one_hospitals")
    private Double oneHospitals;//一级医院以及一级以下的社区医院
    private Integer oneHospitals;//一级医院以及一级以下的社区医院
    @Column(name = "unit")
    private String unit; //计价单位
@ -177,29 +177,29 @@ public class SpecialistServiceItemDO extends UuidIdentityEntityWithOperator impl
    }
    @Column(name = "three_hospitals")
    public Double getThreeHospitals() {
    public Integer getThreeHospitals() {
        return threeHospitals;
    }
    public void setThreeHospitals(Double threeHospitals) {
    public void setThreeHospitals(Integer threeHospitals) {
        this.threeHospitals = threeHospitals;
    }
    @Column(name = "two_hospitals")
    public Double getTwoHospitals() {
    public Integer getTwoHospitals() {
        return twoHospitals;
    }
    public void setTwoHospitals(Double twoHospitals) {
    public void setTwoHospitals(Integer twoHospitals) {
        this.twoHospitals = twoHospitals;
    }
    @Column(name = "one_hospitals")
    public Double getOneHospitals() {
    public Integer getOneHospitals() {
        return oneHospitals;
    }
    public void setOneHospitals(Double oneHospitals) {
    public void setOneHospitals(Integer oneHospitals) {
        this.oneHospitals = oneHospitals;
    }

+ 14 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/house/HealthyHouseMapping.java

@ -0,0 +1,14 @@
package com.yihu.jw.rm.health.house;
/**
 * Created by Trick on 2018/2/7.
 */
public class HealthyHouseMapping {
    public static final String api_healthyHouse_common = "svr-healthy-house";
    public static final String api_success ="succes";
    public static class HealthyHouse{
    }
}

+ 25 - 0
svr/svr-healthy-house/.gitignore

@ -0,0 +1,25 @@
/target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

+ 97 - 0
svr/svr-healthy-house/pom.xml

@ -0,0 +1,97 @@
<?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>com.yihu.jw</groupId>
		<artifactId>wlyy-parent-pom</artifactId>
		<version>2.0.0</version>
		<relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
	</parent>
	<groupId>com.yihu.jw</groupId>
	<artifactId>healthy-house</artifactId>
	<version>${parent.version}</version>
	<packaging>jar</packaging>
	<name>healthy-house</name>
	<description>healthy-house for jw2.0</description>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
		<spring-cloud.version>Finchley.SR1</spring-cloud.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-aop</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-logging</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-eureka</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-config</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu</groupId>
			<artifactId>swagger-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu</groupId>
			<artifactId>mysql-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.jw</groupId>
			<artifactId>common-request-mapping</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.jw</groupId>
			<artifactId>common-entity</artifactId>
		</dependency>
	</dependencies>
</project>

+ 1 - 0
svr/svr-healthy-house/readme.MD

@ -0,0 +1 @@
svr-healthy-house i健康城市健康-健康小屋

+ 17 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/HealthyHouseApplication.java

@ -0,0 +1,17 @@
package com.yihu.jw.healthyhouse;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@SpringBootApplication(exclude = OAuth2AutoConfiguration.class)
@ComponentScan(basePackages = {"com"})
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class HealthyHouseApplication {
	public static void main(String[] args) {
		SpringApplication.run(HealthyHouseApplication.class, args);
	}
}

+ 49 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/SwaggerConfig.java

@ -0,0 +1,49 @@
//package com.yihu.jw.healthyhouse.config;
//
//import com.yihu.jw.rm.health.house.HealthyHouseMapping;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import static springfox.documentation.builders.PathSelectors.regex;
//
//@Configuration
//@EnableSwagger2
//@ComponentScan("com.yihu.jw.**")
//public class SwaggerConfig {
//    public static final String house_API = "house";
//
//    @Bean
//    public Docket wlyyAPI() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .groupName(house_API)
//                .useDefaultResponseMessages(false)
//                .forCodeGeneration(false)
//                .pathMapping("/")
//                .select()
//                .paths(or(
//                        regex("/" + HealthyHouseMapping.api_healthyHouse_common + "/.*")
//                ))
//                .build()
//                .apiInfo(wlyyApiInfo());
//    }
//
//    private ApiInfo wlyyApiInfo() {
//        ApiInfo wlyyInfo = new ApiInfo("基卫2.0API",
//                "基卫2.0API,提供基础卫生相关服务。",
//                "1.0",
//                "No terms of service",
//                "wenfujian@jkzl.com",
//                "The Apache License, Version 2.0",
//                "http://www.apache.org/licenses/LICENSE-2.0.html"
//        );
//
//        return wlyyInfo;
//    }
//
//
//}

+ 29 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/jpa/HibernateProperties.java

@ -0,0 +1,29 @@
package com.yihu.jw.healthyhouse.config.jpa;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Component
@RefreshScope
public class HibernateProperties {
    @Value("${hibernate.dialect}")
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        return properties;
    }
}

+ 58 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/config/jpa/WlyyHouseJpa.java

@ -0,0 +1,58 @@
package com.yihu.jw.healthyhouse.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyyHouseEntityManagerFactory",
        transactionManagerRef = "wlyyHouseTransactionManager",
        basePackages = {"com.yihu.jw.healthyhouse.dao"})   //设置Repository所在位置
public class WlyyHouseJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "wlyyHouseEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.jw.healthyhouse.entity");
        emfb.setPersistenceUnitName("archives");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        Properties properties = hibernateProperties.hibProperties();
        properties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "wlyyHouseTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("wlyyHouseEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

+ 88 - 0
svr/svr-healthy-house/src/main/resources/application.yml

@ -0,0 +1,88 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
server:
  port: 10081
spring:
  application:
    name:  svr-healthy-house
  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小
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
  # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.68:9200
#      uris: http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
#      username: # Login user.
#      password: # Login password.
#      proxy.port:  # Proxy port the HTTP client should use.
#      proxy.host:  # Proxy host the HTTP client should use.
#hibernate 配置
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: true
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
---
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/wlyy_archives?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: 123456
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwtest
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwprod
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/

+ 14 - 0
svr/svr-healthy-house/src/main/resources/banner.txt

@ -0,0 +1,14 @@
 /$$                           /$$   /$$     /$$                         /$$
| $$                          | $$  | $$    | $$                        | $$
| $$$$$$$   /$$$$$$   /$$$$$$ | $$ /$$$$$$  | $$$$$$$  /$$   /$$        | $$$$$$$   /$$$$$$  /$$   /$$  /$$$$$$$  /$$$$$$
| $$__  $$ /$$__  $$ |____  $$| $$|_  $$_/  | $$__  $$| $$  | $$ /$$$$$$| $$__  $$ /$$__  $$| $$  | $$ /$$_____/ /$$__  $$
| $$  \ $$| $$$$$$$$  /$$$$$$$| $$  | $$    | $$  \ $$| $$  | $$|______/| $$  \ $$| $$  \ $$| $$  | $$|  $$$$$$ | $$$$$$$$
| $$  | $$| $$_____/ /$$__  $$| $$  | $$ /$$| $$  | $$| $$  | $$        | $$  | $$| $$  | $$| $$  | $$ \____  $$| $$_____/
| $$  | $$|  $$$$$$$|  $$$$$$$| $$  |  $$$$/| $$  | $$|  $$$$$$$        | $$  | $$|  $$$$$$/|  $$$$$$/ /$$$$$$$/|  $$$$$$$
|__/  |__/ \_______/ \_______/|__/   \___/  |__/  |__/ \____  $$        |__/  |__/ \______/  \______/ |_______/  \_______/
                                                       /$$  | $$
                                                      |  $$$$$$/
                                                       \______/
**************************spring-boot.version: ${spring-boot.version}*****************************

+ 45 - 0
svr/svr-healthy-house/src/main/resources/bootstrap.yml

@ -0,0 +1,45 @@
spring:
  #从发现服务里面取配置服务的信息
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      username: jw
      password: jkzl
      discovery:
        enabled: true #使用发现服务
        service-id: svr-configurations #配置服务的名字
---
spring:
  profiles: dev
##发现服务的地址
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring:
  profiles: jwtest
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring:
  profiles: jwprod
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka/

+ 16 - 0
svr/svr-healthy-house/src/test/java/com/yihu/jw/healthyhouse/HealthyHouseApplicationTests.java

@ -0,0 +1,16 @@
package com.yihu.jw.healthyhouse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class HealthyHouseApplicationTests {
	@Test
	public void contextLoads() {
	}
}

+ 38 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistHospitalServiceItemController.java

@ -9,6 +9,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.service.SpecialistHospitalServiceItemService;
import com.yihu.jw.util.DataUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -49,6 +50,7 @@ public class SpecialistHospitalServiceItemController extends EnvelopRestEndpoint
            List<HospitalServiceItemDO> hospitalServiceItemDOS = new ArrayList<>();
            for (int i =0 ; i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                object.replace("expense", DataUtils.doubleToInt(object.getDouble("expense")));
                HospitalServiceItemDO hospitalServiceItemDO = toEntity(object.toJSONString(),HospitalServiceItemDO.class);
                hospitalServiceItemDOS.add(hospitalServiceItemDO);
            }
@ -78,7 +80,22 @@ public class SpecialistHospitalServiceItemController extends EnvelopRestEndpoint
                    hospitalList.add(array.getString(i));
                }
            }
            return specialistHospitalServiceItemService.selectByHospital(hospitalList);
            MixEnvelop envelop = specialistHospitalServiceItemService.selectByHospital(hospitalList);
            List<HospitalServiceItemDO> hospitalServiceItemDOList = envelop.getDetailModelList();
            JSONArray array1 = new JSONArray();
            if (hospitalServiceItemDOList != null && hospitalServiceItemDOList.size()!=0){
                for (HospitalServiceItemDO hospitalServiceItemDO:hospitalServiceItemDOList){
                    JSONObject object = (JSONObject) JSONObject.toJSON(hospitalServiceItemDO);
                    object.replace("expense", DataUtils.integerTransferDouble(hospitalServiceItemDO.getExpense()));
                    JSONObject jsonObject = object.getJSONObject("specialistServiceItemDO");
                    jsonObject.replace("threeHospitals", DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getThreeHospitals()));
                    jsonObject.replace("twoHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getTwoHospitals()));
                    jsonObject.replace("oneHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getOneHospitals()));
                    array1.add(object);
                }
            }
            envelop.setDetailModelList(array1);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -103,7 +120,22 @@ public class SpecialistHospitalServiceItemController extends EnvelopRestEndpoint
            for (int i =0 ;i<array.size();i++){
                idList.add(array.getString(i));
            }
            return specialistHospitalServiceItemService.selectById(idList);
            MixEnvelop envelop = specialistHospitalServiceItemService.selectById(idList);
            List<HospitalServiceItemDO> hospitalServiceItemDOList = envelop.getDetailModelList();
            JSONArray array1 = new JSONArray();
            if (hospitalServiceItemDOList != null && hospitalServiceItemDOList.size()!=0){
                for (HospitalServiceItemDO hospitalServiceItemDO:hospitalServiceItemDOList){
                    JSONObject object = (JSONObject) JSONObject.toJSON(hospitalServiceItemDO);
                    object.replace("expense", DataUtils.integerTransferDouble(hospitalServiceItemDO.getExpense()));
                    JSONObject jsonObject = object.getJSONObject("specialistServiceItemDO");
                    jsonObject.replace("threeHospitals", DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getThreeHospitals()));
                    jsonObject.replace("twoHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getTwoHospitals()));
                    jsonObject.replace("oneHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDO.getSpecialistServiceItemDO().getOneHospitals()));
                    array1.add(object);
                }
            }
            envelop.setDetailModelList(array1);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -179,7 +211,7 @@ public class SpecialistHospitalServiceItemController extends EnvelopRestEndpoint
                                              @ApiParam(name = "serviceItemName", value = "服务项目名称")
                                              @RequestParam(name = "serviceItemName",required = false)String serviceItemName){
        try {
            return specialistHospitalServiceItemService.selectByHospital1(hospital,docHospital,serviceItemName);
            return  specialistHospitalServiceItemService.selectByHospital1(hospital,docHospital,serviceItemName);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -201,7 +233,9 @@ public class SpecialistHospitalServiceItemController extends EnvelopRestEndpoint
            JSONArray array = JSONArray.parseArray(hospitalItems);
            List<HospitalServiceItemDO> hospitalServiceItemDOList = new ArrayList<>();
            for (int i = 0;i<array.size();i++){
                HospitalServiceItemDO hospitalServiceItemDO = toEntity(array.getJSONObject(i).toJSONString(),HospitalServiceItemDO.class);
                JSONObject object = array.getJSONObject(i);
                object.replace("expense", DataUtils.doubleToInt(object.getDouble("expense")));
                HospitalServiceItemDO hospitalServiceItemDO = toEntity(object.toJSONString(),HospitalServiceItemDO.class);
                hospitalServiceItemDOList.add(hospitalServiceItemDO);
            }
            return specialistHospitalServiceItemService.importData(hospitalServiceItemDOList);

+ 65 - 6
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistServiceItemController.java

@ -2,13 +2,16 @@ package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/8/17.
 */
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.specialist.SpecialistEvaluateDO;
import com.yihu.jw.entity.specialist.SpecialistServiceItemDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.service.SpecialistServiceItemService;
import com.yihu.jw.util.DataUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -52,7 +55,20 @@ public class SpecialistServiceItemController extends EnvelopRestEndpoint {
                                                       @RequestParam(value = "pageSize") Integer pageSize){
        try {
            SpecialistServiceItemDO serviceItemDO = toEntity(serviceItem,SpecialistServiceItemDO.class);
            return specialistServiceItemService.select(serviceItemDO,page,pageSize);
            MixEnvelop envelop = specialistServiceItemService.select(serviceItemDO,page,pageSize);
            JSONArray array = new JSONArray();
            List<SpecialistServiceItemDO> specialistServiceItemDOS =  envelop.getDetailModelList();
            if (specialistServiceItemDOS != null && specialistServiceItemDOS.size()!=0){
                for (SpecialistServiceItemDO specialistServiceItemDO:specialistServiceItemDOS){
                    JSONObject jsonObject = (JSONObject)JSONObject.toJSON(specialistServiceItemDO);
                    jsonObject.replace("threeHospitals", DataUtils.integerTransferDouble(specialistServiceItemDO.getThreeHospitals()));
                    jsonObject.replace("twoHospitals",DataUtils.integerTransferDouble(specialistServiceItemDO.getTwoHospitals()));
                    jsonObject.replace("oneHospitals",DataUtils.integerTransferDouble(specialistServiceItemDO.getOneHospitals()));
                    array.add(jsonObject);
                }
            }
            envelop.setDetailModelList(array);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -72,7 +88,17 @@ public class SpecialistServiceItemController extends EnvelopRestEndpoint {
    public MixEnvelop<Boolean,Boolean> insert(@ApiParam(name = "serviceItem", value = "服务项目JSON")
                                                       @RequestParam(value = "serviceItem")String serviceItem){
        try {
            SpecialistServiceItemDO serviceItemDO = toEntity(serviceItem,SpecialistServiceItemDO.class);
            JSONObject object = JSON.parseObject(serviceItem);
            if (object.getDouble("threeHospitals")!=null){
                object.replace("threeHospitals", DataUtils.doubleToInt(object.getDouble("threeHospitals")));
            }
            if (object.getDouble("twoHospitals")!=null){
                object.replace("twoHospitals",DataUtils.doubleToInt(object.getDouble("twoHospitals")));
            }
            if (object.getDouble("oneHospitals")!=null){
                object.replace("oneHospitals",DataUtils.doubleToInt(object.getDouble("oneHospitals")));
            }
            SpecialistServiceItemDO serviceItemDO = toEntity(object.toJSONString(),SpecialistServiceItemDO.class);
            return specialistServiceItemService.insert(serviceItemDO);
        }catch (Exception e){
            e.printStackTrace();
@ -120,7 +146,17 @@ public class SpecialistServiceItemController extends EnvelopRestEndpoint {
    public MixEnvelop<Boolean,Boolean> udpate(@ApiParam(name = "serviceItem", value = "服务项目JSON")
                                              @RequestParam(value = "serviceItem")String serviceItem){
        try {
            SpecialistServiceItemDO serviceItemDO = toEntity(serviceItem,SpecialistServiceItemDO.class);
            JSONObject object = JSON.parseObject(serviceItem);
            if (object.getDouble("threeHospitals")!=null){
                object.replace("threeHospitals", DataUtils.doubleToInt(object.getDouble("threeHospitals")));
            }
            if (object.getDouble("twoHospitals")!=null){
                object.replace("twoHospitals",DataUtils.doubleToInt(object.getDouble("twoHospitals")));
            }
            if (object.getDouble("oneHospitals")!=null){
                object.replace("oneHospitals",DataUtils.doubleToInt(object.getDouble("oneHospitals")));
            }
            SpecialistServiceItemDO serviceItemDO = toEntity(object.toJSONString(),SpecialistServiceItemDO.class);
            return specialistServiceItemService.update(serviceItemDO);
        }catch (Exception e){
            e.printStackTrace();
@ -138,10 +174,23 @@ public class SpecialistServiceItemController extends EnvelopRestEndpoint {
     */
    @PostMapping(value = SpecialistMapping.serviceItem.selectItemByHospital)
    @ApiOperation(value = "根据医院code获取服务项目")
    public MixEnvelop<SpecialistServiceItemDO,SpecialistServiceItemDO> selectByHospital(@ApiParam(name = "hospital", value = "医院code")
    public MixEnvelop selectByHospital(@ApiParam(name = "hospital", value = "医院code")
                                              @RequestParam(value = "hospital")String hospital){
        try {
            return specialistServiceItemService.selectByHospital(hospital);
            MixEnvelop envelop = specialistServiceItemService.selectByHospital(hospital);
            JSONArray array = new JSONArray();
            List<SpecialistServiceItemDO> specialistServiceItemDOS =  envelop.getDetailModelList();
            if (specialistServiceItemDOS != null && specialistServiceItemDOS.size()!=0){
                for (SpecialistServiceItemDO specialistServiceItemDO:specialistServiceItemDOS){
                    JSONObject jsonObject = (JSONObject)JSONObject.toJSON(specialistServiceItemDO);
                    jsonObject.replace("threeHospitals", DataUtils.integerTransferDouble(specialistServiceItemDO.getThreeHospitals()));
                    jsonObject.replace("twoHospitals",DataUtils.integerTransferDouble(specialistServiceItemDO.getTwoHospitals()));
                    jsonObject.replace("oneHospitals",DataUtils.integerTransferDouble(specialistServiceItemDO.getOneHospitals()));
                    array.add(jsonObject);
                }
            }
            envelop.setDetailModelList(array);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -163,7 +212,17 @@ public class SpecialistServiceItemController extends EnvelopRestEndpoint {
            JSONArray array = JSONArray.parseArray(serviceItems);
            List<SpecialistServiceItemDO> specialistServiceItemDOS = new ArrayList<>();
            for (int i = 0;i<array.size();i++){
                SpecialistServiceItemDO specialistServiceItemDO = toEntity(array.getJSONObject(i).toJSONString(),SpecialistServiceItemDO.class);
                JSONObject object = array.getJSONObject(i);
                if (object.getDouble("threeHospitals")!=null){
                    object.replace("threeHospitals", DataUtils.doubleToInt(object.getDouble("threeHospitals")));
                }
                if (object.getDouble("twoHospitals")!=null){
                    object.replace("twoHospitals",DataUtils.doubleToInt(object.getDouble("twoHospitals")));
                }
                if (object.getDouble("oneHospitals")!=null){
                    object.replace("oneHospitals",DataUtils.doubleToInt(object.getDouble("oneHospitals")));
                }
                SpecialistServiceItemDO specialistServiceItemDO = toEntity(object.toJSONString(),SpecialistServiceItemDO.class);
                specialistServiceItemDOS.add(specialistServiceItemDO);
            }
            return specialistServiceItemService.importData(specialistServiceItemDOS);

+ 6 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -17,6 +17,7 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.service.rehabilitation.RehabilitationPlanService;
import com.yihu.jw.util.DataUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -139,6 +140,7 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
                                                                       @RequestParam(value = "rehabilitationPlan", required = true)String rehabilitationPlan){
        try {
            JSONObject json = new JSONObject(rehabilitationPlan);
            json.put("totalExpense", DataUtils.doubleToInt(json.getDouble("totalExpense")));
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
@ -164,7 +166,7 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            ObjectMapper object = new ObjectMapper();
            object.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm"));
            List<RehabilitationDetailDO> details = object.readValue(planDetails, new TypeReference<List<RehabilitationDetailDO>>(){});
            PatientRehabilitationPlanDO planDO = toEntity(rehabilitationPlan, PatientRehabilitationPlanDO.class);
            PatientRehabilitationPlanDO planDO = toEntity(json.toString(), PatientRehabilitationPlanDO.class);
            planDO = rehabilitationPlanService.createPatientRehabilitationPlan(planDO);
            details = rehabilitationPlanService.createRehabilitationDetail(details, planDO.getId());
            //调用服务包接口
@ -200,9 +202,10 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
    @PostMapping(value = SpecialistMapping.rehabilitation.createServiceQrCode)
    @ApiOperation(value = "根据康复计划明细id和医生code生成服务码")
    public MixEnvelop<String,String> createServiceQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                                         @ApiParam(name = "doctorCode", value = "医生code")@RequestParam(value = "doctorCode", required = true)String doctorCode){
                                                         @ApiParam(name = "doctorCode", value = "医生code")@RequestParam(value = "doctorCode", required = true)String doctorCode,
                                                         @ApiParam(name = "imageUrl",value = "二维码地址")@RequestParam(value = "imageUrl",required = true)String imageUrl){
        try {
            return rehabilitationPlanService.createServiceQrCode(planDetailId,doctorCode);
            return rehabilitationPlanService.createServiceQrCode(planDetailId,doctorCode,imageUrl);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 0 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistServiceItemDao.java

@ -6,7 +6,6 @@ import com.yihu.jw.entity.specialist.SpecialistServiceItemDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import sun.plugin.javascript.navig.LinkArray;
import java.util.List;

+ 2 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.dao.rehabilitation;
import com.yihu.jw.entity.specialist.PatientHospitalRecordDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
@ -16,6 +17,7 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    PatientRehabilitationPlanDO findById(String id);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 and p.createUser=?2 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatientAndCreateUser(String patient, String doctor);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 order by p.createTime desc ")

+ 4 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationDetailDao.java

@ -33,16 +33,16 @@ public interface RehabilitationDetailDao extends PagingAndSortingRepository<Reha
    @Query("select d from RehabilitationDetailDO d where d.executeTime<=?1 and d.executeTime>=?2 and d.planId=?3")
    List<RehabilitationDetailDO> findByPlanId(Date executeStartTime,Date executeEndTime,String planId);
    @Query(value ="select count(distinct d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor=?1 and p.patient=?2  and d.status!=?3",nativeQuery = true)
    @Query(value ="select count(DISTINCT d.plan_id,d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor=?1 and p.patient=?2  and d.status!=?3",nativeQuery = true)
    Integer unfinishItemByDoctor(String doctor,String patient,Integer status);
    @Query(value ="select count(distinct d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor in (?1,?2) and p.patient=?3  and d.status!=?4",nativeQuery = true)
    @Query(value ="select count(DISTINCT d.plan_id,d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor in (?1,?2) and p.patient=?3  and d.status!=?4",nativeQuery = true)
    Integer unfinishItemByDoctor(String generalDoctor,String healthDoctor,String patient,Integer status);
    @Query(value ="select count(distinct d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor=?1 and p.patient=?2",nativeQuery = true)
    @Query(value ="select count(DISTINCT d.plan_id,d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor=?1 and p.patient=?2",nativeQuery = true)
    Integer findItemByDoctor(String doctor,String patient);
    @Query(value ="select count(distinct d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor in (?1,?2) and p.patient=?3",nativeQuery = true)
    @Query(value ="select count(DISTINCT d.plan_id,d.hospital_service_item_id) from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.doctor in (?1,?2) and p.patient=?3",nativeQuery = true)
    Integer findItemByDoctor(String generalDoctor,String healthDoctor,String patient);
//    @Query("select count(distinct serviceItemId) from RehabilitationDetailDO d left join PatientRehabilitationPlanDO p on d.planId=p.id where doctor=?1 and p.patient=?2 ")

+ 53 - 20
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistHospitalServiceItemService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.SpecialistServiceItemDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.DataUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -200,38 +201,64 @@ public class SpecialistHospitalServiceItemService extends EnvelopRestEndpoint {
                SpecialistServiceItemDO specialistServiceItemDO = hospitalServiceItemDOS1.get(j).getSpecialistServiceItemDO();
                if (itemType.get(i).equals(specialistServiceItemDO.getItemType())){
            type.add(specialistServiceItemDO.getDiseaseItem());
                }
            }
        }
        JSONArray itemArray = new JSONArray();
        List<String> serviceItems = new ArrayList<>();
        if (type != null && type.size() != 0){
            for (int z =0 ;z<type.size();z++){
                List<HospitalServiceItemDO> hospitalServiceItemDOS2 = new ArrayList<>();
                JSONObject object1 =new JSONObject();
                for (int j = 0;j<hospitalServiceItemDOS1.size();j++){
                    SpecialistServiceItemDO specialistServiceItemDO = hospitalServiceItemDOS1.get(j).getSpecialistServiceItemDO();
                        if (type.get(z).equals(specialistServiceItemDO.getDiseaseItem())) {
                            hospitalServiceItemDOS2.add(hospitalServiceItemDOS1.get(j));
                for (int z =0 ;z<type.size();z++){
                    List<HospitalServiceItemDO> hospitalServiceItemDOS2 = new ArrayList<>();
                    JSONObject object1 =new JSONObject();
                    for (int j = 0;j<hospitalServiceItemDOS1.size();j++){
                        SpecialistServiceItemDO specialistServiceItemDO = hospitalServiceItemDOS1.get(j).getSpecialistServiceItemDO();
                        if (itemType.get(i).equals(specialistServiceItemDO.getItemType())){
                            System.out.println(itemType.get(i));
                            System.out.println(specialistServiceItemDO.getDiseaseItem());
                            if (type.get(z).equals(specialistServiceItemDO.getDiseaseItem())) {
                                hospitalServiceItemDOS2.add(hospitalServiceItemDOS1.get(j));
                            }
                        }
                }
                if (serviceItems!=null && serviceItems.size()!=0){
                    if (!serviceItems.contains(type.get(z))){
                    }
                    if (serviceItems!=null && serviceItems.size()!=0){
                        if (!serviceItems.contains(type.get(z))){
                            serviceItems.add(type.get(z));
                            object1.put("itemName",type.get(z));
                            object1.put("hospitalServiceItems",hospitalServiceItemDOS2);
                            itemArray.add(object1);
                        }else {
                            object1.put("itemName",type.get(z));
                            object1.put("hospitalServiceItems",hospitalServiceItemDOS2);
                            itemArray.add(object1);
                        }
                    }else {
                        serviceItems.add(type.get(z));
                        object1.put("itemName",type.get(z));
                        object1.put("hospitalServiceItems",hospitalServiceItemDOS2);
                        itemArray.add(object1);
                    }
                }else {
                    serviceItems.add(type.get(z));
                    object1.put("itemName",type.get(z));
                    object1.put("hospitalServiceItems",hospitalServiceItemDOS2);
                    itemArray.add(object1);
                }
        }
        if (itemArray !=null && itemArray.size()!=0){
            JSONArray jsonArray = new JSONArray();
            for (int j = 0;j<itemArray.size();j++){
                JSONObject object1 = itemArray.getJSONObject(j);
                JSONObject jsonObject1 = new JSONObject();
                JSONArray array1 = object1.getJSONArray("hospitalServiceItems");
                JSONArray array2 = new JSONArray();
                for (int k=0;k<array1.size();k++){
                    JSONObject jsonObject = array1.getJSONObject(k);
                    jsonObject.replace("expense", DataUtils.integerTransferDouble(jsonObject.getInteger("expense")));
                    array2.add(jsonObject);
                }
                jsonObject1.put("itemName",object1.getString("itemName"));
                jsonObject1.put("hospitalServiceItems",array2);
                jsonArray.add(jsonObject1);
            }
            object.put("item",jsonArray);
        }else {
            object.put("item",itemArray);
        }
        object.put("itemType",itemType.get(i));
        object.put("item",itemArray);
        array.add(object);
    }
    List<JSONArray> list = new ArrayList<>();
@ -316,7 +343,13 @@ public class SpecialistHospitalServiceItemService extends EnvelopRestEndpoint {
            SpecialistServiceItemDO specialistServiceItemDO = hospitalServiceItemDOS.get(i).getSpecialistServiceItemDO();
            JSONObject object = new JSONObject();
            object.put("itemName",specialistServiceItemDO.getItemType());
            object.put("hospitalServiceItem",hospitalServiceItemDOS.get(i));
            JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hospitalServiceItemDOS.get(i));
            jsonObject.replace("expense", DataUtils.integerTransferDouble(hospitalServiceItemDOS.get(i).getExpense()));
            JSONObject object1 = jsonObject.getJSONObject("specialistServiceItemDO");
            object1.replace("threeHospitals", DataUtils.integerTransferDouble(hospitalServiceItemDOS.get(i).getSpecialistServiceItemDO().getThreeHospitals()));
            object1.replace("twoHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDOS.get(i).getSpecialistServiceItemDO().getTwoHospitals()));
            object1.replace("oneHospitals",DataUtils.integerTransferDouble(hospitalServiceItemDOS.get(i).getSpecialistServiceItemDO().getOneHospitals()));
            object.put("hospitalServiceItem",jsonObject);
            array.add(object);
        }
        List<JSONArray> list = new ArrayList<>();
@ -362,7 +395,7 @@ public class SpecialistHospitalServiceItemService extends EnvelopRestEndpoint {
                List<SpecialistServiceItemDO> specialistServiceItemDOS = specialistServiceItemDao.findByTitleAndContent(hospitalServiceItemDO.getTitle(),hospitalServiceItemDO.getContent());
                if (specialistServiceItemDOS != null && specialistServiceItemDOS.size()!=0){
                    List<HospitalServiceItemDO> hospitalServiceItemDOList = specialistHospitalServiceItemDao.findByHospitalAndServiceItemId(hospitalServiceItemDO.getHospital(),specialistServiceItemDOS.get(0).getId());
                    if (hospitalServiceItemDOList == null && hospitalServiceItemDOList.size() ==0){
                    if (hospitalServiceItemDOList != null && hospitalServiceItemDOList.size() !=0){
                        continue;
                    }else {
                        hospitalServiceItemDO.setStatus(1);

+ 41 - 12
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -21,11 +21,13 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.util.*;
/**
@ -200,23 +202,48 @@ public class RehabilitationManageService {
            Map<String,Object> specialistMap = specialistRelationList.get(0);
            resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
            resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
            Integer specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
            Integer specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
            Integer specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
            resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
            resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
//            Integer specialistUnfinishCount = null;
//            Integer specialistFinishCount = null;
//            Integer specialistServiceCount = null;
//            if(specialistMap.get("health_assistant")==null){
//
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
//            }else{
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//            }
//            resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
//            resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
            Integer specialistUnfinishCount1 = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
            Integer specialistFinishCount1 = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
            Integer specialistServiceCount1 = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
            Integer specialistUnfinishCount2 = rehabilitationDetailDao.unfinishItemByDoctor(specialistMap.get("health_assistant")+"",patientCode,1);
            Integer specialistFinishCount2 = rehabilitationDetailDao.findItemByDoctor(specialistMap.get("health_assistant")+"",patientCode);
            Integer specialistServiceCount2 = rehabilitationDetailDao.completeServiceByDoctor(specialistMap.get("health_assistant")+"",patientCode,1);
            resultMap.put("specialistFinishItemCount",specialistFinishCount1-specialistUnfinishCount1+specialistFinishCount2-specialistUnfinishCount2);//完成项目
            resultMap.put("specialistServiceRecordCount",specialistServiceCount1+specialistServiceCount2);//服务次数
            //家庭医生(包括全科医生、健管师)
            String signFamilySql = "SELECT f.*,t.name as teamName FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
            List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
            Map<String,Object> signFamilyMap = signFamilyList.get(0);
            resultMap.put("signFamilyAdminTeamName",signFamilyMap.get("teamName"));
            resultMap.put("familyHospitalName",signFamilyMap.get("hospital_name"));//家庭医生所在医院
            Integer familyUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
            Integer familyFinishCount = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode);
            Integer familyServiceCount = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
            resultMap.put("signFamilyFinishItemCount",familyFinishCount-familyUnfinishCount);//完成项目
            resultMap.put("signFamilyServiceRecordCount",familyServiceCount);//服务次数
            Integer familyUnfinishCount1 = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor")+"",patientCode,1);
            Integer familyFinishCount1 = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor")+"",patientCode);
            Integer familyServiceCount1 = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor")+"",patientCode,1);
            Integer familyUnfinishCount2 = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
            Integer familyFinishCount2 = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor_health")+"",patientCode);
            Integer familyServiceCount2 = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor_health")+"",patientCode,1);
            resultMap.put("signFamilyFinishItemCount",familyFinishCount1-familyUnfinishCount1+familyFinishCount2-familyUnfinishCount2);//完成项目
            resultMap.put("signFamilyServiceRecordCount",familyServiceCount1+familyServiceCount2);//服务次数
            //基础信息
            resultMap.put("hospitalName",signFamilyMap.get("hospital_name"));
@ -476,7 +503,8 @@ public class RehabilitationManageService {
            resultMap.put("content",one.get("content"));//项目内容
            resultMap.put("hospitalName",one.get("hospital_name"));//地点
            resultMap.put("executeTime",one.get("execute_time"));//执行时间
            resultMap.put("expense",one.get("expense"));//收费
            DecimalFormat df = new DecimalFormat("0.00");
            resultMap.put("expense",df.format(((Integer)one.get("expense")*1.00)/100.00));//收费
            resultMap.put("reserve",one.get("reserve"));//是否需要预约(1预约、0不预约)
            resultMap.put("planStatus",one.get("planStatus"));//计划的状态
            Integer status = Integer.valueOf(one.get("status").toString());//状态(0未完成,1已完成,2已预约)
@ -570,7 +598,8 @@ public class RehabilitationManageService {
        resultMap.put("content",one.get("content"));//项目内容
        resultMap.put("hospitalName",one.get("hospital_name"));//地点
        resultMap.put("executeTime",one.get("execute_time"));//执行时间
        resultMap.put("expense",one.get("expense"));//收费
        DecimalFormat df = new DecimalFormat("0.00");
        resultMap.put("expense",df.format(((Integer)one.get("expense")*1.00)/100.00));//收费
        resultMap.put("reserve",one.get("reserve"));//是否需要预约(1预约、0不预约)
        resultMap.put("planStatus",one.get("planStatus"));//计划的状态
        Integer status = Integer.valueOf(one.get("status").toString());//状态(0未完成,1已完成,2已预约)

+ 7 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -298,8 +298,8 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        patientRehabilitationPlanDao.updateServicePackageId(planId, servicePackageId);
    }
    public MixEnvelop<String,String> createServiceQrCode(String planDetailId,String doctorCode){
        RehabilitationDetailDO rehabilitationDetailDO = rehabilitationDetailDao.findById(planDetailId);
    public MixEnvelop<String,String> createServiceQrCode(String planDetailId,String doctorCode,String imageUrl){
        /*RehabilitationDetailDO rehabilitationDetailDO = rehabilitationDetailDao.findById(planDetailId);
        String fileUrl = "";
        if (rehabilitationDetailDO!=null) {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(rehabilitationDetailDO.getServiceQrCode())) {
@ -341,8 +341,11 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
                String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + fileUrl + "' where id='" + planDetailId + "'";
                jdbcTemplate.update(sql);
            }
        }
        return MixEnvelop.getSuccess("获取二维码成功!",fileUrl);
        }*/
        //更新到康复计划居民关系表中
        String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + imageUrl + "' where id='" + planDetailId + "'";
        jdbcTemplate.update(sql);
        return MixEnvelop.getSuccess("获取二维码成功!",imageUrl);
    }
    public Map<String,Object> checkAfterQrCode(String planDetailId,String patietCode)throws Exception{

+ 71 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/util/DataUtils.java

@ -0,0 +1,71 @@
package com.yihu.jw.util;/**
 * Created by nature of king on 2018/9/17.
 */
/**
 * @author wangzhinan
 * @create 2018-09-17 15:32
 * @desc 数据转换工具
 **/
public class DataUtils {
    public static Integer doubleToInt(Double d) {
        if (d == null) {
            return 0;
        }
        String currency = String.valueOf(d);
        int index = currency.indexOf(".");
        int length = currency.length();
        Integer amLong = 0;
        if (index == -1) {
            amLong = Integer.valueOf(currency + "00");
        } else if (length - index >= 3) {
            amLong = Integer.valueOf((currency.substring(0, index + 3)).replace(".", ""));
            if (length - index > 3) {
                if (Integer.valueOf(currency.substring(index + 3, index + 4)) >= 5) {
                    amLong++;
                }
            }
        } else if (length - index == 2) {
            amLong = Integer.valueOf((currency.substring(0, index + 2)).replace(".", "") + 0);
        } else {
            amLong = Integer.valueOf((currency.substring(0, index + 1)).replace(".", "") + "00");
        }
        return amLong;
    }
    public static String integerTransferDouble(Integer amount){
        try {
            if(!amount.toString().matches("\\-?[0-9]+"));
        }catch (Exception e) {
            e.printStackTrace();
        }
        int flag = 0;
        String amString = amount.toString();
        if(amString.charAt(0)=='-'){
            flag = 1;
            amString = amString.substring(1);
        }
        StringBuffer result = new StringBuffer();
        if(amString.length()==1){
            result.append("0.0").append(amString);
        }else if(amString.length() == 2){
            result.append("0.").append(amString);
        }else{
            String intString = amString.substring(0,amString.length()-2);
            for(int i=1; i<=intString.length();i++){
                if( (i-1)%3 == 0 && i !=1){
//                    result.append(",");
                }
                result.append(intString.substring(intString.length()-i,intString.length()-i+1));
            }
            result.reverse().append(".").append(amString.substring(amString.length()-2));
        }
        if(flag == 1){
            return "-"+result.toString();
        }else{
            return result.toString();
        }
    }
}

+ 4 - 4
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -163,15 +163,15 @@ fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
fast-dfs:
  #tracker-server: 172.19.103.54:22122
  #public-server: http://172.19.103.54:80/
  tracker-server: 172.19.103.54:22122
  public-server: http://172.19.103.54:80/
neiwang:
  enable: false
  #wlyy: http://59.61.92.90:9099/iot/
  wlyy: http://59.61.92.90:9099/iot/
base:
  url: http://172.17.110.212:10020/
  url: http://192.168.120.167:10020/svr-base/
wechat:
  appId: wxad04e9c4c5255acf