Prechádzať zdrojové kódy

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida 8 rokov pred
rodič
commit
97d7c43be0
100 zmenil súbory, kde vykonal 2307 pridanie a 2117 odobranie
  1. 2 2
      patient-co-statistics-es/src/main/resources/application.yml
  2. 8 8
      patient-co-statistics/pom.xml
  3. 18 0
      patient-co-wlyy/downloadPage.html
  4. BIN
      patient-co-wlyy/images/booking.png
  5. BIN
      patient-co-wlyy/images/device.png
  6. BIN
      patient-co-wlyy/images/examination.png
  7. BIN
      patient-co-wlyy/images/familycontract.png
  8. BIN
      patient-co-wlyy/images/inspect.png
  9. BIN
      patient-co-wlyy/images/myfamily.png
  10. BIN
      patient-co-wlyy/images/operatinginstructions.png
  11. BIN
      patient-co-wlyy/images/operatinginstructions1.png
  12. BIN
      patient-co-wlyy/images/prescriptionRecords.png
  13. BIN
      patient-co-wlyy/images/renew.png
  14. BIN
      patient-co-wlyy/images/visit.png
  15. 214 228
      patient-co-wlyy/pom.xml
  16. 18 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java
  17. 34 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  18. 120 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  19. 61 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/HealthJpa.java
  20. 27 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/HibernateProperties.java
  21. 67 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/WlyyJpa.java
  22. 44 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/security/WebSecurityConfig.java
  23. 15 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/war/ServletInitializer.java
  24. 0 32
      patient-co-wlyy/src/main/java/com/yihu/wlyy/exception/InvalidUserException.java
  25. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  26. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  27. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java
  28. 3 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignAgainJob.java
  29. 4 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/BaseService.java
  30. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  31. 4 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultService.java
  32. 2 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  33. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java
  34. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java
  35. 5 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  36. 7 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyService.java
  37. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  38. 6 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  39. 9 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  40. 315 308
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  41. 4 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/PatientRemindService.java
  42. 6 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  43. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/QrcodeService.java
  44. 3 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java
  45. 0 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  46. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java
  47. 3 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java
  48. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ehr/EhrService.java
  49. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java
  50. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSignService.java
  51. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  52. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/verified/VerifiedService.java
  53. 3 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java
  54. 4 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  55. 79 47
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  56. 5 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/RemindExpensesTask.java
  57. 4 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/RemindFocusWechatTask.java
  58. 38 38
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignSsGetTask.java
  59. 4 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignUploadTask.java
  60. 21 95
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java
  61. 164 201
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java
  62. 10 63
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpUtil.java
  63. 28 23
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  64. 6 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/RSAUtils.java
  65. 23 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendNews.java
  66. 0 30
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendP2PUtil.java
  67. 6 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendPatientUtil.java
  68. 296 373
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java
  69. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java
  70. 8 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  71. 3 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  72. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java
  73. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  74. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  75. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  76. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java
  77. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java
  78. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java
  79. 2 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java
  80. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  81. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  82. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  83. 122 149
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/archives/PatientArchivesController.java
  84. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultCommunicationController.java
  85. 7 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  86. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultPublicController.java
  87. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java
  88. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java
  89. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthRecordController.java
  90. 0 42
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/swagger/SwaggerConfig.java
  91. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  92. 13 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatCoreController.java
  93. 68 61
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  94. 3 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinAccessTokenUtils.java
  95. 3 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTempMsgSendUtils.java
  96. 0 111
      patient-co-wlyy/src/main/resources/application.properties
  97. 318 0
      patient-co-wlyy/src/main/resources/application.yml
  98. 0 238
      patient-co-wlyy/src/main/resources/applicationContext.xml
  99. BIN
      patient-co-wlyy/src/main/resources/fastdfs_lib.jar
  100. 0 0
      patient-co-wlyy/src/main/resources/kaptcha-2.3.2.jar

+ 2 - 2
patient-co-statistics-es/src/main/resources/application.yml

@ -6,11 +6,11 @@ spring:
    name: quota-es
  boot:
    admin:
      url: http://172.19.103.87:8082
      url: http://localhost:8082
      username: jkzl
      password: jkzlehr
      client:
        service-url: http://172.19.103.87:8082
        service-url: http://localhost:8082
  datasource:
    primaryReadWrite:

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

@ -9,7 +9,7 @@
    <modelVersion>4.0.0</modelVersion>
    <!--打成war包需要的配置-->
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <!--<packaging>jar</packaging>-->
    <name>patient-co-statistics</name>
@ -383,7 +383,7 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>${version.spring-boot}</version>
            <scope>provided</scope>
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
@ -415,12 +415,12 @@
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <!--<plugin>-->
                <!--<artifactId>maven-war-plugin</artifactId>-->
                <!--<configuration>-->
                    <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
                <!--</configuration>-->
            <!--</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

+ 18 - 0
patient-co-wlyy/downloadPage.html

@ -0,0 +1,18 @@
<html>
<body>
演示版本下载:
<br>
<b>Android (说明:可以与生产版APP同时安装)</b>
<br>
<ul>
<li>
<a href="http://ehr.yihu.com/ssgg/app/ssgg_doctor_demo_v1.1.3.apk">V1.1.3(Android) -- 发布日期2016-09-07</a></li>
</ul>
<b>IOS (说明:不能与生产版APP同时安装)</b>
<br>
<ul>
<li><a href="itms-services://?action=download-manifest&url=https://ehr.yihu.com/ssgg/ssgg_doctor.plist">V1.1.3(IOS) -- 发布日期2016-09-07</a></li>
</ul>
</body>
</html>

BIN
patient-co-wlyy/images/booking.png


BIN
patient-co-wlyy/images/device.png


BIN
patient-co-wlyy/images/examination.png


BIN
patient-co-wlyy/images/familycontract.png


BIN
patient-co-wlyy/images/inspect.png


BIN
patient-co-wlyy/images/myfamily.png


BIN
patient-co-wlyy/images/operatinginstructions.png


BIN
patient-co-wlyy/images/operatinginstructions1.png


BIN
patient-co-wlyy/images/prescriptionRecords.png


BIN
patient-co-wlyy/images/renew.png


BIN
patient-co-wlyy/images/visit.png


+ 214 - 228
patient-co-wlyy/pom.xml

@ -9,45 +9,38 @@
    <name>patient-co-wlyy</name>
    <properties>
        <!-- 主要依赖库的版本定义 -->
        <springside.version>4.2.3-GA</springside.version>
        <spring.version>4.2.6.RELEASE</spring.version>
        <hibernate.version>4.3.5.Final</hibernate.version>
        <spring-data-jpa.version>1.6.0.RELEASE</spring-data-jpa.version>
        <tomcat-jdbc.version>7.0.53</tomcat-jdbc.version>
        <version.spring-boot>1.3.5.RELEASE</version.spring-boot>
        <version.springside>4.2.3-GA</version.springside>
        <version.spring>4.3.2.RELEASE</version.spring>
        <version.spring-data-jpa>1.6.0.RELEASE</version.spring-data-jpa>
        <version.spring-data-commons>1.8.0.RELEASE</version.spring-data-commons>
        <version.spring-data-keyvalue>1.1.2.RELEASE</version.spring-data-keyvalue>
        <version.spring-data-redis>1.7.2.RELEASE</version.spring-data-redis>
        <version.swagger>2.4.0</version.swagger>
        <version.poi>3.15-beta1</version.poi>
        <version.hibernate>4.3.5.Final</version.hibernate>
        <version.hibernate-validator>5.0.3.Final</version.hibernate-validator>
        <version.logback>1.1.2</version.logback>
        <version.aspectj>1.7.4</version.aspectj>
        <version.quartz>2.2.3</version.quartz>
        <version.redis>2.8.1</version.redis>
        <version.fastdfs>1.25</version.fastdfs>
        <version.servlet-api>3.1.0</version.servlet-api>
        <version.joda-time>2.8.2</version.joda-time>
        <sitemesh.version>2.4.2</sitemesh.version>
        <hibernate-validator.version>5.0.3.Final</hibernate-validator.version>
        <jackson.version>2.4.0</jackson.version>
        <aspectj.version>1.7.4</aspectj.version>
        <jackson.version>2.6.6</jackson.version>
        <slf4j.version>1.7.7</slf4j.version>
        <logback.version>1.1.2</logback.version>
        <commons-lang3.version>3.3.2</commons-lang3.version>
        <guava.version>17.0</guava.version>
        <junit.version>4.11</junit.version>
        <assertj.version>1.6.1</assertj.version>
        <mockito.version>1.9.5</mockito.version>
        <selenium.version>2.42.2</selenium.version>
        <jetty.version>7.6.15.v20140411</jetty.version>
        <h2.version>1.3.176</h2.version>
        <!-- Plugin的属性定义 -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.6</java.version>
        <!-- 项目属性 -->
        <!--
        <jdbc.driver.groupId>com.h2database</jdbc.driver.groupId>
        <jdbc.driver.artifactId>h2</jdbc.driver.artifactId>
        <jdbc.driver.version>${h2.version}</jdbc.driver.version>
        -->
        <jdbc.driver.groupId>mysql</jdbc.driver.groupId>
        <jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId>
        <jdbc.driver.version>5.1.22</jdbc.driver.version>
        <version.mysql>5.1.38</version.mysql>
    </properties>
    <prerequisites>
        <maven>3.0.0</maven>
    </prerequisites>
    <!-- 设定插件仓库, 如有Nexus私服, 取消注释并指向正确的服务器地址. -->
    <pluginRepositories>
@ -62,38 +55,147 @@
    </pluginRepositories>
    <!-- 依赖项定义 -->
    <dependencies>
        <!--Swagger-->
        <!--Spring boot family-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.4.0</version>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-docs</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>${version.spring-boot}</version>
    </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-devtools</artifactId>-->
        <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!-- end -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${version.servlet-api}</version>
        </dependency>
        <!-- spring start -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>java-ffmpegjave</artifactId>
            <version>1.0.4</version>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${version.spring}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${version.spring}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>${version.spring-data-commons}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-keyvalue</artifactId>
            <version>${version.spring-data-keyvalue}</version>
        </dependency>
        <!-- spring end -->
        <!--Swagger start -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
            <version>${version.swagger}</version>
        </dependency>
        <!--Spring-->
        <!--Swagger end -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
            <groupId>com.yihu</groupId>
            <artifactId>jave-ffmpegjave</artifactId>
            <version>1.0.4</version>
        </dependency>
        <!-- poi start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15-beta1</version>
            <version>${version.poi}</version>
        </dependency>
        <!-- poi end-->
        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
@ -139,7 +241,7 @@
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>${springside.version}</version>
            <version>${version.springside}</version>
        </dependency>
        <!-- PERSISTENCE begin -->
@ -147,7 +249,7 @@
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
            <version>${version.hibernate}</version>
        </dependency>
        <dependency>
@ -155,54 +257,36 @@
            <artifactId>kaptcha</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>com.ylzinfo.onepay</groupId>
            <artifactId>onepay</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- spring data access -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${spring-data-jpa.version}</version>
            <version>${version.spring-data-jpa}</version>
        </dependency>
        <!-- spring aop -->
        <!-- aspectjrt start -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
            <version>${version.aspectj}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
            <scope>runtime</scope>
            <version>${version.aspectj}</version>
        </dependency>
        <!-- aspectjrt end -->
        <!-- connection pool -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>${tomcat-jdbc.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- jdbc driver -->
        <dependency>
            <groupId>${jdbc.driver.groupId}</groupId>
            <artifactId>${jdbc.driver.artifactId}</artifactId>
            <version>${jdbc.driver.version}</version>
            <scope>runtime</scope>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${version.mysql}</version>
        </dependency>
        <!-- PERSISTENCE end -->
        <!-- WEB begin -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>opensymphony</groupId>
@ -224,19 +308,11 @@
        </dependency>
        <!-- WEB end -->
        <!-- SECURITY begin -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <!-- SECURITY end -->
        <!-- JSR303 BeanValidator -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
            <version>${version.hibernate-validator}</version>
        </dependency>
        <!-- JSON begin -->
@ -261,14 +337,6 @@
            <version>20160212</version>
        </dependency>
        <!-- JSON end -->
        <!--fastjson-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.4</version>
        </dependency>
        <dependency>
            <groupId>org.htmlparser</groupId>
            <artifactId>htmlparser</artifactId>
@ -297,14 +365,14 @@
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <version>${version.logback}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
            <version>${version.logback}</version>
            <scope>runtime</scope>
        </dependency>
@ -351,42 +419,6 @@
        </dependency>
        <!-- GENERAL UTILS end -->
        <!-- TEST begin -->
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>${springside.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- selenium 2.0 -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
@ -432,28 +464,7 @@
                </exclusion>
            </exclusions>
        </dependency>
        <!-- h2  如果生产数据库不是H2,解开下面的注释
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
        </dependency>
        -->
        <!-- jetty -->
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>
        <!--二维码生成 start-->
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
@ -464,59 +475,65 @@
            <artifactId>javase</artifactId>
            <version>3.1.0</version>
        </dependency>
        <!--二维码生成 end-->
        <!-- quartz start  -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.3</version>
            <version>${version.quartz}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>8.0.28</version>
            <scope>provided</scope>
        </dependency>
        <!-- spring data的结合  -->
        <!-- quartz end  -->
        <!-- redis start  -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>1.7.2.RELEASE</version>
            <version>${version.spring-data-redis}</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.8.1</version>
            <version>${version.redis}</version>
        </dependency>
        <!-- TEST end -->
        <!-- redis end  -->
        <!--fastdfs start-->
        <dependency>
            <groupId>org.csource</groupId>
            <artifactId>fastdfs_lib</artifactId>
            <version>1.25</version>
            <version>${version.fastdfs}</version>
        </dependency>
        <!--fastdfs end-->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>RELEASE</version>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${version.joda-time}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>com.ylz</groupId>
            <artifactId>onepay-java-sdk</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>net.sf.ehcache</groupId>
                <artifactId>ehcache-core</artifactId>
                <version>2.6.9</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <finalName>wlyy</finalName>
        <plugins>
            <!--打成war包需要的配置-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
@ -528,56 +545,25 @@
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>onepay</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <groupId>com.ylzinfo.onepay</groupId>
                            <artifactId>onepay</artifactId>
                            <version>1.0</version>
                            <packaging>jar</packaging>
                            <file>${basedir}/src/main/resources/onepay-java-sdk.jar</file>
                        </configuration>
                    </execution>
                    <execution>
                        <id>kaptcha</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <groupId>com.google.code.kaptcha</groupId>
                            <artifactId>kaptcha</artifactId>
                            <version>2.3</version>
                            <packaging>jar</packaging>
                            <file>${basedir}/src/main/resources/kaptcha-2.3.2.jar</file>
                        </configuration>
                    </execution>
                    <execution>
                        <id>fastdfs_lib</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <groupId>org.csource</groupId>
                            <artifactId>fastdfs_lib</artifactId>
                            <version>1.25</version>
                            <packaging>jar</packaging>
                            <file>${basedir}/src/main/resources/fastdfs_lib.jar</file>
                        </configuration>
                    </execution>
                </executions>
                <version>3.1</version>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!--打包的时候把webapp下的资源移到根目录下-->
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${basedir}/</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

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

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

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

@ -0,0 +1,34 @@
package com.yihu.wlyy.config;
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.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
 * Created by chenweida on 2017/4/6.
 */
@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);
    }
}

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

@ -0,0 +1,120 @@
package com.yihu.wlyy.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    private static final String PUBLIC_API = "Default";
    private static final String Doctor_API = "doctor";
    private static final String Patient_API = "patient";
    private static final String Other_API = "other";
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Doctor_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/doctor/.*"))
                .build()
                .apiInfo(publicApiInfo());
    }
    private ApiInfo publicApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "向PC端,微信、App等应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
    @Bean
    public Docket patientAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Patient_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/patient/.*"))
                .build()
                .apiInfo(patientApiInfo());
    }
    private ApiInfo patientApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "向PC端,微信、App等应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
    @Bean
    public Docket otherAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Other_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/third/.*"),
                        regex("/statistics/.*"),
                        regex("/statistics/province/.*"),
                        regex("/job/.*"),
                        regex("/family_contract/.*"),
                        regex("/hosptail/.*"),
                        regex("/manage_util/.*"),
                        regex("/common/.*"),
                        regex("/hospitals/.*"),
                        regex("/upload/.*"),
                        regex("/weixin/.*"),
                        regex("/wx/.*"),
                        regex("/area/.*"),
                        regex("/login/.*"),
                        regex("/qrcode/.*")
                ))
                .build()
                .apiInfo(otherApiInfo());
    }
    private ApiInfo otherApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "向PC端,微信、App等应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
}

+ 61 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/HealthJpa.java

@ -0,0 +1,61 @@
package com.yihu.wlyy.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.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "healthEntityManagerFactory",
        transactionManagerRef = "healthTransactionManager",
        basePackages = {"com.yihu.wlyy.health.repository"})  //设置Repository所在位置
public class HealthJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "healthDataSource")
    @ConfigurationProperties(prefix="spring.datasource.health")
    public DataSource healthDataSource() {
        return DataSourceBuilder.create().build();
    }
    @Bean(name = "healthEntityManagerFactory")
    public LocalContainerEntityManagerFactoryBean entityManagerFactorySecondary(
            @Qualifier("healthDataSource") DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.wlyy.health.entity");
        emfb.setPersistenceUnitName("health");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "healthTransactionManager")
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("healthEntityManagerFactory")EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

+ 27 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/HibernateProperties.java

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

+ 67 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/jpa/WlyyJpa.java

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

+ 44 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/security/WebSecurityConfig.java

@ -0,0 +1,44 @@
package com.yihu.wlyy.config.security;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.beans.factory.annotation.Value;
        import org.springframework.context.annotation.Configuration;
        import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
        import org.springframework.security.config.annotation.web.builders.HttpSecurity;
        import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
        import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
 * Created by Administrator on 2016.10.17.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Value("${security.basic.username}")
    String username;
    @Value("${security.basic.password}")
    String password;
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/swagger-ui.html").authenticated()
                .antMatchers("/swagger-ui.html").authenticated()
                .antMatchers("/configuration/security").authenticated()
                .anyRequest().permitAll()
                .and()
                .csrf().disable()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()
                .logout().logoutSuccessUrl("/login")
                .permitAll();
    }
    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser(username).password(password).roles("USER");
    }
}

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

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

+ 0 - 32
patient-co-wlyy/src/main/java/com/yihu/wlyy/exception/InvalidUserException.java

@ -1,32 +0,0 @@
package com.yihu.wlyy.exception;
public class InvalidUserException extends Exception {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4062380426285600840L;
	private int code;
	private String msg;
	public InvalidUserException() {
		super();
	}
	public InvalidUserException(int code, String msg) {
		super();
		this.code = code;
		this.msg = msg;
	}
	public int getCode() {
		return code;
	}
	public String getMsg() {
		return msg;
	}
}

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

@ -8,6 +8,7 @@ import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
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;
@ -23,6 +24,7 @@ import java.util.Map;
 *
 * @author George
 */
