liuwenbin 8 年之前
父节点
当前提交
69b44cce79
共有 100 个文件被更改,包括 4736 次插入1158 次删除
  1. 1 28
      patient-co-customization/patient-co-modern-medicine/pom.xml
  2. 13 9
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java
  3. 69 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/WlyyJpa.java
  4. 4 1
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java
  5. 22 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/Test.java
  6. 38 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/wlyy/IdEntity.java
  7. 419 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/wlyy/patient/Patient.java
  8. 10 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/medicine/TestDao.java
  9. 10 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/PatientDao.java
  10. 27 0
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  11. 21 0
      patient-co-service/wlyy_service/pom.xml
  12. 14 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/DateUtil.java
  13. 411 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/BaseController.java
  14. 96 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  15. 13 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/ZyPushLogDao.java
  16. 12 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionAdjustDao.java
  17. 27 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java
  18. 17 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDiagnosisDao.java
  19. 24 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDispensaryCodeDao.java
  20. 14 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionExpressageDao.java
  21. 19 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionInfoDao.java
  22. 17 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionLogDao.java
  23. 14 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionPayDao.java
  24. 15 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionReviewedDao.java
  25. 10 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Hospital.java
  26. 107 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/ZyPushLog.java
  27. 508 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java
  28. 81 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionAdjust.java
  29. 63 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionDiagnosis.java
  30. 77 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionDispensaryCode.java
  31. 307 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionExpressage.java
  32. 314 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionInfo.java
  33. 252 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionLog.java
  34. 99 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionPay.java
  35. 167 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionReviewed.java
  36. 198 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/VO/PrescriptionExpressageVO.java
  37. 313 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java
  38. 373 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftMaternalService.java
  39. 515 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  40. 17 1
      patient-co-service/wlyy_service/src/main/resources/application.yml
  41. 2 2
      patient-co/patient-co-statistics/pom.xml
  42. 6 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java
  43. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/1.png
  44. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/2.png
  45. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/3.png
  46. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/4.png
  47. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/5.png
  48. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/6.png
  49. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/7.png
  50. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/8.png
  51. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot项目启动的2种方式.docx
  52. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/1.png
  53. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/10.png
  54. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/11.png
  55. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/12.png
  56. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/13.png
  57. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/2.png
  58. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/3.png
  59. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/4.png
  60. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/5.png
  61. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/6.png
  62. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/7.png
  63. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/8.png
  64. 二进制
      patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/9.png
  65. 二进制
      patient-co/patient-co-wlyy-job/doc/接口文档/厦门i健康API文档.docx
  66. 0 10
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/00.readme.txt
  67. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/HBuilder使用该证书打包的例子.png
  68. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/aps推送证书.p12
  69. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/xmijkPro.mobileprovision
  70. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/证书.p12
  71. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/医生端通过HBuilder打包说明(草稿,完整版V0.2).docx
  72. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/发布修改参数.docx
  73. 0 10
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/00.readme.txt
  74. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/20160721170424_该证书的生成命令.png
  75. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/HBuilder使用该证书打包的例子.png
  76. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/ssgg_doctor.keystore
  77. 0 5
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/文档.txt
  78. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/im/im.docx
  79. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/后台/tomcat部署.docx
  80. 二进制
      patient-co/patient-co-wlyy-job/doc/部署文档/正式库/微信端/微信端发布.docx
  81. 0 29
      patient-co/patient-co-wlyy-job/readme.MD
  82. 0 14
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/ObserverRequired.java
  83. 0 90
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/ObserverRequiredAOP.java
  84. 0 57
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/UserFilterAOP.java
  85. 0 22
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  86. 0 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  87. 0 58
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/BaseInterceptor.java
  88. 0 197
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  89. 0 85
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/ObserverRequiredInterceptor.java
  90. 0 146
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  91. 0 141
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java
  92. 0 103
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java
  93. 0 42
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java
  94. 0 39
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/rest/RestException.java
  95. 0 55
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/rest/RestExceptionHandler.java
  96. 0 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java
  97. 0 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java
  98. 0 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  99. 0 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  100. 0 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

+ 1 - 28
patient-co-customization/patient-co-modern-medicine/pom.xml

@ -403,14 +403,9 @@
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <!--易联众支付-->
        <dependency>
            <groupId>com.ylz</groupId>
            <artifactId>onpay-java-sdk-all</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>wlyy</finalName>
        <finalName>patient-co-modern-medicine</finalName>
        <plugins>
            <!--打成war包需要的配置-->
@ -438,27 +433,5 @@
                <version>3.1</version>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!--打包的时候把webapp下的资源移到根目录下-->
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${basedir}/</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
                <!--防止以下两个文件编译的时候出现在项目根目录中,打包的时候还是会打包进去这2个文件-->
                <excludes>
                    <exclude>downloadPage.html</exclude>
                    <exclude>ssgg_doctor.plist</exclude>
                </excludes>
            </resource>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

+ 13 - 9
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java

@ -8,11 +8,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
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.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
@ -22,35 +24,37 @@ import javax.sql.DataSource;
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "medicineEntityManagerFactory",
        transactionManagerRef = "medicineTransactionManager",
        basePackages = {"com.yihu.mm.repository"})   //设置Repository所在位置
        basePackages = {"com.yihu.mm.repository.medicine"})   //设置Repository所在位置
public class MedicineJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "medicineDataSource")
    @Primary
    @Bean(name = "medicineDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.medicine")
    public DataSource medicineDataSource() {
        return DataSourceBuilder.create().build();
    }
    @Bean(name = "medicineEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(
    @Bean(name = "medicineEntityManagerFactory")
    public LocalContainerEntityManagerFactoryBean medicineEntityManagerFactory(
            @Qualifier("medicineDataSource") DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.mm.entity");
        emfb.setPackagesToScan("com.yihu.mm.entity.medicine");
        emfb.setPersistenceUnitName("medicine");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        emfb.afterPropertiesSet();
        return emfb;
    }
@ -58,10 +62,10 @@ public class MedicineJpa {
    @Bean(name = "medicineTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
    @Bean(name = "medicineTransactionManager")
    JpaTransactionManager medicineTransactionManager(
            @Qualifier("medicineEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}
}

+ 69 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/WlyyJpa.java

@ -0,0 +1,69 @@
package com.yihu.mm.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
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.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyyEntityManagerFactory",
        transactionManagerRef = "wlyyTransactionManager",
        basePackages = {"com.yihu.mm.repository.wlyy"})   //设置Repository所在位置
public class WlyyJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "wlyyDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.wlyy")
    public DataSource wlyyDataSource() {
        return DataSourceBuilder.create().build();
    }
    @Bean(name = "wlyyEntityManagerFactory")
    public LocalContainerEntityManagerFactoryBean wlyyEntityManagerFactory(
            @Qualifier("wlyyDataSource") DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.mm.entity.wlyy");
        emfb.setPersistenceUnitName("wlyy");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        emfb.afterPropertiesSet();
        return emfb;
    }
    @Bean(name = "wlyyTransactionManager")
    JpaTransactionManager wlyyTransactionManager(
            @Qualifier("wlyyEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

+ 4 - 1
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java

@ -5,6 +5,8 @@
 *******************************************************************************/
package com.yihu.mm.entity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@ -27,7 +29,8 @@ public abstract class IdEntity implements Serializable {
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public Long getId() {
		return id;
	}

+ 22 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/Test.java

@ -0,0 +1,22 @@
package com.yihu.mm.entity.medicine;
import javax.persistence.*;
/**
 * Created by chenweida on 2017/8/8.
 */
@Entity
@Table(name = "test")
public class Test {
    private Long id;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}

+ 38 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/wlyy/IdEntity.java

@ -0,0 +1,38 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.entity.wlyy;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}

+ 419 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/wlyy/patient/Patient.java

@ -0,0 +1,419 @@
package com.yihu.mm.entity.wlyy.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.mm.entity.wlyy.IdEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 患者信息
 *
 * @author George
 */
@Entity
@Table(name = "wlyy_patient")
public class Patient extends IdEntity implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 8358924836164389434L;
    // 业务主键
    private String code;
    // 身份证号
    private String idcard;
    // 登录密码
    private String password;
    private String salt;
    // 姓名
    private String name;
    // 生日
    private Date birthday;
    // 性別,1男,2女
    private Integer sex;
    // 手機號
    private String mobile;
    // (基卫)手機號
    private String mobileRemarks;
    // 聯繫電話
    private String phone;
    // 社保卡號
    private String ssc;
    // 頭像HTTP地址
    private String photo;
    // 省代碼
    private String province;
    // 城市代碼
    private String city;
    // 區縣代碼
    private String town;
    // 街道代码
    private String street;
    // 省名
    private String provinceName;
    // 市名
    private String cityName;
    // 區縣名
    private String townName;
    // 街道名称
    private String streetName;
    // 地址
    private String address;
    // 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
    private Integer disease;
    // 病情:0绿标,1黄标,2红标
    private Integer diseaseCondition;
    // 病历记录总数
    private Integer recordAmount;
    // 總積分
    private Integer points;
    // 更新時間
    private Date czrq;
    // 微信编号
    private String openid;
    //微信时间
    private Date openidTime;
    // 用户状态:1正常,0禁用,-1恶意注册,2审核中
    private Integer status;
    // 居委会字段id
    private String sickVillage;
    // 居委会字段名称
    private String sickVillageName;
    //	是否绑定电子社保卡
    private Integer sicardStatus;
    //	绑定电子社保卡时间
    private Date sicardTime;
    //是否分配过微信标签  1分配过 0或者空没有
    private Integer isWxtag;
    public Integer getSicardStatus() {
        return sicardStatus;
    }
    public void setSicardStatus(Integer sicardStatus) {
        this.sicardStatus = sicardStatus;
    }
    public Date getSicardTime() {
        return sicardTime;
    }
    public void setSicardTime(Date sicardTime) {
        this.sicardTime = sicardTime;
    }
    public Patient() {
    }
    public Patient(Long id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    @Column(name = "photo", insertable = false)
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    @Column(name = "province_name")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    @Column(name = "street_name")
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public static long getSerialversionuid() {
        return serialVersionUID;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public Integer getDisease() {
        return disease;
    }
    public void setDisease(Integer disease) {
        this.disease = disease;
    }
    @Column(name = "disease_condition")
    public Integer getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(Integer diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
    @Column(name = "record_amount")
    public Integer getRecordAmount() {
        return recordAmount;
    }
    public void setRecordAmount(Integer recordAmount) {
        this.recordAmount = recordAmount;
    }
    public Integer getPoints() {
        return points;
    }
    public void setPoints(Integer points) {
        this.points = points;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getMobileRemarks() {
        return mobileRemarks;
    }
    public void setMobileRemarks(String mobileRemarks) {
        this.mobileRemarks = mobileRemarks;
    }
    public Date getOpenidTime() {
        return openidTime;
    }
    public void setOpenidTime(Date openidTime) {
        this.openidTime = openidTime;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    public Integer getIsWxtag() {
        return isWxtag;
    }
    public void setIsWxtag(Integer isWxtag) {
        this.isWxtag = isWxtag;
    }
    //---------------------------常量----------------------------
    public enum isWchatTage {
        yes(1), no(0);
        isWchatTage(Integer value) {
            this.value = value;
        }
        private Integer value;
        public Integer getValue() {
            return value;
        }
        public void setValue(Integer value) {
            this.value = value;
        }
    }
}

+ 10 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/medicine/TestDao.java

@ -0,0 +1,10 @@
package com.yihu.mm.repository.medicine;
import com.yihu.mm.entity.medicine.Test;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface TestDao extends PagingAndSortingRepository<Test, Long> {
}

+ 10 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/PatientDao.java

@ -0,0 +1,10 @@
package com.yihu.mm.repository.wlyy.patient;
import com.yihu.mm.entity.wlyy.patient.Patient;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
}

+ 27 - 0
patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml

@ -26,6 +26,28 @@ spring:
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    wlyy:
      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小
multipart:
  enabled: true
  max-file-size: 50mb
  max-request-size: 50mb
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
@ -53,11 +75,16 @@ spring:
##开发的配置
spring:
  profiles: dev
  datasource:
    medicine:
      url: jdbc:mysql://172.19.103.77/medicine?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
    wlyy:
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
---
##开发连测试用这个版本的配置

+ 21 - 0
patient-co-service/wlyy_service/pom.xml

@ -91,6 +91,23 @@
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <!--redis-->
        <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>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.8.1</version>
        </dependency>
        <!--Swagger-->
        <dependency>
            <groupId>io.springfox</groupId>
@ -102,6 +119,10 @@
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 智业接口引用 -->
        <dependency>

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/DateUtil.java

@ -64,6 +64,20 @@ public class DateUtil {
        return formatter.format(dateDate);
    }
    /**
     * 将短时间格式时间转换为字符串 yyyy-MM-dd
     *
     * @param dateDate
     * @return
     */
    public static String dateToStr(java.util.Date dateDate, String format) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(dateDate);
    }
    /**
     * 获取当前时间 yyyy-MM-dd HH:mm:ss
     * @return

+ 411 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/BaseController.java

@ -0,0 +1,411 @@
package com.yihu.wlyy.service.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.model.IdEntity;
import com.yihu.wlyy.service.common.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.util.*;
public class BaseController {
    private static Logger logger = LoggerFactory.getLogger(BaseController.class);
    @Autowired
    protected HttpServletRequest request;
    public void error(Exception e) {
        logger.error(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+":"+getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void warn(Exception e) {
        logger.warn(getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void infoMessage(String message) {
        logger.info(message);
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 接口处理成功
     *
     * @param msg
     * @return
     */
    public String success(String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", 200);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, List<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONObject value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param total 总数
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, int total, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put("total", total);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Object value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, Page<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            // 是否为第一页
            map.put("isFirst", list.isFirst());
            // 是否为最后一页
            map.put("isLast", list.isLast());
            // 总条数
            map.put("total", list.getTotalElements());
            // 总页数
            map.put("totalPages", list.getTotalPages());
            map.put(key, list.getContent());
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, Page<?> page, JSONArray array) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", page == null ? false : page.isFirst());
            // 是否为最后一页
            json.put("isLast", page == null ? true : page.isLast());
            // 总条数
            json.put("total", page == null ? 0 : page.getTotalElements());
            // 总页数
            json.put("totalPages", page == null ? 0 : page.getTotalPages());
            json.put(key, array);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Map<?, ?> value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, String value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, IdEntity entity) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, entity);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, boolean isFirst, boolean isLast, long total, int totalPages, String key, Object values) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", isFirst);
            // 是否为最后一页
            json.put("isLast", isLast);
            // 总条数
            json.put("total", total);
            // 总页数
            json.put("totalPages", totalPages);
            json.put(key, values);
            return json.toString();
        } catch (Exception e) {
            logger.error("BaseController:", e.getMessage());
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    public String trimEnd(String param, String trimChars) {
        if (param.endsWith(trimChars)) {
            param = param.substring(0, param.length() - trimChars.length());
        }
        return param;
    }
    /**
     * 无效用户消息返回
     *
     * @param e
     * @param defaultCode
     * @param defaultMsg
     * @return
     */
    public String invalidUserException(Exception e, int defaultCode, String defaultMsg) {
        try {
            // if (e instanceof UndeclaredThrowableException) {
            // UndeclaredThrowableException ute = (UndeclaredThrowableException) e;
            // InvalidUserException iue = (InvalidUserException) ute.getUndeclaredThrowable();
            // if (iue != null) {
            // return error(iue.getCode(), iue.getMsg());
            // }
            // }
            return error(defaultCode, defaultMsg);
        } catch (Exception e2) {
            return null;
        }
    }
    public List<Map<String, Object>> copyBeans(Collection<? extends Object> beans, String... propertyNames) {
        List<Map<String, Object>> result = new ArrayList<>();
        for (Object bean : beans) {
            result.add(copyBeanProperties(bean, propertyNames));
        }
        return result;
    }
    /**
     * 复制特定属性。
     *
     * @param bean
     * @param propertyNames
     * @return
     */
    public Map<String, Object> copyBeanProperties(Object bean, String... propertyNames) {
        Map<String, Object> simplifiedBean = new HashMap<>();
        for (String propertyName : propertyNames) {
            Field field = ReflectionUtils.findField(bean.getClass(), propertyName);
            if (field != null) {
                field.setAccessible(true);
                Object value = ReflectionUtils.getField(field, bean);
                simplifiedBean.put(propertyName, value == null ? "" : value);
            } else {
                simplifiedBean.put(propertyName, "");
            }
        }
        return simplifiedBean;
    }
}

+ 96 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.controller;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.service.prescription.PrescriptionCAService;
import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -13,18 +14,96 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * 长处方接口
 * */
@Controller
@RequestMapping(value = "/third/prescription/")
@Api(description = "长处方接口")
public class PrescriptionController {
public class PrescriptionController extends BaseController{
	@Autowired
	PrescriptionCAService caService;
	@Autowired
	PrescriptionService prescriptionService;
	/**************************************提供智业调用的接口 start******************************************************/
	@RequestMapping(value = "prescriptionAdjustCompleted",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收线下处方调整完成消息")
	public Result prescriptionAdjustCompleted(@ApiParam(name="data",value="json串",defaultValue = "{}")
											  @RequestParam(value = "data",required = true) String data){
		try {
			return prescriptionService.prescriptionAdjustCompleted(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	@RequestMapping(value = "prePayCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收预结算完成消息")
	public Result prePayCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
								   @RequestParam(value = "data",required = true) String data){
		try {
			return prescriptionService.prePayCompletion(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	@RequestMapping(value = "dispensingComplete",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收配药完成消息")
	public Result dispensingComplete(@ApiParam(name="data",value="json串",defaultValue = "{}")
									 @RequestParam(value = "data",required = true) String data){
		try {
			return prescriptionService.dispensingComplete(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	@RequestMapping(value = "pharmacistPrescriptionCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收药师审方完成及结果消息")
	public Result pharmacistPrescriptionCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
												   @RequestParam(value = "data",required = true) String data){
		try {
			return prescriptionService.pharmacistPrescriptionCompletion(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	@RequestMapping(value = "readNewsOnline",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("提供在线问诊消息调阅")
	public String readNewsOnline(@ApiParam(name="data",value="json串",defaultValue = "{}")
								 @RequestParam(value = "data",required = true) String data){
		try {
			return write(200,"success","url","http://www.yihu.com/");
		}catch (Exception e){
			e.printStackTrace();
			return error(-1,e.getMessage());
		}
	}
	/**************************************提供智业调用的接口 end*******************************************************/
	/************************************ CA认证 ************************************************************/
	@RequestMapping(value = "RequestRealNameSoftCertAndSign",method = RequestMethod.POST)
	@ResponseBody
@ -95,4 +174,19 @@ public class PrescriptionController {
		}
	}
	/**---------------------顺丰快递相关接口---------------------**/
	@RequestMapping(value = "getSFExpressInfoByVisitNo",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("根据基卫挂号单获取顺丰快递相关信息")
	public Result getSFExpressInfo(
			@ApiParam(name="visitNo", value="基卫处方编号") @RequestParam(value = "visitNo",required = true) String visitNo){
		try {
			return prescriptionService.getSFExpressInfoByVisitNo(visitNo);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
}

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/ZyPushLogDao.java

@ -0,0 +1,13 @@
package com.yihu.wlyy.service.dao;
import com.yihu.wlyy.service.entity.ZyPushLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/5.
 */
public interface ZyPushLogDao extends PagingAndSortingRepository<ZyPushLog, Long>, JpaSpecificationExecutor<ZyPushLog> {
}

+ 12 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionAdjustDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionAdjust;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2017/8/2.
 */
public interface PrescriptionAdjustDao extends PagingAndSortingRepository<PrescriptionAdjust, Long>,JpaSpecificationExecutor<PrescriptionAdjust> {
}

+ 27 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.Prescription;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionDao extends PagingAndSortingRepository<Prescription, Long>, JpaSpecificationExecutor<Prescription> {
    @Query("from Prescription p where p.code=?1")
    Prescription findByCode(String prescriptionCode);
    @Modifying
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    void updateStatus(String prescriptionCode, Integer status);
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode, Integer status);
    @Query("from Prescription p where p.visitNo=?1")
    Prescription findByVisitNo(String visitNo);
}

+ 17 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDiagnosisDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionDiagnosis;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/7/28.
 */
public interface PrescriptionDiagnosisDao extends PagingAndSortingRepository<PrescriptionDiagnosis, Long>, JpaSpecificationExecutor<PrescriptionDiagnosis> {
    @Query("select p from PrescriptionDiagnosis p where p.prescriptionCode=?1 ")
    List<PrescriptionDiagnosis> findByPrescriptionCode(String prescriptionCode);
}

+ 24 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDispensaryCodeDao.java

@ -0,0 +1,24 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionDispensaryCode;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/7/21.
 * 处方取码
 */
public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepository<PrescriptionDispensaryCode, Long>, JpaSpecificationExecutor<PrescriptionDispensaryCode> {
    @Query("from PrescriptionDispensaryCode where code=?1")
    PrescriptionDispensaryCode finByCode(String code);
//    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")
//    int dispensaryCodeCount(String patientCode);
    @Query("select count(1) from PrescriptionDispensaryCode a where a.code= ?1 and a.isUse =0")
    Integer getResidentQRCodeCount(String code);
//    @Query("select p1 from PrescriptionInfo p1 left join Prescription p2 on p1.prescriptionCode=p2.code where p1.prescriptionCode = ?1")
//    List<PrescriptionInfo> getPrescriptionInfo(String prescriptionCode);
}

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionExpressageDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionExpressage;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface PrescriptionExpressageDao extends PagingAndSortingRepository<PrescriptionExpressage, Long>, JpaSpecificationExecutor<PrescriptionExpressage> {
    @Query("from PrescriptionExpressage p where p.prescriptionCode=?1 and p.del=1")
    PrescriptionExpressage findByPrescriptionPay(String prescriptionCode);
    @Query("from PrescriptionExpressage p where p.mailno=?1")
    PrescriptionExpressage findByPrescriptionExpressMailno(String mailno);
}

+ 19 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionInfoDao.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionInfoDao extends PagingAndSortingRepository<PrescriptionInfo, Long>, JpaSpecificationExecutor<PrescriptionInfo> {
    @Query("from PrescriptionInfo p where p.prescriptionCode=?1 and p.del=1")
    List<PrescriptionInfo> findByPrescriptionCode(String prescriptionCode);
    @Query("from PrescriptionInfo p where p.code=?1 and p.del=1")
    PrescriptionInfo findByCode(String code);
}

+ 17 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionLogDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<PrescriptionLog, Long>, JpaSpecificationExecutor<PrescriptionLog> {
    @Query("select l.status,l.createTime from PrescriptionLog l where l.prescriptionCode=?1 and l.type in ?2 order by createTime desc")
    List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types);
}

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionPayDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionPay;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 and p.status=1")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
}

+ 15 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionReviewedDao.java

@ -0,0 +1,15 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionReviewed;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2017/8/4.
 */
public interface PrescriptionReviewedDao extends PagingAndSortingRepository<PrescriptionReviewed, Long>, JpaSpecificationExecutor<PrescriptionReviewed> {
    @Query("select p from PrescriptionReviewed p where p.prescriptionCode=?1")
    PrescriptionReviewed findByPrescriptionCode(String prescriptionCode);
}

+ 10 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Hospital.java

@ -50,6 +50,8 @@ public class Hospital extends IdEntity {
	private String roadCode;
	//中心/站点
	private String centerSite;
	//联系电话
	private String phone;
	public String getDel() {
		return del;
@ -172,4 +174,12 @@ public class Hospital extends IdEntity {
	public void setCenterSite(String centerSite) {
		this.centerSite = centerSite;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
}

+ 107 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/ZyPushLog.java

@ -0,0 +1,107 @@
package com.yihu.wlyy.service.entity;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 *  保存智业推送日志
 * Created by yeshijie on 2017/8/5.
 */
@Entity
@Table(name = "wlyy_zy_push_log")
public class ZyPushLog extends IdEntity {
    private String type;//'接口类型 1(推送续方)',
    private String content;//'业务内容',
    private String api;//'调用接口',
    private String method;//'调用方式',
    private String response;//'返回结果',
    private String request;//'请求数据',
    private String error;//'报错信息',
    private String status;//'状态 0失败 1成功 2已重试',
    private Integer retryTimes;//'重试次数',
    private Date createTime;// '创建时间',
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getApi() {
        return api;
    }
    public void setApi(String api) {
        this.api = api;
    }
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public String getResponse() {
        return response;
    }
    public void setResponse(String response) {
        this.response = response;
    }
    public String getRequest() {
        return request;
    }
    public void setRequest(String request) {
        this.request = request;
    }
    public String getError() {
        return error;
    }
    public void setError(String error) {
        this.error = error;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Integer getRetryTimes() {
        return retryTimes;
    }
    public void setRetryTimes(Integer retryTimes) {
        this.retryTimes = retryTimes;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 508 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java

@ -0,0 +1,508 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import org.springframework.util.StringUtils;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方
 */
@Entity
@Table(name = "wlyy_prescription")
public class Prescription extends IdEntity {
    private String code;                    //业务主键
    private String jwCode;                  //基卫的历史处方code
    private String visitNo;                  //基卫的挂号code(调用基位开方接口后回调给我们后才有值)
    private String recipeNo;                  //基卫的处方code(调用基位开方接口后回调给我们后才有值)
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //审核时间
    private Date payTime;                   //支付时间
    private Date failTime;                  //基位 开方失败时间
    private String failReason;                  //基位 开方失败原因
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 3.调整完成 4.调整失败 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private Long adminTeamId;             //患者签约的行政团队
    private String hospital;                  //医院 关联 dm_hospital code
    private String hospitalName;              //医院 关联 dm_hospital name
    private String dept;                       //科室code
    private String deptName;                   //科室名称
    private String diagnosisCode;             //诊断的病种code
    private String diagnosis;                  //诊断名称
    private String consult;                    //咨询id 1对1
    //    private String dispensary_code;           //取药编码  关联wlyy_prescription_dispensary_code  code
//    private String dispensaryAddress;         //取药地址
    private Integer dispensaryType;            //取药类型:1 自取 2快递配送 3健管师配送
    private String caCertData;                  //ca加密信息
    //    private String expressNum;                  //快递单号
//    private String expressCompanyName;         //快递公司名称
    private String caMessage;                   //ca指纹信息
    private String remark;                     //处方备注
    private String reason;                      //续方原因
    //    private Double ybCost;                      //医保费用
//    private Double myCost;                      //自己付费
    private Integer prescriptionType;          //处方类型:1、门诊处方,2、住院处方
    private String cancelReason;
    private String adjustReason;
    private String statusName; //
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "parent_code")
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "reviewed_time")
    public Date getReviewedTime() {
        return reviewedTime;
    }
    public void setReviewedTime(Date reviewedTime) {
        this.reviewedTime = reviewedTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "pay_time")
    public Date getPayTime() {
        return payTime;
    }
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dosage_time")
    public Date getDosageTime() {
        return dosageTime;
    }
    public void setDosageTime(Date dosageTime) {
        this.dosageTime = dosageTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dispatching_time")
    public Date getDispatchingTime() {
        return dispatchingTime;
    }
    public void setDispatchingTime(Date dispatchingTime) {
        this.dispatchingTime = dispatchingTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "finish_time")
    public Date getFinishTime() {
        return finishTime;
    }
    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "admin_team_id")
    public Long getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(Long adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "diagnosis_code")
    public String getDiagnosisCode() {
        return diagnosisCode;
    }
    public void setDiagnosisCode(String diagnosisCode) {
        this.diagnosisCode = diagnosisCode;
    }
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }
    @Column(name = "consult")
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "dispensary_type")
    public Integer getDispensaryType() {
        return dispensaryType;
    }
    public void setDispensaryType(Integer dispensaryType) {
        this.dispensaryType = dispensaryType;
    }
    @Column(name = "ca_message")
    public String getCaMessage() {
        return caMessage;
    }
    public void setCaMessage(String caMessage) {
        this.caMessage = caMessage;
    }
    public String getJwCode() {
        return jwCode;
    }
    public void setJwCode(String jwCode) {
        this.jwCode = jwCode;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public String getCaCertData() {
        return caCertData;
    }
    public void setCaCertData(String caCertData) {
        this.caCertData = caCertData;
    }
    public Integer getPrescriptionType() {
        return prescriptionType;
    }
    public void setPrescriptionType(Integer prescriptionType) {
        this.prescriptionType = prescriptionType;
    }
    @Transient
    public String getTypeName() {
        switch (type) {
            case 1: {
                return "自取";
            }
            case 2: {
                return "快递配送";
            }
            case 3: {
                return "健管师配送";
            }
        }
        return "";
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = getStatusName(status,null);
    }
    public Date getExpressageTime() {
        return expressageTime;
    }
    public void setExpressageTime(Date expressageTime) {
        this.expressageTime = expressageTime;
    }
    @Transient
    public static String getStatusName(Integer status, String hospitalName) {
        /**
         *  no_reviewed("审核不通过", -1),
         revieweding("待审核", 0),
         changeing("调整中",2),
         reviewed_success("审核通过/开方中", 10),
         wait_pay("开方完成/待支付", 20),
         pay_error("支付失败", 21),
         pay_success("支付成功/待配药", 30),
         wait_expressage("配药成功/待配送", 40),
         expressageing_error("配送失败", 41),
         expressageJGS("分配健管师", 42),
         expressageing("配送中", 45),
         expressage2hospital("配送到服务站", 49),
         finish("配送到患者手中/已完成", 100);
         */
        //-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成
        switch (status) {
            case -3: {
                return "支付超时";
            }
            case -2: {
                return "患者自己取消";
            }
            case -1: {
                return "审核不通过";
            }
            case 0: {
                return "待审核";
            }
            case 2: {
                return "调整处方中";
            }
            case 3: {
                return "调整成功";
            }
            case 4: {
                return "调整失败";
            }
            case 21: {
                return "药师审核失败";
            }
            case 31: {
                return "开方失败";
            }
            case 10: {
                return "开方中";
            }
            case 20: {
                return "药师审核中";
            }
            case 30: {
                return "开方中/药师审核成功";
            }
            case 40: {
                return "开方完成/待支付 ";
            }
            case 41: {
                return "支付失败";
            }
            case 50: {
                return " 支付成功/待配药";
            }
            case 60: {
                return "配药成功/待配送";
            }
            case 61: {
                return "配送失败";
            }
            case 62: {
                return "分配健管师 ";
            }
            case 65: {
                return "配送中 ";
            }
            case 69: {
                if (StringUtils.isEmpty(hospitalName)) {
                    return "配送到服务站";
                }
                {
                    return "配送到" + hospitalName;
                }
            }
            case 100: {
                return "续方完成";
            }
        }
        return "未知";
    }
    public String getCancelReason() {
        return cancelReason;
    }
    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }
    public String getAdjustReason() {
        return adjustReason;
    }
    public void setAdjustReason(String adjustReason) {
        this.adjustReason = adjustReason;
    }
    public String getVisitNo() {
        return visitNo;
    }
    public void setVisitNo(String visitNo) {
        this.visitNo = visitNo;
    }
    public String getRecipeNo() {
        return recipeNo;
    }
    public void setRecipeNo(String recipeNo) {
        this.recipeNo = recipeNo;
    }
    public Date getFailTime() {
        return failTime;
    }
    public void setFailTime(Date failTime) {
        this.failTime = failTime;
    }
    public String getFailReason() {
        return failReason;
    }
    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }
}

+ 81 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionAdjust.java

@ -0,0 +1,81 @@
package com.yihu.wlyy.service.entity.prescription;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方调整记录表
 */
@Entity
@Table(name = "wlyy_prescription_adjust")
public class PrescriptionAdjust extends IdEntity {
    private String code;                    //业务主键
    private String prescriptionCode;// 处方code
    private Date createTime;               //调整时间
    private String reason;                      //调整原因
    private String userCode;    //调整用户code
    private String userName;    //调整用户名称
    private String userType;// 1医生 2患者
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
}

+ 63 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionDiagnosis.java

@ -0,0 +1,63 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/7/28.
 * 处方诊断表
 */
@Entity
@Table(name = "wlyy_prescription_diagnosis")
public class PrescriptionDiagnosis  extends IdEntity {
    private String code;
    private String prescriptionCode;
    private String name;
    private Date createTime;
    private Date updateTime;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 77 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionDispensaryCode.java

@ -0,0 +1,77 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方编码表
 */
@Entity
@Table(name = "wlyy_prescription_dispensary_code")
public class PrescriptionDispensaryCode extends IdEntity {
    private String code;                    //年月日8位数字+6位随机数字
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private Date createTime;               //创建时间
    private Integer type;                   //编码类型:1 居民取药码 2 配送员(健管师)取药码 3 配送员(健管师)配送码
    private String imgUrl;                  //图片存在FastFDS的路径
    private Integer isUse;//是否使用 1是 0否
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_code")
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getImgUrl() {
        return imgUrl;
    }
    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }
    public Integer getIsUse() {
        return isUse;
    }
    public void setIsUse(Integer isUse) {
        this.isUse = isUse;
    }
}

+ 307 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionExpressage.java

@ -0,0 +1,307 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "wlyy_prescription_expressage")
public class PrescriptionExpressage extends IdEntity {
    private String code;                    //业务code
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private String mailno;                  //快递单号
    private String name;                    //收货人名称
    private String mobile;                  //收货人手机号码
    private String phone;                   //收货人座机号
    private String address;                 //收货人详细地址
    private String provinceCode;           //收货人省代码
    private String provinceName;           //收货人省名称
    private String cityCode;                //收货人市代码
    private String cityName;                //收货人市名称
    private String townCode;                //收货人区代码
    private String townName;                //收货人区名称
    private String streetCode;              //收货人街道代码
    private String streetName;              //收货人街道名称
    private Integer price;                    //快递的配送费用 单位是分
    private Integer weight;                  //快递重量  单位是g
    //配送人信息
    private String hospitalName;            // 如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private String hospitalAddress;         // 机构地址
    private String expressageName;          //配送人名称
    private String expressageCode;          //配送人code
    private String expressageMobile;        //配送人电话
    private Date expressageTime;                //开始配送的时间
    //医院接收快递信息
    private String acceptMobile;        //医院药品接收人电话
    private String acceptCode;        //医院药品接收人Code
    private String acceptName;        //医院药品接收人名称
    private String acceptHospital;        //医院药品接收人名称
    private String acceptHospitalName;        //医院药品接收人名称
    private Date acceptTime;                //接收的时间
    private Integer oneselfPickupFlg;//是否自取 1是 0否
    private Date createTime;                //创建的时间
    private Integer del;    //1可用 0删除
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public Integer getPrice() {
        return price;
    }
    public void setPrice(Integer price) {
        this.price = price;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getOneselfPickupFlg() {
        return oneselfPickupFlg;
    }
    public void setOneselfPickupFlg(Integer oneselfPickupFlg) {
        this.oneselfPickupFlg = oneselfPickupFlg;
    }
    public String getMailno() { return mailno; }
    public void setMailno(String mailno) { this.mailno = mailno; }
    public String getExpressageName() {
        return expressageName;
    }
    public void setExpressageName(String expressageName) {
        this.expressageName = expressageName;
    }
    public String getExpressageCode() {
        return expressageCode;
    }
    public void setExpressageCode(String expressageCode) {
        this.expressageCode = expressageCode;
    }
    public String getExpressageMobile() {
        return expressageMobile;
    }
    public void setExpressageMobile(String expressageMobile) {
        this.expressageMobile = expressageMobile;
    }
    public Integer getWeight() {
        return weight;
    }
    public void setWeight(Integer weight) {
        this.weight = weight;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getHospitalAddress() {
        return hospitalAddress;
    }
    public void setHospitalAddress(String hospitalAddress) {
        this.hospitalAddress = hospitalAddress;
    }
    public String getAcceptMobile() {
        return acceptMobile;
    }
    public void setAcceptMobile(String acceptMobile) {
        this.acceptMobile = acceptMobile;
    }
    public String getAcceptCode() {
        return acceptCode;
    }
    public void setAcceptCode(String acceptCode) {
        this.acceptCode = acceptCode;
    }
    public String getAcceptName() {
        return acceptName;
    }
    public void setAcceptName(String acceptName) {
        this.acceptName = acceptName;
    }
    public String getAcceptHospital() {
        return acceptHospital;
    }
    public void setAcceptHospital(String acceptHospital) {
        this.acceptHospital = acceptHospital;
    }
    public String getAcceptHospitalName() {
        return acceptHospitalName;
    }
    public void setAcceptHospitalName(String acceptHospitalName) {
        this.acceptHospitalName = acceptHospitalName;
    }
    public Date getExpressageTime() {
        return expressageTime;
    }
    public void setExpressageTime(Date expressageTime) {
        this.expressageTime = expressageTime;
    }
    public Date getAcceptTime() {
        return acceptTime;
    }
    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }
}

+ 314 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionInfo.java

@ -0,0 +1,314 @@
package com.yihu.wlyy.service.entity.prescription;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Administrator on 2017/7/21.
 * 处方详细
 */
@Entity
@Table(name = "wlyy_prescription_info")
public class PrescriptionInfo extends IdEntity {
    private String code;                    //业务主键
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String drugCode;               //药品code
    private String drugName;               //药品名称
    private String drugRate;               //吃药频率
    private String drugRateName;          //用药频次名称
    private String drugFormat;             //药品规格
    private Integer num;                    //药品数目
    private Integer isRefrigerate;         //是否冷藏 1是 0否
    private String direction;               //药品用法
    private Integer price;                    //药品单价 单位是分
    private Integer del;               //1可用 0删除 不填数据库默认是1
    private String jwSubCode;//智业子处方号
    private String drugNumUnit;//数量单位编码
    private String drugNumUnitName;//数量单位名称
    private Integer cost;//金额 单位是分
    private Integer charge;//自付 单位是分
    private String bindFlag;//成组标志, 0.非成组,1.成组
    private Integer dayCount;//用药天数
    private String drugUsage;//用药方法编码
    private String usageName;//用药方法名称
    private String physicDose;//用药剂量
    private String physicDoseUnit;//剂量单位编码
    private String physicDoseUnitName;//剂量单位名称
    private String physicAmount;//用药总量
    private String physicAmountUnit;//总量单位编码
    private String physicAmountUnitName;//总量单位名称
    private String physicInjectPlace;//注射地点编码
    private String physicInjectPlaceName;//注射地点名称
    private String physicSkinTest;//注射地点名称
    private String physicSkinTestName;//皮试类型名称
    private String remark;//备注
    @Column(name = "code",unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_code")
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @Column(name = "drug_code")
    public String getDrugCode() {
        return drugCode;
    }
    public void setDrugCode(String drugCode) {
        this.drugCode = drugCode;
    }
    @Column(name = "drug_name")
    public String getDrugName() {
        return drugName;
    }
    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }
    public String getDrugRate() {
        return drugRate;
    }
    public void setDrugRate(String drugRate) {
        this.drugRate = drugRate;
    }
    public String getDrugFormat() {
        return drugFormat;
    }
    public void setDrugFormat(String drugFormat) {
        this.drugFormat = drugFormat;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Integer getIsRefrigerate() {
        return isRefrigerate;
    }
    public void setIsRefrigerate(Integer isRefrigerate) {
        this.isRefrigerate = isRefrigerate;
    }
    public String getDirection() {
        return direction;
    }
    public void setDirection(String direction) {
        this.direction = direction;
    }
    public Integer getPrice() {
        return price;
    }
    public void setPrice(Integer price) {
        this.price = price;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getJwSubCode() {
        return jwSubCode;
    }
    public void setJwSubCode(String jwSubCode) {
        this.jwSubCode = jwSubCode;
    }
    public String getDrugNumUnit() {
        return drugNumUnit;
    }
    public void setDrugNumUnit(String drugNumUnit) {
        this.drugNumUnit = drugNumUnit;
    }
    public String getDrugNumUnitName() {
        return drugNumUnitName;
    }
    public void setDrugNumUnitName(String drugNumUnitName) {
        this.drugNumUnitName = drugNumUnitName;
    }
    public Integer getCost() {
        return cost;
    }
    public void setCost(Integer cost) {
        this.cost = cost;
    }
    public Integer getCharge() {
        return charge;
    }
    public void setCharge(Integer charge) {
        this.charge = charge;
    }
    @Column(name = "bind_flag")
    public String getBindFlag() {
        return bindFlag;
    }
    public void setBindFlag(String bindFlag) {
        this.bindFlag = bindFlag;
    }
    @Column(name = "day_count")
    public Integer getDayCount() {
        return dayCount;
    }
    public void setDayCount(Integer dayCount) {
        this.dayCount = dayCount;
    }
    public String getDrugUsage() {
        return drugUsage;
    }
    public void setDrugUsage(String drugUsage) {
        this.drugUsage = drugUsage;
    }
    @Column(name = "usage_name")
    public String getUsageName() {
        return usageName;
    }
    public void setUsageName(String usageName) {
        this.usageName = usageName;
    }
    @Column(name = "physic_dose")
    public String getPhysicDose() {
        return physicDose;
    }
    public void setPhysicDose(String physicDose) {
        this.physicDose = physicDose;
    }
    public String getPhysicDoseUnit() {
        return physicDoseUnit;
    }
    public void setPhysicDoseUnit(String physicDoseUnit) {
        this.physicDoseUnit = physicDoseUnit;
    }
    public String getPhysicDoseUnitName() {
        return physicDoseUnitName;
    }
    public void setPhysicDoseUnitName(String physicDoseUnitName) {
        this.physicDoseUnitName = physicDoseUnitName;
    }
    public String getPhysicAmount() {
        return physicAmount;
    }
    public void setPhysicAmount(String physicAmount) {
        this.physicAmount = physicAmount;
    }
    public String getPhysicAmountUnit() {
        return physicAmountUnit;
    }
    public void setPhysicAmountUnit(String physicAmountUnit) {
        this.physicAmountUnit = physicAmountUnit;
    }
    public String getPhysicAmountUnitName() {
        return physicAmountUnitName;
    }
    public void setPhysicAmountUnitName(String physicAmountUnitName) {
        this.physicAmountUnitName = physicAmountUnitName;
    }
    public String getPhysicInjectPlace() {
        return physicInjectPlace;
    }
    public void setPhysicInjectPlace(String physicInjectPlace) {
        this.physicInjectPlace = physicInjectPlace;
    }
    public String getPhysicInjectPlaceName() {
        return physicInjectPlaceName;
    }
    public void setPhysicInjectPlaceName(String physicInjectPlaceName) {
        this.physicInjectPlaceName = physicInjectPlaceName;
    }
    public String getPhysicSkinTest() {
        return physicSkinTest;
    }
    public void setPhysicSkinTest(String physicSkinTest) {
        this.physicSkinTest = physicSkinTest;
    }
    public String getPhysicSkinTestName() {
        return physicSkinTestName;
    }
    public void setPhysicSkinTestName(String physicSkinTestName) {
        this.physicSkinTestName = physicSkinTestName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getDrugRateName() {
        return drugRateName;
    }
    public void setDrugRateName(String drugRateName) {
        this.drugRateName = drugRateName;
    }
}

+ 252 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionLog.java

@ -0,0 +1,252 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方日志
 */
@Entity
@Table(name = "wlyy_prescription_log")
public class PrescriptionLog extends IdEntity {
    public enum PrescriptionLogType {
        zy("智业对接", 1),
        ylz("易联众对接", 2),
        create("创建处方", 3),
        reviewed("审核", 4),
        pay("支付", 5),
        expressage("配送", 6),
        finish("已完成", 7),
        sf("顺丰对接", 8);
        private String name;
        private int value;
        PrescriptionLogType(String name, int value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    //状态枚举
    public enum PrescriptionLogStatus {
        //续方取消
        pay_outtime("支付超时", -3),
        patient_canel("患者自己取消", -2),
        // 审核不通过
        no_reviewed("审核不通过", -1),
        //审核中
        revieweding("待审核", 0),
        changeing("调整中", 2),
        change_success("调整成功",3),
        change_error("调整失败",4),
        reviewed_success(" 医生审核(CA)通过", 10),
        //药师审核中
        Pharmacist_examination("药师审核中",20),
        Pharmacist_examination_error("药师审核失败",21),
        //开方中/药师审核成功
        adding("开方中/药师审核成功",30),
        add_error("开方失败",31),
        //待支付
        wait_pay("开方完成/待支付", 40),
        pay_error("支付失败", 41),
        //配药中
        pay_success("支付成功/待配药", 50),
        //等待领药
        wait_expressage("配药成功/待配送", 60),
        //配送中
        expressageing_error("配送失败", 61),
        expressageJGS("分配健管师", 62),
        expressageing("配送中", 65),
        expressage2hospital("配送到服务站", 69),
        //已完成
        finish("配送到患者手中/已完成", 100);
        private String name;
        private int value;
        PrescriptionLogStatus(String name, int value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Integer status;                 //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成)
    private Integer type;                   //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private String userCode;                  //医生或者患者code
    private String userName;                  //医生或者患者name
    private Integer userType;                 //1 患者 2医生
    private Integer flag;                      //操作是否成功 1成功 0失败
    private String remark;                     //备注信息
    private String hospital;                //医院code
    private String hospitalName;            //医院名称
    private String statusName;  //状态名称
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_code")
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "user_code")
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    @Column(name = "user_name")
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    @Column(name = "flag")
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = Prescription.getStatusName(this.status,hospitalName);
    }
}

+ 99 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionPay.java

@ -0,0 +1,99 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2017/7/26.
 * 处方支付表
 */
@Entity
@Table(name = "wlyy_prescription_pay")
public class PrescriptionPay extends IdEntity {
    private String code;//业务code
    private String payNum;//支付流水号
    private String prescriptionCode;//续方code
    private Date createTime;//创建时间
    private String ybCard;//医保卡号
    private Integer type;// 1 医保支付
    private Integer status;//状态  成功1 失败0
    private Integer ybCost;//统筹金额  单位分
    private Integer myCost;//自费金额  单位分
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPayNum() {
        return payNum;
    }
    public void setPayNum(String payNum) {
        this.payNum = payNum;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getYbCard() {
        return ybCard;
    }
    public void setYbCard(String ybCard) {
        this.ybCard = ybCard;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getYbCost() {
        return ybCost;
    }
    public void setYbCost(Integer ybCost) {
        this.ybCost = ybCost;
    }
    public Integer getMyCost() {
        return myCost;
    }
    public void setMyCost(Integer myCost) {
        this.myCost = myCost;
    }
}

+ 167 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionReviewed.java

@ -0,0 +1,167 @@
package com.yihu.wlyy.service.entity.prescription;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方日志
 */
@Entity
@Table(name = "wlyy_prescription_reviewed")
public class PrescriptionReviewed extends IdEntity {
    //状态枚举
    public enum PrescriptionReviewedStatus {
        del("删除", -2),
        reviewed_fail("审核失败", -1),
        reviewed_wait("待审核", 0),
        reviewed_success("审核成功", 1);
        private String name;
        private int value;
        PrescriptionReviewedStatus(String name, int value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //审核时间
    private String hospital;                  //医院 关联 dm_hospital code
    private String hospitalName;              //医院 关联 dm_hospital name
    private String dept;                       //科室code
    private String deptName;                   //科室名称
    private String doctor;                  //审核医生
    private String doctorName;                  //审核医生名称
    private Integer status;               //  1审核通过1 0待审核  -1  审核通过   -2无效审核
    private String reason;                  //审核不通过原因
    private String remark;                  //备注
    private Date reviewedTime;           //审核时间
    public Date getReviewedTime() {
        return reviewedTime;
    }
    public void setReviewedTime(Date reviewedTime) {
        this.reviewedTime = reviewedTime;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 198 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/VO/PrescriptionExpressageVO.java

@ -0,0 +1,198 @@
package com.yihu.wlyy.service.entity.prescription.VO;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import java.util.ArrayList;
import java.util.List;
public class PrescriptionExpressageVO extends Result {
    //快递编号
    private String mailno;
    //业务类型:如标准快递
    private String mailtype;
    //目的地区域代码
    private String destcode;
    /**----寄方信息----**/
    // 医院名稱
    private String j_name;
    //省份名称
    private String j_provinceName;
    //城市名称
    private String j_cityName;
    //区县名称
    private String j_townName;
    //医院详细地址
    private String j_address;
    //联系电话
    private String j_phone;
    /**----收方信息----**/
    //收货人名称
    private String d_name;
    //省份名称
    private String d_provinceName;
    //城市名称
    private String d_cityName;
    //区县名称
    private String d_townName;
    //医院详细地址
    private String d_address;
    //收货人座机号
    private String d_phone;
    //产品类别:11--医药常温
    private Integer express_type;
    //付款方式:1:寄方付,2:收方付 3:第三方付
    private Integer pay_method;
    //订单的药品详情
    private List<PrescriptionInfo> infos = new ArrayList<>();
    public String getMailno() {
        return mailno;
    }
    public void setMailno(String mailno) {
        this.mailno = mailno;
    }
    public String getJ_name() {
        return j_name;
    }
    public void setJ_name(String j_name) {
        this.j_name = j_name;
    }
    public String getJ_provinceName() {
        return j_provinceName;
    }
    public void setJ_provinceName(String j_provinceName) {
        this.j_provinceName = j_provinceName;
    }
    public String getJ_cityName() {
        return j_cityName;
    }
    public void setJ_cityName(String j_cityName) {
        this.j_cityName = j_cityName;
    }
    public String getJ_townName() {
        return j_townName;
    }
    public void setJ_townName(String j_townName) {
        this.j_townName = j_townName;
    }
    public String getJ_address() {
        return j_address;
    }
    public void setJ_address(String j_address) {
        this.j_address = j_address;
    }
    public String getJ_phone() {
        return j_phone;
    }
    public void setJ_phone(String j_phone) {
        this.j_phone = j_phone;
    }
    public String getD_name() {
        return d_name;
    }
    public void setD_name(String d_name) {
        this.d_name = d_name;
    }
    public String getD_provinceName() {
        return d_provinceName;
    }
    public void setD_provinceName(String d_provinceName) {
        this.d_provinceName = d_provinceName;
    }
    public String getD_cityName() {
        return d_cityName;
    }
    public void setD_cityName(String d_cityName) {
        this.d_cityName = d_cityName;
    }
    public String getD_townName() {
        return d_townName;
    }
    public void setD_townName(String d_townName) {
        this.d_townName = d_townName;
    }
    public String getD_address() {
        return d_address;
    }
    public void setD_address(String d_address) {
        this.d_address = d_address;
    }
    public String getD_phone() {
        return d_phone;
    }
    public void setD_phone(String d_phone) {
        this.d_phone = d_phone;
    }
    public Integer getExpress_type() {
        return express_type;
    }
    public void setExpress_type(Integer express_type) {
        this.express_type = express_type;
    }
    public Integer getPay_method() {
        return pay_method;
    }
    public void setPay_method(Integer pay_method) {
        this.pay_method = pay_method;
    }
    public List<PrescriptionInfo> getInfos() {
        return infos;
    }
    public void setInfos(List<PrescriptionInfo> infos) {
        this.infos = infos;
    }
    public String getMailtype() {
        return mailtype;
    }
    public void setMailtype(String mailtype) {
        this.mailtype = mailtype;
    }
    public String getDestcode() {
        return destcode;
    }
    public void setDestcode(String destcode) {
        this.destcode = destcode;
    }
}

+ 313 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java

@ -0,0 +1,313 @@
package com.yihu.wlyy.service.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.dao.HospitalMappingDao;
import com.yihu.wlyy.service.dao.ZyPushLogDao;
import com.yihu.wlyy.service.entity.HospitalMapping;
import com.yihu.wlyy.service.entity.ZyPushLog;
import com.zoe.phip.ssp.sdk.ApiException;
import net.sf.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
/**
 * 智业接口--基本方法
 * Created by yeshijie on 2017/7/17.
 */
@Service
public class ZysoftBaseService {
    private org.slf4j.Logger logger= LoggerFactory.getLogger(ZysoftBaseService.class);
    @Autowired
    private LogService logService;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private ZyPushLogDao zyPushLogDao;
    //默认重复次数
    private int retryTimes = 3;
    @Value("${zysoftApi.internet}")
    private String internet;
    @Value("${zysoftApi.base}")
    private String base;
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    /**
     * 保存智业推送日志
     * @param request
     * @param api
     * @param content
     * @param error
     * @param method
     * @param status
     * @param type
     */
    public Result addZyPushLog(String request, String api, String content, String error, String method, String status, String type,String errMsg){
        Result re = null;
        if(errMsg==null){
            re = Result.success("接收线下处方调整完成消息成功");
        }else {
            re = Result.error(-1,errMsg);
        }
        ZyPushLog log = new ZyPushLog();
        log.setCreateTime(new Date());
        log.setApi(api);
        log.setContent(content);
        log.setError(error);
        log.setMethod(method);
        log.setRequest(request);
        log.setResponse(JSONObject.fromObject(re).toString());
        log.setRetryTimes(0);
        log.setStatus(status);
        log.setType(type);
        zyPushLogDao.save(log);
        return re;
    }
    /**
     * 获取基础路径
     * @param apiType
     * @return
     */
    private String getBaseApi(Integer apiType){
        String baseApi = "";
        switch (apiType){
            case 1:
                baseApi = base;
                break;
            case 2:
                baseApi = internet;
                break;
            default:
                baseApi = base;
                break;
        }
        return baseApi;
    }
    /**
     * 基卫二次封装Get接口
     */
    public String getSecond(String api, String content, Map<String,String> params, Map<String,String> headers, boolean needRetry,Integer apiType) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = JSONObject.fromObject(params).toString();
        String msgHeader = JSONObject.fromObject(headers).toString();
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        logger.info("msgHeader:"+msgHeader+"\r\n");
        logger.info("msgBody:"+msgBody+"\r\n");
        //新增日志
        String method = "GET";
        Boolean isSuccess = true;
        String error = "";
        String baseApi = getBaseApi(apiType);
        int times = 0;
        try {
            re = ZysoftApi.getSingleton().get(baseApi, paramsList, null,true);
            if(needRetry)
            {
                while(retryTimes>0 && re.contains("接口调用传入的参数[msgHeader]格式不正确"))    //基卫bug预防,重调接口
                {
                    re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,true);
                    retryTimes --;
                    times++;
                }
            }
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            String message = map.get("MESSAGE");
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),message);
            }
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    /**
     * 基卫二次封装Post接口
     */
    public String postSecond(String api,String content, Map<String,String> params,JSONObject jsonParams, Map<String,String> headers,boolean needRetry,Integer apiType) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = params==null?jsonParams.toString():JSONObject.fromObject(params).toString();
        String msgHeader = JSONObject.fromObject(headers).toString();
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        logger.info("msgHeader:"+msgHeader+"\r\n");
        logger.info("msgBody:"+msgBody+"\r\n");
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
        String baseApi = getBaseApi(apiType);
        int times = 0;
        try {
            re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,true);
            if(needRetry)
            {
                int maxTimes = retryTimes;
                while(maxTimes>0 && re.contains("接口调用传入的参数[msgHeader]格式不正确"))    //基卫bug预防,重调接口
                {
                    re = ZysoftApi.getSingleton().post(baseApi, paramsList, null,true);
                    maxTimes --;
                    times++;
                }
            }
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
            }
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    /**
     * 获取机构映射
     */
    public String[] getHospitalMapping(String hospital) throws Exception
    {
        if(StringUtil.isEmpty(hospital)) //使用默认医院
        {
            String mappingCode = SystemConfig.getInstance().getJwHospital();
            String licence = SystemConfig.getInstance().getJwLicence();
            return new String[]{mappingCode,licence};
        }
        else {
            HospitalMapping hm = hospitalMappingDao.getMappingCode(hospital, "1");  //转换成基卫机构代码
            String licence = "";
            if (hm != null && !StringUtil.isEmpty(hm.getMappingCode()) && !StringUtil.isEmpty(hm.getLicence())) {
                hospital = hm.getMappingCode();
                licence = hm.getLicence();
            } else {
                throw new Exception("机构【" + hospital + "】映射配置未完善!");
            }
            return new String[]{hospital, licence};
        }
    }
    /*************************** 格式转换 *******************************************************/
    /**
     * 获取单对象
     */
    public Map<String,String> getJwOne(String response) throws Exception
    {
        Map<String,String> re = new HashMap<>();
        Map<String,Object> map = objectMapper.readValue(response,Map.class);
        String code = String.valueOf(map.get("CODE"));
        if(code.equals("1")) {
            List<Map<String, String>> list = (List<Map<String, String>>) map.get("DATA");
            if (list != null && list.size() > 0) {
                re = list.get(0);
            }
        }
        else{
            re.put("MESSAGE",String.valueOf(map.get("MESSAGE")));
        }
        return re;
    }
    /**
     * 获取单对象列表
     **/
    public List<Map<String,String>> getJwList(String response) throws Exception
    {
        Map<String,Object> map = objectMapper.readValue(response,Map.class);
        List<Map<String,String>> list = (List<Map<String,String>>)map.get("DATA");
        return list;
    }
}

+ 373 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftMaternalService.java

@ -0,0 +1,373 @@
package com.yihu.wlyy.service.service;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * 智业接口--产检模块
 * Created by yeshijie on 2017/7/17.
 * 方法注释中7.32等为智业接口文档的编号
 */
@Service
public class ZysoftMaternalService extends ZysoftBaseService{
    /**
     * 7.32获取孕妇建卡信息(妇幼保健)
     */
    public String getEhrMaternalFirstExamRecord(String idcard,String searchTime,String hospital,String licence) throws Exception
    {
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalFirstExamRecord","获取孕妇建卡信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.33 获取非第一次产检记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalReExamRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalReExamRecord","获取非第一次产检记录",params,null,header,false,1);
        return response;
    }
    /**
     * 7.34 获取产床预约信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalBedPrecontractRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalBedPrecontractRecord","获取产床预约信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.35 获取高危产妇信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalPregnancyHighRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalPregnancyHighRecord","获取高危产妇信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.36 获取孕妇分娩信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalDeliveryRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalDeliveryRecord","获取孕妇分娩信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.37 获取新生儿基本信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalDeliveryChildRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalDeliveryChildRecord","获取新生儿基本信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.38 获取儿童健康体检0-6岁记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalChildMedicalRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalChildMedicalRecord","获取儿童健康体检0-6岁记录",params,null,header,false,1);
        return response;
    }
    /**
     * 7.39 获取新生儿访视信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalHomeVisitRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalHomeVisitRecord","获取新生儿访视信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.40 获取新生儿免疫记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalChildImmuneRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalChildImmuneRecord","获取新生儿免疫记录",params,null,header,false,1);
        return response;
    }
    /**
     * 7.41 获取孕妇预建卡信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalPreFirstExamRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("getEhrMaternalPreFirstExamRecord","获取孕妇预建卡信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.42 上传孕妇预建卡信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String SaveEhrMaternalPreFirstExamRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("SaveEhrMaternalPreFirstExamRecord","上传孕妇预建卡信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.43 上传新生儿访视信息
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String SaveEhrMaternalHomeVisitRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("SEARCH_TIME",searchTime);
        String response = postSecond("SaveEhrMaternalHomeVisitRecord","上传新生儿访视信息",params,null,header,false,1);
        return response;
    }
    /**
     * 7.44 获取待产记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalZSPreDeliveryRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("PUERPERA_ID_NUMBER",idcard);
        params.put("TPP_RECORD_DATE_TIME",searchTime);
        String response = postSecond("getEhrMaternalZSPreDeliveryRecord","获取待产记录",params,null,header,false,1);
        return response;
    }
    /**
     * 7.45 获取阴道分娩记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalZSDeliveryRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("PUERPERA_ID_NUMBER",idcard);
        params.put("CREATE_TIME",searchTime);
        String response = postSecond("getEhrMaternalZSDeliveryRecord","获取阴道分娩记录",params,null,header,false,1);
        return response;
    }
    /**
     * 7.46 获取剖宫产记录
     * @param idcard
     * @param searchTime
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getEhrMaternalZSCaesareanBirthRecord(String idcard,String searchTime,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("ORG_CODE",hospital);
        params.put("PUERPERA_ID_NUMBER",idcard);
        params.put("CREATE_TIME",searchTime);
        String response = postSecond("getEhrMaternalZSCaesareanBirthRecord","获取剖宫产记录",params,null,header,false,1);
        return response;
    }
}

+ 515 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -0,0 +1,515 @@
package com.yihu.wlyy.service.service.prescription;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.dao.HospitalDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.entity.Hospital;
import com.yihu.wlyy.service.entity.prescription.Prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionExpressage;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
import com.yihu.wlyy.service.service.ZysoftBaseService;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 长处方接口
 * Created by yeshijie on 2017/8/3.
 */
@Service
@Transactional
public class PrescriptionService extends ZysoftBaseService{
    private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    private String channelTopic = "redisPrescription";
    /**
     * 新增续方日志
     * @param prescription
     */
    public void addPrescriptionLog(Prescription prescription,String remark){
        PrescriptionLog log = new PrescriptionLog();
        log.setStatus(prescription.getStatus());
        log.setPrescriptionCode(prescription.getCode());
        log.setCode(getCode());
        log.setCreateTime(new Date());
        log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
        log.setFlag(1);
        log.setHospital(prescription.getHospital());
        log.setHospitalName(prescription.getHospitalName());
        log.setRemark(remark);
        log.setUserCode(prescription.getDoctor());
        log.setUserName(prescription.getDoctorName());
        log.setUserType(2);
        prescriptionLogDao.save(log);
    }
    /********************************************智业推送数据处理 start**************************************************/
    /**
     * 接收线下处方调整完成消息
     */
    public Result prescriptionAdjustCompleted(String jsonObject){
        String error = null;
        String status = "1";
        String errMsg = null;
        String msg = "";
        try{
            JSONObject json = JSONObject.fromObject(jsonObject);
            Integer CODE= json.getInt("CODE");
            JSONObject pre = json.getJSONObject("Data");
            String prescriptionCode = pre.getString("PRESCRIPTION_CODE");
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            if(prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.changeing.getValue()||prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.change_error.getValue()){
                if(CODE==1){
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.change_success.getValue());
                    prescriptionDao.save(prescription);
                    //调整续方的药品信息
                    JSONArray prescription_detail = pre.getJSONArray("PRESCRIPTION_DETAIL");
                    for(int i =0;i<prescription_detail.size();i++){
                        JSONObject info = prescription_detail.getJSONObject(i);
                        String infoCode = info.getString("SUB_NO");
                        PrescriptionInfo prescriptionInfo = prescriptionInfoDao.findByCode(infoCode);
                        prescriptionInfo.setRemark(info.getString("REMARK"));
                        prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                        prescriptionInfo.setDirection("口服");//药品用法
                        prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
                        prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setPrice(info.getInt("ITEM_PRICE"));//药品单价
                        prescriptionInfo.setNum(info.getInt("ITEM_QUANTITY"));//药品数目
                        prescriptionInfo.setJwSubCode("");//智业子处方号
                        prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                        prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
                        prescriptionInfo.setCost(1);//金额
                        prescriptionInfo.setCharge(0);//自付
                        prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
                        prescriptionInfo.setDayCount(info.getInt("DAY_COUNT"));//用药天数
                        prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
                        prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
                        prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
                        prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                        prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                        prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                        prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                        prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
                        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                        prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                        prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                        prescriptionInfoDao.save(prescriptionInfo);
                    }
                    // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                    JSONObject message = new JSONObject();
                    message.put("title","adjustPrescription");
                    message.put("state",1);
                    message.put("prescription",prescriptionCode);
                    message.put("mes","调整处方完成");
                    redisTemplate.convertAndSend(channelTopic,message.toString());
                }else {
                    //调整失败
                    prescription.setStatus(4);
                    prescriptionDao.save(prescription);
                    msg = json.getString("MSG");
                }
                //新增续方日志
                addPrescriptionLog(prescription,"接收线下处方调整完成消息-"+msg);
            }
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(jsonObject,"prescriptionAdjustCompleted","接收线下处方调整完成消息",error,"POST",status,"1",errMsg);
    }
    /**
     * 接收预结算完成消息
     */
    public Result prePayCompletion(String jsonObject){
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.fromObject(jsonObject);
            Integer code = json.getInt("CODE");
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
                //修改续方表状态
//                Prescription prescription = prescriptionDao.f
                //修改续方审核表状态
                // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                JSONObject message = new JSONObject();
                message.put("title","redisAddPrescription");
                message.put("state",1);
                message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
//                message.put("mes","预结算完成完成");
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
            }
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(jsonObject,"prePayCompletion","接收预结算完成消息",error,"POST",status,"1",errMsg);
    }
    /**
     * 接收配药完成消息
     */
    public Result dispensingComplete(String jsonObject){
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.fromObject(jsonObject);
            Integer code = json.getInt("CODE");
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
                //判断健管师配送要添加续方消息,提示健管师有续方代配送
                JSONObject message = new JSONObject();
                message.put("title","dispensingComplete");
                message.put("state",1);
                message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
//                message.put("mes","预结算完成完成");
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
            }
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(jsonObject,"dispensingComplete","接收配药完成消息",error,"POST",status,"1",errMsg);
    }
    /**
     * 接收药师审方完成及结果消息
     */
    public Result pharmacistPrescriptionCompletion(String jsonObject){
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.fromObject(jsonObject);
            Integer code = json.getInt("CODE");
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
            }
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(jsonObject,"pharmacistPrescriptionCompletion","接收药师审方完成及结果消息",error,"POST",status,"1",errMsg);
    }
    /********************************************智业推送数据处理 end**************************************************/
    /*********************************************请求智业接口数据 start**************************************************/
    /**
     * 7.1字典获取接口
     * @param dictName 字典名称
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getDictForI(String dictName,String hospital,String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("dictName",dictName);
        String response = postSecond("getDictForI","字典获取接口",params,null,header,false,2);
        return response;
    }
    /**
     * 7.2 处方模板获取接口
     * @param staffCode 员工编码
     * @param deptCode 部门编码
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getRecipeTemplate(String staffCode,String deptCode,String hospital,String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("staffCode",staffCode);
        params.put("deptCode",deptCode);
        String response = postSecond("getRecipeTemplate","处方模板获取接口",params,null,header,false,2);
        return response;
    }
    /**
     * 调阅历史处方接口
     * @param cardNo 卡号
     * @param recipeNo 医嘱号
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getLastRecipe(String cardNo,String recipeNo,String hospital,String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        params.put("recipeNo",recipeNo);
        String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2);
        return response;
    }
    /**
     * 7.4 挂号开处方接口
     * @param json
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String saveRecipe(JSONObject json, String hospital, String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2);
        return response;
    }
    /**
     * 7.5 查询处方结算结果列表
     * @param cardNo
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getDispUnSettleFeeList(String cardNo, String hospital, String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        String response = postSecond("getDispUnSettleFeeList","查询处方结算结果列表",params,null,header,false,2);
        return response;
    }
    /**
     * 7.6 院内结算确认接口
     * @param json
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String executeSickSettle(JSONObject json, String hospital, String licence)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        String response = postSecond("executeSickSettle","院内结算确认接口",null,json,header,false,2);
        return response;
    }
    /*********************************************请求智业接口数据 end**************************************************/
    /*********************************************智业请求顺丰快递接口数据 START**************************************************/
    /**
     * 根据基卫处方编码获取顺丰快递相关信息
     * @param jwCode
     * @return
     */
    public Result getSFExpressInfoByVisitNo(String visitNo) {
        //根据基卫处方编号获取处方信息
        Prescription prescription = prescriptionDao.findByVisitNo(visitNo);
        if(prescription == null){
            return Result.error(-1,"查询失败,未找到处方,挂号单为:"+visitNo);
        }
        //根据处方编码获取处方快递信息
        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionPay(prescription.getCode());
        if(prescriptionExpressage == null || StringUtils.isBlank(prescriptionExpressage.getMailno())){
            return Result.error(-2,"查询失败,该处方的快递还未成功下单,挂号单为:"+visitNo);
        }
        //根据医院CODE,获取医院详细
        Hospital hospital = hospitalDao.findByCode(prescription.getHospital());
        //获取订单的药品详情
        List<PrescriptionInfo> prescriptionInfolist = prescriptionInfoDao.findByPrescriptionCode(prescription.getCode());
        PrescriptionExpressageVO vo = new PrescriptionExpressageVO();
        vo.setMailno(prescriptionExpressage.getMailno());
        vo.setMailtype("标准快递");
        vo.setDestcode(prescriptionExpressage.getCityCode());
        //-----寄方信息----
        vo.setJ_name(hospital.getName());
        vo.setJ_provinceName(hospital.getProvinceName());
        vo.setJ_cityName(hospital.getCityName());
        vo.setJ_townName(hospital.getTownName());
        vo.setJ_address(hospital.getAddress());
        vo.setJ_phone(hospital.getPhone());
        //-----收方信息-----
        vo.setD_name(prescriptionExpressage.getName());
        vo.setD_provinceName(prescriptionExpressage.getProvinceName());
        vo.setD_cityName(prescriptionExpressage.getCityName());
        vo.setD_townName(prescriptionExpressage.getTownName());
        vo.setD_address(prescriptionExpressage.getAddress());
        vo.setD_phone(prescriptionExpressage.getPhone());
        vo.setPay_method(2);
        vo.setExpress_type(11);
        vo.setInfos(prescriptionInfolist);
        return Result.success("查询成功",vo);
    }
    /*********************************************智业请求顺丰快递接口数据 END**************************************************/
}

+ 17 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -59,6 +59,12 @@ spring:
    maxTotal: 500
    maxIdle: 30
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
    channelTopic : redisAddPrescription
---
spring:
  profiles: test
@ -70,7 +76,11 @@ spring:
    maxTotal: 500
    maxIdle: 30
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
    channelTopic : redisAddPrescription
---
spring:
  profiles: production
@ -81,3 +91,9 @@ spring:
    driverClassName: com.mysql.jdbc.Driver
    maxTotal: 500
    maxIdle: 30
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
    channelTopic : redisAddPrescription

+ 2 - 2
patient-co/patient-co-statistics/pom.xml

@ -49,8 +49,8 @@
        <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.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
        <version.tomcat-embed>8.0.28</version.tomcat-embed>
    </properties>

+ 6 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java

@ -23,6 +23,11 @@ import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurerAdapter {
    private static final String PUBLIC_API = "Default";
    /**
     * 解决swagger UI资源映射找不到问题
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html")
@ -31,6 +36,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)

二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/1.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/2.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/3.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/4.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/5.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/6.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/7.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot启动/8.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/boot项目启动的2种方式.docx


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/1.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/10.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/11.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/12.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/13.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/2.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/3.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/4.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/5.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/6.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/7.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/8.png


二进制
patient-co/patient-co-wlyy-job/doc/技术文档/IDEA操作/tomcat启动/9.png


二进制
patient-co/patient-co-wlyy-job/doc/接口文档/厦门i健康API文档.docx


+ 0 - 10
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/00.readme.txt

@ -1,10 +0,0 @@
----------------------------------
包名:
com.yihu.xmijk
证书密码:
111111
----------------------------------
develope.apple.com 账号:
chunyudang.yihu@gmail.com 
Jkzldangchunyu060201

二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/HBuilder使用该证书打包的例子.png


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/aps推送证书.p12


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/xmijkPro.mobileprovision


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/ios/证书.p12


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/医生端通过HBuilder打包说明(草稿,完整版V0.2).docx


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/发布修改参数.docx


+ 0 - 10
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/00.readme.txt

@ -1,10 +0,0 @@
----------------------------------
包名:
com.wjw.ssgg.doctor
证书别名:
ssgg_doctor.keystore
证书密码:
ssgg_doctor
----------------------------------

二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/20160721170424_该证书的生成命令.png


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/HBuilder使用该证书打包的例子.png


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/ssgg_doctor.keystore


+ 0 - 5
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/app/安卓/文档.txt

@ -1,5 +0,0 @@
upload_preview.js
common_http.js
im_new.js

二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/im/im.docx


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/后台/tomcat部署.docx


二进制
patient-co/patient-co-wlyy-job/doc/部署文档/正式库/微信端/微信端发布.docx


+ 0 - 29
patient-co/patient-co-wlyy-job/readme.MD

@ -1,29 +0,0 @@
项目中涉及到的框架
spring,springMVC,springJPA,springSecurity,springBoot
quartz,swagger-ui,hibernate,redis,fastDfs
项目包结构
doc 项目相关文档
src 代码
    main
        java
            com.yihu.wlyy
                aop 切面相关代码
                config 配置相关代码
                entity jpa 实体类相关代码
                event 事件相关代码
                exception 异常相关代码
                health 体征设备相关代码
                interceptors 拦截器相关代码
                job 任务相关代码
                logs 日志相关代码
                repository dao相关代码
                rest 
                service 服务类相关代码
                task 线程相关代码
                util 工具类相关代码
                web controller相关代码
                wechat 微信相关代码
        resource 资源和配置文件
        webapp  web相关代码

+ 0 - 14
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/ObserverRequired.java

@ -1,14 +0,0 @@
package com.yihu.wlyy.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 * Created by Trick on 2017/6/24.
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ObserverRequired {
}

+ 0 - 90
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/ObserverRequiredAOP.java

@ -1,90 +0,0 @@
package com.yihu.wlyy.aop;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
 * Created by Trick on 2017/6/24.
 */
@Aspect
@Component
public class ObserverRequiredAOP {
    //Controller层切点路径
    @Pointcut("execution(* com.yihu.wlyy.web..*.*(..))")
    public void controllerAspect() {
    }
    public ObserverRequiredAOP() {
        //System.out.println("Observer---------------------------------------");
    }
    @Around("controllerAspect() && @annotation(com.yihu.wlyy.aop.ObserverRequired)")
    public Object checkToken(ProceedingJoinPoint point) throws Throwable {
        Object o = null;
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
        String error = "";
        try {
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            String observer = json.has("observer") ? json.getString("observer") : "";
            if(StringUtils.isNotBlank(observer)&&"1".equals(observer)){
                PrintWriter writer=response.getWriter();
                writer.write(error(403, "该操作没有权限"));
                writer.flush();
                return o;
            }
        }catch (Exception e){
            //return o;
        }
         o = point.proceed();
        return o;
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
}

+ 0 - 57
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/aop/UserFilterAOP.java

@ -1,57 +0,0 @@
package com.yihu.wlyy.aop;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yihu.wlyy.repository.security.TokenDao;
@Component
@Aspect
public class UserFilterAOP {
	@Autowired
	public TokenDao tokenDao;
//	private JSONObject getAgent() {
//		try {
//			HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//			String userAgent = request.getHeader("User-Agent");
//			return new JSONObject(userAgent);
//		} catch (Exception e) {
//			return null;
//		}
//	}
//
//	@Before("execution(* com.yihu.wlyy.service.app..*.*(..))")
//	public void before() throws Exception {
//		JSONObject json = getAgent();
//		if(json == null){
//			// 未登录
//			throw new InvalidUserException(SystemConf.NOT_LOGIN, "请登录后再操作!");
//		}
//		String user = json.getString("uid");
//		String imei = json.getString("imei");
//		int platform = json.getInt("platform");
//
//		Token token = SystemData.allUserTokens.get(user);
//		if (token == null) {
//			token = tokenDao.findByUser(user, platform);
//			if (token == null) {
//				// 未登录
//				throw new InvalidUserException(SystemConf.NOT_LOGIN, "请登录后再操作!");
//			} else {
//				if (token.getTimeout().getTime() < new Date().getTime()) {
//					// 登录超时
//					throw new InvalidUserException(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录");
//				} else if (!StringUtils.equals(imei, token.getImei())) {
//					// 别处登录
//					throw new InvalidUserException(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录");
//				} else {
//					// 登录正常,更新缓存
//					SystemData.allUserTokens.put(user, token);
//				}
//			}
//		}
//	}
}

+ 0 - 22
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -1,10 +1,5 @@
package com.yihu.wlyy.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.interceptors.DoctorInterceptor;
import com.yihu.wlyy.interceptors.PatientInterceptor;
import com.yihu.wlyy.interceptors.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
@ -19,24 +14,7 @@ import java.util.List;
 */
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
    @Autowired
    private DoctorInterceptor doctorInterceptor;
    @Autowired
    private PatientInterceptor patientInterceptor;
    @Autowired
    private UserInterceptor userInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**","/statistics/province/**","/statistics/**");
        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
        super.addInterceptors(registry);
    }
//    /**
//     * 为null的数据不返回
//     * @param converters

+ 0 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -3,7 +3,6 @@ package com.yihu.wlyy.entity.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;

+ 0 - 58
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/BaseInterceptor.java

@ -1,58 +0,0 @@
package com.yihu.wlyy.interceptors;
import javax.servlet.http.HttpServletRequest;
import com.yihu.wlyy.repository.url.CudUrlDao;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import com.yihu.wlyy.repository.security.TokenDao;
abstract public class BaseInterceptor implements HandlerInterceptor {
	private Logger logger= LoggerFactory.getLogger(BaseInterceptor.class);
	@Autowired
	public TokenDao tokenDao;
	@Autowired
	public CudUrlDao cudUrlDao;
	public JSONObject getAgent(HttpServletRequest request) {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			logger.info("userAgent:" + userAgent);
			return new JSONObject(userAgent);
		} catch (Exception e) {
			return null;
		}
	}
	public String error(int code, String msg) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			return json.toString();
		} catch (Exception e) {
			return null;
		}
	}
	public String write(int code, String msg) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			return json.toString();
		} catch (Exception e) {
			return null;
		}
	}
}

+ 0 - 197
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -1,197 +0,0 @@
package com.yihu.wlyy.interceptors;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.entity.url.CudUrl;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.Map;
/**
 * 医生权限校验
 *
 * @author George
 */
@Component
public class DoctorInterceptor extends BaseInterceptor {
    private Logger logger = LoggerFactory.getLogger(DoctorInterceptor.class);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
        try {
            request.setCharacterEncoding("UTF-8");
            request.setAttribute("log-start", new Date().getTime());
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            if (json == null) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
                    return true;
                }
            }
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            Integer platform = json.has("platform") ? json.getInt("platform") : 2;
            logger.debug("tokenStr:"+tokenStr);
            logger.debug("uid:"+uid);
            logger.debug("imei:"+imei);
            logger.debug("observer:"+observer);
            logger.debug("platform:"+platform);
            //如果是观察者直接返回true
            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {
                Class cls = ((HandlerMethod) handler).getBeanType();
                RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
                Method method = ((HandlerMethod) handler).getMethod();
                RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
                String url = "";
                String urlCls = "";
                String urlMth = "";
                if (clsRm.value() != null && clsRm.value().length > 0) {
                    urlCls = clsRm.value()[0];
                }
                if (mthRm.value() != null && mthRm.value().length > 0) {
                    urlMth = mthRm.value()[0];
                }
                if (StringUtils.isNotEmpty(urlCls)) {
                    url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
                }
                if (StringUtils.isNotEmpty(urlMth)) {
                    url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
                }
                url = url.replace("\\", "/").replace("//", "/");
                CudUrl cudUrl = cudUrlDao.findByUrl(url);
                if (url.equals("/doctor/consult/readed")) {
                    response.getOutputStream().write(write(200, "操作成功").getBytes());
                    return false;
                }
                if (cudUrl != null) {
                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {
                        return true;
                    } else {
                        response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
                        return false;
                    }
                }
                return true;
            }
            if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            Token token = null;
            Map<String, Token> tempMap = null;
            if (platform == 2) {
                tempMap = SystemData.doctorTokens;
            } else {
                tempMap = SystemData.doctorPCTokens;
            }
            token = tempMap.get(uid);
            if (token == null) {
                token = tokenDao.findByPatient(uid, platform);
                if (token != null) {
                    // 加入缓存
                    tempMap.put(uid, token);
                }
            }
            if (token == null || token.getPlatform() != 2) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                flag = false;
            } else {
                if (token.getTimeout().getTime() < new Date().getTime()) {
                    // 登录超时
                    response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
                    flag = false;
                } else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
                    // 别处登录
                    response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
                    flag = false;
                } else {
                    // 一天只更新一次
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        // 更新内存
                        tempMap.put(uid, token);
                        // 更新数据库
                        tokenDao.save(token);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        if (null == request.getAttribute("log-start")) {
            return;
        }
        long start = (long) request.getAttribute("log-start");
        long end = new Date().getTime();
        Class cls = ((HandlerMethod) handler).getBeanType();
        RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
        Method method = ((HandlerMethod) handler).getMethod();
        RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
        String url = "";
        String urlCls = "";
        String urlMth = "";
        if (clsRm.value() != null && clsRm.value().length > 0) {
            urlCls = clsRm.value()[0];
        }
        if (mthRm.value() != null && mthRm.value().length > 0) {
            urlMth = mthRm.value()[0];
        }
        if (StringUtils.isNotEmpty(urlCls)) {
            url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
        }
        if (StringUtils.isNotEmpty(urlMth)) {
            url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
        }
        url = url.replace("\\", "/").replace("//", "/");
        JSONObject json = getAgent(request);
        String uid = json.has("uid") ? json.getString("uid") : "";
        InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
    }
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    }
}

+ 0 - 85
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/ObserverRequiredInterceptor.java

@ -1,85 +0,0 @@
package com.yihu.wlyy.interceptors;
import com.yihu.wlyy.aop.ObserverRequired;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
 * Created by Trick on 2017/6/24.
 */
public class ObserverRequiredInterceptor  implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation mi) throws Throwable {
        Object[] ars = mi.getArguments();
        HttpServletRequest request =null;
        HttpServletResponse response = null;
        for(Object o :ars){
            if(o instanceof HttpServletRequest){
                request = (HttpServletRequest) o;
            }
            if(o instanceof HttpServletResponse){
                response = (HttpServletResponse) o;
            }
        }
        if(request!=null&&response!=null){
            JSONObject json = getAgent(request);
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            //if(StringUtils.isNotBlank(observer)&&"1".equals(observer)){
                if(mi.getMethod().isAnnotationPresent(ObserverRequired.class)){
                    System.out.println("----------this method is added @ObserverRequired-------------------------");
                    response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
                    return null;
                }
            //}
        }
        //执行被拦截的方法,切记,如果此方法不调用,则被拦截的方法不会被执行。
        return mi.proceed();
    }
    public JSONObject getAgent(HttpServletRequest request) {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            System.out.println("userAgent:" + userAgent);
            return new JSONObject(userAgent);
        } catch (Exception e) {
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
    public String error(int code, String msg) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            return json.toString();
        } catch (Exception e) {
            return null;
        }
    }
}

+ 0 - 146
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -1,146 +0,0 @@
package com.yihu.wlyy.interceptors;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Date;
/**
 * 患者权限校验
 * @author George
 *
 */
@Component
public class PatientInterceptor extends BaseInterceptor {
	private Logger logger = LoggerFactory.getLogger(PatientInterceptor.class);
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		try {
			request.setCharacterEncoding("UTF-8");
			request.setAttribute("log-start", new Date().getTime());
			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")||request.getRequestURI().contains("/patient/feedback/saveAppeal")){
				return true;
			}
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			logger.debug("userAgent:"+json);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			String tokenStr = json.has("token") ? json.getString("token") : "";
			String user = json.has("uid") ? json.getString("uid") : "";
			String imei = json.has("imei") ? json.getString("imei") : "";
			String openid = json.has("openid") ? json.getString("openid") : "";
			int platform = json.has("platform") ? json.getInt("platform") : 1;
			logger.debug("tokenStr:"+tokenStr);
			logger.debug("uid:"+user);
			logger.debug("imei:"+imei);
			logger.debug("openid:"+openid);
			logger.debug("platform:"+platform);
			if (StringUtils.isEmpty(imei)) {
				imei = openid;
			}
			Token token = null;
			if (platform == 1) {
				token = SystemData.patientTokens.get(user);
			} else if (platform == 3) {
				token = SystemData.wxPatientTokens.get(user);
			}
			if (token == null) {
				token = tokenDao.findByPatient(user, platform);
				// 加入缓存
				if (platform == 1) {
					SystemData.patientTokens.put(user, token);
				} else if (platform == 3) {
					SystemData.wxPatientTokens.put(user, token);
				}
			}
			if (token == null || StringUtils.isEmpty(tokenStr) || (token.getPlatform() != 1 && token.getPlatform() != 3)) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				flag = false;
			} else {
				if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(user, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
					// 别处登录
					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
					flag = false;
				} else {
					// 一天只更新一次
					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
						// 今天未更新,则更新缓存
						token.setCzrq(new Date());
						// 更新内存
						if (platform == 1) {
							SystemData.patientTokens.put(user, token);
						} else if (platform == 3) {
							SystemData.wxPatientTokens.put(user, token);
						}
						// 更新数据库
						tokenDao.save(token);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		if(null==request.getAttribute("log-start")){
			return;
		}
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();
		RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
		Method method = ((HandlerMethod) handler).getMethod();
		RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
		String url = "";
		String urlCls = "";
		String urlMth = "";
		if (clsRm.value() != null && clsRm.value().length > 0) {
			urlCls = clsRm.value()[0];
		}
		if (mthRm.value() != null && mthRm.value().length > 0) {
			urlMth = mthRm.value()[0];
		}
		if (StringUtils.isNotEmpty(urlCls)) {
			url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
		}
		if (StringUtils.isNotEmpty(urlMth)) {
			url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
		}
		url = url.replace("\\", "/").replace("//", "/");
		JSONObject json = getAgent(request);
		String uid = json.has("uid") ? json.getString("uid") : "";
		InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
	}
	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
	}
}

+ 0 - 141
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java

@ -1,141 +0,0 @@
package com.yihu.wlyy.interceptors;
import java.lang.reflect.Method;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
/**
 * 公共方法,权限简单校验
 * @author George
 *
 */
@Component
public class UserInterceptor extends BaseInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		try {
			request.setCharacterEncoding("UTF-8");
			request.setAttribute("log-start", new Date().getTime());
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			// 获取用户token
			String tokenStr = json.has("token") ? json.getString("token") : "";
			String uid = json.has("uid") ? json.getString("uid") : "";
			String imei = json.has("imei") ? json.getString("imei") : "";
			String openid = json.has("openid") ? json.getString("openid") : "";
			if (StringUtils.isEmpty(imei)) {
				imei = openid;
			}
			Token token = null;
			if (SystemData.doctorTokens.containsKey(uid)) {
				token = SystemData.doctorTokens.get(uid);
			} else if (SystemData.patientTokens.containsKey(uid)) {
				token = SystemData.patientTokens.get(uid);
			} else if (SystemData.wxPatientTokens.containsKey(uid)) {
				token = SystemData.wxPatientTokens.get(uid);
			}
			if (token == null) {
				token = tokenDao.findByToken(tokenStr);
				if (token != null) {
					switch (token.getPlatform()) {
					case 1:
						SystemData.patientTokens.put(uid, token);
						break;
					case 2:
						SystemData.doctorTokens.put(uid, token);
						break;
					case 3:
						SystemData.wxPatientTokens.put(uid, token);
						break;
					}
				}
			}
			if (token == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			} else {
				if (token.getTimeout().getTime() < new Date().getTime()) {
					// 登录超时
					response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
					return false;
				} else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
					// 别处登录
					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
					return false;
				} else {
					// 一天只更新一次
					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
						// 今天未更新,则更新缓存
						token.setCzrq(new Date());
						// 更新内存
						SystemData.doctorTokens.put(uid, token);
						// 更新数据库
						tokenDao.save(token);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return true;
	}
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();
		RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
		Method method = ((HandlerMethod) handler).getMethod();
		RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
		String url = "";
		String urlCls = "";
		String urlMth = "";
		if (clsRm.value() != null && clsRm.value().length > 0) {
			urlCls = clsRm.value()[0];
		}
		if (mthRm.value() != null && mthRm.value().length > 0) {
			urlMth = mthRm.value()[0];
		}
		if (StringUtils.isNotEmpty(urlCls)) {
			url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
		}
		if (StringUtils.isNotEmpty(urlMth)) {
			url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
		}
		url = url.replace("\\", "/").replace("//", "/");
		JSONObject json = getAgent(request);
		String uid = json.has("uid") ? json.getString("uid") : "";
		InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
	}
	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
	}
}

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

@ -1,103 +0,0 @@
package com.yihu.wlyy.logs;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 业务日志输出
 * <p>
 * Created by lyr-pc on 2017/1/19.
 */
public class BusinessLogs {
    // 日志输出
    private static Logger logger = LoggerFactory.getLogger(BusinessLogs.class);
    /**
     * 业务类型
     */
    public enum BusinessType {
        // 咨询
        consult
        // 指导
        , guidance
        // 健康教育
        , article
        // 随访
        , followup
        // 预约
        , appointment
        // 标签
        , label
        // 注册
        , register
        // 健康档案
        , archive
        // 签约
        , sign
        // 指标
        , index
    }
    /**
     * 业务日志输出
     *
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type, String caller,String user, JSONObject info) {
        try {
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 2);
            log.put("caller", caller);
            JSONObject data = new JSONObject();
            data.put("businessType", type.ordinal());
            data.put("patient", user);
            data.put("data", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 业务日志输出
     *
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type,String caller, String user, JSONArray info) {
        try {
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 2);
            log.put("caller", caller);
            JSONObject data = new JSONObject();
            data.put("businessType", type.ordinal());
            data.put("patient", user);
            data.put("data", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 0 - 42
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java

@ -1,42 +0,0 @@
package com.yihu.wlyy.logs;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * Created by lyr-pc on 2017/1/22.
 */
public class InterfaceCallLogs {
    // 日志输出
    private static Logger logger = LoggerFactory.getLogger(InterfaceCallLogs.class);
    /**
     * 接口调用日志输出
     *
     * @param info 日志信息
     */
    public static void info(long time, String url, String user, String info) {
        try {
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 1);
            log.put("caller", user);
            JSONObject data = new JSONObject();
            data.put("responseTime", time);
            data.put("url", url);
            data.put("params", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 0 - 39
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/rest/RestException.java

@ -1,39 +0,0 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.rest;
import org.springframework.http.HttpStatus;
/**
 * 专用于Restful Service的异常.
 * 
 * @author calvin
 */
public class RestException extends RuntimeException {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6603105449344479863L;
	
	public HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
	public RestException() {
	}
	public RestException(HttpStatus status) {
		this.status = status;
	}
	public RestException(String message) {
		super(message);
	}
	public RestException(HttpStatus status, String message) {
		super(message);
		this.status = status;
	}
}

+ 0 - 55
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/rest/RestExceptionHandler.java

@ -1,55 +0,0 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.rest;
import java.util.Map;
import javax.validation.ConstraintViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import org.springside.modules.beanvalidator.BeanValidators;
import org.springside.modules.mapper.JsonMapper;
import org.springside.modules.web.MediaTypes;
/**
 * 自定义ExceptionHandler,专门处理Restful异常.
 * 
 * @author calvin
 */
// 会被Spring-MVC自动扫描,但又不属于Controller的annotation。
@ControllerAdvice
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
	private JsonMapper jsonMapper = new JsonMapper();
	/**
	 * 处理RestException.
	 */
	@ExceptionHandler(value = { RestException.class })
	public final ResponseEntity<?> handleException(RestException ex, WebRequest request) {
		HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.parseMediaType(MediaTypes.TEXT_PLAIN_UTF_8));
		return handleExceptionInternal(ex, ex.getMessage(), headers, ex.status, request);
	}
	/**
	 * 处理JSR311 Validation异常.
	 */
	@ExceptionHandler(value = { ConstraintViolationException.class })
	public final ResponseEntity<?> handleException(ConstraintViolationException ex, WebRequest request) {
		Map<String, String> errors = BeanValidators.extractPropertyAndMessage(ex.getConstraintViolations());
		String body = jsonMapper.toJson(errors);
		HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.parseMediaType(MediaTypes.TEXT_PLAIN_UTF_8));
		return handleExceptionInternal(ex, body, headers, HttpStatus.BAD_REQUEST, request);
	}
}

+ 0 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java

@ -3,7 +3,6 @@ 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;
@ -128,7 +127,6 @@ public class PatientEventService {
            }
            patientEventImgDao.save(imgList);
        }
        BusinessLogs.info(BusinessLogs.BusinessType.archive, caller, es.getPatient(), new JSONObject(es));
    }
    /**

+ 0 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java

@ -1,8 +1,5 @@
package com.yihu.wlyy.service.app.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateLabel;

+ 0 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -8,7 +8,6 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
@ -1224,7 +1223,6 @@ public class SignPatientLabelInfoService extends BaseService {
            }
        }
        BusinessLogs.info(BusinessLogs.BusinessType.label, caller, patient, logArray);
        return 1;
    }
@ -1453,7 +1451,6 @@ public class SignPatientLabelInfoService extends BaseService {
            }
        }
        BusinessLogs.info(BusinessLogs.BusinessType.label, caller, patient, logArray);
        return 1;
    }

+ 0 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -13,7 +13,6 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.*;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
@ -1179,7 +1178,6 @@ public class FamilyContractService extends BaseService {
            ImUtill.sendImMsg(doc.getCode(), doc.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2, "0", "家庭医生代理签约成功!", "1");
        }
        BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
        return temp;
    }
@ -1523,7 +1521,6 @@ public class FamilyContractService extends BaseService {
            ImUtill.sendImMsg(doc.getCode(), doc.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2, "0", "家庭医生签约成功!", "1");
        }
        result.put("status", 1);
        BusinessLogs.info(BusinessLogs.BusinessType.sign, caller, sf.getPatient(), new JSONObject(sf));
        return result;
    }

+ 0 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java


部分文件因为文件数量过多而无法显示