@Component
public class DoctorInterceptor extends BaseInterceptor {
    @Override

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

@ -7,6 +7,7 @@ import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
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;
@ -21,6 +22,7 @@ import java.util.Date;
 * @author George
 *
 */
@Component
public class PatientInterceptor extends BaseInterceptor {
	@Override

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

@ -9,6 +9,7 @@ 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;
@ -23,6 +24,7 @@ import com.yihu.wlyy.util.SystemData;
 * @author George
 *
 */
@Component
public class UserInterceptor extends BaseInterceptor {
	@Override

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignAgainJob.java

@ -30,6 +30,8 @@ import java.util.*;
public class SignAgainJob extends WeixinBaseController implements Job {
    @Autowired
    private  PatientDao patientDao;
    @Autowired
    private SendNews sendNews;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
@ -48,7 +50,7 @@ public class SignAgainJob extends WeixinBaseController implements Job {
                List<String> openIds = patientDao.findOpenids();
                System.out.println("accessToken ---> "+ accessToken);
                System.out.println("openIds --> "+openIds.size());
                SendNews.sendNews(accessToken,openIds);
                sendNews.sendNews(accessToken,openIds);
            }
            System.out.println("sign again job end");
        } catch (Exception e) {

+ 4 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/BaseService.java

@ -9,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.yihu.wlyy.entity.security.RSA;
import com.yihu.wlyy.repository.security.RSADao;
import com.yihu.wlyy.util.CommonUtil;
import org.springframework.stereotype.Service;
@Service
public class BaseService {
	// RSA加密信息持久化DAO
@ -19,7 +21,8 @@ public class BaseService {
	public String getCode() {
		return UUID.randomUUID().toString().replaceAll("-", "");
	}
	@Autowired
	private CommonUtil CommonUtil;
	/**
	 * 发送平台消息
	 * @param content 消息内容

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -104,6 +104,8 @@ public class DoctorInfoService extends BaseService {
    private DoctorWorkTimeService doctorWorkTimeService;
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private ImUtill ImUtill;
    /**
@ -119,6 +121,7 @@ public class DoctorInfoService extends BaseService {
    /**
     * 获取医生的签约病人
     *SendPatientUtil
     *
     * @param doctor
     * @return

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

@ -10,6 +10,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.SendPatientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -51,6 +52,8 @@ public class ConsultService extends BaseService {
	@Autowired
	private PatientService patientService;
	@Autowired
	private ImUtill imUtill;
	/**
	 * 添加一条咨询记录
@ -147,7 +150,7 @@ public class ConsultService extends BaseService {
			}
		}
		if(signFamily!=null){
			new SendPatientUtil(doctor,doctorName,patient, contentType, content,title,signFamily.getType()+"",signFamily.getTeamCode()).start();
			new SendPatientUtil(doctor,doctorName,patient, contentType, content,title,signFamily.getType()+"",signFamily.getTeamCode(),imUtill).start();
		}else {
			throw new RuntimeException("无法找到签约关系!");
		}

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

@ -110,8 +110,6 @@ public class ConsultTeamService extends ConsultService {
    private MessageDao messageDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    WeiXinAccessTokenUtils accessTokenUtils;
@ -857,12 +855,10 @@ public class ConsultTeamService extends ConsultService {
    public Integer addPrescriptionConsult(String jwCode,String patient,String agent,String doctorCode,ConsultTeam ct,String reason) throws Exception {
        synchronized (jwCode.intern()){
            List<Prescription> prescriptionList = prescriptionDao.fingdByJwCodeAndStatus(jwCode,0);
            if(prescriptionList!=null&&prescriptionList.size()>0){//存在未审核的续方
                return -1;
            }
            Doctor doctor = doctorDao.findByCode(doctorCode);
            // 查询患者信息
            Patient p = patientDao.findByCode(patient);
@ -929,6 +925,8 @@ public class ConsultTeamService extends ConsultService {
            ct.setDoctorRead(1);
            // 添加咨询记录
            Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
            // 设置关联指导
            consult.setGuidance(ct.getGuidance());
            //关联业务code
            consult.setRelationCode(prescription.getCode());
            // 设置咨询标识
@ -972,7 +970,6 @@ public class ConsultTeamService extends ConsultService {
        }
    }
    /**
     * 发送消息给IM
     *

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

@ -41,6 +41,8 @@ public class EvaluateService extends BaseService {
    ConsultTeamDoctorDao consultTeamDoctorDao;
    @Autowired
    EvaluateScoreDao evaluateScoreDao;
    @Autowired
    private ImUtill ImUtill;
    private void save(Map<String, List<Evaluate>> docEvaMap) {
        for (String key : docEvaMap.keySet())

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -64,6 +64,8 @@ public class PatientDeviceService extends BaseService {
    private PatientBloodSuggerDao patientBloodSuggerDao;
    @Autowired
    private PatientHealthTimeDao patientHealthTimeDao;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    private String url = SystemConf.getInstance().getYihuOpenPlatformUrl();
    private String appid = SystemConf.getInstance().getYihuOpenPlatformAppId();

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -56,6 +56,11 @@ public class FamilyMemberService extends BaseService {
    Map<Integer, String> relations = new HashMap<>();
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private HttpUtil HttpUtil;
    @PostConstruct
    public void init() {
        relations.put(0, "其他");

+ 7 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyService.java

@ -58,8 +58,12 @@ public class FamilyService {
    @Autowired
    private ConsultService consultService;
    @Value("#{sys.doctor_invitel_template}")
    @Value("${wechat.message.doctor_invitel_template}")
    private String templateId;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
    private String appId;
    //通過患者身份證查找患者家庭成员
    @Transactional
@ -380,8 +384,8 @@ public class FamilyService {
         */
        //填充url
        String url = systemConf.getProperty("doctor_invitel_url");
        url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"))//appid
        url = url.replace("{server}",wechat_base_url)
                .replace("{appId}", appId)//appid
                .replace("{doctorCode}", doctor.getCode())//医生code;
                .replace("{invilogcode}", code)//邀请记录code
                .replace("{currentPatient}", currentPatient.getCode())//当前用户的code

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -71,6 +71,8 @@ public class PatientHealthIndexService extends BaseService {
    @Autowired
    private DoctorWorkTimeService doctorWorkTimeService;
    @Autowired
    private CommonUtil CommonUtil;

+ 6 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -15,6 +15,7 @@ import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@ -50,13 +51,16 @@ public class MessageService extends BaseService {
    private PatientDao patientDao;
    @Autowired
    private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    @Value("${im.im_list_get}")
    private String im_list_get;
    /**
     * IM消息数量
     */
    private String getImMsgAmount(String doctor) {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
        String url =im_list_get
                + "/api/v2/sessions/unread_message_count?user_id=" + doctor;
        return HttpClientUtil.get(url, "UTF-8");
    }

+ 9 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -44,10 +45,14 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HttpUtil httpUtil;
    private static Object obj = new Object();
    private static Object obj2 = new Object();
    String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
    @Value("${fastDFS.fastdfs_file_url}")
    String fastdfs_file_url;
    //获取居民端取药码列表
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize) {
@ -124,7 +129,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        // 生成二维码
        ObjectNode imgNode = makeQrcodeFromWeiXin(token,code);
        //Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastUrl + imgNode.get("groupName").toString().replaceAll("\"","")
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode.get("remoteFileName").toString().replaceAll("\"","");
        //新增居民处方取码记录
@ -152,7 +157,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        //String jgsID= "";//配送员用户ID后4位
//        String jgsCode = code+"1234";//code+jgsID.substring(jgsID.length()-4);
        ObjectNode imgNode2 = makeQrcodeFromWeiXin(token,jgsCode);
        String fileUrl = fastUrl + imgNode2.get("groupName").toString().replaceAll("\"","")
        String fileUrl = fastdfs_file_url + imgNode2.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode2.get("remoteFileName").toString().replaceAll("\"","");
        //新增配送员处方取码记录
        PrescriptionDispensaryCode prescriptionDispensaryCode = new PrescriptionDispensaryCode();
@ -169,7 +174,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    public ObjectNode makeQrcodeFromWeiXin(String token,String content){
        String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + token;
        String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + content + "\"}}}";
        String result = HttpUtil.sendPost(token_url, params);
        String result = httpUtil.sendPost(token_url, params);
        if (!StringUtils.isEmpty(result)) {
            JSONObject json = new JSONObject(result);

+ 315 - 308
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -124,9 +124,13 @@ public class FamilyContractService extends BaseService {
    private ConsultDao consultDao;
    @Autowired
    private SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    private SignFamilyMappingDao signFamilyMappingDao;
    @Autowired
    private ImUtill ImUtill;
    @Autowired
    private HttpUtil httpUtil;
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCodeAndType(code, 2);
@ -163,6 +167,7 @@ public class FamilyContractService extends BaseService {
    public SignFamily findSigningRenewByPatient(String patient) {
        return signFamilyDao.findSigningByPatient(patient);
    }
    /**
     * 查询医院列表
     *
@ -549,7 +554,7 @@ public class FamilyContractService extends BaseService {
     * @param patient 居民code
     * @return
     */
    public int sign(String doctor, String patient,String countryCode) throws Exception {
    public int sign(String doctor, String patient, String countryCode) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
@ -597,12 +602,12 @@ public class FamilyContractService extends BaseService {
        sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
        sf.setSignYear(DateUtil.getSignYear()+"");
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        sf.setSignYear(DateUtil.getSignYear() + "");
        //1.3.5新增居委会字段
        signWebService.setPatientCountryFamily(countryCode,sf);
        signWebService.setPatientCountryFamily(countryCode, sf);
        SignFamily temp = signFamilyDao.save(sf);
@ -668,8 +673,8 @@ public class FamilyContractService extends BaseService {
        }
        //结束与医生所有消息
        List<Message> messages = messageDao.findByPatient(patient, doctor);
        if(messages!=null&&messages.size()>0){
            for(Message message:messages){
        if (messages != null && messages.size() > 0) {
            for (Message message : messages) {
                //修改信息为无效
                if (message != null) {
                    message.setRead(0);
@ -682,6 +687,7 @@ public class FamilyContractService extends BaseService {
    /**
     * 取消续签
     *
     * @param patient
     * @param doctor
     * @return
@ -689,15 +695,15 @@ public class FamilyContractService extends BaseService {
     */
    public int unsignRenew(String patient, String doctor) throws Exception {
        if(DateUtil.getNowMonth()<7){
            SignFamilyRenew  sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
            if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
        if (DateUtil.getNowMonth() < 7) {
            SignFamilyRenew sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        }else{
            SignFamily  sf = signFamilyDao.findByDoctorPatient(doctor, patient);
            if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
        } else {
            SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
            if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
@ -706,8 +712,8 @@ public class FamilyContractService extends BaseService {
        //结束与医生所有消息
        List<Message> messages = messageDao.findByPatientRenew(patient, doctor);
        if(messages!=null&messages.size()>0){
            for(Message message:messages){
        if (messages != null & messages.size() > 0) {
            for (Message message : messages) {
                //修改信息为无效
                if (message != null) {
                    message.setRead(0);
@ -871,7 +877,7 @@ public class FamilyContractService extends BaseService {
                                         String emerMobile, String images,
                                         String healthLabel, String customLabel, String disease,
                                         String expenses, String signDoctorCode,
                                         String signDoctorName, String signDoctorLevel, long adminTeamCode,String sevId,String countryCode) throws Exception {
                                         String signDoctorName, String signDoctorLevel, long adminTeamCode, String sevId, String countryCode) throws Exception {
        // 查询是否有家庭签约
        SignFamily sc = signFamilyDao.findByIdcard(idcard);
        if (sc != null) {
@ -886,19 +892,19 @@ public class FamilyContractService extends BaseService {
//        List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
        Calendar cal = Calendar.getInstance();
        int m = cal.get(Calendar.MONTH)+1;
        String signYear = "" ;
        if(m>=4){
        int m = cal.get(Calendar.MONTH) + 1;
        String signYear = "";
        if (m >= 4) {
            //签约当前年度
            signYear = cal.get(Calendar.YEAR)+"";
        }else{
            signYear = cal.get(Calendar.YEAR) + "";
        } else {
            //签约过去年度
            signYear = (cal.get(Calendar.YEAR)-1)+"";
            signYear = (cal.get(Calendar.YEAR) - 1) + "";
        }
        SignFamily sf = new SignFamily();
        String signCode = getCode();
        sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
        sf.setSignYear(DateUtil.getSignYear() + "");//设置签约年度
        sf.setBegin(DateUtil.getNowDateShort());
        sf.setCode(signCode);
        sf.setCzrq(new Date());
@ -947,8 +953,8 @@ public class FamilyContractService extends BaseService {
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        //设置1.3.3.2服务信息
        if(StringUtils.isNotBlank(sevId)){
            signWebService.setSevId(sf,sevId);
        if (StringUtils.isNotBlank(sevId)) {
            signWebService.setSevId(sf, sevId);
        }
        // 查询该患者是否已注册
        Patient patient = patientDao.findByIdcard(idcard);
@ -1004,8 +1010,8 @@ public class FamilyContractService extends BaseService {
//        }
        // 更新签约日期
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        sf.setOpenid(patient.getOpenid());
        sf.setPatient(patient.getCode());
@ -1023,21 +1029,21 @@ public class FamilyContractService extends BaseService {
        sf.setTeamCode(doctorTeamCode);
        ///1.3.5判断是否续签
        Map<String,Object> oldSign = checkLastYearIsSign(sf.getPatient(),sf.getDoctor());
        if(oldSign!=null){
        Map<String, Object> oldSign = checkLastYearIsSign(sf.getPatient(), sf.getDoctor());
        if (oldSign != null) {
            //如果为续签
            signWebService.setRenewLog(sf);
            Integer adminTCode = (Integer) oldSign.get("admin_team_code");
            Long aTCode = adminTCode.longValue();
            if(aTCode!=null&&aTCode==adminTeamCode){
            if (aTCode != null && aTCode == adminTeamCode) {
                sf.setRenewFlag("1");
            }else{
            } else {
                sf.setRenewFlag("2");
            }
        }else{
        } else {
            sf.setRenewFlag("0");
        }
        sf.setSignYear(DateUtil.getSignYear()+"");
        sf.setSignYear(DateUtil.getSignYear() + "");
        signFamilyDao.save(sf);
        //添加团队成员
        //添加健康管理师
@ -1081,12 +1087,12 @@ public class FamilyContractService extends BaseService {
            throw new Exception("patient sign label settting error:" + patient.getIdcard());
        }
        //1.3.5新增居委会字段
        signWebService.setPatientCountryFamily(countryCode,sf);
        signWebService.setPatientCountryFamily(countryCode, sf);
        //保存签约信息
        SignFamily temp = signFamilyDao.save(sf);
        //设置基卫标识1.3.3.2版本更新
        setSignFamilyMapping(temp.getCode(),temp.getIdcard(),temp.getSignYear());
        setSignFamilyMapping(temp.getCode(), temp.getIdcard(), temp.getSignYear());
        if (temp != null && patient != null) {
            Doctor doc = doctorDao.findByCode(sf.getDoctor());
@ -1098,7 +1104,7 @@ public class FamilyContractService extends BaseService {
            JSONObject json = new JSONObject();
            json.put("first", "签约成功通知");
            json.put("toUser", sf.getPatient());
            json.put("represented",sf.getPatient());//被代理人
            json.put("represented", sf.getPatient());//被代理人
            json.put("doctor", sf.getDoctor());
            json.put("doctorName", sf.getDoctorName());
            json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
@ -1124,24 +1130,24 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = json;
                    data.remove("toUser");
                    data.remove("agent");
                    data.put("toUser",member.getCode());
                    data.put("agent","1");
                    data.put("toUser", member.getCode());
                    data.put("agent", "1");
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(patient,j.getInt("relation"),patient.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), patient.getName()));
                    PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), patient.getName(), data);
                }
            }
            new Thread(new SignUploadTask(sf.getCode())).start();
            new Thread(new SignUploadTask(sf.getCode(), httpUtil)).start();
            JSONObject participants = new JSONObject();
            participants.put(sf.getPatient(), 0);
            if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
@ -1244,14 +1250,14 @@ public class FamilyContractService extends BaseService {
            //List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
            Calendar cal = Calendar.getInstance();
            int m = cal.get(Calendar.MONTH)+1;
            String year = "" ;
            if(m>=4){
            int m = cal.get(Calendar.MONTH) + 1;
            String year = "";
            if (m >= 4) {
                //签约当前年度
                year = cal.get(Calendar.YEAR)+"";
            }else{
                year = cal.get(Calendar.YEAR) + "";
            } else {
                //签约过去年度
                year = (cal.get(Calendar.YEAR)-1)+"";
                year = (cal.get(Calendar.YEAR) - 1) + "";
            }
            Calendar now = Calendar.getInstance();
@ -1283,8 +1289,8 @@ public class FamilyContractService extends BaseService {
            }
            // 更新签约日期
            sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
            sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
            sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
            sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
            // 改为签约生效
@ -1293,8 +1299,8 @@ public class FamilyContractService extends BaseService {
            sf.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
            sf.setAdminTeamId(adminTeamCode);
            //设置服务类型1.3.3.2版本更新
            if(StringUtils.isNotBlank(sevId)){
                signWebService.setSevId(sf,sevId);
            if (StringUtils.isNotBlank(sevId)) {
                signWebService.setSevId(sf, sevId);
            }
            if (StringUtils.isNotEmpty(doctor)) {
                //设置全科医生
@ -1317,7 +1323,7 @@ public class FamilyContractService extends BaseService {
            sf.setSignDoctorLevel(String.valueOf(docLeader.getLevel()));
            sf.setCzrq(new Date());
            sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
            sf.setSignYear(DateUtil.getSignYear() + "");//设置签约年度
            sf.setApplyDate(new Date());
            Doctor doc = doctorDao.findByCode(sf.getDoctor());
            //sf.setFamilyCode(createSignCode(sf.getDoctor(), doc.getHospital()));
@ -1368,7 +1374,7 @@ public class FamilyContractService extends BaseService {
            doctorTeamDoctor.save(wlyyDoctorTeamPatient);
            //设置基卫标识1.3.3.2版本更新
            setSignFamilyMapping(sf.getCode(),sf.getIdcard(),sf.getSignYear());
            setSignFamilyMapping(sf.getCode(), sf.getIdcard(), sf.getSignYear());
        } else {
            // 医生拒绝
@ -1378,7 +1384,7 @@ public class FamilyContractService extends BaseService {
            JSONObject json = new JSONObject();
            json.put("first", "签约失败通知");
            json.put("toUser", sf.getPatient());
            json.put("represented",sf.getPatient());//被代理人
            json.put("represented", sf.getPatient());//被代理人
            json.put("doctor", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealth() : sf.getDoctor());
//            增加signcode
            json.put("signCode", sf.getCode());
@ -1402,17 +1408,17 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = json;
                    data.remove("toUser");
                    data.put("toUser",member.getCode());
                    data.put("toUser", member.getCode());
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                    PushMsgTask.getInstance().putWxMsg(access_token, 2, member.getOpenid(), p.getName(), data);
                }
            }
@ -1440,15 +1446,15 @@ public class FamilyContractService extends BaseService {
            JSONObject json = new JSONObject();
            json.put("first", "签约成功通知");
            json.put("toUser", sf.getPatient());
            json.put("represented",sf.getPatient());//被代理人
            json.put("represented", sf.getPatient());//被代理人
            json.put("doctor", doc.getCode());
            json.put("doctorName", doc.getName());
            json.put("date", DateUtil.dateToStrShort(new Date()));
            json.put("content", content);
            json.put("remark", ""); //您好,您成功签约家庭医生
//            添加签约code by wjj 2017.7.18
            json.put("signCode",sf.getCode()); //签约code
            json.put("agent","0"); //是否是代理 否
            json.put("signCode", sf.getCode()); //签约code
            json.put("agent", "0"); //是否是代理 否
            // 添加到发送队列
            if (StringUtils.isNotBlank(sf.getOpenid())) {
                PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
@ -1464,24 +1470,24 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = json;
                    data.remove("toUser");
                    data.remove("agent");
                    data.put("toUser",member.getCode());
                    data.put("agent","1");
                    data.put("toUser", member.getCode());
                    data.put("agent", "1");
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                    PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), p.getName(), data);
                }
            }
            new Thread(new SignUploadTask(sf.getCode())).start();
            new Thread(new SignUploadTask(sf.getCode(),httpUtil)).start();
            JSONObject participants = new JSONObject();
            participants.put(sf.getPatient(), 0);
            if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
@ -1548,7 +1554,7 @@ public class FamilyContractService extends BaseService {
            JSONObject json = new JSONObject();
            json.put("first", "解约申请通知");
            json.put("toUser", sf.getPatient());
            json.put("represented",sf.getPatient());//被代理人
            json.put("represented", sf.getPatient());//被代理人
            json.put("date", DateUtil.getStringDateShort());
            json.put("doctor", sf.getDoctor());
            json.put("doctorName", sf.getDoctorName());
@ -1571,18 +1577,18 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                Patient p = patientDao.findByCode(patient);
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = json;
                    data.remove("toUser");
                    data.put("toUser",member.getCode());
                    data.put("toUser", member.getCode());
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                    PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
                }
            }
@ -1593,7 +1599,7 @@ public class FamilyContractService extends BaseService {
            JSONObject json = new JSONObject();
            json.put("first", "解约申请通知");
            json.put("toUser", sf.getPatient());
            json.put("represented",sf.getPatient());//被代理人
            json.put("represented", sf.getPatient());//被代理人
            json.put("date", DateUtil.getStringDateShort());
            json.put("doctor", sf.getDoctor());
            json.put("doctorName", sf.getDoctorName());
@ -1616,18 +1622,18 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                Patient p = patientDao.findByCode(patient);
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = json;
                    data.remove("toUser");
                    data.put("toUser",member.getCode());
                    data.put("toUser", member.getCode());
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                    PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
                }
            }
@ -2036,7 +2042,7 @@ public class FamilyContractService extends BaseService {
     * @param healthDoctor 健康管理师code
     * @return
     */
    public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) throws Exception{
    public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) throws Exception {
        JSONObject result = new JSONObject();
        Patient p = patientDao.findByCode(patient);
@ -2094,7 +2100,7 @@ public class FamilyContractService extends BaseService {
                JSONObject data = new JSONObject();
                data.put("toUser", patient);
                data.put("represented",patient);//被代理人
                data.put("represented", patient);//被代理人
                data.put("doctor", docHealth.getCode());
                data.put("doctorName", docHealth.getName());
                data.put("first", p.getName() + ",您好!您签约团队的健康管理师已变更,您的新健管师信息如下:");
@ -2110,7 +2116,7 @@ public class FamilyContractService extends BaseService {
            } else {
                JSONObject data = new JSONObject();
                data.put("toUser", patient);
                data.put("represented",patient);//被代理人
                data.put("represented", patient);//被代理人
                data.put("doctor", docHealth.getCode());
                data.put("doctorName", docHealth.getName());
                data.put("first", p.getName() + ",您好!您的签约团队已为您新增一位健康管理师,医生信息如下:");
@ -2204,7 +2210,7 @@ public class FamilyContractService extends BaseService {
            JSONObject data = new JSONObject();
            data.put("toUser", patient);
            data.put("represented",patient);//被代理人
            data.put("represented", patient);//被代理人
            data.put("doctor", docQk.getCode());
            data.put("doctorName", docQk.getName());
            data.put("first", p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
@ -2254,17 +2260,17 @@ public class FamilyContractService extends BaseService {
//                }
//            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(),p.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject data = msg;
                    data.remove("toUser");
                    data.put("toUser",member.getCode());
                    data.put("toUser", member.getCode());
                    String first = (String) data.get("first");
                    data.remove("first");
                    data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                    PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), data);
                }
            }
@ -2706,7 +2712,7 @@ public class FamilyContractService extends BaseService {
        Map<String, JSONObject> docMap = new HashMap<>();
        SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
//        SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
        SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
        SignFamily jtSign = getSignFamilyBySessionId(sessionId, infos[0]);
        if (ssSign != null) {
            DoctorTeamMember member = doctorTeamDoctor.findSanshiByTeamAndType(ssSign.getTeamCode(), 1);
            if (member != null) {
@ -2774,7 +2780,7 @@ public class FamilyContractService extends BaseService {
        Map<String, JSONObject> docMap = new HashMap<>();
        SignFamily ssSign = signFamilyDao.findSignByPatient(infos[0], 1);
//        SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
        SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
        SignFamily jtSign = getSignFamilyBySessionId(sessionId, infos[0]);
        JSONObject ssArray = new JSONObject();
        JSONObject jtArray = new JSONObject();
        if (ssSign != null) {
@ -2804,19 +2810,20 @@ public class FamilyContractService extends BaseService {
    /**
     * 根据会话id查询 家庭签约信息
     *
     * @param sessionId
     * @param patient
     * @return
     */
    public SignFamily getSignFamilyBySessionId(String sessionId,String patient){
    public SignFamily getSignFamilyBySessionId(String sessionId, String patient) {
        SignFamily signFamily = null;
        String sql = "select id from " + SystemConf.getInstance().getImDataBaseName() + ".topics where  session_id = '"+sessionId+"' order by create_time desc limit 0, 1";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
        String sql = "select id from " + SystemConf.getInstance().getImDataBaseName() + ".topics where  session_id = '" + sessionId + "' order by create_time desc limit 0, 1";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {
            String consultCode = list.get(0).get("id").toString();
            signFamily = signFamilyDao.findByPatient(patient);
            Consult consult = consultDao.findByCode(consultCode);
            if(signFamily==null||signFamily.getApplyDate().getTime()-consult.getCzrq().getTime()>0){
            if (signFamily == null || signFamily.getApplyDate().getTime() - consult.getCzrq().getTime() > 0) {
                signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
            }
        }
@ -2891,7 +2898,7 @@ public class FamilyContractService extends BaseService {
    }
    //根据姓名、地址、身份证搜索已分配健管师的居民
    public List getPatientByLable(String doctorCode, String filter, String level, Long team,int page,int pagesize) throws Exception {
    public List getPatientByLable(String doctorCode, String filter, String level, Long team, int page, int pagesize) throws Exception {
        List list = new ArrayList();
        //判断当前用户是健康管理师还是全科
        List<Map<String, Object>> datas = null;
@ -2915,10 +2922,10 @@ public class FamilyContractService extends BaseService {
                    " and sf.admin_team_code = ? " +
                    " AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
                    " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC " +
                    " limit "+(page-1)*pagesize+","+pagesize;
                    " limit " + (page - 1) * pagesize + "," + pagesize;
            //查找居民
            datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
            datas = jdbcTemplate.queryForList(sql, doctorCode, team, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%");
        } else if (level.equals("2")) {
            //全科
            String sql = "SELECT  DISTINCT " +
@ -2939,10 +2946,10 @@ public class FamilyContractService extends BaseService {
                    " and sf.admin_team_code = ? " +
                    " AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
                    " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC " +
                    " limit "+(page-1)*pagesize+","+pagesize;
                    " limit " + (page - 1) * pagesize + "," + pagesize;
            //查找居民
            datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
            datas = jdbcTemplate.queryForList(sql, doctorCode, team, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%");
        } else {
            throw new Exception("参数错误!");
@ -2950,13 +2957,13 @@ public class FamilyContractService extends BaseService {
        if (datas != null && datas.size() > 0) {
            for (Map<String, Object> map : datas) {
                Map ma = new HashMap();
                ma.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard")==null?"":map.get("idcard").toString()));
                ma.put("photo",map.get("photo")==null?"":map.get("photo").toString());
                ma.put("name",map.get("name")==null?"":map.get("name").toString());
                ma.put("code",map.get("code")==null?"":map.get("code").toString());
                ma.put("sex",map.get("sex")==null?"":map.get("sex").toString());
                ma.put("address",map.get("address")==null?"":map.get("address").toString());
                ma.put("idcard",map.get("idcard")==null?"":map.get("idcard").toString());
                ma.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard") == null ? "" : map.get("idcard").toString()));
                ma.put("photo", map.get("photo") == null ? "" : map.get("photo").toString());
                ma.put("name", map.get("name") == null ? "" : map.get("name").toString());
                ma.put("code", map.get("code") == null ? "" : map.get("code").toString());
                ma.put("sex", map.get("sex") == null ? "" : map.get("sex").toString());
                ma.put("address", map.get("address") == null ? "" : map.get("address").toString());
                ma.put("idcard", map.get("idcard") == null ? "" : map.get("idcard").toString());
                list.add(ma);
            }
        }
@ -3143,7 +3150,7 @@ public class FamilyContractService extends BaseService {
     * @return
     */
    @Transactional
    public int signRenew(String doctor,String healthDoctor, String patient, String reason) throws Exception {
    public int signRenew(String doctor, String healthDoctor, String patient, String reason) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
@ -3157,7 +3164,7 @@ public class FamilyContractService extends BaseService {
        Doctor d = doctorDao.findByCode(doctor);
        Doctor hd = null;
        if(StringUtils.isNotBlank(healthDoctor)){
        if (StringUtils.isNotBlank(healthDoctor)) {
            hd = doctorDao.findByCode(healthDoctor);
        }
@ -3165,11 +3172,11 @@ public class FamilyContractService extends BaseService {
            return -3;
        }
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH) + 1;
        List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
        if(res!=null&&res.size()>0){
        List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(patient, DateUtil.getSignYear() + "");
        if (res != null && res.size() > 0) {
            return -2;
        }
@ -3178,21 +3185,21 @@ public class FamilyContractService extends BaseService {
        String sql = "";
        //判断是否有生效记录SQL
        sql ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='"+(DateUtil.getSignYear()-1)+"'";
        sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='" + (DateUtil.getSignYear() - 1) + "'";
        List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
        if(signs==null||signs.size()==0){
        List<Map<String, Object>> signs = jdbcTemplate.queryForList(sql);
        if (signs == null || signs.size() == 0) {
            return -4;
        }
        Map<String,Object> sign = signs.get(0);
        Map<String, Object> sign = signs.get(0);
        //判断续签医生是否一致
        if(doctor.equals(sign.get("doctor"))){
        if (doctor.equals(sign.get("doctor"))) {
            //如果一致保存团队信息
            sf.setTeamCode((String)sign.get("teamCode"));
            Integer c=(Integer)sign.get("adminTeamCode");
            sf.setTeamCode((String) sign.get("teamCode"));
            Integer c = (Integer) sign.get("adminTeamCode");
            sf.setRenewFlag("1");
            sf.setAdminTeamId(c.longValue());
        }else {
        } else {
            //如果不一致 查看医生团队
            sf.setRenewFlag("2");
//            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
@ -3213,8 +3220,8 @@ public class FamilyContractService extends BaseService {
            team.setDel("1");
            team.setSignType("2");
            //判断是否有健康管理师
            if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
                team.setName(d.getName()+","+hd.getName()+","+p.getName());
            if (hd != null && StringUtils.isNotBlank(hd.getName())) {
                team.setName(d.getName() + "," + hd.getName() + "," + p.getName());
                //新建健康管理师
                DoctorTeamMember hdmb = new DoctorTeamMember();
                hdmb.setName(hd.getName());
@ -3226,8 +3233,8 @@ public class FamilyContractService extends BaseService {
                hdmb.setType(3);
                hdmb.setSignType("2");
                doctorTeamDoctor.save(hdmb);
            }else{
                team.setName(d.getName()+","+p.getName());
            } else {
                team.setName(d.getName() + "," + p.getName());
            }
            //新建医生成员
            DoctorTeamMember dmb = new DoctorTeamMember();
@ -3261,18 +3268,18 @@ public class FamilyContractService extends BaseService {
        sf.setCzrq(new Date());
        sf.setPatientApplyDate(new Date());
        if(d!=null){
        if (d != null) {
            sf.setDoctor(doctor);
            sf.setDoctorName(d.getName());
            sf.setSignDoctorCode(doctor);
            sf.setSignDoctorName(d.getName());
        }
        if(hd!=null){
        if (hd != null) {
            sf.setDoctorHealth(healthDoctor);
            sf.setDoctorHealthName(hd.getName());
        }
        sf.setMobile((String)sign.get("mobile"));
        sf.setMobile((String) sign.get("mobile"));
        sf.setName(p.getName());
        sf.setIdcard(p.getIdcard());
        sf.setOpenid(p.getOpenid());
@ -3287,12 +3294,12 @@ public class FamilyContractService extends BaseService {
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        sf.setSignYear(DateUtil.getSignYear()+"");
        sf.setSignYear(DateUtil.getSignYear() + "");
        sf.setIsValid(0);
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        //设置转签原因
        if(StringUtils.isNotBlank(reason)){
        if (StringUtils.isNotBlank(reason)) {
            sf.setRenewChangeReason(reason);
        }
@ -3313,9 +3320,9 @@ public class FamilyContractService extends BaseService {
            message.setTitle("家庭续签申请");
            message.setType(1);//家庭签约信息
            message.setReadonly(1);//是否只读消息
            if("1".equals(sf.getRenewFlag())){
            if ("1".equals(sf.getRenewFlag())) {
                message.setSignStatus("8");//续签
            }else{
            } else {
                message.setSignStatus("9");//改签
            }
@ -3327,7 +3334,7 @@ public class FamilyContractService extends BaseService {
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
            if (jsonObject.getString("status").equals("1")) {
                //如果在工作时间内就推送
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName() + "申请与您续签家庭医生", patient);
            }
        }
@ -3342,7 +3349,7 @@ public class FamilyContractService extends BaseService {
     * @return
     */
    @Transactional
    public int signRenewOverdue(String doctor,String healthDoctor, String patient, String reason,String countryCode) throws Exception {
    public int signRenewOverdue(String doctor, String healthDoctor, String patient, String reason, String countryCode) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
@ -3350,7 +3357,7 @@ public class FamilyContractService extends BaseService {
        Doctor d = doctorDao.findByCode(doctor);
        Doctor hd = null;
        if(StringUtils.isNotBlank(healthDoctor)){
        if (StringUtils.isNotBlank(healthDoctor)) {
            hd = doctorDao.findByCode(healthDoctor);
        }
@ -3359,32 +3366,32 @@ public class FamilyContractService extends BaseService {
        }
        List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
        if(res!=null&&res.size()>0){
        List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(patient, DateUtil.getSignYear() + "");
        if (res != null && res.size() > 0) {
            return -2;
        }
        SignFamily sf = new SignFamily();
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        String sql  ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND t.expenses_status='1' AND t.sign_year ='"+(year-1)+"'";
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH) + 1;
        String sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND t.expenses_status='1' AND t.sign_year ='" + (year - 1) + "'";
        List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
        if(signs==null||signs.size()==0){
        List<Map<String, Object>> signs = jdbcTemplate.queryForList(sql);
        if (signs == null || signs.size() == 0) {
            return -4;
        }
        Map<String,Object> sign = signs.get(0);
        Map<String, Object> sign = signs.get(0);
        //判断续签医生是否一致
        if(doctor.equals(sign.get("doctor"))){
        if (doctor.equals(sign.get("doctor"))) {
            //如果一致保存团队信息
            sf.setRenewFlag("1");
            sf.setTeamCode((String)sign.get("teamCode"));
            Integer c=(Integer)sign.get("adminTeamCode");
            sf.setTeamCode((String) sign.get("teamCode"));
            Integer c = (Integer) sign.get("adminTeamCode");
            sf.setAdminTeamId(c.longValue());
        }else {
        } else {
            //如果不一致 查看医生团队
            sf.setRenewFlag("2");
//            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
@ -3405,8 +3412,8 @@ public class FamilyContractService extends BaseService {
            team.setDel("1");
            team.setSignType("2");
            //判断是否有健康管理师
            if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
                team.setName(d.getName()+","+hd.getName()+","+p.getName());
            if (hd != null && StringUtils.isNotBlank(hd.getName())) {
                team.setName(d.getName() + "," + hd.getName() + "," + p.getName());
                //新建健康管理师
                DoctorTeamMember hdmb = new DoctorTeamMember();
                hdmb.setName(hd.getName());
@ -3418,8 +3425,8 @@ public class FamilyContractService extends BaseService {
                hdmb.setType(3);
                hdmb.setSignType("2");
                doctorTeamDoctor.save(hdmb);
            }else{
                team.setName(d.getName()+","+p.getName());
            } else {
                team.setName(d.getName() + "," + p.getName());
            }
            //新建医生成员
            DoctorTeamMember dmb = new DoctorTeamMember();
@ -3453,18 +3460,18 @@ public class FamilyContractService extends BaseService {
        sf.setCzrq(new Date());
        sf.setPatientApplyDate(new Date());
        if(d!=null){
        if (d != null) {
            sf.setDoctor(doctor);
            sf.setDoctorName(d.getName());
            sf.setSignDoctorCode(doctor);
            sf.setSignDoctorName(d.getName());
        }
        if(hd!=null){
        if (hd != null) {
            sf.setDoctorHealth(healthDoctor);
            sf.setDoctorHealthName(hd.getName());
        }
        sf.setMobile((String)sign.get("mobile"));
        sf.setMobile((String) sign.get("mobile"));
        sf.setName(p.getName());
        sf.setIdcard(p.getIdcard());
        sf.setOpenid(p.getOpenid());
@ -3479,16 +3486,16 @@ public class FamilyContractService extends BaseService {
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        sf.setSignYear(year+"");
        sf.setSignYear(year + "");
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        if(StringUtils.isNotBlank(reason)){
        if (StringUtils.isNotBlank(reason)) {
            sf.setRenewChangeReason(reason);
        }
       //1.3.5新增居委会字段
        signWebService.setPatientCountryFamily(countryCode,sf);
        //1.3.5新增居委会字段
        signWebService.setPatientCountryFamily(countryCode, sf);
        SignFamily temp = signFamilyDao.save(sf);
@ -3508,9 +3515,9 @@ public class FamilyContractService extends BaseService {
            message.setType(1);//家庭签约信息
            message.setReadonly(1);//是否只读消息
            if("1".equals(sf.getRenewFlag())){
            if ("1".equals(sf.getRenewFlag())) {
                message.setSignStatus("8");//续签
            }else{
            } else {
                message.setSignStatus("9");//改签
            }
            //message.setSignStatus("1");//过期以后,变为1为签约
@ -3522,7 +3529,7 @@ public class FamilyContractService extends BaseService {
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
            if (jsonObject.getString("status").equals("1")) {
                //如果在工作时间内就推送
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName() + "申请与您续签家庭医生", patient);
            }
        }
@ -3530,20 +3537,19 @@ public class FamilyContractService extends BaseService {
    }
    /**
     *
     * @param code
     * @return
     */
    public String getTeamName(String code){
        try{
            String sql = "SELECT t.name FROM wlyy_doctor_team t WHERE t.code ='"+code+"'";
    public String getTeamName(String code) {
        try {
            String sql = "SELECT t.name FROM wlyy_doctor_team t WHERE t.code ='" + code + "'";
            List<Map<String,Object>> map = jdbcTemplate.queryForList(sql);
            List<Map<String, Object>> map = jdbcTemplate.queryForList(sql);
            if(map!=null&&map.size()>0){
                return (String)map.get(0).get("name");
            if (map != null && map.size() > 0) {
                return (String) map.get(0).get("name");
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
@ -3559,7 +3565,7 @@ public class FamilyContractService extends BaseService {
        int year = cal.get(Calendar.YEAR);
        //得到家庭签约
        SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatientOverDue(patientCode,(year-1)+"");
        SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatientOverDue(patientCode, (year - 1) + "");
        if (jtSignFamily != null) {
            //家庭签约只找全科医生
@ -3611,10 +3617,11 @@ public class FamilyContractService extends BaseService {
    /**
     * 存储同步纪委标识
     *
     * @param idCard
     * @param signYear
     */
    public void setSignFamilyMapping(String signCode,String idCard,String signYear){
    public void setSignFamilyMapping(String signCode, String idCard, String signYear) {
        SignFamilyMapping maping = new SignFamilyMapping();
        maping.setCode(signCode);
        maping.setCreateTime(new Date());
@ -3624,11 +3631,11 @@ public class FamilyContractService extends BaseService {
        //判断是否是预签约
        //判断规则:如果在4月份到7月份为预签约
        int month = DateUtil.getNowMonth();
        if(month>=4&&month<7){
        if (month >= 4 && month < 7) {
            //预签约逻辑
            maping.setNeedUpload("0");
            maping.setNeedRenewUpload("1");
        }else{
        } else {
            maping.setNeedUpload("1");
            maping.setNeedRenewUpload("0");
        }
@ -3639,16 +3646,16 @@ public class FamilyContractService extends BaseService {
        return signFamilyDao.findOutTimeSigningByPatient(patient);
    }
    public JSONObject getServerPatientList(Long teamCode){
        String serverSql="SELECT " +
    public JSONObject getServerPatientList(Long teamCode) {
        String serverSql = "SELECT " +
                " d.`code` As labelCode, " +
                " d.`name` AS label " +
                " FROM " +
                " wlyy_sign_dict d " +
                " WHERE " +
                " d.type IN ('1', '2') " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' " ;
        String patientSql ="SELECT " +
                " AND d. YEAR = '" + DateUtil.getSignYear() + "' ";
        String patientSql = "SELECT " +
                " f.patient, " +
                " f.sign_year, " +
                " t.server_type AS serverType, " +
@ -3664,65 +3671,65 @@ public class FamilyContractService extends BaseService {
                "   wlyy_sign_family s " +
                "  WHERE " +
                "   s.`status` >= 0 " +
                "  AND s.admin_team_code = " +teamCode+
                "  AND s.admin_team_code = " + teamCode +
                "  AND s.doctor_health IS NULL " +
                " ) f " +
                "WHERE " +
                " t.sign_code = f. CODE ";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
                " s.patient" +
                " FROM " +
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code =" +teamCode+
                " AND s.admin_team_code =" + teamCode +
                " AND s.doctor_health IS NULL";
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        JSONObject rs = new JSONObject();
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if(serlist!=null&&serlist.size()>0){
            if(patientList!=null){
                for(Map<String,Object> map :serlist){
                    String labelCode = (String)map.get("labelCode");
                    List<Map<String,String>> codes = new ArrayList<>();
        rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
        List<Map<String, Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if (serlist != null && serlist.size() > 0) {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
                        if(labelCode.equals(serverType)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
                    map.put("number",(codes!=null&&codes.size()>0)?codes.size():0);
                    map.put("codes", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }
        }
        rs.put("patients",serlist);
        rs.put("patients", serlist);
        return rs;
    }
    public JSONObject getCountryPatientList(Long teamCode){
    public JSONObject getCountryPatientList(Long teamCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " FROM " +
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? "+
                " AND s.admin_team_code = ? " +
                " AND s.doctor_health IS NULL";
        JSONObject rs = new JSONObject();
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql,new Object[]{teamCode});
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        String patientSql ="SELECT " +
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql, new Object[]{teamCode});
        rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
        String patientSql = "SELECT " +
                " f.sick_village AS labelCode, " +
                " f.sick_village_name AS label, " +
                " COUNT(1) AS number " +
@ -3732,37 +3739,37 @@ public class FamilyContractService extends BaseService {
                " f.`status` >= 0 " +
                " AND f.admin_team_code = ? " +
                " AND f.doctor_health IS NULL " +
                " AND f.sick_village IS NOT NULL "+
                " AND f.sick_village IS NOT NULL " +
                " GROUP BY " +
                " f.sick_village " +
                " ORDER BY " +
                " number DESC ";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql,new Object[]{teamCode});
        if(patientList!=null&&patientList.size()>0){
            for(Map<String,Object> map : patientList){
                String labelCode = (String)map.get("labelCode");
                if(StringUtils.isNotBlank(labelCode)){
                    List<Map<String,String>> codes = new ArrayList<>();
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql, new Object[]{teamCode});
        if (patientList != null && patientList.size() > 0) {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String lbCode = p.get("labelCode") ==null?"":((String)p.get("labelCode"));
                        if(labelCode.equals(lbCode)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
                    map.put("codes", codes);
                }
            }
        }
        rs.put("patients",patientList);
        rs.put("patients", patientList);
        return rs;
    }
    public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode,String level,String oldDoctorCode){
    public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode, String level, String oldDoctorCode) {
        String totalSql = " SELECT " +
                " s.patient,ifnull(s.sick_village,0) as labelCode" +
                " FROM " +
@ -3770,15 +3777,15 @@ public class FamilyContractService extends BaseService {
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = ? ";
        if("2".equals(level)){
            totalSql =  totalSql+" AND s.doctor ='"+oldDoctorCode+"'";
        }else{
            totalSql =  totalSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
        if ("2".equals(level)) {
            totalSql = totalSql + " AND s.doctor ='" + oldDoctorCode + "'";
        } else {
            totalSql = totalSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
        }
        JSONObject rs = new JSONObject();
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql,new Object[]{teamCode});
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        String patientSql ="SELECT " +
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql, new Object[]{teamCode});
        rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
        String patientSql = "SELECT " +
                " f.sick_village AS labelCode, " +
                " f.sick_village_name AS label, " +
                " COUNT(1) AS number " +
@ -3786,54 +3793,54 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_family f " +
                " WHERE " +
                " f.`status` >= 0 " +
                " AND f.sick_village IS NOT NULL "+
                " AND f.admin_team_code = ? " ;
        if("2".equals(level)){
            patientSql =  patientSql+" AND f.doctor ='"+oldDoctorCode+"'";
        }else{
            patientSql =  patientSql+" AND f.doctor_health ='"+oldDoctorCode+"'";
        }
        patientSql = patientSql+" GROUP BY " +
                " AND f.sick_village IS NOT NULL " +
                " AND f.admin_team_code = ? ";
        if ("2".equals(level)) {
            patientSql = patientSql + " AND f.doctor ='" + oldDoctorCode + "'";
        } else {
            patientSql = patientSql + " AND f.doctor_health ='" + oldDoctorCode + "'";
        }
        patientSql = patientSql + " GROUP BY " +
                " f.sick_village " +
                " ORDER BY " +
                " number DESC ";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql,new Object[]{teamCode});
        if(patientList!=null&&patientList.size()>0){
            for(Map<String,Object> map : patientList){
                String labelCode = (String)map.get("labelCode");
                if(StringUtils.isNotBlank(labelCode)){
                    List<Map<String,String>> codes = new ArrayList<>();
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql, new Object[]{teamCode});
        if (patientList != null && patientList.size() > 0) {
            for (Map<String, Object> map : patientList) {
                String labelCode = (String) map.get("labelCode");
                if (StringUtils.isNotBlank(labelCode)) {
                    List<Map<String, String>> codes = new ArrayList<>();
                    Iterator iterator = totalList.iterator();
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String lbCode = p.get("labelCode") ==null?"":((String)p.get("labelCode"));
                        if(labelCode.equals(lbCode)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
                        if (labelCode.equals(lbCode)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
                    map.put("codes", codes);
                }
            }
        }
        rs.put("patients",patientList);
        rs.put("patients", patientList);
        return rs;
    }
    public JSONObject getServerPatientListNum(Long teamCode,String level, String oldDoctorCode){
        String serverSql="SELECT " +
    public JSONObject getServerPatientListNum(Long teamCode, String level, String oldDoctorCode) {
        String serverSql = "SELECT " +
                " d.`code` As labelCode, " +
                " d.`name` AS label " +
                " FROM " +
                " wlyy_sign_dict d " +
                " WHERE " +
                " d.type IN ('1', '2') " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' ";
                " AND d. YEAR = '" + DateUtil.getSignYear() + "' ";
        String patientSql ="SELECT  " +
        String patientSql = "SELECT  " +
                " f.patient, " +
                " s.server_type AS serverType, " +
                " s.server_type_name AS serverTypeName " +
@ -3847,68 +3854,67 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code = " +teamCode ;
                " AND s.admin_team_code = " + teamCode;
        //1查询全科,其他查询健管师
        if("2".equals(level)){
            patientSql =  patientSql+" AND s.doctor ='"+oldDoctorCode+"'";
        }else{
            patientSql =  patientSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
        if ("2".equals(level)) {
            patientSql = patientSql + " AND s.doctor ='" + oldDoctorCode + "'";
        } else {
            patientSql = patientSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
        }
        patientSql =patientSql+" ) f WHERE f.`code` =s.sign_code";
        patientSql = patientSql + " ) f WHERE f.`code` =s.sign_code";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql =" SELECT " +
        List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
                " s.patient " +
                " FROM " +
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.admin_team_code =" +teamCode;
                " AND s.admin_team_code =" + teamCode;
        //1查询全科,其他查询健管师
        if("2".equals(level)){
            totalSql =  totalSql+" AND s.doctor ='"+oldDoctorCode+"'";
        }else{
            totalSql =  totalSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
        if ("2".equals(level)) {
            totalSql = totalSql + " AND s.doctor ='" + oldDoctorCode + "'";
        } else {
            totalSql = totalSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
        }
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        JSONObject rs = new JSONObject();
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if(serlist!=null&&serlist.size()>0){
            if(patientList!=null){
                for(Map<String,Object> map :serlist){
                    String labelCode = (String)map.get("labelCode");
                    List<Map<String,String>> codes = new ArrayList<>();
        rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
        List<Map<String, Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if (serlist != null && serlist.size() > 0) {
            if (patientList != null) {
                for (Map<String, Object> map : serlist) {
                    String labelCode = (String) map.get("labelCode");
                    List<Map<String, String>> codes = new ArrayList<>();
                    Iterator iterator = patientList.iterator();
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
                        if(labelCode.equals(serverType)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                    while (iterator.hasNext()) {
                        Map<String, Object> p = (Map<String, Object>) iterator.next();
                        String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
                        if (labelCode.equals(serverType)) {
                            Map<String, String> code = new HashMap<>();
                            code.put("code", (String) p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
                    map.put("number",(codes!=null&&codes.size()>0)?codes.size():0);
                    map.put("codes", codes);
                    map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
                }
            }
        }
        rs.put("patients",serlist);
        rs.put("patients", serlist);
        return rs;
    }
    public List<Map<String,Object>> patientGroupByServerType(String doctor) {
    public List<Map<String, Object>> patientGroupByServerType(String doctor) {
        // 先根据server_type分组查找wlyy_sign_family表中该医生的签约的患者,然后wlyy_sign_dict left join 得到全部的类型
        String sql="SELECT " +
        String sql = "SELECT " +
                " sd.CODE labelCode, " +
                " sd.NAME labelName, " +
                "  IFNULL(t.count,0) amount " +
@ -3939,9 +3945,9 @@ public class FamilyContractService extends BaseService {
                "  s.server_type " +
                ") t ON sd.CODE = t.server_type " +
                "WHERE " +
                " sd.`year` = '"+DateUtil.getSignYear()+"'";
                " sd.`year` = '" + DateUtil.getSignYear() + "'";
        List<Map<String,Object>> queryData=jdbcTemplate.queryForList(sql,doctor,doctor);
        List<Map<String, Object>> queryData = jdbcTemplate.queryForList(sql, doctor, doctor);
        return queryData;
@ -3949,16 +3955,17 @@ public class FamilyContractService extends BaseService {
    /**
     * 判断患者和医生是否有去年的签约记录
     *
     * @param patient
     * @param doctor
     * @return
     */
    public Map<String,Object> checkLastYearIsSign(String patient,String doctor){
        String sql = "SELECT f.id,f.admin_team_code FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.patient='"+patient+"' AND f.sign_year='"+(DateUtil.getSignYear()-1)+"' AND f.`status`=-4 AND f.expenses_status ='1'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null&&list.size()>0){
    public Map<String, Object> checkLastYearIsSign(String patient, String doctor) {
        String sql = "SELECT f.id,f.admin_team_code FROM wlyy_sign_family f WHERE f.doctor ='" + doctor + "' AND f.patient='" + patient + "' AND f.sign_year='" + (DateUtil.getSignYear() - 1) + "' AND f.`status`=-4 AND f.expenses_status ='1'";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }else{
        } else {
            return null;
        }
    }

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/PatientRemindService.java

@ -56,6 +56,8 @@ public class PatientRemindService extends BaseService {
    ConsultService consultService;
    @Autowired
    WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    SMSService sMSService;
    /**
     * 缴费提醒
@ -134,7 +136,7 @@ public class PatientRemindService extends BaseService {
        }
        if (patients.size() > 0) {
            RemindExpensesTask task = new RemindExpensesTask(patients, doc, hos);
            RemindExpensesTask task = new RemindExpensesTask(patients, doc, hos,smsService);
            new Thread(task).start();
            redisTemplate.opsForSet().add("expenses:remind:set", redisPatients.toArray(new String[]{}));
            redisTemplate.expire("expenses:remind:set", today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), TimeUnit.MILLISECONDS);
@ -385,7 +387,7 @@ public class PatientRemindService extends BaseService {
            }
            if (patients.size() > 0) {
                RemindFocusWechatTask task = new RemindFocusWechatTask(patients, doc);
                RemindFocusWechatTask task = new RemindFocusWechatTask(patients, doc,sMSService);
                new Thread(task).start();
                redisTemplate.opsForSet().add("wechat:focus:remind:set", redisPatients.toArray(new String[]{}));
                redisTemplate.expire("wechat:focus:remind:set", today.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), TimeUnit.MILLISECONDS);

+ 6 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -33,6 +33,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -108,6 +109,8 @@ public class SignWebService extends BaseService {
    private StreetDao streetDao;
    @Autowired
    private CountryDao countryDao;
    @Autowired
    private SMSService smsService;
    /**
     * 厦门市
     */
@ -1296,7 +1299,7 @@ public class SignWebService extends BaseService {
                    //发送短信
                    String mobile = (String) signFamily.get("mobile");
                    if (StringUtils.isNotBlank(mobile)) {
                        SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                    }
                }
@ -1404,7 +1407,7 @@ public class SignWebService extends BaseService {
                    //发送短信
                    String mobile = (String) signFamily.get("mobile");
                    if (StringUtils.isNotBlank(mobile)) {
                        SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                        smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                    }
                }
@ -1962,7 +1965,7 @@ public class SignWebService extends BaseService {
            //发送短信
            String mobile = p.getMobile();
            if (StringUtils.isNotBlank(mobile)) {
                SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                smsService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                patientSetReminFlag(patientCode);
                return 2;
            }

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/QrcodeService.java

@ -35,6 +35,8 @@ public class QrcodeService extends BaseService {
    private HospitalDao hospitalDao;
    @Autowired
    private TownDao townDao;
    @Autowired
    private HttpUtil HttpUtil;
    /**
     * 所有医生二维码生成

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java

@ -43,6 +43,8 @@ public class SMSService extends BaseService {
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorDao doctorDao;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    /**
     * 发送短信验证码接口
@ -183,7 +185,7 @@ public class SMSService extends BaseService {
     * @param content
     * @return
     */
    public static JSONObject sendMsg(String mobile, String content) {
    public  JSONObject sendMsg(String mobile, String content) {
        // 调用总部发送信息的接口
        String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(content, mobile), "GBK");
        JSONObject json = toJson(result);

+ 0 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -19,7 +19,6 @@ import com.yihu.wlyy.repository.doctor.DoctorPatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.security.TokenDao;
import com.yihu.wlyy.task.SignSsGetTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.EncodesUtil;
import com.yihu.wlyy.util.IdcardInfoExtractor;

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java

@ -29,6 +29,8 @@ public class DoctorGuidanceTempService extends BaseService {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 记录医生健康指导模板使用次数
     *

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

@ -55,6 +55,8 @@ public class DoctorTeamGuidanceService extends BaseService {
    private ConsultService consultService;
    @Autowired
    DoctorGuidanceTempDao guidanceTempDao;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 新增团队指导模板
@ -397,7 +399,7 @@ public class DoctorTeamGuidanceService extends BaseService {
     * @param images
     * @throws Exception
     */
    public static String validateImages(String images) throws Exception {
    public  String validateImages(String images) throws Exception {
        String imagePath = "";
        String imageUrls = "";
        String imageRow = "";

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ehr/EhrService.java

@ -29,6 +29,8 @@ public class EhrService extends BaseService {
    @Autowired
    ObjectMapper  objectMapper;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    private String ehrUrl = SystemConf.getInstance().getEhrServices();   //EHR档案服务地址
    private String ehrBaseUrl = SystemConf.getInstance().getEhrServicesBase(); //EHR底层服务地址

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java

@ -28,6 +28,8 @@ public class JwArchivesService {
    @Autowired
    private SystemDictService systemDictService;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    /**

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSignService.java

@ -29,6 +29,8 @@ public class JwSignService {
    //基卫服务地址
    private String jwUrl = SystemConf.getInstance().getJwUrl();
    @Autowired
    private HttpClientUtil HttpClientUtil;

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -39,6 +39,8 @@ public class JwSmjkService {
    @Autowired
    SystemDictService systemDictService;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    /****************************************************************************************************************************/

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/verified/VerifiedService.java

@ -44,6 +44,8 @@ public class VerifiedService {
    @Autowired
    private ObjectMapper objectMapper = new ObjectMapper();
    @Autowired
    private HttpClientUtil HttpClientUtil;
    /**
     * 获取随机数

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java

@ -25,7 +25,7 @@ import java.util.Map;
@Service
public class WeiXinCoreService extends BaseService {
    @Autowired
    private SignFamilyDao signFamilyDao;
    private WeiXinEventProcess weiXinEventProcess;
    /**
     * 微信推送消息处理
@ -81,14 +81,14 @@ public class WeiXinCoreService extends BaseService {
        switch (msgType) {
            case WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT:  // 事件消息
                result = WeiXinEventProcess.eventProcess(message);
                result = weiXinEventProcess.eventProcess(message);
                break;
            case WeiXinMessageUtils.RESP_MESSAGE_TYPE_TEXT:  // 回复文本消息
                String content = message.get("Content");
                if ("续签".equals(content)){
//                      发送续签和签约图文消息
                    System.out.print("content======? "+content);
                    result = WeiXinEventProcess.replyKeyword(message);
                    result = weiXinEventProcess.replyKeyword(message);
                    System.out.print("图文结束======? ");
                }
                break;

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -25,6 +25,7 @@ import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -65,7 +66,8 @@ public class OnePayService {
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorDao doctorDao;
    @Value("${server.server_url}")
    private String serverUrl;
    /**
     * 查询绑卡信息(本人)
     */
@ -260,7 +262,7 @@ public class OnePayService {
            params.put("totalAmount", totalAmount);   //交易总金额
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            String returnUrl = systemConf.getProperty("return_url");
            returnUrl = returnUrl.replace("{server}", systemConf.getProperty("server_url"));
            returnUrl = returnUrl.replace("{server}", serverUrl);
            params.put("returnUrl",returnUrl);   //页面跳转地址
            params.put("channel", channel);  //微信医保支付
            params.put("merchName", orgName);  //收款单位名称

+ 79 - 47
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -4,13 +4,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.wechat.WechatTemplate;
import com.yihu.wlyy.entity.wechat.WechatTemplateData;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
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.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -49,6 +50,33 @@ public class PushMsgTask {
        return "1111";
    }
    @Autowired
    private HttpUtil httpUtil;
    @Value("${server.server_url}")
    private String server_url;
    @Value("${wechat.message.template_consult_notice}")
    private String template_consult_notice;
    @Value("${wechat.message.template_sign_success}")
    private String template_sign_success;
    @Value("${wechat.message.template_sign_failed}")
    private String template_sign_failed;
    @Value("${wechat.message.template_health_notice}")
    private String template_health_notice;
    @Value("${wechat.message.template_termination}")
    private String template_termination;
    @Value("${wechat.message.template_appoint_success}")
    private String template_appoint_success;
    @Value("${wechat.message.template_appoint_failed}")
    private String template_appoint_failed;
    @Value("${wechat.message.template_expenses_remind}")
    private String template_expenses_remind;
    @Value("${wechat.message.template_healthy_article}")
    private String template_healthy_article;
    @Value("${wechat.message.template_doctor_change}")
    private String template_doctor_change;
    @Value("${wechat.message.template_doctor_survey}")
    private String template_doctor_survey;
    /**
     * 添加一条推送消息
     *
@ -114,11 +142,17 @@ public class PushMsgTask {
    }
    private void run() {
        new Thread(new ConsumerTask()).start();
        new Thread(new ConsumerTask(httpUtil)).start();
    }
    // 消费者
    class ConsumerTask implements Runnable {
        private HttpUtil httpUtil;
        public ConsumerTask(HttpUtil httpUtil) {
            this.httpUtil = httpUtil;
        }
        @Override
        public void run() {
@ -151,7 +185,7 @@ public class PushMsgTask {
                        String title = json.has("title") ? json.getString("title") : "";
                        String msg = json.has("msg") ? json.getString("msg") : "";
                        String data = json.has("data") ? json.getString("data") : "";
                        boolean res = HttpUtil.pushMessage(receiver, type, title, msg, data);
                        boolean res = httpUtil.pushMessage(receiver, type, title, msg, data);
                        if (res) {
                            logger.info("消息推送成功!");
                        } else {
@ -206,7 +240,7 @@ public class PushMsgTask {
                    logger.error("参数错误!error");
                    return false;
                }
                String result = HttpUtil.sendPost(token_url, params);
                String result = httpUtil.sendPost(token_url, params);
                JSONObject jsonResult = new JSONObject(result);
                if (Integer.parseInt(jsonResult.get("errcode").toString()) == 0) {
                    logger.info("微信信息推送成功!success");
@ -234,7 +268,7 @@ public class PushMsgTask {
     */
    public String typeMsg(int type, String openid, String name, JSONObject json) {
        try {
            String url = SystemConf.getInstance().getSystemProperties().getProperty("server_url") + "wx/html/";
            String url = server_url + "wx/html/";
            WechatTemplate temp = new WechatTemplate();
            temp.setTouser(openid);
            temp.setTopcolor("#000000");
@ -250,11 +284,11 @@ public class PushMsgTask {
            String temp_id = "";
            if (type == 3) {
                if (json.has("isPublic") && json.getInt("isPublic") == 1) {
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                } else {
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                }
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_consult_notice");
                temp_id = template_consult_notice;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -270,27 +304,27 @@ public class PushMsgTask {
                m.put("keyword3", keyword3);
            } else if (type == 1 || type == 2) {
                if (type == 1) {
                    temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_sign_success");
                    temp_id =template_sign_success;
                } else {
                    temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_sign_failed");
                    temp_id =template_sign_failed;
                }
                String isRenew = "0";
                if(json.has("isRenew")){
                if (json.has("isRenew")) {
                    isRenew = "1";
                }
                String signState ="0";
                if(json.has("signState")){
                    signState = (String)json.get("signState");
                String signState = "0";
                if (json.has("signState")) {
                    signState = (String) json.get("signState");
                }
                if(json.has("isRenew")&&type==2){
                if (json.has("isRenew") && type == 2) {
                    //如果续签失败,不发送详情
                }else{
                    if (json.has("agent")&&("1".equals(json.getString("agent")))){
                } else {
                    if (json.has("agent") && ("1".equals(json.getString("agent")))) {
//                        发送给授权代理人
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&isRenew="+isRenew+"&signState="+signState+"&represented="+json.getString("represented")+"&signCode"+json.getString("signCode"));
                    }else if(json.has("agent")&&("0".equals(json.getString("agent")))){
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode" + json.getString("signCode"));
                    } else if (json.has("agent") && ("0".equals(json.getString("agent")))) {
//                        发送给自己
                        temp.setUrl(url + "html/qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&isRenew="+isRenew+"&signState="+signState+"&represented="+json.getString("represented")+"&signCode"+json.getString("signCode"));
                        temp.setUrl(url + "html/qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode" + json.getString("signCode"));
                    }
                }
                temp.setTouser(openid);
@ -313,8 +347,8 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("keyword4", keyword4);
            } else if (type == 4) {
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name+"&represented="+json.getString("represented"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_health_notice");
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id = template_health_notice;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -337,8 +371,8 @@ public class PushMsgTask {
                keyword5.setValue(json.getString("content"));
                m.put("keyword5", keyword5);
            } else if (type == 5) {
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_termination");
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id = template_termination;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -357,8 +391,8 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("keyword4", keyword4);
            } else if (type == 6) {
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_appoint_success");
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id =template_appoint_success;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -377,8 +411,8 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("planstarttime", keyword4);
            } else if (type == 7) {
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_appoint_failed");
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id =template_appoint_failed;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -398,7 +432,7 @@ public class PushMsgTask {
                m.put("keynote4", keyword4);
            } else if (type == 8) {
                //temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_expenses_remind");
                temp_id = template_expenses_remind;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -417,8 +451,8 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("remark", keyword4);
            } else if (type == 9) {
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp_id = SystemConf.getInstance().getSystemProperties().getProperty("template_healthy_article");
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id = template_healthy_article;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -441,9 +475,8 @@ public class PushMsgTask {
                keyword5.setValue(json.getString("remark"));
                m.put("remark", keyword5);
            } else if (type == 10) {
                temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties()
                        .getProperty("template_doctor_change"));
                temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setTemplate_id(template_doctor_change);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
@ -459,12 +492,11 @@ public class PushMsgTask {
                keyword3.setValue(json.getString("keyword3"));
                m.put("keyword3", keyword3);
            } else if (type == 11) {
                String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented");
                String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented");
//                temp.setUrl(url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                temp.setUrl(xinurl);
//                temp.setTemplate_id("fgYiMntj1amEkE8_GLUPmAIyssUAroJrNSHqvydt-PQ");
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties()
                        .getProperty("template_doctor_survey"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
@ -479,8 +511,8 @@ public class PushMsgTask {
                logger.error("url=======type =11 =====================>" + xinurl);
            } else if (type == 12) {
                temp.setUrl(url + "jtgx/html/application-msg-list.html?openid=" + openid + "&member=" + json.getString("member")+"&toUser="+json.getString("member")+"&toName="+name);
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setUrl(url + "jtgx/html/application-msg-list.html?openid=" + openid + "&member=" + json.getString("member") + "&toUser=" + json.getString("member") + "&toName=" + name);
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -505,7 +537,7 @@ public class PushMsgTask {
            } else if (type == 13) {
                temp.setUrl(url + "jtgx/html/family.html?openid=" + openid);
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -527,7 +559,7 @@ public class PushMsgTask {
//                keyword4.setValue(json.getString("keyword4"));
//                m.put("keyword4", keyword4);
            } else if (type == 14) {
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -539,14 +571,14 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            } else if (type == 15) {
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
            } else if (type == 16) {
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid+"&changeDoctor="+1 + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid + "&changeDoctor=" + 1 + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
@ -556,8 +588,8 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            } else if (type == 17) {
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&represented="+json.getString("represented"));
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
@ -568,7 +600,7 @@ public class PushMsgTask {
                m.put("keyword2", keyword2);
            } else if (type == 18) {
                temp.setUrl(url + json.getString("url"));
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));

+ 5 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/RemindExpensesTask.java

@ -35,11 +35,14 @@ public class RemindExpensesTask implements Runnable {
    @Autowired
    ConsultService consultService;
    public RemindExpensesTask(List<Patient> patients, Doctor doctor, Hospital hospital) {
    private SMSService smsService;
    public RemindExpensesTask(List<Patient> patients, Doctor doctor, Hospital hospital,SMSService smsService) {
        this.patients = patients;
        this.doctor = doctor;
        this.hospital = hospital;
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
        this.smsService=smsService;
    }
    @Override
@ -93,7 +96,7 @@ public class RemindExpensesTask implements Runnable {
            }
        }
        JSONObject result = SMSService.sendMsg(sb.toString(), doctor.getName() + "医生提醒您:为完成家庭医生签约," +
        JSONObject result = smsService.sendMsg(sb.toString(), doctor.getName() + "医生提醒您:为完成家庭医生签约," +
                "尽早为您提供家庭医生服务,请尽快到" + hospital.getName() + "(地址:" + hospital.getAddress() + ")缴费");
    }
}

+ 4 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/RemindFocusWechatTask.java

@ -22,14 +22,17 @@ public class RemindFocusWechatTask implements Runnable {
    Doctor doctor;
    SMSService SMSService;
    /**
     * 构造函数
     *
     * @param patients 居民列表
     */
    public RemindFocusWechatTask(List<Map<String, Object>> patients, Doctor doctor) {
    public RemindFocusWechatTask(List<Map<String, Object>> patients, Doctor doctor,SMSService SMSService) {
        this.patients = patients;
        this.doctor = doctor;
        this.SMSService=SMSService;
    }
    @Override

+ 38 - 38
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignSsGetTask.java

@ -1,38 +1,38 @@
package com.yihu.wlyy.task;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * Created by lyr-pc on 2016/10/20.
 */
public class SignSsGetTask implements Runnable {
    private static Logger logger = LoggerFactory.getLogger(SignUploadTask.class);
    String idcard = "";
    public SignSsGetTask(String idcard) {
        this.idcard = idcard;
    }
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
            String url = SystemConf.getInstance().getJwUrl();
            String resultStr = HttpUtil.sendPost(url + "/third/sign/LoadSanshiSignFamily?idcard=" + idcard, "");
            JSONObject json = new JSONObject(resultStr);
            if (json.getInt("status") == 200) {
                logger.info("sign_ss_get_success:" + idcard);
            } else {
                logger.error("sign_ss_get_failed:" + idcard);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
//package com.yihu.wlyy.task;
//
//import com.yihu.wlyy.util.HttpUtil;
//import com.yihu.wlyy.util.SystemConf;
//import org.json.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * Created by lyr-pc on 2016/10/20.
// */
//public class SignSsGetTask implements Runnable {
//    private static Logger logger = LoggerFactory.getLogger(SignUploadTask.class);
//
//    String idcard = "";
//
//    public SignSsGetTask(String idcard) {
//        this.idcard = idcard;
//    }
//
//    @Override
//    public void run() {
//        try {
//            Thread.sleep(3000);
//            String url = SystemConf.getInstance().getJwUrl();
//            String resultStr = HttpUtil.sendPost(url + "/third/sign/LoadSanshiSignFamily?idcard=" + idcard, "");
//            JSONObject json = new JSONObject(resultStr);
//
//            if (json.getInt("status") == 200) {
//                logger.info("sign_ss_get_success:" + idcard);
//            } else {
//                logger.error("sign_ss_get_failed:" + idcard);
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//}

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignUploadTask.java

@ -21,8 +21,10 @@ public class SignUploadTask implements Runnable {
    String code = "";
    public SignUploadTask(String code) {
    private HttpUtil httpUtil;
    public SignUploadTask(String code,HttpUtil httpUtil) {
        this.code = code;
        this.httpUtil=httpUtil;
    }
    @Override
@ -30,7 +32,7 @@ public class SignUploadTask implements Runnable {
        try {
            Thread.sleep(3000);
            String url = SystemConf.getInstance().getJwUrl();
            String resultStr = HttpUtil.sendPost(url + "/third/sign/UploadSignFamily?code=" + code, "");
            String resultStr = httpUtil.sendPost(url + "/third/sign/UploadSignFamily?code=" + code, "");
            JSONObject json = new JSONObject(resultStr);
            if (json.getInt("status") == 200) {

+ 21 - 95
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -4,17 +4,21 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import it.sauronsoftware.jave.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.*;
@Component
public class CommonUtil {
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    /**
     * 获取图片全路径
     *
     * @return
     */
    public static String getPhoneUrl(String url) {
    public  String getPhoneUrl(String url) {
        if (StringUtils.isEmpty(url)) {
            return "";
        } else {
@ -26,14 +30,8 @@ public class CommonUtil {
        }
    }
    public static String getMobileEncode(String mobile) {
        if (StringUtils.isNotEmpty(mobile) && mobile.length() == 11) {
            return mobile.substring(0, 4) + "****" + mobile.substring(8, 11);
        }
        return mobile;
    }
    public static String getIdcardEncode(String idcard) {
    public  String getIdcardEncode(String idcard) {
        if (idcard != null) {
            if (idcard.length() == 18) {
                return idcard.substring(0, 9) + "*******" + idcard.substring(16, 18);
@ -50,7 +48,7 @@ public class CommonUtil {
     * @param obj
     * @return
     */
    public static byte[] toByteArray(Object obj) {
    public  byte[] toByteArray(Object obj) {
        byte[] bytes = null;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
@ -72,7 +70,7 @@ public class CommonUtil {
     * @param bytes
     * @return
     */
    public static Object toObject(byte[] bytes) {
    public  Object toObject(byte[] bytes) {
        Object obj = null;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
@ -88,80 +86,6 @@ public class CommonUtil {
        return obj;
    }
    public static final InputStream byte2Input(byte[] buf) {
        return new ByteArrayInputStream(buf);
    }
    public static final byte[] input2byte(InputStream inStream) throws IOException {
        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
        byte[] buff = new byte[100];
        int rc = 0;
        while ((rc = inStream.read(buff, 0, 100)) > 0) {
            swapStream.write(buff, 0, rc);
        }
        byte[] in2b = swapStream.toByteArray();
        return in2b;
    }
    /**
     * 返回:张三为张*
     *
     * @param name 姓名
     * @return
     */
    public static String getEncryptName(String name) {
        if (StringUtils.isEmpty(name)) {
            return null;
        }
        if (name.length() == 1) {
            return name;
        }
        // 获取姓
        String temp = name.substring(0, 1);
        for (int i = 1; i < name.length(); i++) {
            temp += "*";
        }
        return temp;
    }
    /**
     * 拷贝临时图片到存储目录
     *
     * @param images
     * @return
     * @throws IOException
     */
//    public static String copyTempImage(String images) throws IOException {
//        // 文件保存的临时路径
//        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
//        // 图片保存路径
//        String imagePath = SystemConf.getInstance().getImagePath() + File.separator;
//        String[] tempImages = images.split(",");
//        String temp = "";
//        for (String image : tempImages) {
//            File file = new File(tempPath + image);
//            File smallFile = new File(tempPath + image + "_small");
//            if (file.exists() && smallFile.exists()) {
//                // 原图拷贝路径
//                File targetFile = new File(imagePath + image);
//                // 缩略图拷贝路径
//                File targetSmallFile = new File(imagePath + image + "_small");
//                // 拷贝原图
//                FileUtils.copyFile(file, targetFile);
//                // 拷贝缩略图
//                FileUtils.copyFile(smallFile, targetSmallFile);
//                // 删除临时文件
//                FileUtils.forceDelete(file);
//                FileUtils.forceDelete(smallFile);
//                if (temp.length() == 0) {
//                    temp = SystemConf.getInstance().getImageServer() + image;
//                } else {
//                    temp += "," + SystemConf.getInstance().getImageServer() + image;
//                }
//            }
//        }
//        return temp;
//    }
    /**
     * 拷贝临时语音文件到存储目录
@ -170,9 +94,11 @@ public class CommonUtil {
     * @return
     * @throws IOException
     */
    public static String copyTempVoice(String voices) throws  Exception {
    public String copyTempVoice(String voices) throws  Exception {
        // 文件保存的临时路径
        String serverUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
        String serverUrl = fastdfs_file_url;
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
        File f = new File(voices);
@ -199,7 +125,7 @@ public class CommonUtil {
     * @param standardMin 最小标准值
     * @return 0正常,1高,-1低
     */
    public static double checkHealthIndex(double curValue, double standardMax, double standardMin) {
    public  double checkHealthIndex(double curValue, double standardMax, double standardMin) {
        if (curValue <= 0) {
            return 0;
        }
@ -221,10 +147,10 @@ public class CommonUtil {
     * @return
     * @throws Exception
     */
    public static String copyTempImage(String files) throws Exception {
    public  String copyTempImage(String files) throws Exception {
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        String serverUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
        String serverUrl = fastdfs_file_url;
        String[] fileArray = files.split(",");
        FastDFSUtil fastDFSUtil = new FastDFSUtil();
        String fileUrls = "";
@ -252,7 +178,7 @@ public class CommonUtil {
        return fileUrls;
    }
    public static void changeToMp3(String sourcePath, String targetPath) {
    public  void changeToMp3(String sourcePath, String targetPath) {
        File source = new File(sourcePath);
        File target = new File(targetPath);
        AudioAttributes audio = new AudioAttributes();
@ -272,7 +198,7 @@ public class CommonUtil {
        }
    }
    public static long getVideoTimeAndImg(String sourcePath,String targetPath) throws  Exception{
    public  long getVideoTimeAndImg(String sourcePath,String targetPath) throws  Exception{
        File source = new File(sourcePath);
        Encoder encoder = new Encoder();
        MultimediaInfo m = encoder.getInfo(source);
@ -293,7 +219,7 @@ public class CommonUtil {
    public static void changeToMp4(String sourcePath, String targetPath) {
    public  void changeToMp4(String sourcePath, String targetPath) {
        File source = new File(sourcePath);
        File target = new File(targetPath);
        AudioAttributes audio = new AudioAttributes();
@ -337,7 +263,7 @@ public class CommonUtil {
    }
    public static String getSubString(String content,int min,int max){
    public  String getSubString(String content,int min,int max){
        if(StringUtils.isBlank(content)){
            return "";
        }else if(content.length()<=max){
@ -347,7 +273,7 @@ public class CommonUtil {
        }
    }
    public static String  saveVoiceToDisk(InputStream inputStream,String newFileName) throws Exception {
    public  String  saveVoiceToDisk(InputStream inputStream,String newFileName) throws Exception {
        // 文件保存的临时路径
        String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
        // 拼接年月日路径

+ 164 - 201
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java

@ -15,8 +15,10 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@ -26,216 +28,177 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Component
public class HttpClientUtil {
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @return
     */
    public  String post(String url, List<NameValuePair> params, String chatSet) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
	/**
	 * 发送post请求
	 * @param url 请求地址
	 * @param params 请求参数
	 * @param chatSet 编码格式
	 * @return
	 */
	public static String post(String url, List<NameValuePair> params, String chatSet) {
		// 创建默认的httpClient实例.
		CloseableHttpClient httpclient = HttpClients.createDefault();
		// 创建httppost
		HttpPost httppost = new HttpPost(url);
		UrlEncodedFormEntity uefEntity;
		try {
			uefEntity = new UrlEncodedFormEntity(params, chatSet);
			httppost.setEntity(uefEntity);
			CloseableHttpResponse response = httpclient.execute(httppost);
			try {
				HttpEntity entity = response.getEntity();
				if (entity != null) {
					return EntityUtils.toString(entity, chatSet);
				}
			} finally {
				response.close();
			}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			// 关闭连接,释放资源
			try {
				httpclient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return null;
	}
	/**
	 * http post调用方法
	 * @param url
	 * @param xmlData 格式字符串
	 * @return
	 * @throws Exception
	 */
    /**
     * 发送get请求
     *
     * @param url     请求地址
     * @param chatSet 编码格式
     * @return
     */
    public  String get(String url, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            HttpGet httpget = new HttpGet(url);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
	public String httpPost(String url, String xmlData)throws Exception {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		String strResult="";
    /**
     * http调用方法,(健康之路开放平台)
     *
     * @param url
     * @param params
     * @return
     * @throws Exception
     */
    public  String httpPost(String url, Map<String, String> params) throws Exception {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            HttpPost httpPost = new HttpPost(url);
            if (params != null && params.size() > 0) {
                List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
                    valuePairs.add(nameValuePair);
                }
                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
                httpPost.setEntity(formEntity);
            }
            CloseableHttpResponse resp = httpclient.execute(httpPost);
            try {
                HttpEntity entity = resp.getEntity();
                String respContent = EntityUtils.toString(entity, "UTF-8").trim();
                return respContent;
            } finally {
                resp.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            httpclient.close();
        }
    }
		try {
		HttpPost post = new HttpPost(url);
		StringEntity entity = new StringEntity(xmlData);
		post.setEntity(entity);
		post.setHeader("Content-Type", "text/xml;charset=UTF-8");
		HttpResponse response = httpclient.execute(post);
		if(response.getStatusLine().getStatusCode()==200){
			try {
//				读取服务器返回过来的json字符串数据
				strResult = EntityUtils.toString(response.getEntity(),"UTF-8");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			// 关闭连接,释放资源
			try {
				httpclient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return strResult;
	}
	/**
	 * 发送get请求
	 * @param url 请求地址
	 * @param chatSet 编码格式
	 * @return
	 */
	public static String get(String url, String chatSet) {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		try {
			// 创建httpget.
			HttpGet httpget = new HttpGet(url);
			// 执行get请求.
			CloseableHttpResponse response = httpclient.execute(httpget);
			try {
				// 获取响应实体
				HttpEntity entity = response.getEntity();
				if (entity != null) {
					return EntityUtils.toString(entity, chatSet);
				}
			} finally {
				response.close();
			}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			// 关闭连接,释放资源
			try {
				httpclient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return null;
	}
    /**
     * 获取加密后参数集合(健康之路开放平台)
     *
     * @param params
     * @return
     */
    public  Map<String, String> getSecretParams(Map<String, String> params, String appId, String secret) {
        String timestamp = Long.toString(System.currentTimeMillis());
        params.put("timestamp", timestamp);
        StringBuilder stringBuilder = new StringBuilder();
	/**
	 * http调用方法,(健康之路开放平台)
	 * @param url
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public static String httpPost(String url, Map<String, String> params) throws Exception {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		try {
			HttpPost httpPost = new HttpPost(url);
			if(params!=null&&params.size()>0){
				List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
				for (Map.Entry<String, String> entry : params.entrySet()) {
					NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
					valuePairs.add(nameValuePair);
				}
				UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(	valuePairs, "UTF-8");
				httpPost.setEntity(formEntity);
			}
			CloseableHttpResponse resp = httpclient.execute(httpPost);
			try {
				HttpEntity entity = resp.getEntity();
				String respContent = EntityUtils.toString(entity, "UTF-8").trim();
				return respContent;
			} finally {
				resp.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}finally {
			httpclient.close();
		}
	}
        // 对参数名进行字典排序  
        String[] keyArray = params.keySet().toArray(new String[0]);
        Arrays.sort(keyArray);
        // 拼接有序的参数名-值串  
        stringBuilder.append(appId);
        for (String key : keyArray) {
            stringBuilder.append(key).append(params.get(key));
        }
        String codes = stringBuilder.append(secret).toString();
        String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
        // 添加签名,并发送请求  
        params.put("appId", appId);
        params.put("sign", sign);
	/**
	 * 获取加密后参数集合(健康之路开放平台)
	 * @param params
	 * @return
	 */
	public static Map<String,String> getSecretParams(Map<String, String> params,String appId,String secret)
	{
		String timestamp = Long.toString(System.currentTimeMillis());
		params.put("timestamp", timestamp);
		StringBuilder stringBuilder = new StringBuilder();
        return params;
    }
		// 对参数名进行字典排序  
		String[] keyArray = params.keySet().toArray(new String[0]);
		Arrays.sort(keyArray);
		// 拼接有序的参数名-值串  
		stringBuilder.append(appId);
		for(String key : keyArray)
		{
			stringBuilder.append(key).append(params.get(key));
		}
		String codes = stringBuilder.append(secret).toString();
		String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
		// 添加签名,并发送请求  
		params.put("appId", appId);
		params.put("sign", sign);
		return params;
	}
    public  String postBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
	public static String postBody(String url,JSONObject params){
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
		headers.setContentType(type);
		headers.add("Accept", MediaType.APPLICATION_JSON.toString());
		org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
		String ret = restTemplate.postForObject(url, formEntity, String.class);
		return ret;
	}
	public static void putBody(String url,JSONObject params){
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
		headers.setContentType(type);
		headers.add("Accept", MediaType.APPLICATION_JSON.toString());
		org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
		restTemplate.put(url, formEntity, String.class);
	}
    public  void putBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        restTemplate.put(url, formEntity, String.class);
    }
}

+ 10 - 63
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpUtil.java

@ -3,6 +3,8 @@ package com.yihu.wlyy.util;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
import java.net.HttpURLConnection;
@ -12,10 +14,13 @@ import java.net.URLConnection;
/*
 * MD5 算法
 */
@Component
public class HttpUtil {
	private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
	@Autowired
	private ImUtill ImUtill;
	/**
	 * 向指定URL发送GET方法的请求
	 *
@ -25,7 +30,7 @@ public class HttpUtil {
	 *            请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
	 * @return URL 所代表远程资源的响应结果
	 */
	public static String sendGet(String url, String param) {
	public  String sendGet(String url, String param) {
		String result = "";
		BufferedReader in = null;
		try {
@ -68,7 +73,7 @@ public class HttpUtil {
	 *            POST参数。
	 * @return 所代表远程资源的响应结果
	 */
	public static String sendPost(String url, String param) {
	public  String sendPost(String url, String param) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
@ -123,7 +128,7 @@ public class HttpUtil {
	 * @param msg 消息内容
	 * @param data 消息数据
	 */
	public static boolean pushMessage(String receiver, String businessType, String title, String msg, String data) {
	public  boolean pushMessage(String receiver, String businessType, String title, String msg, String data) {
		try{
			JSONObject participants = new JSONObject();
			participants.put("system",0);
@ -141,61 +146,6 @@ public class HttpUtil {
		return false;
	}
	/**
	 * 发送消息到websocket服务器,然后由websocket服务器中转给微信端
	 * @param userid 接收数据的患者id
	 * @param data 内容
	 * @return 推送成功:{"errno":"0","errmsg":""},推送失败:{"errno":"1","errmsg":"User is not online"}
	 * @author shenzaixin
	 */
	public static String sendWeixinWebsocketMsg(String userid,String data){
		PrintWriter out = null;
		BufferedReader in = null;
		HttpURLConnection conn = null;
		try {
			System.out.println("consult-send:" + userid + ":" + data);
			String url = SystemConf.getInstance().getWeixinWebsocketServer() + "?userid=" + userid + "&data=" + data;
			URL realUrl = new URL(url);
			// 打开和URL之间的连接
			conn = (HttpURLConnection) realUrl.openConnection();
			conn.setRequestMethod("GET");
			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			conn.setRequestProperty("Content-Type", "application/json");
//			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
//			osw.write(param.toString());
//			osw.flush();
			// 读取返回内容
			StringBuffer buffer = new StringBuffer();
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
			String temp;
			while ((temp = br.readLine()) != null) {
				buffer.append(temp);
			}
			System.out.println(buffer.toString());
			JSONObject json = new JSONObject(buffer.toString());
			System.out.println("consult-reply:" + json.toString());
			return json.toString();
		} catch (Exception e) {
			logger.error("push message error:", e);
			return "{\"errno\":\"1\",\"errmsg\":\""+e.getMessage()+"\"}";
		} finally {
			try {
				if (out != null) {
					out.close();
				}
				if (in != null) {
					in.close();
				}
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
	}
	/**
	 * 向指定 URL 发送POST方法的请求
	 *
@ -204,7 +154,7 @@ public class HttpUtil {
	 * @param charset 编码格式
	 * @return 所代表远程资源的响应结果
	 */
	public static String sendPost(String url, String param, String charset) {
	public  String sendPost(String url, String param, String charset) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
@ -249,9 +199,6 @@ public class HttpUtil {
		return buffer.toString();
	}
	public static void main(String[] args) {
		boolean result = HttpUtil.pushMessage("U20160322000001", "1", "您有一条医嘱提醒", "少吃辣,多运动,多吃水果!", null);
		System.out.println(result);
	}
}

+ 28 - 23
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -2,25 +2,30 @@ package com.yihu.wlyy.util;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * Created by 卓 on 2017/1/13.
 */
@Component
public class ImUtill {
    @Autowired
    private HttpClientUtil HttpClientUtil;
    private static final String im_host = SystemConf.getInstance().getImListGet();
    /**
     * 获取医生统计数据
     * status reply 为空值是是该医生总咨询量
     *
     * @param user   团队就把团队的医生合并起来用,隔开(医生编码)
     * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode
     * @param status
     * @param reply
     * @return
     */
    public static String getConsultData(String user,Integer adminTeamCode, Integer status, Integer reply) {
    public String getConsultData(String user, Integer adminTeamCode, Integer status, Integer reply) {
        String imAddr = im_host + "api/v2/sessions/topics/count/reply";
        imAddr = imAddr + "?user=" + user;
        if (status != null) {
@ -36,7 +41,7 @@ public class ImUtill {
        return response;
    }
    public static void updateTopics(String topicId, String jsonValue) {
    public void updateTopics(String topicId, String jsonValue) {
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id", topicId);
@ -49,15 +54,15 @@ public class ImUtill {
     * 获取团队内医生的健康咨询状况
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     *
     * @param user     团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode  行政团队code
     * @param user          团队就把团队的医生合并起来用,隔开(医生编码)
     * @param adminTeamCode 行政团队code
     * @param page
     * @param pagesize
     * @param status
     * @param reply
     * @return
     */
    public static String getTeamConsultByStatus(String user,Integer adminTeamCode, Integer status, Integer reply, int page, int pagesize) {
    public String getTeamConsultByStatus(String user, Integer adminTeamCode, Integer status, Integer reply, int page, int pagesize) {
        String imAddr = im_host + "api/v2/sessions/healthTeamTopics";
        imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
        if (adminTeamCode != null) {
@ -85,7 +90,7 @@ public class ImUtill {
     * @param reply
     * @return
     */
    public static String getConsultByStatus(String user, Integer status, Integer reply, int page, int pagesize) {
    public String getConsultByStatus(String user, Integer status, Integer reply, int page, int pagesize) {
        String imAddr = im_host + "api/v2/sessions/healthTopics";
        imAddr = imAddr + "?user=" + user + "&page=" + page + "&pagesize=" + pagesize;
        if (status != null) {
@ -105,7 +110,7 @@ public class ImUtill {
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public static String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType) {
    public String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
@ -124,7 +129,7 @@ public class ImUtill {
     * @param sessionId 会话ID
     * @param status    状态
     */
    public static String updateSessionStatus(String sessionId, String status) {
    public String updateSessionStatus(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
@ -137,7 +142,7 @@ public class ImUtill {
     * @param sessionId 会话ID
     * @param status    状态
     */
    public static String updateTopicEvaluate(String sessionId, String status) {
    public String updateTopicEvaluate(String sessionId, String status) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
@ -152,7 +157,7 @@ public class ImUtill {
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public static String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent) {
    public String sendTopicIM(String from, String fromName, String topicId, String contentType, String content, String agent) {
        String url = im_host + "api/v2/sessions/topic/" + topicId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
@ -173,7 +178,7 @@ public class ImUtill {
     * @param topicId
     * @return
     */
    public static String sendIntoTopicIM(String from, String sessionId, String topicId, String content, String intoUser, String intoUserName) {
    public String sendIntoTopicIM(String from, String sessionId, String topicId, String content, String intoUser, String intoUserName) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/into";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
@ -193,7 +198,7 @@ public class ImUtill {
     * @param endUserName 结束人名字
     * @param sessionId   会话ID
     */
    public static JSONObject endTopics(String sessionId, String endUser, String endUserName, String topicId) {
    public JSONObject endTopics(String sessionId, String endUser, String endUserName, String topicId) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/topics/" + topicId + "/ended";
        JSONObject params = new JSONObject();
        params.put("session_id", sessionId);
@ -217,7 +222,7 @@ public class ImUtill {
     * @param user      结束人名字
     * @param sessionId 会话ID
     */
    public static void updateTopicUser(String sessionId, String user) {
    public void updateTopicUser(String sessionId, String user) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participants/" + user;
        JSONObject params = new JSONObject();
        params.put("user", user + ":" + 0);
@ -231,7 +236,7 @@ public class ImUtill {
     * @param topicName    议题名称
     * @param participants 成员
     */
    public static JSONObject createTopics(String sessionId, String topicId, String topicName, JSONObject participants, JSONObject messages, String sessionType) {
    public JSONObject createTopics(String sessionId, String topicId, String topicName, JSONObject participants, JSONObject messages, String sessionType) {
        String imAddr = im_host + "api/v2/sessions/" + topicId + "/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id", topicId);
@ -253,7 +258,7 @@ public class ImUtill {
    /**
     * 创建会话(system)
     */
    public static JSONObject createSession(JSONObject participants, String sessionType, String sessionName, String sessionId) {
    public JSONObject createSession(JSONObject participants, String sessionType, String sessionName, String sessionId) {
        String imAddr = im_host + "api/v2/sessions";
        JSONObject params = new JSONObject();
        params.put("participants", participants.toString());
@ -281,7 +286,7 @@ public class ImUtill {
     * @param agent
     * @return
     */
    public static JSONObject getCreateTopicMessage(String senderId, String senderName, String title, String description, String images, String agent) {
    public JSONObject getCreateTopicMessage(String senderId, String senderName, String title, String description, String images, String agent) {
        JSONObject messages = new JSONObject();
        messages.put("description", description);
        messages.put("title", title);
@ -292,7 +297,7 @@ public class ImUtill {
        return messages;
    }
    public static JSONObject getTopicMessage(String topicId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
    public JSONObject getTopicMessage(String topicId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host
                + "api/v2/sessions/topic/" + topicId + "/messages?topic_id=" + topicId + "&end=" + startMsgId
                + "&start=" + (endMsgId == null ? "" : endMsgId) + "&page=" + page + "&pagesize=" + pagesize + "&user=" + uid;
@ -310,7 +315,7 @@ public class ImUtill {
    }
    public static JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
    public JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/messages?session_id=" + sessionId + "&user=" + uid + "&start_message_id=" + startMsgId + "&end_message_id=" + endMsgId + "&page=" + page + "&pagesize=" + pagesize;
        try {
            String ret = HttpClientUtil.get(url, "UTF-8");
@ -330,7 +335,7 @@ public class ImUtill {
     * @param sessionId
     * @return
     */
    public static JSONObject deleteMucUser(String userId, String oldUserId, String sessionId) throws Exception {
    public JSONObject deleteMucUser(String userId, String oldUserId, String sessionId) throws Exception {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participant/update";
        try {
            JSONObject params = new JSONObject();
@ -356,7 +361,7 @@ public class ImUtill {
     * @param topicId
     * @return
     */
    public static JSONObject getTopic(String topicId) throws Exception {
    public JSONObject getTopic(String topicId) throws Exception {
        String url = im_host + "api/v2/sessions/topics/" + topicId + "?topic_id=" + topicId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
@ -378,7 +383,7 @@ public class ImUtill {
     * @return
     * @throws Exception
     */
    public static JSONArray getParticipants(String sessionId) {
    public JSONArray getParticipants(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");
@ -395,7 +400,7 @@ public class ImUtill {
     * @return
     * @throws Exception
     */
    public static JSONArray getSessions(String sessionId) {
    public JSONArray getSessions(String sessionId) {
        String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
        try {
            String ret = HttpClientUtil.get(url, "utf-8");

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/RSAUtils.java

@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory;
import com.yihu.wlyy.entity.security.RSA;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * RSA算法加密/解密工具类。
@ -38,8 +40,12 @@ import com.yihu.wlyy.service.BaseService;
 * @author fuchun
 * @version 1.0.0, 2010-05-05
 */
@Component
public class RSAUtils {
	@Autowired
	private CommonUtil CommonUtil;
	private BaseService baseService;
	private static final Logger LOGGER = LoggerFactory.getLogger(RSAUtils.class);

+ 23 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendNews.java

@ -11,6 +11,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -35,6 +36,15 @@ import static sun.management.Agent.error;
public class SendNews {
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
    @Autowired
    private HttpClientUtil HttpClientUtil;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
    private String appId;
    @Value("${images.sign_path}")
    private String sign_path;
    /**
     * 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
@ -44,7 +54,7 @@ public class SendNews {
     * @return String 上传的图片地址
     * @throws IOException
     */
    public static String uploadImage(String url, String filePath) throws IOException {
    public  String uploadImage(String url, String filePath) throws IOException {
        String result = null;
        File file = new File(filePath);
        System.out.println("file  ====> " + file);
@ -133,7 +143,7 @@ public class SendNews {
     * @param data        图文消息文字素材内容
     * @return
     */
    public static String uploadNesText(String accessToken, String url, JSONObject data) throws Exception {
    public  String uploadNesText(String accessToken, String url, JSONObject data) throws Exception {
        url = url.replaceFirst("ACCESS_TOKEN", accessToken);
        //上传的图文消息数据,其中thumb_media_id是文件上传图片上传的id
        String result = HttpClientUtil.postBody(url, data);
@ -147,27 +157,27 @@ public class SendNews {
     * @param openidData  群发图文消息内容
     * @return
     */
    public static String sendNewspMessage(String accessToken, String url, JSONObject openidData) throws Exception {
    public  String sendNewspMessage(String accessToken, String url, JSONObject openidData) throws Exception {
        url = url.replace("ACCESS_TOKEN", accessToken);
        String json = HttpClientUtil.postBody(url, openidData);
        return json;
    }
    public static void sendNews(String accessToken, List<String> openIds) throws Exception {
    public  void sendNews(String accessToken, List<String> openIds) throws Exception {
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        //本地上传图片的路径及跳转路径
        String renewPath = systemConf.getProperty("renew_path");
        String renewUrl = systemConf.getProperty("patient_sign_again_url");
        renewUrl = renewUrl.replaceAll("\\{server\\}", SystemConf.getInstance().getSystemProperties().getProperty("wechat_base_url"));
        renewUrl = renewUrl.replaceAll("\\{appId\\}", SystemConf.getInstance().getSystemProperties().getProperty("appId"));
        renewUrl = renewUrl.replaceAll("\\{server\\}", wechat_base_url);
        renewUrl = renewUrl.replaceAll("\\{appId\\}", appId);
        renewUrl = renewUrl.replaceAll("amp;","");
        renewUrl = renewUrl.replaceAll(";","&");
        String signPath = systemConf.getProperty("sign_path");
        String signPath = sign_path;
        String signUrl = systemConf.getProperty("doctor_subscribe_url");
        signUrl = signUrl.replaceAll("\\{server\\}", SystemConf.getInstance().getSystemProperties().getProperty("wechat_base_url"));
        signUrl = signUrl.replaceAll("\\{appId\\}", SystemConf.getInstance().getSystemProperties().getProperty("appId"));
        signUrl = signUrl.replaceAll("\\{server\\}", wechat_base_url);
        signUrl = signUrl.replaceAll("\\{appId\\}", appId);
        signUrl = signUrl.replaceAll("amp;","");
        signUrl = signUrl.replaceAll(";","&");
@ -176,8 +186,8 @@ public class SendNews {
        String groupUrl = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN";//根据openid发群发消息地址
        getMediaUrl = getMediaUrl.replace("ACCESS_TOKEN", accessToken);
        String renewImage = SendNews.uploadImage(getMediaUrl, renewPath);
        String signImage = SendNews.uploadImage(getMediaUrl, signPath);
        String renewImage = this.uploadImage(getMediaUrl, renewPath);
        String signImage = this.uploadImage(getMediaUrl, signPath);
        JSONObject newsTextData = new JSONObject();
        JSONArray newsText = new JSONArray();
@ -199,7 +209,7 @@ public class SendNews {
        newsText.put(data1);
        newsText.put(data);
        newsTextData.put("articles", newsText);
        String media = SendNews.uploadNesText(accessToken, mediaurl, newsTextData);
        String media = this.uploadNesText(accessToken, mediaurl, newsTextData);
        JSONObject news = new JSONObject();
        JSONObject mapnews = new JSONObject();
@ -210,7 +220,7 @@ public class SendNews {
        news.put("msgtype", "mpnews");
        news.put("send_ignore_reprint", 1);
        SendNews.sendNewspMessage(accessToken, groupUrl, news);
        this.sendNewspMessage(accessToken, groupUrl, news);
    }

+ 0 - 30
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendP2PUtil.java

@ -1,30 +0,0 @@
package com.yihu.wlyy.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;
public class SendP2PUtil {
	public static String sendP2Pmsg(String from,String to,String contentType,String content){
		String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
				+ "api/v1/chats/pm";
		List<NameValuePair> params = new ArrayList<>();
		if(!"4".equals(contentType)){
			contentType = "0";
		}
		params.add(new BasicNameValuePair("from", from));
		params.add(new BasicNameValuePair("to", to));
		params.add(new BasicNameValuePair("content",  content));
		params.add(new BasicNameValuePair("contentType",contentType));
		String response = HttpClientUtil.post(url, params, "UTF-8");
		if (StringUtils.isEmpty(response)) {
			return "-1";
		}else{
			return "200";
		}
	}
}

+ 6 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendPatientUtil.java

@ -19,8 +19,9 @@ public class SendPatientUtil extends  Thread {
	private String title;
	private String type;
	private String teamCode;
	private ImUtill imUtill;
	public SendPatientUtil(String from,String fromName,String to,String contentType,String content,String title,String type,String teamCode){
	public SendPatientUtil(String from,String fromName,String to,String contentType,String content,String title,String type,String teamCode,ImUtill imUtill){
		this.from = from;
		this.fromName = fromName;
		this.to = to;
@ -29,11 +30,12 @@ public class SendPatientUtil extends  Thread {
		this.title = title;
		this.type = type;
		this.teamCode =teamCode;
		this.imUtill=imUtill;
	}
	public String sendToPatient(String from,String fromName,String to,String contentType,String content,String title,String type,String teamCode){
		JSONArray jsonArray = ImUtill.getParticipants(to+"_"+teamCode+"_"+type);
		JSONArray jsonArray = imUtill.getParticipants(to+"_"+teamCode+"_"+type);
		JSONObject participants = new JSONObject();
		for(Object object:jsonArray){
			JSONObject jsonObject = (JSONObject)object;
@ -49,12 +51,12 @@ public class SendPatientUtil extends  Thread {
		if(!"4".equals(contentType)){
			contentType = "0";
		}
		JSONObject sessionJson  = ImUtill.createSession(participants,ImUtill.SESSION_TYPE_MUC,title,to+"_"+teamCode+"_"+type);
		JSONObject sessionJson  = imUtill.createSession(participants,ImUtill.SESSION_TYPE_MUC,title,to+"_"+teamCode+"_"+type);
		if(sessionJson.getInt("status")==-1){
			throw  new RuntimeException(sessionJson.getString("message"));
		}
		JSONObject session = sessionJson.getJSONObject("data");
		return ImUtill.sendImMsg(from,fromName,session.getString("id"),contentType,content,"1");
		return imUtill.sendImMsg(from,fromName,session.getString("id"),contentType,content,"1");
	}
	public void run(){

+ 296 - 373
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java

@ -1,389 +1,312 @@
package com.yihu.wlyy.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@Component
public class SystemConf {
	// 别处登录
	public static final int LOGIN_OTHER = 999;
	// 登录超时
	public static final int LOGIN_TIMEOUT = 998;
	// 未登录
	public static final int NOT_LOGIN = 997;
	private static final String SERVER_IP = "server_ip";
	private static final String IM_LIST_GET = "im_list_get";
	private static final String SERVER_PORT = "server_port";
	private static final String SERVER_DOMAIN = "server_domain";
	// 消息推送服务器地址
	private static final String MSG_PUSH_SERVER = "msg_push_server";
	//微信端websocket服务地址
	private static final String WEIXIN_WEBSOCKET_SERVER = "weixin_websocket_server";
	// 服务器地址
	private static final String SERVER_URL = "server_url";
	// 图片资源服务器地址
	private static final String IMAGE_SERVER = "image_server";
	// 语音资源服务器地址
	private static final String VOICE_SERVER = "voice_server";
	// 聊天咨询服务器地址
	private static final String CHAT_SERVER = "chat_server";
	// 文件保存临时路径
	private static final String TEMP_PATH = "upload_temp_path";
	// 聊天文件保存路径
	private static final String CHAT_FILE_PATH = "chat_file_path";
	// 图片存放地址
	private static final String IMAGE_PATH = "image_path";
	// 语音存在地址
	private static final String VOICE_PATH = "voice_path";
	private static final String appId = "appId";
	private static final String appSecret = "appSecret";
	// 血糖餐前最小值
	public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
	// 血糖餐前最大值
	public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
	// 血糖餐后最小值
	public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
	// 血糖餐后最大值
	public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
	// 舒张压最小值
	public static final double HEALTH_STANDARD_SZY_MIN = 60;
	// 舒张压最大值
	public static final double HEALTH_STANDARD_SZY_MAX = 90;
	// 收缩压最小值
	public static final double HEALTH_STANDARD_SSY_MIN = 90;
	// 收缩压最大值
	public static final double HEALTH_STANDARD_SSY_MAX = 140;
	// 同一ip最大短信数
	public static final int MAX_SMS_IP = 10;
	// 同一手机号大最短信数
	public static final int MAX_SMS_MOBILE = 5;
	// 发送短信验证码间隔(分钟)
	public static final int SMS_INTERVAL = 2;
	private static Object lock = new Object();
	// 全局系统配置信息
	private static SystemConf systemConf;
	// 系统配置文件
	private Properties systemProperties;
	//im列表
	private String imListGet;
	public static SystemConf getInstance() {
		if (systemConf == null) {
			synchronized (lock) {
				systemConf = new SystemConf();
			}
		}
		return systemConf;
	}
	/**
	 * 加载系统配置文件
	 * @return
	 */
	public Properties getSystemProperties() {
		if (systemProperties == null) {
			InputStream is = null;
			try {
				is = this.getClass().getResourceAsStream("/system.properties");
				systemProperties = new Properties();
				systemProperties.load(is);
			} catch (IOException e1) {
				e1.printStackTrace();
			} finally {
				if (is != null) {
					try {
						is.close();
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			}
		}
		return systemProperties;
	}
	/**
	 *  短信接口地址
 	 */
	public String getSmsUrl(){
		return getSystemProperties().getProperty("yihu_sms_url");
	}
	/**
	 *   短信企业编号
	 */
	public String getSmsCode(){
		return getSystemProperties().getProperty("yihu_sms_code");
	}
	/**
	 * 短信用户名
    // 别处登录
    public static final int LOGIN_OTHER = 999;
    // 登录超时
    public static final int LOGIN_TIMEOUT = 998;
    // 未登录
    public static final int NOT_LOGIN = 997;
    // 文件保存临时路径
    private static final String TEMP_PATH = "upload_temp_path";
    // 血糖餐前最小值
    public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
    // 血糖餐前最大值
    public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
    // 血糖餐后最小值
    public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
    // 血糖餐后最大值
    public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
    // 舒张压最小值
    public static final double HEALTH_STANDARD_SZY_MIN = 60;
    // 舒张压最大值
    public static final double HEALTH_STANDARD_SZY_MAX = 90;
    // 收缩压最小值
    public static final double HEALTH_STANDARD_SSY_MIN = 90;
    // 收缩压最大值
    public static final double HEALTH_STANDARD_SSY_MAX = 140;
    // 同一手机号大最短信数
    public static final int MAX_SMS_MOBILE = 5;
    // 发送短信验证码间隔(分钟)
    public static final int SMS_INTERVAL = 2;
    private static Object lock = new Object();
    // 全局系统配置信息
    private static SystemConf systemConf;
    // 系统配置文件
    private Properties systemProperties;
    //im列表
    private String imListGet;
    public static SystemConf getInstance() {
        if (systemConf == null) {
            synchronized (lock) {
                systemConf = new SystemConf();
            }
        }
        return systemConf;
    }
    /**
     * 加载系统配置文件
     *
     * @return
     */
	public String getSmsName(){
		return getSystemProperties().getProperty("yihu_sms_name");
	}
    public Properties getSystemProperties() {
        if (systemProperties == null) {
            InputStream is = null;
            try {
                is = this.getClass().getResourceAsStream("/system.properties");
                systemProperties = new Properties();
                systemProperties.load(is);
            } catch (IOException e1) {
                e1.printStackTrace();
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return systemProperties;
    }
    /**
     * 短信接口地址
     */
    public String getSmsUrl() {
        return getSystemProperties().getProperty("yihu_sms_url");
    }
    /**
     * 短信企业编号
     */
    public String getSmsCode() {
        return getSystemProperties().getProperty("yihu_sms_code");
    }
    /**
     * 短信用户名
     */
    public String getSmsName() {
        return getSystemProperties().getProperty("yihu_sms_name");
    }
    /**
     * 短信登录密码
     */
    public String getSmsPassword() {
        return getSystemProperties().getProperty("yihu_sms_password");
    }
    ;
    /**
     * 挂号接口地址
     */
    public String getGuahaoUrl() {
        return getSystemProperties().getProperty("yihu_guahao_url");
    }
    /**
     * 挂号接口对接appid
     */
    public String getGuahaoAppid() {
        return getSystemProperties().getProperty("yihu_guahao_appid");
    }
    /**
     * 挂号接口对接app secret
     */
    public String getGuahaoSecret() {
        return getSystemProperties().getProperty("yihu_guahao_secret");
    }
    /**
     * IM地址
     *
     * @return
     */
    @Value("${im.im_list_get}")
    private String im_list_get;
    public String getImListGet() {
        return im_list_get;
    }
    /**
     * 获取文件保存的临时路径
     *
     * @return
     */
    public String getTempPath() {
        return getSystemProperties().getProperty(TEMP_PATH);
    }
    /**
     * 获取图片存在地址
     *
     * @return
     */
    @Value("${images.path}")
    private String imagesPath;
    public String getImagePath() {
        return imagesPath;
    }
    @Value("${wechat.appId}")
    private String appId;
    @Value("${wechat.appSecret}")
    private String appSecret;
    @Value("${wechat.accId}")
    private String accId;
    public String getAppId() {
        return appId;
    }
    public String getAccId() {
        return accId;
    }
    public String getAppSecret() {
        return appSecret;
    }
    /**
     * 获取服务全路径
     *
     * @return
     */
    @Value("${server.server_url}")
    private String server_url;
    public String getServerUrl() {
        return server_url;
    }
    public String getServerUrlStr() {
        return server_url;
    }
    /******************************** 挂号配置 ********************************************/
    /**
     * 获取厦门预约服务地址
     */
    public String getXMGuahaoUrl() {
        return getSystemProperties().getProperty("guahao_url");
    }
    /**
     * 获取厦门预约服务命名空间
     */
    public String getXMGuahaoNamespace() {
        return getSystemProperties().getProperty("guahao_namespace");
    }
    /****************************************************************************************/
    @Value("${sign.check_upload}")
    private String sign_check_upload;
    /**
     * 基卫服务地址
     */
    public String getJwUrl() {
        return getSystemProperties().getProperty("sign_check_upload");
    }
    /********************************* EHR配置 **********************************************/
    /**
     * 是否启用EHR演示
     */
    public Boolean getEhrUsed() {
        return Boolean.valueOf(getSystemProperties().getProperty("ehr_used"));
    }
    /**
     * EHR档案服务地址
     */
    public String getEhrServices() {
        return getSystemProperties().getProperty("ehr_services");
    }
    /**
     * EHR底层地址
     */
    public String getEhrServicesBase() {
        return getSystemProperties().getProperty("ehr_services_base");
    }
    /**************************************************************************************/
    /*********************************
     * 健康之路开放平台 配置
     **********************************************/
	/**
	 * 短信登录密码
    @Value("${yihu.yihu_OpenPlatform_url}")
    private String yihu_OpenPlatform_url;
    @Value("${yihu.yihu_OpenPlatform_appId}")
    private String yihu_OpenPlatform_appId;
    @Value("${yihu.yihu_OpenPlatform_secret}")
    private String yihu_OpenPlatform_secret;
    /**
     * 健康之路开放平台url
     */
	public String getSmsPassword(){
		return getSystemProperties().getProperty("yihu_sms_password");
	};
	/**
	 *  挂号接口地址
	 */
	public String getGuahaoUrl(){
		return getSystemProperties().getProperty("yihu_guahao_url");
	}
	/**
	 *  挂号接口对接appid
	 */
	public String getGuahaoAppid(){
		return getSystemProperties().getProperty("yihu_guahao_appid");
	}
	/**
	 *  挂号接口对接app secret
	 */
	public String getGuahaoSecret(){
		return getSystemProperties().getProperty("yihu_guahao_secret");
	}
	/**
	 * 获取服务IP地址/域名
	 * @return
	 */
	public String getServerIp() {
		return getSystemProperties().getProperty(SERVER_IP);
	}
	/**
	 * 获取服务端口号
	 * @return
	 */
	public String getServerPort() {
		return getSystemProperties().getProperty(SERVER_PORT);
	}
	/**
	 * IM地址
	 * @return
    public String getYihuOpenPlatformUrl() {
        return yihu_OpenPlatform_url;
    }
    /**
     * 健康之路开放平台渠道号
     */
	public String getImListGet() {
		return getSystemProperties().getProperty(IM_LIST_GET);
	}
	/**
	 * 获取服务资源名
	 * @return
	 */
	public String getServerDomain() {
		return getSystemProperties().getProperty(SERVER_DOMAIN);
	}
	/**
	 * 获取图片资源服务器地址
	 * @return
	 */
	public String getImageServer() {
		return getSystemProperties().getProperty(IMAGE_SERVER);
	}
	/**
	 * 获取语音资源服务器地址
	 * @return
	 */
	public String getVoiceServer() {
		return getSystemProperties().getProperty(VOICE_SERVER);
	}
	/**
	 * 获取聊天附件服务器地址
	 * @return
	 */
	public String getChatServer() {
		return getSystemProperties().getProperty(CHAT_SERVER);
	}
	/**
	 * 获取文件保存的临时路径
	 * @return
	 */
	public String getTempPath() {
		return getSystemProperties().getProperty(TEMP_PATH);
	}
	/**
	 * 获取图片存在地址
	 * @return
	 */
	public String getImagePath() {
		return getSystemProperties().getProperty(IMAGE_PATH);
	}
	/**
	 * 获取语音存放地址
	 * @return
	 */
	public String getVoicePath() {
		return getSystemProperties().getProperty(VOICE_PATH);
	}
	/**
	 * 聊天附件保存路径
	 * @return
	 */
	public String getChatPath() {
		return getSystemProperties().getProperty(CHAT_FILE_PATH);
	}
	/**
	 * 获取消息推送服务器
	 * @return
	 */
	public String getMsgPushServer() {
		return getSystemProperties().getProperty(MSG_PUSH_SERVER);
	}
	public String getWeixinWebsocketServer() {
		return getSystemProperties().getProperty(WEIXIN_WEBSOCKET_SERVER);
	}
	public String getServerUrlStr() {
		String temp = getSystemProperties().getProperty(SERVER_URL);
		if (StringUtils.isEmpty(temp)) {
			temp = "http://www.xmtyw.cn/wlyy/";
		}
		return temp;
	}
	
	public String getAppId(){
		String temp = getSystemProperties().getProperty(appId);
		if (StringUtils.isEmpty(temp)) {
			temp = "wxad04e9c4c5255acf";
		}
		return temp;
	}
	public String getAccId(){
		String temp = getSystemProperties().getProperty("accId");
		return temp;
	}
	
	public String getAppSecret(){
		String temp = getSystemProperties().getProperty(appSecret);
		if (StringUtils.isEmpty(temp)) {
			temp = "ae77c48ccf1af5d07069f5153d1ac8d3";
		}
		return temp;
	}
	/**
	 * 获取服务全路径
	 * @return
	 */
	public String getServerUrl() {
		String port = getServerPort();
		port = StringUtils.isEmpty(port) ? "" : ":" + port;
		String domain = getServerDomain();
		domain = StringUtils.isEmpty(port) ? "" : "/" + domain;
		return "http://" + getServerIp() + port + domain + "/";
	}
	public static void main(String[] args) {
		System.out.println(getInstance().getServerUrl());
	}
	/******************************** 挂号配置 ********************************************/
	/**
	 * 获取厦门预约服务地址
	 */
	public String getXMGuahaoUrl() {
		return getSystemProperties().getProperty("guahao_url");
	}
	/**
	 * 获取厦门预约服务命名空间
	 */
	public String getXMGuahaoNamespace() {
		return getSystemProperties().getProperty("guahao_namespace");
	}
	/****************************************************************************************/
	/**
	 * 基卫服务地址
	 */
	public String getJwUrl() {
		return getSystemProperties().getProperty("sign_check_upload");
	}
	/********************************* EHR配置 **********************************************/
	/**
	 * 是否启用EHR演示
	 */
	public Boolean getEhrUsed() {
		return Boolean.valueOf(getSystemProperties().getProperty("ehr_used"));
	}
	/**
	 * EHR档案服务地址
	 */
	public String getEhrServices() {
		return getSystemProperties().getProperty("ehr_services");
	}
	/**
	 * EHR底层地址
	 */
	public String getEhrServicesBase() {
		return getSystemProperties().getProperty("ehr_services_base");
	}
	/**************************************************************************************/
	/********************************* 健康之路开放平台 配置 **********************************************/
	/**
	 * 健康之路开放平台url
	 */
	public String getYihuOpenPlatformUrl() {
		return getSystemProperties().getProperty("yihu_OpenPlatform_url");
	}
	/**
	 * 健康之路开放平台渠道号
	 */
	public String getYihuOpenPlatformAppId() {
		return getSystemProperties().getProperty("yihu_OpenPlatform_appId");
	}
	/**
	 * 健康之路开放平台秘钥
	 */
	public String getYihuOpenPlatformSecret() {
		return getSystemProperties().getProperty("yihu_OpenPlatform_secret");
	}
	/**************************************************************************************/
	/**
	 * 获取IM数据库名
	 * @return
    public String getYihuOpenPlatformAppId() {
        return yihu_OpenPlatform_appId;
    }
    /**
     * 健康之路开放平台秘钥
     */
    public String getYihuOpenPlatformSecret() {
        return yihu_OpenPlatform_secret;
    }
    /**************************************************************************************/
    /**
     * 获取IM数据库名
     *
     * @return
     */
	public String getImDataBaseName(){ return getSystemProperties().getProperty("im_dataBase");}
    @Value("${im.data_base_name}")
    private String im_dataBase_name;
    public String getImDataBaseName() {
        return im_dataBase_name;
    }
}

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java

@ -32,6 +32,10 @@ public class WeixinBaseController extends BaseController {
	@Autowired
	private TokenService tokenService;
	@Autowired
	private CommonUtil CommonUtil;
	@Autowired
	private HttpUtil HttpUtil;
	/**
	 * 通过code获取判断openid
	 * 

+ 8 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -20,6 +20,8 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.codec.EncoderException;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
@ -41,6 +43,10 @@ public class FileUploadController extends BaseController {
    @ApiParam
    FastDFSUtil fastDFSUtil;
    @Autowired
    private CommonUtil CommonUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    /**
     * 患者头像上传
@ -53,7 +59,6 @@ public class FileUploadController extends BaseController {
    @ResponseBody
    public String patientPhoto(HttpServletRequest request, HttpServletResponse response, String photo) {
        try {
            String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            String fileName = null;
@ -166,7 +171,7 @@ public class FileUploadController extends BaseController {
    public String chatFile(HttpServletRequest request, HttpServletResponse response) {
        List<String> tempPaths = new ArrayList<String>();
        try {
            String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
            String fastUrl = fastdfs_file_url;
            String type  = request.getParameter("type");
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
@ -325,7 +330,7 @@ public class FileUploadController extends BaseController {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        List<String> tempPaths = new ArrayList<String>();
        String fastUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
        String fastUrl = fastdfs_file_url;
        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
            MultipartFile mf = entity.getValue();
            String fileName = mf.getOriginalFilename();

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -62,6 +62,8 @@ public class WechatController extends WeixinBaseController {
    WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    AccessTokenService accessTokenService;
    @Autowired
    HttpUtil HttpUtil;
    /**
@ -427,7 +429,7 @@ public class WechatController extends WeixinBaseController {
                //判断d登录密码是否正确
                if (loginPassword.equals(p.getPassword())) {
                    // 绑定用户手机号和openid
                    if (!StringUtils.equals(p.getOpenid(), openid)&&!"undefined".equals(openid)) {//undefined不更新数据库
                    if (!StringUtils.equals(p.getOpenid(), openid) && !"undefined".equals(openid)) {//undefined不更新数据库
                        //patient.setOpenid(openid);
                        patientService.updatePatient(p, openid);
                    }

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -35,6 +35,8 @@ public class imController extends BaseController {
    private DoctorDao doctorDao;
    @Autowired
    private ConsultDao consultDao;
    @Autowired
    private ImUtill ImUtill;
    /**
     * 获取单个咨询

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -31,6 +31,9 @@ public class WlyySerivceController extends BaseController{
    @Autowired
    private JwSmjkService jwSmjkService;
    @Autowired
    private HttpUtil HttpUtil;
    /**
     * 检查是否签约

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -91,6 +91,8 @@ public class DoctorController extends BaseController {
    private DoctorAdminTeamDao doctorAdminTeamDao;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 社区医院下医生列表查询接口 没分页

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -62,6 +62,10 @@ public class DoctorConsultController extends WeixinBaseController {
    private ConsultService consultService;
    @Autowired
    private TalkGroupService talkGroupService;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private ImUtill ImUtill;
    /**
     * 三师咨询列表查询
     *

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultPublicController.java

@ -43,6 +43,8 @@ public class DoctorConsultPublicController extends BaseController {
	@Autowired
	private DoctorInfoService doctorInfoService;
	@Autowired
	private CommonUtil CommonUtil;
	@Autowired
	PatientService patientService;

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java

@ -26,6 +26,8 @@ public class DoctorFeedbackController extends BaseController {
    private FeedbackService feedbackService;
    @Autowired
    private AppealService appealService;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 医生端保存意见反馈

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java

@ -47,6 +47,8 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
	@Autowired
	private ConsultService consultService;
	@Autowired
	private CommonUtil CommonUtil;
//======================
	@Autowired
	DoctorGuidanceTempService doctorGuidanceTempService;

+ 2 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java

@ -58,7 +58,8 @@ public class DoctorPatientGroupController extends BaseController {
    private StringRedisTemplate redisTemplate;
    @Autowired
    private DoctorTeamDao doctorTeamDao;
    @Autowired
    private CommonUtil CommonUtil;
    private final int DOCTOR_PATIENT_OBJECT_LENGTH = 13;
    /**

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -73,6 +73,10 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private HttpUtil HttpUtil;
    /**
     * 根据姓名、地址、身份证搜索已分配的居民
     *

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -46,6 +46,8 @@ public class DoctorSignController extends WeixinBaseController {
    @Autowired
    private SignWebService signWebService;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private DoctorInfoService infoService;
    @Autowired

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -46,6 +46,8 @@ import java.util.Map;
@Api(description = "患者管理")
public class PatientController extends WeixinBaseController {
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private PatientInfoService patientInfoService;
    @Autowired

+ 122 - 149
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/archives/PatientArchivesController.java

@ -16,6 +16,7 @@ import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -46,34 +47,32 @@ public class PatientArchivesController extends WeixinBaseController {
    @Autowired
    private PatientService patientService;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @ApiOperation("获取门诊记录/住院记录(基卫+APP)")
    @RequestMapping(value = "/event", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getAllEvent(@ApiParam(name="type",value="类型",defaultValue = "")
                              @RequestParam(value="type",required = false) String type,
                              @ApiParam(name="page",value="第几页",defaultValue = "1")
                              @RequestParam(value="page",required = true) String page,
                              @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
                              @RequestParam(value="pageSize",required = true) String pageSize,
                              @ApiParam(name="lastTime",value="最后一条时间",defaultValue = "2010-10-10 00:00:00")
                              @RequestParam(value="lastTime",required = false) String lastTime) {
    public String getAllEvent(@ApiParam(name = "type", value = "类型", defaultValue = "")
                              @RequestParam(value = "type", required = false) String type,
                              @ApiParam(name = "page", value = "第几页", defaultValue = "1")
                              @RequestParam(value = "page", required = true) String page,
                              @ApiParam(name = "pageSize", value = "每页几行", defaultValue = "10")
                              @RequestParam(value = "pageSize", required = true) String pageSize,
                              @ApiParam(name = "lastTime", value = "最后一条时间", defaultValue = "2010-10-10 00:00:00")
                              @RequestParam(value = "lastTime", required = false) String lastTime) {
        try {
            List<Map<String,String>> result = patientRecordService.getAllEvent(getRepUID(),type,page,pageSize,lastTime);
            List<Map<String, String>> result = patientRecordService.getAllEvent(getRepUID(), type, page, pageSize, lastTime);
            return write(200, "获取就诊记录成功!", "data", result);
        } catch (Exception e) {
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
            }
            else if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"获取门/急诊数据失败!");
            if (e.getMessage().indexOf("卡号尚未在医疗机构注册过") > 0) {
                return error(-1, "对不起,您的社保卡有变更,请改天再试");
            } else if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "获取门/急诊数据失败!");
            }
        }
    }
@ -81,28 +80,24 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案详情(基卫)")
    public String getHealthData(@ApiParam(name="event",value="事件ID",defaultValue = "")
                                @RequestParam(value="event",required = true) String event,
                                @ApiParam(name="catalog",value="档案类型",defaultValue = "")
                                @RequestParam(value="catalog",required = true) String catalog,
                                @ApiParam(name="serial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="serial",required = true) String serial) {
    public String getHealthData(@ApiParam(name = "event", value = "事件ID", defaultValue = "")
                                @RequestParam(value = "event", required = true) String event,
                                @ApiParam(name = "catalog", value = "档案类型", defaultValue = "")
                                @RequestParam(value = "catalog", required = true) String catalog,
                                @ApiParam(name = "serial", value = "该类别顺序号,默认填1", defaultValue = "1")
                                @RequestParam(value = "serial", required = true) String serial) {
        try {
            String result = patientRecordService.getHealthData(getRepUID(), event, catalog, serial);
//            String result = patientRecordService.getHealthData(getUID(), event, catalog, serial);
            return write(200, "获取健康档案详情成功!", "data", result);
        } catch (Exception e) {
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
            }
            else if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"获取健康档案详情失败!");
            if (e.getMessage().indexOf("卡号尚未在医疗机构注册过") > 0) {
                return error(-1, "对不起,您的社保卡有变更,请改天再试");
            } else if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "获取健康档案详情失败!");
            }
        }
    }
@ -110,24 +105,20 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/catalog", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("通过事件号获取档案类型列表(基卫)")
    public String getEventCatalog(@ApiParam(name="event",value="事件ID",defaultValue = "")
                                @RequestParam(value="event",required = true) String event) {
    public String getEventCatalog(@ApiParam(name = "event", value = "事件ID", defaultValue = "")
                                  @RequestParam(value = "event", required = true) String event) {
        try {
            List<Map<String,String>> result = patientRecordService.getEventCatalog(getRepUID(),event);
            List<Map<String, String>> result = patientRecordService.getEventCatalog(getRepUID(), event);
//            List<Map<String,String>> result = patientRecordService.getEventCatalog(getUID(),event);
            return write(200, "通过事件号获取档案类型列表成功!", "data", result);
        } catch (Exception e) {
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
            }
            else if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"获取档案类型列表失败!");
            if (e.getMessage().indexOf("卡号尚未在医疗机构注册过") > 0) {
                return error(-1, "对不起,您的社保卡有变更,请改天再试");
            } else if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "获取档案类型列表失败!");
            }
        }
    }
@ -136,26 +127,22 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取用药记录(基卫)")
    public String getDrugsList(@ApiParam(name="page",value="第几页",defaultValue = "1")
                                   @RequestParam(value="page",required = true) String page,
                               @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
                                   @RequestParam(value="pageSize",required = true) String pageSize) {
    public String getDrugsList(@ApiParam(name = "page", value = "第几页", defaultValue = "1")
                               @RequestParam(value = "page", required = true) String page,
                               @ApiParam(name = "pageSize", value = "每页几行", defaultValue = "10")
                               @RequestParam(value = "pageSize", required = true) String pageSize) {
        try {
            String result = patientRecordService.getDrugsListPage(getRepUID(), page, pageSize);     //"P20161008001"
//            String result = patientRecordService.getDrugsListPage(getUID(), page, pageSize);     //"P20161008001"
            return write(200, "获取用药记录成功!", "data", result);
        } catch (Exception e) {
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
            }
            else if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"获取用药记录失败!");
            if (e.getMessage().indexOf("卡号尚未在医疗机构注册过") > 0) {
                return error(-1, "对不起,您的社保卡有变更,请改天再试");
            } else if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "获取用药记录失败!");
            }
        }
    }
@ -163,58 +150,53 @@ public class PatientArchivesController extends WeixinBaseController {
    @ApiOperation("获取检查检验报告(基卫+APP)")
    @RequestMapping(value = "/event/report", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getReportList(@ApiParam(name="page",value="第几页",defaultValue = "1")
                                    @RequestParam(value="page",required = true) String page,
                                @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
                                    @RequestParam(value="pageSize",required = true) String pageSize,
                                @ApiParam(name="lastTime",value="最后一条时间",defaultValue = "2010-10-10 00:00:00")
                                    @RequestParam(value="lastTime",required = false) String lastTime)
    {
    public String getReportList(@ApiParam(name = "page", value = "第几页", defaultValue = "1")
                                @RequestParam(value = "page", required = true) String page,
                                @ApiParam(name = "pageSize", value = "每页几行", defaultValue = "10")
                                @RequestParam(value = "pageSize", required = true) String pageSize,
                                @ApiParam(name = "lastTime", value = "最后一条时间", defaultValue = "2010-10-10 00:00:00")
                                @RequestParam(value = "lastTime", required = false) String lastTime) {
        try {
            List<Map<String,String>> result = patientRecordService.getExamAndLabReport(getRepUID(), page, pageSize,lastTime);
            List<Map<String, String>> result = patientRecordService.getExamAndLabReport(getRepUID(), page, pageSize, lastTime);
//            List<Map<String,String>> result = patientRecordService.getExamAndLabReport(getUID(), page, pageSize,lastTime);
            return write(200, "获取检查检验报告成功!", "data", result);
        } catch (Exception e) {
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
            }
            else if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"获取检查检验报告失败!");
            if (e.getMessage().indexOf("卡号尚未在医疗机构注册过") > 0) {
                return error(-1, "对不起,您的社保卡有变更,请改天再试");
            } else if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "获取检查检验报告失败!");
            }
        }
    }
    /****************************************** 社区体检 **********************************************************/
    /******************************************
     * 社区体检
     **********************************************************/
    @RequestMapping(value = "list_medical", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("查询居民社区健康体检列表")
    public String medical(
                          @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
                          @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                          @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
                          @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try{
            @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
            @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
            @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            Patient p = patientService.findByCode(getRepUID());
//            Patient p = patientService.findByCode(getUID());
            if(p != null){
                JSONArray re = jwArchivesService.getEhrSickMedicalList(p.getIdcard(),pageIndex,pageSize);
                return write(200,"查询成功","list",re);
            }else{
                return error(-1,"患者不存在");
            }
        }catch (Exception e){
            if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            if (p != null) {
                JSONArray re = jwArchivesService.getEhrSickMedicalList(p.getIdcard(), pageIndex, pageSize);
                return write(200, "查询成功", "list", re);
            } else {
                return error(-1, "患者不存在");
            }
            else{
                return error(-1,"查询居民社区健康体检列表失败!");
        } catch (Exception e) {
            if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "查询居民社区健康体检列表失败!");
            }
        }
    }
@ -223,30 +205,28 @@ public class PatientArchivesController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("查询居民社区健康体检详情信息")
    public String medical_detail(@ApiParam(name = "medicalNo", value = "体检ID", defaultValue = "1249652")
                                 @RequestParam(value="medicalNo",required = true) String medicalNo){
        try{
                                 @RequestParam(value = "medicalNo", required = true) String medicalNo) {
        try {
            JSONObject json = jwArchivesService.getEhrSickMedicalRecord(medicalNo);
            return write(200,"查询成功","medical_detail",json);
        }catch (Exception e){
            if(e.getMessage().startsWith("error"))
            {
                return error(-1,e.getMessage());
            }
            else{
                return error(-1,"查询居民社区健康体检详情失败!");
            return write(200, "查询成功", "medical_detail", json);
        } catch (Exception e) {
            if (e.getMessage().startsWith("error")) {
                return error(-1, e.getMessage());
            } else {
                return error(-1, "查询居民社区健康体检详情失败!");
            }
        }
    }
    /******************************************* 就诊事件管理 **********************************************************/
    /*******************************************
     * 就诊事件管理
     **********************************************************/
    @RequestMapping(value = "/event/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取就诊事件详情")
    public String getEventDetail(@ApiParam(name="event",value="事件ID",defaultValue = "")
                                 @RequestParam(value="event",required = true) String event)
    {
    public String getEventDetail(@ApiParam(name = "event", value = "事件ID", defaultValue = "")
                                 @RequestParam(value = "event", required = true) String event) {
        try {
            JSONObject result = patientEventService.getEventDetail(event);
@ -259,9 +239,8 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/save", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("保存就诊事件详情")
    public String saveEventDetail(@ApiParam(name="data",value="就诊事件json数据",defaultValue = "")
                                 @RequestParam(value="data",required = true) String data)
    {
    public String saveEventDetail(@ApiParam(name = "data", value = "就诊事件json数据", defaultValue = "")
                                  @RequestParam(value = "data", required = true) String data) {
        try {
            patientEventService.saveEventDetail(data, getRepUID());
//            patientEventService.saveEventDetail(data, getUID());
@ -275,9 +254,8 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/delete", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("删除就诊事件")
    public String deleteEvent(@ApiParam(name="event",value="就诊事件id",defaultValue = "")
                                  @RequestParam(value="event",required = true) Long event)
    {
    public String deleteEvent(@ApiParam(name = "event", value = "就诊事件id", defaultValue = "")
                              @RequestParam(value = "event", required = true) Long event) {
        try {
            patientEventService.deleteEvent(event);
@ -290,28 +268,26 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/uploadImg", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("单张上传图片")
    public String uploadImg(@ApiParam(name="mediaId",value="微信图片标识",defaultValue = "wL1vfE9g1fiRCl5xd-Xotl1XycWQ9mwigDLUv-S0Kmde-pXNrlySKbf5RM5SwwFl")
                            @RequestParam(value="mediaId",required = true) String mediaId)
    {
    public String uploadImg(@ApiParam(name = "mediaId", value = "微信图片标识", defaultValue = "wL1vfE9g1fiRCl5xd-Xotl1XycWQ9mwigDLUv-S0Kmde-pXNrlySKbf5RM5SwwFl")
                            @RequestParam(value = "mediaId", required = true) String mediaId) {
        try {
            String url ="";
            String url = "";
            FastDFSUtil fastDFSUtil = new FastDFSConfig().fastDFSUtil();
            InputStream wxImg = getInputStream(mediaId);
            ObjectNode result = fastDFSUtil.upload(wxImg, "jpg", "");
            wxImg.close();
            String serverUrl = SystemConf.getInstance().getSystemProperties().getProperty("fastdfs_file_url");
            String serverUrl = fastdfs_file_url;
            if (result != null) {
                url = serverUrl
                        + result.get("groupName").toString().replaceAll("\"", "") + "/"
                        + result.get("remoteFileName").toString().replaceAll("\"", "");
            }
            else{
            } else {
                return write(-1, "图片上传失败!");
            }
            return write(200, "图片上传成功!","url", url);
            return write(200, "图片上传成功!", "url", url);
        } catch (Exception e) {
            return invalidUserException(e,-1, "图片上传失败!");
            return invalidUserException(e, -1, "图片上传失败!");
        }
    }
@ -319,9 +295,8 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/img/delete", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("删除就诊事件图片")
    public String deleteEventImg(@ApiParam(name="id",value="就诊事件图片id",defaultValue = "")
                              @RequestParam(value="id",required = true) Long id)
    {
    public String deleteEventImg(@ApiParam(name = "id", value = "就诊事件图片id", defaultValue = "")
                                 @RequestParam(value = "id", required = true) Long id) {
        try {
            patientEventService.deleteEventImg(id);
@ -334,17 +309,16 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/img/add", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("新增就诊事件图片")
    public String addEventImg(@ApiParam(name="eventId",value="就诊事件id",defaultValue = "")
                                 @RequestParam(value="eventId",required = true) Long eventId,
                              @ApiParam(name="imgType",value="图片类别",defaultValue = "")
                              @RequestParam(value="imgType",required = true) String imgType,
                              @ApiParam(name="imgLabel",value="图片标签",defaultValue = "")
                                  @RequestParam(value="imgLabel",required = true) String imgLabel,
                              @ApiParam(name="imgUrl",value="图片路径",defaultValue = "")
                                  @RequestParam(value="imgUrl",required = true) String imgUrl)
    {
    public String addEventImg(@ApiParam(name = "eventId", value = "就诊事件id", defaultValue = "")
                              @RequestParam(value = "eventId", required = true) Long eventId,
                              @ApiParam(name = "imgType", value = "图片类别", defaultValue = "")
                              @RequestParam(value = "imgType", required = true) String imgType,
                              @ApiParam(name = "imgLabel", value = "图片标签", defaultValue = "")
                              @RequestParam(value = "imgLabel", required = true) String imgLabel,
                              @ApiParam(name = "imgUrl", value = "图片路径", defaultValue = "")
                              @RequestParam(value = "imgUrl", required = true) String imgUrl) {
        try {
            patientEventService.addEventImg(eventId,imgType,imgLabel,imgUrl);
            patientEventService.addEventImg(eventId, imgType, imgLabel, imgUrl);
            return write(200, "新增就诊事件图片成功!");
        } catch (Exception e) {
@ -355,15 +329,14 @@ public class PatientArchivesController extends WeixinBaseController {
    @RequestMapping(value = "/event/img/edit", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("修改就诊事件图片")
    public String editEventImg(@ApiParam(name="id",value="就诊事件图片id",defaultValue = "")
                              @RequestParam(value="id",required = true) Long id,
                              @ApiParam(name="imgType",value="图片类别",defaultValue = "")
                              @RequestParam(value="imgType",required = true) String imgType,
                              @ApiParam(name="imgLabel",value="图片标签",defaultValue = "")
                              @RequestParam(value="imgLabel",required = true) String imgLabel)
    {
    public String editEventImg(@ApiParam(name = "id", value = "就诊事件图片id", defaultValue = "")
                               @RequestParam(value = "id", required = true) Long id,
                               @ApiParam(name = "imgType", value = "图片类别", defaultValue = "")
                               @RequestParam(value = "imgType", required = true) String imgType,
                               @ApiParam(name = "imgLabel", value = "图片标签", defaultValue = "")
                               @RequestParam(value = "imgLabel", required = true) String imgLabel) {
        try {
            patientEventService.editEventImg(id,imgType,imgLabel);
            patientEventService.editEventImg(id, imgType, imgLabel);
            return write(200, "修改就诊事件图片成功!");
        } catch (Exception e) {

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultCommunicationController.java

@ -34,6 +34,8 @@ public class ConsultCommunicationController extends WeixinBaseController {
	@Autowired
	private ConsultCommunicationService consultCommunicationService;
	@Autowired
	private CommonUtil CommonUtil;
	/**
	 * 添加病友圈帖子
	 * @param question 问题

+ 7 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -69,6 +69,12 @@ public class ConsultController extends WeixinBaseController {
    private DoctorDao doctorDao;
    @Autowired
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private ImUtill ImUtill;
    @Autowired
    private HttpUtil httpUtil;
    /**
     * 患者咨询记录查询
@ -126,12 +132,11 @@ public class ConsultController extends WeixinBaseController {
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方咨询列表")
    public String getPreConsultList(@RequestParam(required = false) String title,
            @RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
                                    @RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
        try {
            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
@ -173,7 +178,6 @@ public class ConsultController extends WeixinBaseController {
            return error(-1, "查询失败!");
        }
    }
    /**
     * 获取医生的排班时间
     *

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultPublicController.java

@ -38,6 +38,8 @@ public class ConsultPublicController extends WeixinBaseController {
	@Autowired
	private PatientInfoService patientInfoService;
	@Autowired
	private CommonUtil CommonUtil;
	/**
	 * 添加公共咨询

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -42,6 +42,8 @@ public class PatientDeviceController extends BaseController {
    private PatientHealthTimeDao patientHealthTimeDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    private String url = SystemConf.getInstance().getYihuOpenPlatformUrl();
    private String appid = SystemConf.getInstance().getYihuOpenPlatformAppId();

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -25,6 +25,8 @@ public class PatientFeedbackController extends WeixinBaseController {
    private FeedbackService feedbackService;
    @Autowired
    private AppealService appealService;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 居民端保存意见反馈

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthRecordController.java

@ -47,6 +47,8 @@ public class PatientHealthRecordController extends WeixinBaseController {
	@Autowired
	private PatientHealthRecordService patientHealthRecordService;
	@Autowired
	private CommonUtil CommonUtil;
	/**
	 * 保健记录更改接口(包括手动记录的修改和所有的删除)
	 *

+ 0 - 42
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/swagger/SwaggerConfig.java

@ -1,42 +0,0 @@
package com.yihu.wlyy.web.swagger;
import org.springframework.context.annotation.Bean;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public class SwaggerConfig {
    private static final String PUBLIC_API = "Default";
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(PUBLIC_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/.*"))
                .build()
                .apiInfo(publicApiInfo());
    }
    private ApiInfo publicApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "向PC端,微信、App等应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
}

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -70,6 +70,8 @@ public class BookingController extends WeixinBaseController {
    private ConsultService consultService;
    @Autowired
    private JwSmjkService jwSmjkService;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    /**
     * 根据城市编码获取相应挂号服务

+ 13 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatCoreController.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.web.wx;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.weixin.WeiXinCoreService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
@ -9,6 +8,7 @@ import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -32,6 +32,14 @@ public class WechatCoreController extends WeixinBaseController {
    @Autowired
    private WeiXinCoreService weiXinCoreService;
    @Value("${wechat.wechat_token}")
    private String wechat_token;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
    private String appId;
    @Autowired
    private HttpUtil HttpUtil;
    /**
     * 微信接口验证
@ -104,8 +112,8 @@ public class WechatCoreController extends WeixinBaseController {
     * @return
     * @throws NoSuchAlgorithmException
     */
    private static boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
        String token = SystemConf.getInstance().getSystemProperties().getProperty("wechat_token");
    private  boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
        String token = this.wechat_token;
        // 字典序排序
        String[] array = new String[]{token, timestamp, nonce};
        Arrays.sort(array);
@ -169,8 +177,8 @@ public class WechatCoreController extends WeixinBaseController {
            bufferedReader.close();
            reader.close();
            // 替换服务器地址、APPID
            params = params.replaceAll("server_url", SystemConf.getInstance().getSystemProperties().getProperty("wechat_base_url"));
            params = params.replaceAll("appId", SystemConf.getInstance().getSystemProperties().getProperty("appId"));
            params = params.replaceAll("server_url", wechat_base_url);
            params = params.replaceAll("appId", appId);
            // 请求微信接口创建菜单
            String jsonStr = HttpUtil.sendPost(url, params);
            JSONObject result = new JSONObject(jsonStr);

+ 68 - 61
patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -4,6 +4,7 @@ import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.wechat.util.WeiXinMessageReplyUtils;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.*;
@ -16,13 +17,19 @@ import java.util.*;
@Component
public class WeiXinEventProcess {
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
    private String appId;
    @Value("${server.server_url}")
    private String serverUrl;
    /**
     * 微信推送事件处理
     *
     * @param message
     * @return
     */
    public static String eventProcess(Map<String, String> message) throws Exception {
    public  String eventProcess(Map<String, String> message) throws Exception {
        String result = "";
        String event = message.get("Event");
@ -39,7 +46,7 @@ public class WeiXinEventProcess {
                }
                break;
            case WeiXinMessageUtils.EVENT_TYPE_CLICK: //菜单点击
                result = WeiXinEventProcess.clickProcess(message);
                result = this.clickProcess(message);
            default:
                break;
        }
@ -53,7 +60,7 @@ public class WeiXinEventProcess {
     * @param message
     * @return
     */
    public static String clickProcess(Map<String, String> message) throws Exception {
    public  String clickProcess(Map<String, String> message) throws Exception {
        String result = "";
        if (message.get("EventKey").equals("caozuoshuoming")) {
@ -77,7 +84,7 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String clickEventProcess(Map<String, String> message) throws Exception {
    private  String clickEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
@ -91,10 +98,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlConsult = systemConf.getProperty("patient_operatinginstrutions_pic_url");
        // URL设置服务器URL、AppId
        urlConsult = urlConsult.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlConsult = urlConsult.replace("{server}",wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlConsult = picUrlConsult.replace("{server}", systemConf.getProperty("server_url"));
        picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
        articleConsult.put("Url", urlConsult);
        articleConsult.put("Title", "医生咨询功能使用说明");
@ -109,10 +116,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
        // URL设置服务器URL、AppId
        urlBooking = urlBooking.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlBooking = urlBooking.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", systemConf.getProperty("server_url"));
        picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
@ -127,10 +134,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlDevice = systemConf.getProperty("patient_device_pic_url");
        // URL设置服务器URL、AppId
        urlDevice = urlDevice.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlDevice = urlDevice.replace("{server}",wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlDevice = picUrlDevice.replace("{server}", systemConf.getProperty("server_url"));
        picUrlDevice = picUrlDevice.replace("{server}", serverUrl);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "体征设备管理功能使用说明");
@ -145,10 +152,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
        // URL设置服务器URL、AppId
        urlFamily = urlFamily.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlFamily = urlFamily.replace("{server}", wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        picUrlFamily = picUrlFamily.replace("{server}", systemConf.getProperty("server_url"));
        picUrlFamily = picUrlFamily.replace("{server}", serverUrl);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "我的家庭功能使用说明");
@ -171,7 +178,7 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String clickEventProcessMenu(Map<String, String> message) throws Exception {
    private  String clickEventProcessMenu(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
@ -183,10 +190,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String visit_pic = systemConf.getProperty("patient_visit_pic");
        // URL设置服务器URL、AppId
        visit = visit.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        visit = visit.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        visit_pic = visit_pic.replace("{server}", systemConf.getProperty("server_url"));
        visit_pic = visit_pic.replace("{server}", serverUrl);
        articleVisit.put("Url", visit);
        articleVisit.put("Title", "就诊记录");
@ -201,10 +208,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String inspect_pic = systemConf.getProperty("patient_inspect_pic");
        // URL设置服务器URL、AppId
        inspect = inspect.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        inspect = inspect.replace("{server}",wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        inspect_pic = inspect_pic.replace("{server}", systemConf.getProperty("server_url"));
        inspect_pic = inspect_pic.replace("{server}", serverUrl);
        articleInspect.put("Url", inspect);
        articleInspect.put("Title", "检查检验");
@ -218,10 +225,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String examination_pic = systemConf.getProperty("patient_examination_pic");
        // URL设置服务器URL、AppId
        examination = examination.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        examination = examination.replace("{server}",wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        examination_pic = examination_pic.replace("{server}", systemConf.getProperty("server_url"));
        examination_pic = examination_pic.replace("{server}",serverUrl);
        articleExamination.put("Url", examination);
        articleExamination.put("Title", "社区体检");
@ -236,10 +243,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String prescription_pic = systemConf.getProperty("patient_prescription_pic");
        // URL设置服务器URL、AppId
        examination = examination.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        examination = examination.replace("{server}", wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        prescription_pic = examination_pic.replace("{server}", systemConf.getProperty("server_url"));
        prescription_pic = examination_pic.replace("{server}",serverUrl);
        articleExamination.put("Url", prescription);
        articleExamination.put("Title", "处方记录");
@ -261,7 +268,7 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String subscribeEventProcess(Map<String, String> message) throws Exception {
    private  String subscribeEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
@ -274,10 +281,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
        // URL设置服务器URL、AppId
        url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        url = url.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
        picUrl = picUrl.replace("{server}", serverUrl);
        article.put("Url", url);
        article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
@ -300,17 +307,17 @@ public class WeiXinEventProcess {
     *
     * @param articles
     */
    public static void setUrlItems(List<Map<String, String>> articles, Properties systemConf) {
    public  void setUrlItems(List<Map<String, String>> articles, Properties systemConf) {
        Map<String, String> articleConsult = new HashMap<>();
        // 图文URL
        String urlConsult = systemConf.getProperty("patient_consult_url");
        // 图文消息图片URL
        String picUrlConsult = systemConf.getProperty("patient_operatinginstrutions_pic_url");
        // URL设置服务器URL、AppId
        urlConsult = urlConsult.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlConsult = urlConsult.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlConsult = picUrlConsult.replace("{server}", systemConf.getProperty("server_url"));
        picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
        articleConsult.put("Url", urlConsult);
        articleConsult.put("Title", "医生咨询功能使用说明");
@ -325,10 +332,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
        // URL设置服务器URL、AppId
        urlBooking = urlBooking.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlBooking = urlBooking.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", systemConf.getProperty("server_url"));
        picUrlBooking = picUrlBooking.replace("{server}",serverUrl);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
@ -343,10 +350,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlDevice = systemConf.getProperty("patient_device_pic_url");
        // URL设置服务器URL、AppId
        urlDevice = urlDevice.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlDevice = urlDevice.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlDevice = picUrlDevice.replace("{server}", systemConf.getProperty("server_url"));
        picUrlDevice = picUrlDevice.replace("{server}", serverUrl);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "体征设备管理功能使用说明");
@ -361,10 +368,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
        // URL设置服务器URL、AppId
        urlFamily = urlFamily.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        urlFamily = urlFamily.replace("{server}", wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        picUrlFamily = picUrlFamily.replace("{server}", systemConf.getProperty("server_url"));
        picUrlFamily = picUrlFamily.replace("{server}",serverUrl);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "我的家庭功能使用说明");
@ -381,7 +388,7 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String scanEventProcess(Map<String, String> message) throws Exception {
    private  String scanEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 场景值
        String eventKey = message.get("EventKey");
@ -401,11 +408,11 @@ public class WeiXinEventProcess {
            String[] keys = eventKey.replace("qrscene_qr_", "").replace("qr_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}", appId)
                    .replace("{doctorCode}", keys[0]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", keys[1] + "医生签约");
@ -436,11 +443,11 @@ public class WeiXinEventProcess {
            String[] keys = eventKey.replace("qrscene_hs_", "").replace("hs_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
            url = url.replace("{server}",wechat_base_url)
                    .replace("{appId}", appId)
                    .replace("{hospital}", keys[0] + ":" + keys[1]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", keys[1]);
@ -470,11 +477,11 @@ public class WeiXinEventProcess {
            String[] keys = eventKey.replace("qrscene_tw_", "").replace("tw_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}",appId)
                    .replace("{town}", keys[0]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", keys[1]);
@ -503,7 +510,7 @@ public class WeiXinEventProcess {
     * @param description 图文描述
     * @return
     */
    public static Map getNews(String url, String picUrl, String title, String description) {
    public  Map getNews(String url, String picUrl, String title, String description) {
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        Map<String, String> news = new HashMap<>();
        // 图文URL
@ -511,10 +518,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String pictureUrl = systemConf.getProperty(picUrl);
        // URL设置服务器URL、AppId
        targetUrl = targetUrl.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        targetUrl = targetUrl.replace("{server}",wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        pictureUrl = pictureUrl.replace("{server}", systemConf.getProperty("server_url"));
        pictureUrl = pictureUrl.replace("{server}", serverUrl);
        System.out.println("url ====> " + targetUrl);
        System.out.println("picurl ======> " + pictureUrl);
        news.put("Url", targetUrl);
@ -534,7 +541,7 @@ public class WeiXinEventProcess {
     * @param message
     * @return
     */
    public static String replyKeyword(Map<String, String> message) throws Exception {
    public  String replyKeyword(Map<String, String> message) throws Exception {
        String result = "";
        String description = "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。";
        String description1 = "为了能给您提供健康服务,诚邀您签签约家庭医生。";

+ 3 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinAccessTokenUtils.java

@ -15,7 +15,8 @@ import org.springframework.stereotype.Component;
public class WeiXinAccessTokenUtils {
    @Autowired
    private AccessTokenService accessTokenService;
    @Autowired
    private HttpUtil httpUtil;
    /**
     * 获取微信AccessToken
     *
@ -36,7 +37,7 @@ public class WeiXinAccessTokenUtils {
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String params = "grant_type=client_credential&appid=" + SystemConf.getInstance().getAppId() + "&secret=" + SystemConf.getInstance().getAppSecret();
            String result = HttpUtil.sendGet(token_url, params);
            String result = httpUtil.sendGet(token_url, params);
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTempMsgSendUtils.java

@ -14,6 +14,8 @@ public class WeiXinTempMsgSendUtils {
    @Autowired
    WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private HttpUtil httpUtil;
    // 模板消息发送接口URL
    private static String TEMP_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/template" +
@ -53,7 +55,7 @@ public class WeiXinTempMsgSendUtils {
        params.put("data", data);
        // 发送模板消息
        String result = HttpUtil.sendPost(TEMP_MSG_SEND_URL + accessToken, params.toString());
        String result = httpUtil.sendPost(TEMP_MSG_SEND_URL + accessToken, params.toString());
        System.out.println("weixinReturn:"+result);
        JSONObject jsonResult = new JSONObject(result);
        String returnCode=jsonResult.get("errcode").toString();

+ 0 - 111
patient-co-wlyy/src/main/resources/application.properties

@ -1,111 +0,0 @@
####--------------IMPORTANT!!! PRODUCTION ENVIRONMENT------------------#####
#mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#jdbc.username=wlyy
#jdbc.password=jkzlehr@123
#
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://59.61.92.94:3306/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=wlyy
#fv.jdbc.password=jkzlehr@123
#
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=wlyy
#health.jdbc.password=jkzlehr@123
#
#
#redis.host=120.41.253.95
#redis.port=6380
#redis.password=jkzl_ehr
####--------------IMPORTANT!!! DEMO ENVIRONMENT------------------#####
#mysql database setting
#mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://11.1.2.24:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#jdbc.username=wlyy
#jdbc.password=jkzlehr@123
#
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://11.1.2.24:3306/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=wlyy
#fv.jdbc.password=jkzlehr@123
#
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://11.1.2.24:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=wlyy
#health.jdbc.password=jkzlehr@123
#
#jdbc.pool.maxIdle=10
#jdbc.pool.maxActive=50
#
#redis.host=11.1.2.20
#redis.port=6379
##redis.pass=java2000_wl
#
#
#redis.maxIdle=300
#redis.maxActive=600
#redis.maxWait=1000
#redis.testOnBorrow=true
##------------------------------------�����������ݿ�����------------------------------------#
### mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.username=root
#jdbc.password=123456
#
##### health index
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://172.19.103.77/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=root
#health.jdbc.password=123456
#
##### suifang
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=root
#fv.jdbc.password=123456
#
##### redis
#redis.host=172.19.103.47
#redis.port=6379
#redis.password=
#---------------------------------���Ի������ݿ�����---------------------------------------#
#### mysql database setting
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=linzhou
jdbc.password=linzhou
##### health index
health.jdbc.driver=com.mysql.jdbc.Driver
health.jdbc.url=jdbc:mysql://172.19.103.85/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
health.jdbc.username=linzhou
health.jdbc.password=linzhou
##### suifang
fv.jdbc.driver=com.mysql.jdbc.Driver
fv.jdbc.url=jdbc:mysql://172.19.103.85/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
fv.jdbc.username=linzhou
fv.jdbc.password=linzhou
#
##### redis
redis.host=172.19.103.88
redis.port=6379
redis.password=
#-----------------------------------ͨ������--------------------------------------------#
##### redis
redis.maxIdle=300
redis.maxActive=600
redis.maxWait=1000
redis.testOnBorrow=true
##### connection pool settings
jdbc.pool.maxIdle=10
jdbc.pool.maxActive=50

+ 318 - 0
patient-co-wlyy/src/main/resources/application.yml

@ -0,0 +1,318 @@
server:
  port: 8080
spring:
  datasource:
    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小
    health:
      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小
    # REDIS
  redis:
    database: 10 # Database index used by the connection factory.
    password: # Login password of the redis server.
    timeout: 0 # Connection timeout in milliseconds.
      #sentinel:
      #  master: # Name of Redis server.
      #  nodes: # Comma-separated list of host:port pairs.
logging:
  level:
    root: INFO
redis:
  quota:
    current:
      expire: 12 #实时统计redis 的过期时间 默认是2小时
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: true
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
multipart:
  enabled: true
  max-file-size: 50mb
  max-request-size: 50mb
security:
  basic:
    username: jkzl
    password: jkzlehr
---
spring:
  profiles: test
  datasource:
    wlyy:
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: linzhou
      password: linzhou
    health:
      url: jdbc:mysql://172.19.103.85/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: linzhou
      password: linzhou
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
server:
  server_url: http://ehr.yihu.com/wlyy/
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.88:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.88:3000/api/v1/chats/sm
  data_base_name: im_new
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
   #咨询回复
   template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
   #签约成功
   template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
   #签约失败
   template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
   #健康指导提醒
   template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
   #解约提醒
   template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
   #预约成功
   template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
   #预约取消
   template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
   #缴费提醒
   template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
   #健康教育
   template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
   #医生变更
   template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
   #问卷调查
   template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276
  yihu_OpenPlatform_secret: OKC8BS1KGXTDE9GPP1EO4VYLUXF8DJ7QUP72H613ZXA
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
images:
  path: /var/local/upload/images
  renew_path: /usr/local/apache-tomcat-8.0.36/webapps/wlyy/images/renew.png
  sign_path: /usr/local/apache-tomcat-8.0.36/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://172.19.103.85:8011/wlyy_service
---
spring:
  profiles: prod
  datasource:
    wlyy:
      url: jdbc:mysql:/59.61.92.94:3306/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6379 # Redis server port.
    password: jkzl_ehr
server:
  server_url: http://www.xmtyw.cn/wlyy/
im:
  im_list_get: http://120.41.253.95:3000/
  group_server: http://120.41.253.95:3000/api/v1/chats/gm
  msg_push_server: http://120.41.253.95:3000/api/v1/chats/sm
  data_base_name: ichat
wechat:
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fwlyy
  accId: gh_ffd64560fb21
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: MQn79bx1ofb6hekhmRIuqLU7KjySJQzaBzrimgqVrzA
   #咨询回复
   template_consult_notice: 0mF_vHj-ILx8EH8DwzmAi7LqzjqYiU9IrSRRmziTZyc
   #签约成功
   template_sign_success: 0D2vYZVRzFz15p9Y_pkZ1DKutDq8UOsks79FXUKS0tA
   #签约失败
   template_sign_failed: My2VNERjJt4NXR4Ibh42pdrP6B6ka8rQxZeWinQh99s
   #健康指导提醒
   template_health_notice: uv31ES_VCmq3tBYtyGmEQvIwU_zh9LDhF3bFpbIUt5g
   #解约提醒
   template_termination:  C0tdXtA_8k-Cy4a1EkzQuI877vqaqAtRkc-e_Gsd7sk
   #预约成功
   template_appoint_success:  FY3Pqa66tHIE1Fv-irbFBPOh5cYP71fkOzfZKH4S-Fo
   #预约取消
   template_appoint_failed:  tldWEb9AN7p_RoHoD8ml0GxWW3V1V_mpEEhp2v6p56s
   #缴费提醒
   template_expenses_remind:  AcrlihhoGbm22A8cdFFDQ4u38ptRw0aiIPf-aGvNxMM
   #健康教育
   template_healthy_article: a5-ZGf-IUUULsuRNoHWQiBMU6pSYhLgPPqV67SjdLRo
   #医生变更
   template_doctor_change:  dtzSHImbPKfwcrjWlJEjAw3lGlvrLjsobSOE8g4adZA
   #问卷调查
   template_doctor_survey:  8ZWKJmoJ7VR7Uk4YS7aa0Z94QzCkxsyTW6R4CHhUJII
yihu:
  yihu_OpenPlatform_url: http://api.yihu.com.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276
  yihu_OpenPlatform_secret: 2JGL19AH3JS55MQY6ZOFJE1JZJ1OF23GWV67MCDQV74
fastDFS:
  fastdfs_file_url: http://www.xmtyw.cn/
images:
  path: /var/local/upload/images
  renew_path: /usr/local/tomcat8/webapps/wlyy/images/renew.png
  sign_path: /usr/local/tomcat8/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://59.61.92.90:8072/wlyy_service
---
spring:
  profiles: dev
  datasource:
    wlyy:
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
    health:
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.29:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.29:3000/api/v1/chats/sm
  data_base_name: ichat
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_ffd64560fb21
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
   #咨询回复
   template_consult_notice: qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
   #签约成功
   template_sign_success: hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
   #签约失败
   template_sign_failed: ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
   #健康指导提醒
   template_health_notice: 128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
   #解约提醒
   template_termination:  LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
   #预约成功
   template_appoint_success:  Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
   #预约取消
   template_appoint_failed:  pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
   #缴费提醒
   template_expenses_remind:  BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
   #健康教育
   template_healthy_article: LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
   #医生变更
   template_doctor_change:  TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
   #问卷调查
   template_doctor_survey:  IjQvzBy0PLeft2kN9mdBhACXPE9I_jyJywJ6B-JRxsY
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276
  yihu_OpenPlatform_secret: OKC8BS1KGXTDE9GPP1EO4VYLUXF8DJ7QUP72H613ZXA
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
message:
  messageServerUrl: http://10.0.1.3:8080/OpenPlatform/cgiBin/1.0/smsgw/smsSendWS/send
  messageAppId: 9000286
  messageSecret: NW63YK778QPRUD2A6K5SNF7LYRQ888BWOVD6R4FG2VF
images:
  path: /var/local/upload/images
  renew_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/renew.png
  sign_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service

+ 0 - 238
patient-co-wlyy/src/main/resources/applicationContext.xml

@ -1,238 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:task="http://www.springframework.org/schema/task"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
       default-lazy-init="true">
    <description>Spring公共配置</description>
    <!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
    <context:component-scan base-package="com.yihu.wlyy">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
    <task:annotation-driven/>
    <!-- 此处对于定时时间的配置会被注解中的时间配置覆盖,因此,以注解配置为准 -->
    <!-- task:scheduled-tasks scheduler="followUpScheduler">
        <task:scheduled ref="followUpTask" method="push" cron="0 0 6 * * *"/>  
    </task:scheduled-tasks>
    <task:scheduler id="followUpScheduler" pool-size="10"/ -->
    <!-- Jpa Entity Manager 配置 -->
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          autowire-candidate="default">
        <property name="dataSource" ref="dataSource"/>
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
        <property name="packagesToScan" value="com.yihu.wlyy.entity"/>
        <property name="jpaProperties">
            <props>
                <!-- 命名规则 My_NAME->MyName -->
                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <bean id="entityManagerFactoryHealth" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSourceHealth"/>
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapterHealth"/>
        <property name="packagesToScan" value="com.yihu.wlyy.health.entity"/>
        <property name="jpaProperties">
            <props>
                <!-- 命名规则 My_NAME->MyName -->
                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>
    <bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="databasePlatform">
            <bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
                <constructor-arg ref="dataSource"/>
            </bean>
        </property>
    </bean>
    <bean id="hibernateJpaVendorAdapterHealth" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="databasePlatform">
            <bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
                <constructor-arg ref="dataSourceHealth"/>
            </bean>
        </property>
    </bean>
    <!-- Spring Data Jpa配置 -->
    <jpa:repositories base-package="com.yihu.wlyy.repository" transaction-manager-ref="transactionManager"
                      entity-manager-factory-ref="entityManagerFactory"/>
    <jpa:repositories base-package="com.yihu.wlyy.health.repository" transaction-manager-ref="transactionManagerHealth"
                      entity-manager-factory-ref="entityManagerFactoryHealth"/>
    <!-- Jpa 事务配置 -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    <!-- Jpa 事务配置 -->
    <bean id="transactionManagerHealth" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactoryHealth"/>
    </bean>
    <!-- 使用annotation定义事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
    <tx:annotation-driven transaction-manager="transactionManagerHealth" proxy-target-class="true"/>
    <!-- JSR303 Validator定义 -->
    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource"/>
    </bean>
    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
    <!--quartz任务调度器名称,调度器只能加载与名称相同的任务-->
    <!--<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">-->
    <!--<property name="dataSource" ref="dataSource"/>-->
    <!--<property name="configLocation" value="classpath:/quartz.properties" />-->
    <!--<property name="autoStartup" value="true"/>-->
    <!--</bean>-->
    <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxIdle" value="${redis.maxIdle}"/>
        <property name="maxTotal" value="${redis.maxActive}"/>
        <property name="maxWaitMillis" value="${redis.maxWait}"/>
        <property name="testOnBorrow" value="${redis.testOnBorrow}"/>
    </bean>
    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
        <property name="hostName" value="${redis.host}"></property>
        <property name="port" value="${redis.port}"></property>
        <property name="password" value="${redis.password}"></property>
        <property name="database" value="0"></property>
        <property name="poolConfig" ref="poolConfig"></property>
    </bean>
    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
        <property name="connectionFactory" ref="connectionFactory"/>
    </bean>
    <util:properties id="sys" location="classpath*:/system.properties"/>
    <beans>
        <context:property-placeholder ignore-unresolvable="true"
                                      location="classpath*:/application.properties"/>
        <!-- 数据源配置, 使用Tomcat JDBC连接池 -->
        <bean id="dataSourceHealth" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <!-- Connection Info -->
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${health.jdbc.url}"/>
            <property name="username" value="${health.jdbc.username}"/>
            <property name="password" value="${health.jdbc.password}"/>
            <!-- Connection Pooling Info -->
            <property name="maxActive" value="${jdbc.pool.maxActive}"/>
            <property name="maxIdle" value="${jdbc.pool.maxIdle}"/>
            <property name="minIdle" value="0"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
    </beans>
    <!-- production环境 -->
    <beans profile="production">
        <context:property-placeholder ignore-unresolvable="true"
                                      location="classpath*:/application.properties"/>
        <!-- 数据源配置, 使用Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <!-- Connection Info -->
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <!-- Connection Pooling Info -->
            <property name="maxActive" value="${jdbc.pool.maxActive}"/>
            <property name="maxIdle" value="${jdbc.pool.maxIdle}"/>
            <property name="minIdle" value="0"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
        <!-- 数据源配置,使用应用服务器的数据库连接池 -->
        <!--<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/ExampleDB" />-->
    </beans>
    <!-- local development环境 -->
    <beans profile="development">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.development.properties"/>
        <!-- Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
    </beans>
    <!-- functional test 环境 -->
    <beans profile="functional">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.functional.properties,
          			  classpath*:/application.functional-local.properties"/>
        <!-- Tomcat JDBC连接池 -->
        <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
            <property name="driverClassName" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="defaultAutoCommit" value="false"/>
        </bean>
        <!-- 初始化数据表结构 -->
        <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
            <jdbc:script location="classpath:sql/${db.type}/schema.sql"/>
        </jdbc:initialize-database>
    </beans>
    <!-- unit test环境 -->
    <beans profile="test">
        <context:property-placeholder ignore-resource-not-found="true"
                                      location="classpath*:/application.properties,
          			  classpath*:/application.test.properties"/>
        <!-- Spring Simple连接池 -->
        <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
            <property name="driverClass" value="${jdbc.driver}"/>
            <property name="url" value="${jdbc.url}"/>
            <property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>
        </bean>
        <!-- 初始化数据表结构 与默认数据-->
        <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
            <jdbc:script location="classpath:sql/mysql/schema.sql"/>
            <!-- jdbc:script location="classpath:data/h2/import-data.sql" encoding="UTF-8"/ -->
        </jdbc:initialize-database>
    </beans>
</beans>

BIN
patient-co-wlyy/src/main/resources/fastdfs_lib.jar


+ 0 - 0
patient-co-wlyy/src/main/resources/kaptcha-2.3.2.jar


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov