Selaa lähdekoodia

新增后台管理项目

chenweida 7 vuotta sitten
vanhempi
commit
6e599f5c37
100 muutettua tiedostoa jossa 13944 lisäystä ja 0 poistoa
  1. 5 0
      common-lib/pom.xml
  2. 241 0
      patient-co-manage/wlyy-manage/pom.xml
  3. 25 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/Application.java
  4. 37 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/DataSourceConfig.java
  5. 62 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryDeviceConfig.java
  6. 66 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryWlyyConfig.java
  7. 109 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  8. 46 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  9. 49 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/WebMvcConfig.java
  10. 621 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/BaseController.java
  11. 237 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/FileUploadController.java
  12. 134 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/LoginController.java
  13. 22 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/LogoutController.java
  14. 146 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/RegisterController.java
  15. 86 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/district/DistrictController.java
  16. 48 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/label/SignPatientLabelController.java
  17. 32 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/AdminController.java
  18. 17 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/MainController.java
  19. 127 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/account/ShiroDbRealm.java
  20. 132 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/appeal/AppealController.java
  21. 29 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/basedata/BaseDataImportController.java
  22. 112 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/consult/ConsultRemindController.java
  23. 134 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/consult/ConsultReplyController.java
  24. 46 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java
  25. 134 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java
  26. 63 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java
  27. 162 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/ManageDictController.java
  28. 194 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/ManageDictEntryController.java
  29. 42 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/SystemDictController.java
  30. 112 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/feedback/FeedbackController.java
  31. 318 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/hos/HosController.java
  32. 613 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/hos/HosDoctorController.java
  33. 362 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/NotificationController.java
  34. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeController.java
  35. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeObjectController.java
  36. 8 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeScopeController.java
  37. 267 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/patient/AdminPatientController.java
  38. 235 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/sign/SignFamilyController.java
  39. 208 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyQuestionController.java
  40. 179 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateController.java
  41. 300 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/team/WlyyAdminTeamController.java
  42. 429 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageFeatureController.java
  43. 235 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRoleFeatureController.java
  44. 173 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRoleUserController.java
  45. 255 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRolesController.java
  46. 220 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/UserController.java
  47. 44 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/wlyyrole/WlyyRoleController.java
  48. 60 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/wlyyrole/WlyyUserRoleController.java
  49. 205 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndex.java
  50. 189 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/WlyyDevice.java
  51. 11 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/repository/DeviceHealthIndexDao.java
  52. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/repository/WlyyDeviceDao.java
  53. 55 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/City.java
  54. 54 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DictEntryKey.java
  55. 108 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmDevice.java
  56. 56 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmDeviceCategory.java
  57. 65 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmHospitalDeptType.java
  58. 59 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmJob.java
  59. 408 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java
  60. 244 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Followup.java
  61. 174 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Hospital.java
  62. 61 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/HospitalDept.java
  63. 44 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/IdEntity.java
  64. 86 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageDict.java
  65. 91 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageDictEntry.java
  66. 104 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageFeature.java
  67. 57 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoleFeature.java
  68. 57 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoleUser.java
  69. 67 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoles.java
  70. 285 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java
  71. 327 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java
  72. 45 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Province.java
  73. 90 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SMS.java
  74. 505 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java
  75. 94 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignPatientLabel.java
  76. 133 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SocialSecurityInfo.java
  77. 75 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Street.java
  78. 106 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SystemDict.java
  79. 152 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SystemDictList.java
  80. 75 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Town.java
  81. 413 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/User.java
  82. 64 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/UserRole.java
  83. 124 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAdminTeam.java
  84. 140 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAdminTeamMember.java
  85. 183 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNotice.java
  86. 89 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNoticeObject.java
  87. 133 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNoticeScope.java
  88. 138 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyConsult.java
  89. 295 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyConsultTeam.java
  90. 118 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyDoctorTeam.java
  91. 98 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyDoctorTeamMember.java
  92. 129 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDevice.java
  93. 57 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyRole.java
  94. 33 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyRoleArea.java
  95. 67 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyUserRole.java
  96. 111 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/consult/WlyyConsultRemindLog.java
  97. 220 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/consult/WlyyReplyConsult.java
  98. 128 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/feedback/Appeal.java
  99. 118 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java
  100. 0 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyLabelInfo.java

+ 5 - 0
common-lib/pom.xml

@ -30,6 +30,11 @@
        <module>../patient-co-service/wlyy_service</module> <!--其他业务同步-->
        <module>../patient-co-service/wlyy_sign</module> <!--签约同步-->
        <module>../patient-co-service/wlyy_device</module> <!--设备-->
        <!--wlyy后台管理-->
        <module>../patient-co-manage/wlyy-manage</module> <!--i健康后台管理系统-->
    </modules>
</project>

+ 241 - 0
patient-co-manage/wlyy-manage/pom.xml

@ -0,0 +1,241 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yihu</groupId>
    <artifactId>wlyy-manage</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>wlyy-manager</name>
    <url>http://maven.apache.org</url>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <springside.version>4.2.3-GA</springside.version>
        <shiro.version>1.2.3</shiro.version>
        <commons-lang3.version>3.3.2</commons-lang3.version>
        <guava.version>17.0</guava.version>
        <jackson.version>2.4.0</jackson.version>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <dependencies>
        <!-- 能启动,访问 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <!--<exclusion>-->
                    <!--<groupId>org.springframework.boot</groupId>-->
                    <!--<artifactId>spring-boot-starter-logging</artifactId>-->
                <!--</exclusion>-->
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
            <!--<scope>provided</scope>-->
        <!--</dependency>-->
        <!-- 数据库 +application。properties文件 或yml文件-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <!-- servlet 依赖. -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- 使用intellij作为集成开发环境 本地测试时打开,要布署到正式线时要注释-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- 以上 -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <!-- 正常启动,数据库访问。页面显示后其他依赖-->
        <!-- GENERAL UTILS begin -->
        <dependency>
            <groupId>com.belerweb</groupId>
            <artifactId>pinyin4j</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160212</version>
        </dependency>
        <!-- JSON end -->
        <!-- SPRINGSIDE -->
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>${springside.version}</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk16</artifactId>
            <version>1.46</version>
        </dependency>
        <!-- SECURITY begin -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring</artifactId>
            <version>${shiro.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-ehcache</artifactId>
            <version>${shiro.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <!-- SECURITY end -->
        <dependency>
            <groupId>sehrCrypto</groupId>
            <artifactId>sehrCrypto</artifactId>
            <version>1.0.0</version>
        </dependency>
        <!-- Apache Commons fileupload -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!-- Apache Commons fileupload end -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.14</version>
        </dependency>
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
        <!-- swagger ui -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.4.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>classmate</artifactId>
                    <groupId>com.fasterxml</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jexcelapi</groupId>
            <artifactId>jxl</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>org.springframework.security</groupId>-->
        <!--<artifactId>spring-security-core</artifactId>-->
        <!--<version>4.0.0.RELEASE</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <!--https://mvnrepository.com/artifact/org.springframework.security/spring-security-taglibs-->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>wlyy-manage</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin </artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

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

@ -0,0 +1,25 @@
package com.yihu.wlyy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016/6/18.
 */
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}

+ 37 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/DataSourceConfig.java

@ -0,0 +1,37 @@
package com.yihu.wlyy.config;
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 javax.sql.DataSource;
/**
 * Created by yww on 2016/12/1.
 * 多数据源配置
 */
@Configuration
public class DataSourceConfig {
    @Bean(name="deviceDataSource")
    @ConfigurationProperties(prefix="spring.datasource.device")
    public DataSource secondaryDataSource() {
        return DataSourceBuilder.create().build();
    }
    /*@Bean(name="fvDataSource")
    @ConfigurationProperties(prefix="spring.datasource.fv")
    public DataSource fvDataSource() {
        return DataSourceBuilder.create().build();
    }*/
    @Bean(name="wlyyDataSource")
    @Primary // 默认数据源
    @ConfigurationProperties(prefix="spring.datasource.wlyy")
    public DataSource primaryDataSource() {
        return DataSourceBuilder.create().build();
    }
}

+ 62 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryDeviceConfig.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
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.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import java.util.Map;
/**
 * Created by Administrator on 2016/12/1.
 * 设备device数据库jpa支持配置
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef="entityManagerFactoryDevice",
        transactionManagerRef="transactionManagerDevice",
        basePackages= { "com.yihu.wlyy.device.repository" })
public class RepositoryDeviceConfig {
    @Autowired
    private JpaProperties jpaProperties;
    @Autowired
    @Qualifier("deviceDataSource")
    private DataSource deviceDataSource;
    @Bean(name = "entityManagerDevice")
    public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
        return entityManagerFactory(builder).getObject().createEntityManager();
    }
    @Bean(name = "entityManagerFactoryDevice")
    public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
        return builder
                .dataSource(deviceDataSource)
                .properties(getVendorProperties(deviceDataSource))
                .packages("com.yihu.wlyy.device.entity")
                .persistenceUnit("secondaryPersistenceUnit")
                .build();
    }
    private Map<String, String> getVendorProperties(DataSource dataSource) {
        return jpaProperties.getHibernateProperties(dataSource);
    }
    @Bean(name = "transactionManagerDevice")
    PlatformTransactionManager transactionManager(EntityManagerFactoryBuilder builder) {
        return new JpaTransactionManager(entityManagerFactory(builder).getObject());
    }
}

+ 66 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryWlyyConfig.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
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.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import java.util.Map;
/**
 * Created by yww on 2016/12/1.
 * 主数据库wlyy的jpa支持配置
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef="entityManagerFactory",
        transactionManagerRef="transactionManager",
        basePackages= { "com.yihu.wlyy.repository" })
public class RepositoryWlyyConfig {
    @Autowired
    private JpaProperties jpaProperties;
    @Autowired @Qualifier("wlyyDataSource")
    private DataSource dataSource;
    @Bean(name = "entityManager")
    @Primary
    public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
        return entityManagerFactory(builder).getObject().createEntityManager();
    }
    @Bean(name = "entityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
        return builder
                .dataSource(dataSource)
                .properties(getVendorProperties(dataSource))
                .packages("com.yihu.wlyy.entity")
                .persistenceUnit("persistenceUnit")
                .build();
    }
    private Map<String, String> getVendorProperties(DataSource dataSource) {
        return jpaProperties.getHibernateProperties(dataSource);
    }
    @Bean(name = "transactionManager")
    @Primary
    PlatformTransactionManager transactionManagerSecondary(EntityManagerFactoryBuilder builder) {
        return new JpaTransactionManager(entityManagerFactory(builder).getObject());
    }
}

+ 109 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -0,0 +1,109 @@
package com.yihu.wlyy.config;
import com.yihu.wlyy.filter.AccessDecisionManagerImpl;
import com.yihu.wlyy.filter.AccessDeniedHandlerImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.security.access.AccessDecisionManager;
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.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler;
/**
 * @author lincl
 * @version 1.0
 * @created 2016/7/21
 */
@EnableWebSecurity
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    public void configure(WebSecurity web) throws Exception {
        // 设置不拦截规则
        web.ignoring().antMatchers(
                "/static/**",
                "/error/**",
                "/out",
                "/**.jsp",
                "/common/**",
                "/login/**",
                "/admin/hos/doctor/importFromExcel",
                "/admin/hos/doctor/importData",
                "/admin/team/importData",
                "/admin/hos/importData",
                "/admin/hos/doctor/toExcel",
                "/admin/basedata/importData",
                "/admin/wlyyUserRole/importData",
                "/WEB—INF/views/**"
        );
    }
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // 设置拦截规则
        http
                .authorizeRequests()
                .accessDecisionManager(accessDecisionManager())
                .expressionHandler(webSecurityExpressionHandler())
//                .antMatchers("/login").permitAll()
//                .antMatchers("/admin/main").permitAll()
//                .antMatchers("/login/**").permitAll()
//                .antMatchers("/admin/**").authenticated()
                .antMatchers("/admin/**").hasRole("USER")
                .and()
                .exceptionHandling().accessDeniedHandler(accessDeniedHandler())
                .and()
//                .headers().frameOptions().disable();//取消jfame的安全验证
//                .and()
                .headers().disable();
        // 自定义登录页面
//        http.csrf().disable().formLogin().loginPage("/login").permitAll();
        // 自定义注销
//        http.logout().logoutUrl("/logout").logoutSuccessUrl("/login")
//                .invalidateHttpSession(true);
        // session管理
//        http.sessionManagement().sessionFixation().changeSessionId()
//                .maximumSessions(1).expiredUrl("/");
        // RemeberMe  和UserDetailsService合作 用来保存用户信息, 一段时间内可以不用在输入用户名和密码登录,暂不使用该功能
//        http.rememberMe().key("webmvc#FD637E6D9C0F1A5A67082AF56CE32485");
    }
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    }
    /*
     * 最终访问控制器
     */
    @Bean(name = "accessDecisionManager")
    public AccessDecisionManager accessDecisionManager() {
        return new AccessDecisionManagerImpl();
    }
    /*
     * 错误信息拦截器
     */
    @Bean(name = "accessDeniedHandler")
    public AccessDeniedHandlerImpl accessDeniedHandler() {
        AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
//        accessDeniedHandler.setErrorPage("/error/403.jsp");
        return accessDeniedHandler;
    }
    /*
     * 表达式控制器
     */
    @Bean(name = "expressionHandler")
    public DefaultWebSecurityExpressionHandler webSecurityExpressionHandler() {
        DefaultWebSecurityExpressionHandler webSecurityExpressionHandler = new DefaultWebSecurityExpressionHandler();
        return webSecurityExpressionHandler;
    }
}

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

@ -0,0 +1,46 @@
package com.yihu.wlyy.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableWebMvc
@EnableSwagger2
@ComponentScan("com.yihu.wlyy.controller")
public class SwaggerConfig extends WebMvcConfigurerAdapter {
    @Bean
    public Docket patientApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Wlyy-manager")
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .build()
                .apiInfo(patientApiInfo());
    }
    private ApiInfo patientApiInfo() {
        return new ApiInfoBuilder()
                .title("三师后台管理 RESTful APIs")
                .description("三师后台管理 Rest API, all the applications could access the Object model data via JSON")
                .termsOfServiceUrl("NO terms of service")
                .version("1.0")
                .contact(new Contact("yww@jkzl.com", "", ""))
                .license("The Apache License, Version 2.0")
                .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
                .build();
    }
}

+ 49 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/WebMvcConfig.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@EnableWebMvc
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }
    @Bean
    public InternalResourceViewResolver viewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        resolver.setOrder(1);
        return resolver;
    }
    @Bean
    public ResourceBundleMessageSource messageSource() {
        ResourceBundleMessageSource resolver = new ResourceBundleMessageSource();
        resolver.setBasenames("text/message");
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
//    //定义拦截器
//    @Bean
//    UserSessionInterceptor userSessionInterceptor() {
//        return new UserSessionInterceptor();
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(userSessionInterceptor())
//                .addPathPatterns("/admin/**");
//    }
}

+ 621 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/BaseController.java

@ -0,0 +1,621 @@
package com.yihu.wlyy.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.controller.manager.account.ShiroDbRealm.ShiroUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
public class BaseController {
	private static Logger logger = LoggerFactory.getLogger(BaseController.class);
	@Autowired
	protected HttpServletRequest request;
	/**
	 * 获取排序字段名称
	 * @return
	 */
	public String getSortName() {
		return request.getParameter("sortname");
	}
	/**
	 * 获取排序方式ASC,DESC
	 * @return
	 */
	public String getSortOrder() {
		return request.getParameter("sortorder");
	}
	/**
	 * 取出Shiro中的当前用户Id.
	 */
	public Long getCurrentUserId() {
		ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
		return user.id;
	}
	/**
	 * 取出Shiro中的当前用户标识.
	 */
	public String getCurrentUserCode() {
		ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
		return user.code;
	}
	/**
	 * 獲取髮送請求用戶的uid
	 * @return
	 */
	public String getUID() {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			return json.getString("uid");
		} catch (Exception e) {
			return null;
		}
	}
	public String getOpenid() {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			return json.getString("openid");
		} catch (Exception e) {
			return null;
		}
	}
	/**
	 * 获取用户ID
	 * @return
	 */
	public long getId() {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			return json.getLong("id");
		} catch (Exception e) {
			return 0;
		}
	}
	public String getIMEI() {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			return json.getString("imei");
		} catch (Exception e) {
			return null;
		}
	}
	public String getToken() {
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			return json.getString("token");
		} catch (Exception e) {
			return null;
		}
	}
	public void error(Exception e) {
		logger.error(getClass().getName() + ":", e.getMessage());
		e.printStackTrace();
	}
	public void warn(Exception e) {
		logger.warn(getClass().getName() + ":", e.getMessage());
		e.printStackTrace();
	}
	/**
	 * 返回接口处理结果
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @return
	 */
	public String error(int code, String msg) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return null;
		}
	}
	/**
	 * 接口处理成功
	 * @param msg
	 * @return
	 */
	public String success(String msg) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", 200);
			map.put("msg", msg);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return null;
		}
	}
	public String write(int code, String msg) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return null;
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @return
	 */
	public String write(int code, String msg, String key, List<?> list) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, list);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @param value 结果数据
	 * @return
	 */
	public String write(int code, String msg, String key, JSONObject value) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			json.put(key, value);
			return json.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @param value 结果数据
	 * @return
	 */
	public String write(int code, String msg, String key, JSONArray value) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			json.put(key, value);
			return json.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @param total 总数
	 * @param value 结果数据
	 * @return
	 */
	public String write(int code, String msg, int total, String key, JSONArray value) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			json.put("total", total);
			json.put(key, value);
			return json.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @param value 结果数据
	 * @return
	 */
	public String write(int code, String msg, String key, Object value) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, value);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @return
	 */
	public String write(int code, String msg, String key, Page<?> list) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			// 是否为第一页
			map.put("isFirst", list.isFirst());
			// 是否为最后一页
			map.put("isLast", list.isLast());
			// 总条数
			map.put("total", list.getTotalElements());
			// 总页数
			map.put("totalPages", list.getTotalPages());
			map.put(key, list.getContent());
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @return
	 */
	public String write(int code, String msg, String key, Page<?> page, JSONArray array) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			// 是否为第一页
			json.put("isFirst", page.isFirst());
			// 是否为最后一页
			json.put("isLast", page.isLast());
			// 总条数
			json.put("total", page.getTotalElements());
			// 总页数
			json.put("totalPages", page.getTotalPages());
			json.put(key, array);
			return json.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @param value 结果数据
	 * @return
	 */
	public String write(int code, String msg, String key, Map<?, ?> value) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, value);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	* 返回接口处理结果
	*
	* @param code 结果码,成功为200
	* @param msg 结果提示信息
	* @param value 结果数据
	* @return
	*/
	public String write(int code, String msg, String key, String value) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, value);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	* 返回接口处理结果
	*
	*
	* @param code 结果码,成功为200
	* @param msg 结果提示信息
	* @return
	*/
	public String write(int code, String msg, String key, IdEntity entity) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, entity);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果
	 * 
	 * 
	 * @param code 结果码,成功为200
	 * @param msg 结果提示信息
	 * @return
	 */
	public String write(int code, String msg, boolean isFirst, boolean isLast, long total, int totalPages, String key, Object values) {
		try {
			JSONObject json = new JSONObject();
			json.put("status", code);
			json.put("msg", msg);
			// 是否为第一页
			json.put("isFirst", isFirst);
			// 是否为最后一页
			json.put("isLast", isLast);
			// 总条数
			json.put("total", total);
			// 总页数
			json.put("totalPages", totalPages);
			json.put(key, values);
			return json.toString();
		} catch (Exception e) {
			logger.error("BaseController:", e.getMessage());
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	public String trimEnd(String param, String trimChars) {
		if (param.endsWith(trimChars)) {
			param = param.substring(0, param.length() - trimChars.length());
		}
		return param;
	}
	/**
	 * 无效用户消息返回
	 * @param e
	 * @param defaultCode
	 * @param defaultMsg
	 * @return
	 */
	public String invalidUserException(Exception e, int defaultCode, String defaultMsg) {
		try {
			// if (e instanceof UndeclaredThrowableException) {
			// UndeclaredThrowableException ute = (UndeclaredThrowableException) e;
			// InvalidUserException iue = (InvalidUserException) ute.getUndeclaredThrowable();
			// if (iue != null) {
			// return error(iue.getCode(), iue.getMsg());
			// }
			// }
			return error(defaultCode, defaultMsg);
		} catch (Exception e2) {
			return null;
		}
	}
	/**
	 * 返回表格列表数据
	 * @param code 状态码:0成功,非0失败
	 * @param errorMsg 错误消息
	 * @param page 当前页码
	 * @param rows 分页大小
	 * @param list 查询的结果集
	 * @return
	 */
	public String write(int code, String errorMsg, int page, int rows, Page<?> list) {
		try {
			JSONObject object = new JSONObject();
			ObjectMapper mapper = new ObjectMapper();
			object.put("successFlg", code == 0);
			object.put("errorMsg", errorMsg);
			// 是否为第一页
			object.put("errorCode", code);
			// 是否为最后一页
			object.put("currPage", page);
			// 分页大小
			object.put("pageSize", rows);
			// 总条数
			object.put("totalCount", list.getTotalElements());
			// 总页数
			object.put("totalPage", list.getTotalPages());
			// 结果集
			object.put("detailModelList", list.getContent());
			 return object.toString();
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	
	public String write(int code, String errorMsg, int page, int rows, List<?> list) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("successFlg", code == 0);
			map.put("errorMsg", errorMsg);
			// 是否为第一页
			map.put("errorCode", code);
			// 是否为最后一页
			map.put("currPage", page);
			// 分页大小
			map.put("pageSize", rows);
			// 总条数
			map.put("totalCount", list.size());
			// 总页数
			map.put("totalPage", 1);
			// 结果集
			map.put("detailModelList", list);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	
	public String error(int code, String errorMsg, int page, int rows) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("successFlg", code == 0);
			map.put("errorMsg", errorMsg);
			// 是否为第一页
			map.put("errorCode", code);
			// 是否为最后一页
			map.put("currPage", page);
			// 分页大小
			map.put("pageSize", rows);
			// 总条数
			map.put("totalCount", 0);
			// 总页数
			map.put("totalPage", 0);
			// 结果集
			map.put("detailModelList", null);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
    //json串转集合
    public <T> Collection<T> jsonToEntities(String jsonDate, Collection<T> targets, Class<T> targetCls) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            List modelList = objectMapper.readValue(jsonDate,List.class);
            Iterator ex = modelList.iterator();
            while(ex.hasNext()) {
                Object aModelList = ex.next();
                String objJsonData = objectMapper.writeValueAsString(aModelList);
                T model = objectMapper.readValue(objJsonData, targetCls);
                targets.add(model);
            }
            return targets;
        } catch (Exception var8) {
            var8.printStackTrace();
            return null;
        }
    }
    public String write(int code, String errorMsg, int page, int rows, long total, List<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("successFlg", code == 0);
            map.put("errorMsg", errorMsg);
            // 是否为第一页
            map.put("errorCode", code);
            // 是否为最后一页
            map.put("currPage", page);
            // 分页大小
            map.put("pageSize", rows);
            // 总条数
            map.put("totalCount", total);
            // 总页数
            map.put("totalPage", 1);
            // 结果集
            map.put("detailModelList", list);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
}

+ 237 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/FileUploadController.java

@ -0,0 +1,237 @@
//package com.yihu.wlyy.controller.common;
//
//import com.yihu.wlyy.controller.BaseController;
//import com.yihu.wlyy.util.DateUtil;
//import com.yihu.wlyy.util.ImageCompress;
//import com.yihu.wlyy.util.SystemConf;
//import org.apache.commons.io.FileUtils;
//import org.json.JSONObject;
//import org.springframework.stereotype.Controller;
//import org.springframework.util.FileCopyUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.multipart.MultipartFile;
//import org.springframework.web.multipart.MultipartHttpServletRequest;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.File;
//import java.io.IOException;
//import java.text.SimpleDateFormat;
//import java.util.*;
//
//@Controller
//@RequestMapping(value = "/upload")
//public class FileUploadController extends BaseController {
//
//	/**
//	 * 图片上传
//	 * @return
//	 * @throws IOException
//	 * @throws IllegalStateException
//	 */
//	@RequestMapping(value = "image", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
//	@ResponseBody
//	public String image(HttpServletRequest request, HttpServletResponse response) {
//		// 圖片列表
//		List<File> images = new ArrayList<File>();
//		List<String> tempPaths = new ArrayList<String>();
//		// 文件保存的临时路径
//		String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
//		// 拼接年月日路径
//		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
//		try {
//			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
//			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
//			// 创建文件夹
//			File file = new File(tempPath + datePath);
//			if (!file.exists()) {
//				file.mkdirs();
//			}
//			String fileName = null;
//			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
//				// 上传文件
//				MultipartFile mf = entity.getValue();
//				fileName = mf.getOriginalFilename();
//				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
//				// 重命名文件
//				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
//				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
//				File uploadFile = new File(tempPath + datePath + newFileName);
//				// 拷贝文件流到指定文件路径
//				FileCopyUtils.copy(mf.getBytes(), uploadFile);
//				// 生成缩略图
//				ImageCompress.compress(uploadFile.getAbsolutePath(), uploadFile.getAbsolutePath() + "_small", 300, 300);
//				// 添加到上传成功数组中
//				images.add(uploadFile);
//				tempPaths.add(datePath + newFileName);
//			}
//			String urls = "";
//			for (String image : tempPaths) {
//				if (urls.length() == 0) {
//					urls = image;
//				} else {
//					urls += "," + image;
//				}
//			}
//			JSONObject json = new JSONObject();
//			json.put("status", 200);
//			json.put("msg", "上传成功");
//			// 图片标识对象的HTTP链接
//			json.put("urls", urls);
//			System.out.println("图片上传:" + json.toString());
//			return json.toString();
//		} catch (Exception e) {
//			error(e);
//			try {
//				// 清除垃圾图片
//				for (File file : images) {
//					FileUtils.forceDelete(file);
//				}
//			} catch (Exception e2) {
//				error(e2);
//			}
//			return error(-1, "上传失败");
//		}
//	}
//
//	/**
//	 * 聊天附件上传
//	 * @return
//	 * @throws IOException
//	 * @throws IllegalStateException
//	 */
//	@RequestMapping(value = "chat", method = RequestMethod.POST)
//	@ResponseBody
//	public String chatFile(HttpServletRequest request, HttpServletResponse response) {
//		// 圖片列表
//		List<File> files = new ArrayList<File>();
//		List<String> tempPaths = new ArrayList<String>();
//		// 获取聊天文件保存路径
//		String tempPath = SystemConf.getInstance().getChatPath() + File.separator;
//		// 拼接年月日路径
//		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
//		try {
//			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
//			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
//			// 创建文件夹
//			File file = new File(tempPath + datePath);
//			if (!file.exists()) {
//				file.mkdirs();
//			}
//			String fileName = null;
//			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
//				// 上传文件
//				MultipartFile mf = entity.getValue();
//				fileName = mf.getOriginalFilename();
//				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
//				// 重命名文件
//				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
//				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
//				File uploadFile = new File(tempPath + datePath + newFileName);
//				// 拷贝文件流到指定文件路径
//				FileCopyUtils.copy(mf.getBytes(), uploadFile);
//				// 添加到上传成功数组中
//				files.add(uploadFile);
//				tempPaths.add(datePath + newFileName);
//			}
//			String urls = "";
//			for (String temp : tempPaths) {
//				if (urls.length() == 0) {
//					urls = SystemConf.getInstance().getChatServer() + temp;
//				} else {
//					urls += "," + SystemConf.getInstance().getChatServer() + temp;
//				}
//			}
//			JSONObject json = new JSONObject();
//			json.put("status", 200);
//			json.put("msg", "上传成功");
//			// 图片标识对象的HTTP链接
//			json.put("urls", urls);
//			System.out.println("附件上传:" + json.toString());
//			return json.toString();
//		} catch (Exception e) {
//			error(e);
//			try {
//				// 清除垃圾图片
//				for (File file : files) {
//					FileUtils.forceDelete(file);
//				}
//			} catch (Exception e2) {
//				error(e2);
//			}
//			return error(-1, "上传失败");
//		}
//	}
//
//	/**
//	 * 语音上传
//	 * @param request
//	 * @param response
//	 * @return
//	 */
//	@RequestMapping(value = "voice", method = RequestMethod.POST)
//	@ResponseBody
//	public String voice(HttpServletRequest request, HttpServletResponse response) {
//		// 圖片列表
//		List<File> voices = new ArrayList<File>();
//		List<String> tempPaths = new ArrayList<String>();
//		// 文件保存的临时路径
//		String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
//		// 拼接年月日路径
//		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
//		try {
//			MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
//			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
//			// 创建文件夹
//			File file = new File(tempPath + datePath);
//			if (!file.exists()) {
//				file.mkdirs();
//			}
//			String fileName = null;
//			for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
//				// 上传文件
//				MultipartFile mf = entity.getValue();
//				fileName = mf.getOriginalFilename();
//				String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
//				// 重命名文件
//				SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
//				String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
//				File uploadFile = new File(tempPath + datePath + newFileName);
//				// 拷贝文件流到指定文件路径
//				FileCopyUtils.copy(mf.getBytes(), uploadFile);
//				// 添加到上传成功数组中
//				voices.add(uploadFile);
//				tempPaths.add(datePath + newFileName);
//			}
//			String urls = "";
//			for (String voice : tempPaths) {
//				if (urls.length() == 0) {
//					urls = voice;
//				} else {
//					urls += "," + voice;
//				}
//			}
//			JSONObject json = new JSONObject();
//			json.put("status", 200);
//			json.put("msg", "上传成功");
//			// 图片标识对象的HTTP链接
//			json.put("urls", urls);
//			System.out.println("语音上传:" + json.toString());
//			return json.toString();
//		} catch (Exception e) {
//			error(e);
//			try {
//				// 清除垃圾图片
//				for (File file : voices) {
//					FileUtils.forceDelete(file);
//				}
//			} catch (Exception e2) {
//				error(e2);
//			}
//			return error(-1, "上传失败");
//		}
//	}
//
//}

+ 134 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/LoginController.java

@ -0,0 +1,134 @@
package com.yihu.wlyy.controller.common.account;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageFeature;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.repository.WlyyUserRoleDao;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyUserRoleService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 * 用户登录的Controller.
 *
 * @author calvin
 */
@Controller
@RequestMapping(value = "/login")
@SessionAttributes("current_user")
public class LoginController extends BaseController {
    @Autowired
    UserService userService;
    @Autowired
    private WlyyUserRoleDao wlyyUserRoleDao;
    @Autowired
    private WlyyUserRoleService wlyyUserRoleService;
    @RequestMapping(value = "validation")
    @ResponseBody
    public void userValidation(Model model, HttpServletRequest req, HttpServletResponse resp, String userName, String password) throws Exception {
        User curUser = userService.userValidation(userName, password);
        ObjectMapper objectMapper = new ObjectMapper();
        if(curUser == null){
            req.setAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, "登入失败");
            req.getSession().setAttribute("isLogin", "false");
            resp.sendRedirect(req.getContextPath()+"/login");
        }else{
            model.addAttribute("current_user", curUser);
            //获取用户角色信息
            List<ManageFeature> features = getUserFeatures(curUser.getCode());
            Collection<GrantedAuthority> gas = new ArrayList<>();
            if (features != null) {
                for (ManageFeature feature : features) {
                    String url = feature.getUrl();
                    if (url != null && !StringUtils.isEmpty(feature.getUrl().trim()))
                        gas.add(new SimpleGrantedAuthority(feature.getUrl()));
                }
            }
            Collection<String> featureUrlList = new ArrayList<>();
            if (features != null) {
                for (ManageFeature feature : features) {
                    String url = feature.getUrl();
                    if (url != null && !StringUtils.isEmpty(url.trim()))
                        featureUrlList.add(url.trim());
                }
            }
            //区域权限
            List<Map<String, String>> roleMap = wlyyUserRoleService.getUserRoleAndArea(curUser.getCode());
            req.getSession().setAttribute("roleMap",roleMap);
            //TODO 改成来源字典
            if(curUser.getType() == 1){
                curUser.setTypeName("管理员");
            }
            if (StringUtils.equals("admin", curUser.getCode())) {
                curUser.setTypeName("超级管理员");
            }
            if(curUser.getType() == 2){
                curUser.setTypeName("医生");
            }
            if (curUser.getType() == 0) {
                curUser.setTypeName("其他");
            }
            req.getSession().setAttribute("userInfo",curUser);
            req.getSession().setAttribute("mobile", curUser.getMobile());
            req.getSession().setAttribute("code",curUser.getCode());
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("isLogin", "true");
            //生成认证token
            Authentication token = new UsernamePasswordAuthenticationToken(userName, password, gas);
            //将信息存放到SecurityContext
            SecurityContextHolder.getContext().setAuthentication(token);
            req.getSession().setAttribute("token", featureUrlList);
            //根据用户类型,获取跳转的url
            String url = userService.getValueByDictId(curUser.getType() + "");
//            resp.sendRedirect(req.getContextPath()+"/admin/main");
            resp.sendRedirect(url);
        }
    }
    //    //修改密码
//    @RequestMapping(value = "changePwd")
//    public void changePwd(
//            @RequestParam(value = "mobile")String mobile,
//            @RequestParam(value = "oldPwd")String oldPwd,
//            @RequestParam(value = "newPwd")String newPwd,
//            Model model,HttpServletRequest req, HttpServletResponse resp)throws Exception{
//            boolean res = userService.changePwd(mobile, oldPwd, newPwd);
//            if(!res){
//                model.addAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME,"修改密码失败");
//                req.setAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, "修改失败");
//                req.getSession().setAttribute("isLogin", "false");
//            }else {
//                model.addAttribute("changePwdCode","success");
//                req.setAttribute("changePwdCode","success");
//            }
//            resp.sendRedirect(req.getContextPath()+"/login");
//    }
    private List<ManageFeature> getUserFeatures(String userCode) {
        return userService.getUserFeatures(userCode);
    }
}

+ 22 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/LogoutController.java

@ -0,0 +1,22 @@
package com.yihu.wlyy.controller.common.account;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by yww on 2016/12/7.
 */
@Controller
@RequestMapping(value = "/logout")
public class LogoutController {
    @RequestMapping(value = "")
    public void login(HttpServletRequest request,HttpServletResponse response) throws Exception{
        request.getSession().removeAttribute("userInfo");
        request.getSession().removeAttribute("isLogin");
        response.sendRedirect(request.getContextPath() + "/login");
    }
}

+ 146 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/RegisterController.java

@ -0,0 +1,146 @@
package com.yihu.wlyy.controller.common.account;
import com.yihu.wlyy.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * 用户注册的Controller.
 * 
 * @author calvin
 */
@Controller
@RequestMapping(value = "/register")
public class RegisterController extends BaseController {
	// @Autowired
	// private DoctorService doctorService;
//	@Autowired
//	private PatientService patientService;
//	@Autowired
//	private SMSService smsService;
	// /**
	// * 医生注册
	// * @param name 医生姓名
	// * @param mobile 登录手机号
	// * @param password 登录密码
	// * @param captcha 手机验证码
	// * @return
	// */
	// @RequestMapping(value = "doctor")
	// @ResponseBody
	// public String doctor(String name, String mobile, String password, String captcha) {
	// try {
	// if (doctorService.findDoctorByMobile(mobile) != null) {
	// return error(-1, "该手机号已被注册!");
	// }
	// Doctor doctor = new Doctor();
	// doctor.setName(name);
	// doctor.setMobile(mobile);
	// doctor.setPassword(password);
	// JSONObject json = doctorService.registerDoctor(doctor, getIMEI());
	// if (json != null) {
	// // 注册成功
	// return write(200, "注册成功!", "data", json);
	// } else {
	// // 注册失败
	// return error(-1, "注册失败!");
	// }
	// } catch (Exception e) {
	// error(e);
	// return error(-1, "注册失败!");
	// }
	// }
//	/**
//	 * 患者注册
//	 * @param name 姓名
//	 * @param idcard 身份證號
//	 * @param ssc 社保卡号
//	 * @param mobile 登录手机号
//	 * @param captcha 手机验证码
//	 * @param type 1校验,2保存
//	 * @return
//	 */
//	@RequestMapping(value = "patient")
//	@ResponseBody
//	public String patient(String name, String idcard, String ssc, String mobile, String captcha, int type) {
//		try {
//			if (type != 1 && type != 2) {
//				return error(-1, "无效请求!");
//			}
//			if (StringUtils.isEmpty(name)) {
//				return error(-1, "姓名不允许为空!");
//			}
//			if (StringUtils.isEmpty(idcard)) {
//				return error(-1, "身份证号码不允许为空!");
//			}
//			if (StringUtils.isEmpty(ssc)) {
//				return error(-1, "社保卡号不允许为空!");
//			}
//			if (StringUtils.isEmpty(mobile)) {
//				return error(-1, "手机号码不允许为空!");
//			}
//			if (StringUtils.isEmpty(captcha)) {
//				return error(-1, "验证码不允许为空!");
//			}
//			if (StringUtils.isNotEmpty(getOpenid())) {
//				Patient patient = patientService.findByOpenid(getOpenid());
//				if (patient != null) {
//					return error(-1, "当前微信号已绑定身份证:" + CommonUtil.getIdcardEncode(patient.getIdcard()) + " !");
//				}
//			}
//			// 对验证码进行校验
//			int res = smsService.check(mobile, 1, captcha);
//			switch (res) {
//			case -2:
//				return error(-1, "验证码已过期!");
//			case -1:
//				return error(-1, "请输入正确的验证码!");
//			case 0:
//				return error(-1, "验证码无效!");
//			}
//			// 解密身份证号
//			idcard = RSAUtils.getInstance(patientService).decryptString(idcard);
//			idcard = URLDecoder.decode(idcard, "UTF-8");
//			idcard = StringUtils.reverse(idcard);
//			// 判断用户是否已注册
//			Patient patient = patientService.findByIdcard(idcard);
//			if (patient != null) {
//				return error(-1, "该帐号已绑定手机号" + CommonUtil.getMobileEncode(patient.getMobile()) + ",请直接使用此手机号登录");
//			}
//			patient = patientService.findBySsc(ssc);
//			if (patient != null) {
//				return error(-1, "该帐号已绑定手机号" + CommonUtil.getMobileEncode(patient.getMobile()) + ",请直接使用此手机号登录");
//			}
//			patient = patientService.findByMobile(mobile);
//			if (patient != null) {
//				return error(-1, "该手机号码已绑定其他身份证和医保卡,建议您重新输入新手机号码");
//			}
//			if (type == 2) {
//				patient = new Patient();
//				patient.setIdcard(idcard);
//				patient.setMobile(mobile);
//				patient.setName(name);
//				patient.setSsc(ssc);
//				patient.setOpenid(getOpenid());
//				JSONObject json = patientService.register(patient, getIMEI(), 1);
//				if (json != null) {
//					// 注册成功
//					return write(200, "注册成功!", "data", json);
//				} else {
//					// 注册失败
//					return error(-1, "注册失败!");
//				}
//			} else {
//				return success("验证通过!");
//			}
//		} catch (Exception e) {
//			error(e);
//			return error(-1, "注册失败!");
//		}
//	}
}

+ 86 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/district/DistrictController.java

@ -0,0 +1,86 @@
package com.yihu.wlyy.controller.common.district;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.common.district.DistrictService;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
 * 省市区三级地址控制类
 *
 * @author George
 */
@Controller
@RequestMapping(value = "common")
public class DistrictController extends BaseController {
    @Autowired
    private DistrictService districtService;
    /**
     * 省市一二三级查询接口
     *
     * @param type 1一级目录,2二级目录,3三级目录,4街道目录
     * @param code 省或市标识
     * @return
     */
    @RequestMapping(value = "district")
    @ResponseBody
    public String district(int type, String code) {
        try {
            List<?> list = districtService.findByType(type, code);
            return write(200, "查询成功!", "list", list);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 省市一二三级查询接口(包含权限控制)
     *
     * @param type 1一级目录,2二级目录,3三级目录,4街道目录
     * @param code 省或市标识
     * @return
     */
    @RequestMapping(value = "districtAuthority")
    @ResponseBody
    public String districtAuthority(int type, String code) {
        try {
            List<Map<String, String>> roleMap = (List<Map<String, String>>) request.getSession().getAttribute("roleMap");
            List<?> list = districtService.findByType(type, code, roleMap);
            return write(200, "查询成功!", "list", list);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/district/importData", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importData(HttpServletRequest request) {
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook workbook = Workbook.getWorkbook(inputStream);
            districtService.importStreet(workbook);
            return write(200, "操作成功");
        } catch (IOException | BiffException e) {
            e.printStackTrace();
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 48 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/label/SignPatientLabelController.java

@ -0,0 +1,48 @@
package com.yihu.wlyy.controller.common.label;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.SignPatientLabel;
import com.yihu.wlyy.repository.SignPatientLabelDao;
import com.yihu.wlyy.service.manager.sign.SignPatientLabelService;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * Created by yeshijie on 2017/1/22.
 */
@Controller
@RequestMapping(value = "common/label")
public class SignPatientLabelController extends BaseController {
    @Autowired
    private SignPatientLabelService signPatientLabelService;
    @Autowired
    private SignPatientLabelDao signPatientLabelDao;
    @RequestMapping(value = "signPatientLabel")
    @ResponseBody
    public String district(String labelType) {
        try {
            List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(labelType,1);
            JSONArray jsonArray = new JSONArray();
            if(list!=null&&list.size()>0){
                for (SignPatientLabel label:list){
                    JSONObject json = new JSONObject();
                    json.put("code",label.getLabelCode());
                    json.put("name",label.getLabelName());
                    jsonArray.put(json);
                }
            }
            return write(200, "查询成功!", "list", jsonArray);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 32 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/AdminController.java

@ -0,0 +1,32 @@
package com.yihu.wlyy.controller.manager;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * LoginController负责打开登录页面(GET请求)和登录出错页面(POST请求),
 * 
 * 真正登录的POST请求由Filter完成,
 * 
 * @author calvin
 */
@Controller
@RequestMapping(value = "/login")
public class AdminController {
	@RequestMapping(method = RequestMethod.GET)
	public String login() {
		return "login";
	}
	@RequestMapping(method = RequestMethod.POST)
	public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName, Model model) {
		model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
		return "login";
	}
}

+ 17 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/MainController.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.controller.manager;
import com.yihu.wlyy.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(value = "/admin")
public class MainController extends BaseController {
	@RequestMapping(value = "main", method = RequestMethod.GET)
	public String index() {
		return "main";
	}
}

+ 127 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/account/ShiroDbRealm.java

@ -0,0 +1,127 @@
package com.yihu.wlyy.controller.manager.account;
import com.google.common.base.Objects;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.service.manager.account.AdminService;
import com.yihu.wlyy.util.EncodesUtil;
import org.apache.shiro.authc.*;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.springside.modules.utils.Encodes;
import javax.annotation.PostConstruct;
import java.io.Serializable;
public class ShiroDbRealm extends AuthorizingRealm {
	protected AdminService adminService;
	/**
	 * 认证回调函数,登录时调用.
	 */
	@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
		UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
		User user = adminService.findUserByMobile(token.getUsername());
		if (user != null) {
			byte[] salt = Encodes.decodeHex(user.getSalt());
			return new SimpleAuthenticationInfo(new ShiroUser(user.getId(), user.getCode(), user.getMobile(), user.getName()), user.getPassword(), ByteSource.Util.bytes(salt), getName());
		} else {
			return null;
		}
	}
	/**
	 * 授权查询回调函数, 进行鉴权但缓存中无用户的授权信息时调用.
	 */
	@Override
	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
		ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal();
		User user = adminService.findUserByMobile(shiroUser.mobile);
		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
		info.addRoles(user.getRoleList());
		return info;
	}
	/**
	 * 设定Password校验的Hash算法与迭代次数.
	 */
	@PostConstruct
	public void initCredentialsMatcher() {
		HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(EncodesUtil.HASH_ALGORITHM);
		matcher.setHashIterations(EncodesUtil.HASH_INTERATIONS);
		setCredentialsMatcher(matcher);
	}
	public void setAdminService(AdminService adminService) {
		this.adminService = adminService;
	}
	/**
	 * 自定义Authentication对象,使得Subject除了携带用户的登录名外还可以携带更多信息.
	 */
	public static class ShiroUser implements Serializable {
		private static final long serialVersionUID = -1373760761780840081L;
		public Long id;
		public String mobile;
		public String name;
		public String code;
		public ShiroUser(Long id, String code, String mobile, String name) {
			this.id = id;
			this.mobile = mobile;
			this.name = name;
			this.code = code;
		}
		public String getName() {
			return name;
		}
		/**
		 * 本函数输出将作为默认的<shiro:principal/>输出.
		 */
		@Override
		public String toString() {
			return mobile;
		}
		/**
		 * 重载hashCode,只计算loginName;
		 */
		@Override
		public int hashCode() {
			return Objects.hashCode(mobile);
		}
		/**
		 * 重载equals,只计算loginName;
		 */
		@Override
		public boolean equals(Object obj) {
			if (this == obj) {
				return true;
			}
			if (obj == null) {
				return false;
			}
			if (getClass() != obj.getClass()) {
				return false;
			}
			ShiroUser other = (ShiroUser) obj;
			if (mobile == null) {
				if (other.mobile != null) {
					return false;
				}
			} else if (!mobile.equals(other.mobile)) {
				return false;
			}
			return true;
		}
	}
}

+ 132 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/appeal/AppealController.java

@ -0,0 +1,132 @@
package com.yihu.wlyy.controller.manager.appeal;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.service.manager.feedback.AppealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RequestMapping(value = "admin/appeal")
@Api(description = "管理系统账号申诉接口")
public class AppealController extends BaseController {
    @Autowired
    private AppealService appealService;
    //页面初始化数据
    @RequestMapping(value = "/initial", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "意见反馈")
    public String initFeedback() {
        return "appeal/appeal_list";
    }
    /**
     * 初始化列表页
     * @param type 账号申诉的类别
     * @param identity 身份
     * @param status 状态
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "列表")
    public String list(
            @RequestParam(required = false,defaultValue = "-1") int type,
            @RequestParam(required = false,defaultValue = "-1") int identity,
            @RequestParam(required = false,defaultValue = "-1") int status,
            @RequestParam(value = "page",defaultValue = "1") int page,
            @RequestParam(value = "rows",defaultValue = "15") int rows) {
        try {
            Page<Appeal> appeals = appealService.findAppeal(page, rows, type, identity, status);
            return write(200, "操作成功", page, rows, appeals);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "/delAppeal")
    @ResponseBody
    @ApiOperation(value="批量删除")
    public String delAppeal(
            @RequestParam(required = true) String ids){
        try{
            appealService.delappeal(ids);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    //跳转到意见详情页
    @RequestMapping(value = "showDetail", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "跳转到意见详情页")
    public String infoInit(Integer id ) {
        request.setAttribute("id",id);
        return "appeal/appeal_detail";
    }
    /**
     * 根据申诉ID查询申诉详情,并更改状态
     * @param id
     * @return
     */
    @RequestMapping(value = "getAppealById")
    @ResponseBody
    public String getAppealById(@RequestParam(value = "id") Long id) {
        try {
            Map appeal = appealService.getAppealById(id);
            return write(200, "操作成功!", "data", appeal);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    ////跳转到处理页面
    //@RequestMapping(value = "dealInit", method = RequestMethod.GET)
    //@ApiIgnore
    //@ApiOperation(value = "跳转到处理页面")
    //public String dealInit(Integer id ) {
    //    request.setAttribute("id",id);
    //    return "appeal/appeal_deal";
    //}
    /**
     * 根据申诉id,回复内容result进行处理
     * @param id
     * @param result
     * @return
     */
    @RequestMapping(value="dealAppeal")
    @ResponseBody
    public String dealAppeal(@RequestParam(required = true,value="id") Long id,
                             @RequestParam(required = true,value="result") String result){
        try {
            appealService.dealAppeal(id,result);
            return write(200,"操作成功!");
        }catch (Exception e){
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 29 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/basedata/BaseDataImportController.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.controller.manager.basedata;
import com.yihu.wlyy.controller.BaseController;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
/**
 * 基础数据导入
 */
@Controller
@RequestMapping(value = "/admin/basedata")
public class BaseDataImportController extends BaseController {
    //页面跳转(主页面)
    @RequestMapping(value = "initial")
    public String listInit() {
        return "basedata/basedata_list";
    }
}

+ 112 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/consult/ConsultRemindController.java

@ -0,0 +1,112 @@
package com.yihu.wlyy.controller.manager.consult;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.consult.WlyyConsultRemindLog;
import com.yihu.wlyy.entity.consult.WlyyReplyConsult;
import com.yihu.wlyy.service.manager.consult.WlyyConsultRemindLogService;
import com.yihu.wlyy.service.manager.consult.WlyyReplyConsultService;
import com.yihu.wlyy.util.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.text.DecimalFormat;
import java.util.Date;
/**
 * Created by linz on 2017/5/15.
 */
@Controller
@RequestMapping(value = "admin/consult/remind")
@Api(description = "咨询提醒")
public class ConsultRemindController extends BaseController {
    //    咨询列表
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listInit () {
        return "consult/consult_list";
    }
    //    医生信息
    @RequestMapping(value = "docInfo/{code}/{remind}/{reply}/{isclick}", method = RequestMethod.GET)
    public  String DocInfo (@PathVariable("code") String code, @PathVariable("remind") String remind, @PathVariable("reply") String reply, @PathVariable("isclick") String isclick) throws  Exception {
        request.setAttribute("code",code);
        request.setAttribute("remind",remind);
        request.setAttribute("reply",reply);
        request.setAttribute("isclick",isclick);
        return "consult/consult_doctor_info";
    }
    //    咨询提醒
    @RequestMapping(value = "remind/{code}",method = RequestMethod.GET)
    public String Remind (@PathVariable("code") String code) {
        request.setAttribute( "code", code);
        return "consult/consult_remind_content";
    }
    //提醒记录
    @RequestMapping(value = "relyHis",method = RequestMethod.GET)
    public String ReplyHis () {
        return "consult/consult_remind_reply_list";
    }
    @Autowired
    private WlyyConsultRemindLogService wlyyConsultRemindLogService;
    //获取咨询列表
    @RequestMapping(value = "list")
    @ResponseBody
    public String searchList(
            @RequestParam(value = "city",required = false) String city,
            @RequestParam(value = "town",required = false) String town,
            @RequestParam(value = "hospital",required = false) String hospital,
            @RequestParam(value = "teamCode",required = false) String teamCode,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "doctor",required = false) String doctor,
            @RequestParam(value = "beginDate",required = false) String beginDateString,
            @RequestParam(value = "endDate",required = false) String endDateString,
            @RequestParam(value = "remindType",required = false) String remindType,
            @RequestParam(value = "page",required = true) int page,
            @RequestParam(value = "rows",required = true) int rows){
        try {
            Date beginDate = null;
            Date endDate = null;
            if(StringUtils.isNotBlank(beginDateString)){
                beginDate = DateUtil.strToDate(beginDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            if(StringUtils.isNotBlank(endDateString)){
                endDate = DateUtil.strToDate(endDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            PageImpl<WlyyConsultRemindLog> consults = wlyyConsultRemindLogService.list(city,town,hospital,teamCode,doctorName,doctor,beginDate,endDate,remindType,page,rows);
            return write(200,"查询成功",page,rows,consults);
        }catch (Exception ex){
            error(ex);
            return error(-1, "查询失败!");
        }
    }
    //提醒医生
    @RequestMapping(value = "doctor")
    @ResponseBody
    public String remind(
            @RequestParam(value = "doctor",required = false) String doctor,
            @RequestParam(value = "remindType",required = false) Integer remindType,
            @RequestParam(value = "content",required = false) String content){
        try {
            wlyyConsultRemindLogService.remind(doctor,remindType,content);
            return write(200,"提醒成功!");
        }catch (Exception ex){
            error(ex);
            return error(-1, "提醒失败!");
        }
    }
}

+ 134 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/consult/ConsultReplyController.java

@ -0,0 +1,134 @@
package com.yihu.wlyy.controller.manager.consult;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.consult.WlyyReplyConsult;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.service.manager.consult.WlyyReplyConsultService;
import com.yihu.wlyy.service.manager.feedback.AppealService;
import com.yihu.wlyy.service.manager.feedback.FeedbackService;
import com.yihu.wlyy.util.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Map;
/**
 * Created by linz on 2017/5/15.
 */
@Controller
@RequestMapping(value = "admin/consult/reply")
@Api(description = "咨询回复统计相关")
public class ConsultReplyController extends BaseController {
    @Autowired
    private WlyyReplyConsultService wlyyReplyConsultService;
    //获取咨询列表
    @RequestMapping(value = "list")
    @ResponseBody
    public String searchList(
            @RequestParam(value = "city",required = false) String city,
            @RequestParam(value = "town",required = false) String town,
            @RequestParam(value = "hospital",required = false) String hospital,
            @RequestParam(value = "teamCode",required = false) String teamCode,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "doctor",required = false) String doctor,
            @RequestParam(value = "reply",required = false) Integer reply,
            @RequestParam(value = "status",required = false) Integer status,
            @RequestParam(value = "beginDate",required = false) String beginDateString,
            @RequestParam(value = "endDate",required = false) String endDateString,
            @RequestParam(value = "page",required = true) int page,
            @RequestParam(value = "rows",required = true) int rows){
        try {
            Date beginDate = null;
            Date endDate = null;
            if(StringUtils.isNotBlank(beginDateString)){
                beginDate = DateUtil.strToDate(beginDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            if(StringUtils.isNotBlank(endDateString)){
                endDate = DateUtil.strToDate(endDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            PageImpl<WlyyReplyConsult> consults = wlyyReplyConsultService.list(city,town,hospital,teamCode,doctorName,doctor,reply,status,beginDate,endDate,page,rows);
            return write(200,"操作成功",page,rows,consults);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //获取咨询总数及回复率
    @RequestMapping(value = "rate")
    @ResponseBody
    public String getHandData(
            @RequestParam(value = "city",required = false) String city,
            @RequestParam(value = "town",required = false) String town,
            @RequestParam(value = "hospital",required = false) String hospital,
            @RequestParam(value = "teamCode",required = false) String teamCode,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "beginDate",required = false) String beginDateString,
            @RequestParam(value = "endDate",required = false) String endDateString){
        try {
            Date beginDate = null;
            Date endDate = null;
            if(StringUtils.isNotBlank(beginDateString)){
                beginDate = DateUtil.strToDate(beginDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            if(StringUtils.isNotBlank(endDateString)){
                endDate = DateUtil.strToDate(endDateString,DateUtil.YYYY_MM_DD_HH_MM_SS);
            }
            JSONObject result = new JSONObject();
            //未回复数量
            int countNoReply = wlyyReplyConsultService.getCountByFilter(city,town,hospital,teamCode,doctorName,null,0,0,beginDate,endDate);
            //总数
            int count = wlyyReplyConsultService.getCountByFilter(city,town,hospital,teamCode,doctorName,null,null,null,beginDate,endDate);
            result.put("count",count);
            result.put("noReply",countNoReply);
            DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
            Double rate;
            if(count!=0){
                rate = (countNoReply*100.00)/count;
                String  num = df.format(rate);//返回的是String类型的
                result.put("rate",num+"%");
            }else{
                result.put("rate","0.00%");
            }
            return write(200,"获取成功!","data",result);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //获取咨询未回复总数
    @RequestMapping(value = "noReply")
    @ResponseBody
    public String getHandData(
            @RequestParam(value = "doctor",required = false) String doctor){
        try {
            //未回复数量
            int countNoReply = wlyyReplyConsultService.getCountByFilter(null,null,null,null,null,doctor,0,0,null,null);
            return write(200,"获取成功!","data",countNoReply);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
}

+ 46 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java

@ -0,0 +1,46 @@
package com.yihu.wlyy.controller.manager.device;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import com.yihu.wlyy.service.manager.device.DeviceHealthIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by Administrator on 2016/12/5.
 */
@Controller
@RequestMapping("admin/healthIndex")
public class DeviceHealthIndexController extends BaseController{
    @Autowired
    private DeviceHealthIndexService healthIndexService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initList(){return "device/deviceHealthIndex_list";}
    @RequestMapping(value ="list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "date",required = false) String date,
            @RequestParam(value = "idcard",required = false) String idcard,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            Page<DeviceHealthIndex> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, page, pageSize);
            return write(200,"操作成功",page,pageSize,deviceHealthIndexes);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 134 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java

@ -0,0 +1,134 @@
package com.yihu.wlyy.controller.manager.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by yww on 2016/12/2.
 * 设备管理
 */
@Controller
@RequestMapping("admin/device")
public class WlyyDeviceController extends BaseController {
    @Autowired
    private WlyyDeviceService deviceService;
    @Autowired
    private ObjectMapper objectMapper;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initListPage(){
        return "device/device_list";
    }
    @RequestMapping(value = "infoInit")
    public String initInfoPage(@RequestParam(value = "id") Integer id,String type){
        request.setAttribute("id",id);
        request.setAttribute("type",type);
        return "device/device_modify";
    }
    @RequestMapping(value = "createInit")
    public String initCreatePage(@RequestParam(value = "id",required = false) Integer id){
        request.setAttribute("id",id);
        return  "device/device_create";
    }
    //列表查询
    @RequestMapping(value="deviceList",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(value = "deviceName",required = false)String deviceName,
            @RequestParam(value = "deviceCode",required = false) String deviceCode,
            @RequestParam(value = "orgName",required = false)String orgName,
            @RequestParam(value = "linkman",required = false) String linkman,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "rows",required = false)Integer pageSize){
        try {
            Page<WlyyDevice> wlyyDevices = deviceService.searchDeviceList(deviceName,deviceCode,orgName,linkman, page, pageSize);
            return write(200,"操作成功",page,pageSize,wlyyDevices);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "device")
    @ResponseBody
    public String getDevice(@RequestParam(value = "id") Integer id){
        try {
            WlyyDevice device = deviceService.findById(id);
            return  write(200,"操作成功","data",device);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String createDevice(String jsonData){
        try{
            WlyyDevice device = objectMapper.readValue(jsonData, WlyyDevice.class);
            WlyyDevice deviceNew = deviceService.createDevice(device);
            return write(200,"操作成功","data",deviceNew);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String updateDevice(String jsonData){
        try{
            WlyyDevice device = objectMapper.readValue(jsonData, WlyyDevice.class);
            WlyyDevice deviceNew = deviceService.updateDevice(device);
            return write(200,"操作成功","data",deviceNew);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    @RequestMapping(value = "updateStatus")
    @ResponseBody
    public String updateStatus(String jsonData){
        try{
            WlyyDevice device = objectMapper.readValue(jsonData, WlyyDevice.class);
            WlyyDevice deviceNew = deviceService.updateDevice(device);
            return write(200,"操作成功","data",deviceNew);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deleteDevice(Integer id){
        try{
            deviceService.deleteDevice(id);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    @RequestMapping(value = "isCodeExist")
    @ResponseBody
    public String isCodeExist(String deviceCode) {
        return deviceService.existDeviceCode(deviceCode);
    }
}

+ 63 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java

@ -0,0 +1,63 @@
package com.yihu.wlyy.controller.manager.device;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.service.manager.device.WlyyPatientDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by yww on 2016/12/7.
 */
@Controller
@RequestMapping("admin/patientDevice")
public class WlyyPatientDeviceController extends BaseController {
    @Autowired
    private WlyyPatientDeviceService patientDeviceService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listPageInit(){
        return "device/patientDevice_list";
    }
    @RequestMapping(value = "list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(value = "deviceName",required = false) String deviceName,
            @RequestParam(value = "categoryCode",required = false) String categoryCode,
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "page") Integer page,
            @RequestParam(value = "rows") Integer pageSize){
        try {
            Page<WlyyPatientDevice> patientDevices = patientDeviceService.searchList(deviceName,categoryCode, deviceSn, userName, page, pageSize);
            return write(200,"操作成功",page,pageSize,patientDevices);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //设备解绑(记录删除)
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deletePatientDevice(@RequestParam(value = "id") Integer id){
        try {
            if(id == null){
                return write(-1,"id不能为空!");
            }
            patientDeviceService.delete(id);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 162 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/ManageDictController.java

@ -0,0 +1,162 @@
package com.yihu.wlyy.controller.manager.dict;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageDict;
import com.yihu.wlyy.service.manager.dict.ManageDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
 * Created by Administrator on 2017/1/24.
 */
@Controller
@RequestMapping(value = "/admin/dict")
@Api(value = "dict", description = "系统全局字典管理", tags = {"系统字典"})
public class ManageDictController extends BaseController {
    @Autowired
    ManageDictService dictService;
    @Autowired
    private ObjectMapper objectMapper;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listPageInit() {
        return "dict/manageDict";
    }
    @ApiOperation(value = "获取字典列表")
    @RequestMapping(value = "/dictList")
    @ResponseBody
    public String getDictionaries(
            @RequestParam(value = "searchNm", required = false) String searchNm,
            @RequestParam(value = "page", required = false) int page,
            @RequestParam(value = "rows", required = false) int pageSize) {
        if (page <= 0) {
            page = 1;
        }
        if (pageSize <= 0) {
            page = 15;
        }
        PageRequest pageRequest = new PageRequest(page - 1, pageSize);
        String filters = "";
        if (!StringUtils.isEmpty(searchNm)) {
            filters = "name?" + searchNm;
        }
        try {
            List list = dictService.search("", filters, "", page, pageSize);
            long count = dictService.getCount(filters);
            PageImpl<ManageDict> manageDicts = new PageImpl<ManageDict>(list, pageRequest, count);
            return write(200, "", page, pageSize, manageDicts);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "系统错误");
        }
    }
    @ApiOperation(value = "创建字典")
    @RequestMapping(value = "/create")
    @ResponseBody
    public String createDictionary(
            @ApiParam(name = "name", value = "新增字典名称")
            @RequestParam(value = "name") String name,
            @ApiParam(name = "reference", value = "字典简介", defaultValue = "")
            @RequestParam(value = "reference", required = false) String reference) throws Exception {
        try {
            if (StringUtils.isEmpty(name)) {
                return error(-1, "新增字段名称不能为空!");
            }
            ManageDict dict = new ManageDict();
            dict.setName(name);
            dict.setPhoneticCode(name);
            dict.setReference(reference);
            dict.setAuthorId("wwcs");
            dict.setCreateDate(new Date());
            ManageDict systemDict = dictService.createDict(dict);
            return write(200, "操作成功");
        } catch (Exception ex) {
            error(ex);
            return write(-1, "操作失败!");
        }
    }
    @ApiOperation(value = "获取字典")
    @RequestMapping(value = "/dict")
    @ResponseBody
    public String getDictionary(
            @ApiParam(name = "id", value = "字典ID", defaultValue = "")
            @PathVariable(value = "id") long id) {
        ManageDict dict = dictService.retrieve(id);
        if (dict == null) {
            return write(-1, "字典不存在!");
        }
        return write(200, "操作成功", "data", dict);
    }
    @ApiOperation(value = "更新字典")
    @RequestMapping(value = "/update")
    @ResponseBody
    public String updateDictionary(
            @ApiParam(name = "dictId", value = "字典id")
            @RequestParam(value = "dictId", required = true) long dictId,
            @ApiParam(name = "name", value = "新增字典名称")
            @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "reference", value = "字典简介", defaultValue = "")
            @RequestParam(value = "reference", required = false) String reference) {
        ManageDict dict = dictService.retrieve(dictId);
        if (dict == null) {
            return error(-1, "字典不存在!");
        }
        if (StringUtils.isEmpty(name)) {
            return error(-1, "字典名称不能为空");
        }
        try {
            dict.setName(name);
            dictService.updateDict(dict);
            return write(200, "操作成功!");
        } catch (Exception ex) {
            error(ex);
            return write(-1, "操作失败!");
        }
    }
    @ApiOperation(value = "删除字典")
    @RequestMapping(value = "/delete")
    @ResponseBody
    public String deleteDictionary(
            @ApiParam(name = "dictId", value = "字典ID", defaultValue = "")
            @RequestParam(value = "dictId") long id) {
        try {
            dictService.deleteDict(id);
            return write(200, "操场成功");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "/isNameExist")
    @ApiOperation(value = "判断提交的字典名称是否已经存在")
    @ResponseBody
    public String isDictNameExists(
            @ApiParam(name = "name", value = "name", defaultValue = "")
            @RequestParam(value = "name") String name) {
        boolean res = dictService.isDictNameExists(name);
        if (res) {
            return error(-1, "字典名称已存在!");
        }
        return write(200, "字典名称不存在!");
    }
}

+ 194 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/ManageDictEntryController.java

@ -0,0 +1,194 @@
package com.yihu.wlyy.controller.manager.dict;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.DictEntryKey;
import com.yihu.wlyy.entity.ManageDictEntry;
import com.yihu.wlyy.service.manager.dict.ManageDictEntryService;
import com.yihu.wlyy.service.manager.dict.ManageDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/1/24.
 */
@Controller
@RequestMapping(value = "/admin/dictEntry")
@Api(value = "DictEntry", description = "系统全局字典项管理", tags = {"系统字典项"})
public class ManageDictEntryController extends BaseController {
    @Autowired
    ManageDictService dictService;
    @Autowired
    ManageDictEntryService dictEntryService;
    @Autowired
    ObjectMapper objectMapper;
    @ApiOperation(value = "获取字典项列表,分页")
    @RequestMapping(value = "/entryList")
    @ResponseBody
    public String getDictEntries(
            @RequestParam(value = "dictId", required = true) long dictId,
            @RequestParam(value = "page", required = false) int page,
            @RequestParam(value = "rows", required = false) int pageSize) {
        if (page <= 0) {
            page = 1;
        }
        if (pageSize <= 0) {
            page = 15;
        }
        PageRequest pageRequest = new PageRequest(page - 1, pageSize);
        if (dictId <= 0) {
            return error(-1, "字典Id不能为空!");
        }
        String filters = "dictId=" + dictId;
        try {
            List list = dictEntryService.search("", filters, "", page, pageSize);
            long count = dictEntryService.getCount(filters);
            PageImpl<ManageDictEntry> manageDicts = new PageImpl<ManageDictEntry>(list, pageRequest, count);
            return write(200, "", page, pageSize, manageDicts);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "系统错误");
        }
    }
    @ApiOperation(value = "获取字典项列表,不分页")
    @RequestMapping(value = "/entryListForDDL")
    @ResponseBody
    public String searchDictEntriesNoPage(
            @RequestParam(value = "dictId", required = true) long dictId) {
        String filters = "dictId=" + dictId;
        try {
            List list = dictEntryService.search(filters);
            return write(200, "", "dictList", list);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "系统错误");
        }
    }
    @ApiOperation(value = "创建字典项")
    @RequestMapping(value = "/create")
    @ResponseBody
    public String createDictEntry(
            @RequestParam(value = "dictId", required = true) Long dictId,
            @RequestParam(value = "code", required = true) String code,
            @RequestParam(value = "value") String value,
            @RequestParam(value = "sort", required = false) Integer sort,
            @RequestParam(value = "catalog", required = false) String catalog) {
        if (dictId == null) {
            return error(-1, "字典Id不能为空");
        }
        if (StringUtils.isEmpty(code)) {
            return error(-1, "字典项编码不能为空");
        }
        if (StringUtils.isEmpty(value)) {
            return error(-1, "字典项值不能为空");
        }
        ManageDictEntry dictEntryModel = new ManageDictEntry();
        dictEntryModel.setDictId(dictId);
        dictEntryModel.setCode(code);
        dictEntryModel.setValue(value);
        dictEntryModel.setSort(sort);
        dictEntryModel.setCatalog(catalog);
//            if(Boolean.parseBoolean()){
//                return error(-1,"代码在该字典中已存在,请确认。");
//            }
        try {
            ManageDictEntry save = dictEntryService.save(dictEntryModel);
            return write(200, "操作成功!");
        } catch (Exception ex) {
            error(ex);
            return write(-1, "操作失败!");
        }
    }
    @ApiOperation(value = "获取字典项")
    @RequestMapping(value = "/dictEntry")
    @ResponseBody
    public String getDictEntry(
            @ApiParam(name = "dictId", value = "字典ID", defaultValue = "")
            @RequestParam(value = "dictId") long dictId,
            @ApiParam(name = "code", value = "字典项代码", defaultValue = "")
            @PathVariable(value = "code") String code) {
        ManageDictEntry manageDictEntry = dictEntryService.getDictEntry(dictId, code);
        return write(200, "操作成功!", "data", manageDictEntry);
    }
    @ApiOperation(value = "删除字典项")
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object deleteDictEntry(
            @ApiParam(name = "dictId", value = "字典ID", defaultValue = "")
            @RequestParam(value = "dictId") long dictId,
            @ApiParam(name = "code", value = "字典ID", defaultValue = "")
            @RequestParam(value = "code") String code) throws Exception {
        try {
            dictEntryService.deleteDictEntry(dictId, code);
            return write(200, "操场成功");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @ApiOperation(value = "修改字典项")
    @RequestMapping(value = "/update")
    @ResponseBody
    public String updateDictEntry(
            @RequestParam(value = "dictId", required = true) Long dictId,
            @RequestParam(value = "code", required = true) String code,
            @RequestParam(value = "value") String value,
            @RequestParam(value = "sort", required = false) Integer sort,
            @RequestParam(value = "catalog", required = false) String catalog) {
        if (dictId == null) {
            return error(-1, "字典id不能为空");
        }
        if (StringUtils.isEmpty(code)) {
            return error(-1, "字典项编码code不能为空");
        }
        ManageDictEntry dictEntryModel = dictEntryService.retrieve(new DictEntryKey(code, dictId));
        if (null == dictEntryModel) {
            return error(-1, "字典项不存在!");
        }
        dictEntryModel.setValue(value);
        dictEntryModel.setSort(sort);
        dictEntryModel.setCatalog(catalog);
//        if(Boolean.parseBoolean()){
//                return error(-1,"代码在该字典中已存在,请确认。");
//            }
        try {
            dictEntryService.saveDictEntry(dictEntryModel);
            return write(200, "操作成功!");
        } catch (Exception ex) {
            error(ex);
            return write(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "/isCodeExist")
    @ApiOperation(value = "根基dictId和code判断提交的字典项名称是否已经存在")
    @ResponseBody
    public boolean isDictEntryCodeExists(
            @ApiParam(name = "dictId", value = "dictId", defaultValue = "")
            @RequestParam(value = "dictId") long dictId,
            @ApiParam(name = "code", value = "code", defaultValue = "")
            @RequestParam(value = "code") String code) {
        return dictEntryService.isDictContainEntry(dictId, code);
    }
}

+ 42 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/dict/SystemDictController.java

@ -0,0 +1,42 @@
package com.yihu.wlyy.controller.manager.dict;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.SystemDict;
import com.yihu.wlyy.service.manager.dict.SystemDictService;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * Created by Administrator on 2016/8/13.
 */
@Controller
@RequestMapping(value = "/common")
public class SystemDictController extends BaseController {
	@Autowired
	private SystemDictService systemDictService;
	@ResponseBody
	@RequestMapping(value = "/getDictByDictName")
	public String getDictByDictName(String name){
		try {
			List<SystemDict> list=systemDictService.getByDictName(name);
			JSONArray ja=new JSONArray();
			for (SystemDict systemDict:list){
				JSONObject jo=new JSONObject();
				jo.put("value",systemDict.getCode());
				jo.put("text",systemDict.getValue());
				ja.put(jo);
			}
			return write(200,"获取成功","list",ja);
		} catch (Exception e) {
			error(e);
			return error(-1, "获取失败");
		}
	}
}

+ 112 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/feedback/FeedbackController.java

@ -0,0 +1,112 @@
package com.yihu.wlyy.controller.manager.feedback;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.service.manager.feedback.AppealService;
import com.yihu.wlyy.service.manager.feedback.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RequestMapping(value = "admin/feedback")
@Api(description = "管理系统意见反馈接口")
public class FeedbackController extends BaseController {
    @Autowired
    private AppealService appealService;
    @Autowired
    private FeedbackService feedbackService;
    //页面初始化数据
    @RequestMapping(value = "/initial", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "意见反馈")
    public String initFeedback() {
        return "feedback/feedback_list";
    }
    /**
     * 初始化列表页
     * @param type 意见反馈的类别
     * @param identity 身份
     * @param status 状态
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "列表")
    public String list(
            @RequestParam(required = false,defaultValue = "-1") int type,
            @RequestParam(required = false,defaultValue = "-1") int identity,
            @RequestParam(required = false,defaultValue = "-1") int status,
            @RequestParam(value = "page",defaultValue = "1") int page,
            @RequestParam(value = "rows",defaultValue = "15") int rows) {
        try {
            Page<Feedback> res = feedbackService.findFeedback(page,rows,type,identity,status);
            return write(200, "操作成功", page, rows, res);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "/delfeedback")
    @ResponseBody
    @ApiOperation(value="批量删除")
    public String delfeedback(
            @RequestParam(required = true) String ids){
        try{
            feedbackService.delfeedback(ids);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败");
        }
    }
    @RequestMapping(value = "/showDetail", method = RequestMethod.GET)
    @ApiOperation(value = "跳转到意见详情页,并更改状态")
    public String infoInit(@RequestParam long id) {
        try {
            Map map = feedbackService.getFeedbackById(id);
            request.setAttribute("id",id);
            return "feedback/feeback_detail";
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
    /**
     * 根据反馈ID查询反馈详情,并更改状态
     * @param id
     * @return
     */
    @RequestMapping(value = "getFeedbackById")
    @ResponseBody
    public String getFeedbackById(@RequestParam(value = "id") Long id) {
        try {
            Map feedback = feedbackService.getFeedbackById(id);
            return write(200, "操作成功!", "data", feedback);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 318 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/hos/HosController.java

@ -0,0 +1,318 @@
package com.yihu.wlyy.controller.manager.hos;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.Hospital;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.HospitalDao;
import com.yihu.wlyy.service.manager.hos.HosService;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * 医院信息管理
 * Created by yww on 2016/9/27.
 */
@Controller
@RequestMapping(value = "/admin/hos")
public class HosController extends BaseController {
    @Autowired
    private HosService hospitalService;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private DoctorDao doctorDao;
    //页面跳转(主页面)
    @RequestMapping(value = "initial")
    public String listInit() {
        return "hos/hospital_list";
    }
    //页面跳转(详情页面)
    @RequestMapping(value = "infoInit/{id}", method = RequestMethod.GET)
    public String infoInit(@PathVariable("id") Long id, String mode) {
        if (id == 0) {
            request.setAttribute("UUID", UUID.randomUUID().toString().replace("-", ""));
        }
        request.setAttribute("id", id);
        request.setAttribute("mode", mode);
        return "hos/hospital_edit";
    }
    //新增
    @RequestMapping(value = "create")
    @ResponseBody
    public String createHospital(String jsonData) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Hospital hospital = objectMapper.readValue(jsonData, Hospital.class);
            hospitalService.createHospital(hospital);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //修改
    @RequestMapping(value = "update")
    @ResponseBody
    public String updateHospital(String jsonData) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Hospital hospital = objectMapper.readValue(jsonData, Hospital.class);
            hospitalService.createHospital(hospital);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //修改
    @RequestMapping(value = "updateDel")
    @ResponseBody
    public String updateHospitalStatus(
            @RequestParam(name = "id") Long id,
            @RequestParam(name = "del") String del) {
        try {
            boolean res = hospitalService.updateDel(id, del);
            return res == true ? success("操作成功!") : error(-1, "操作失败!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //根据id删除
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deleteHospital(@RequestParam(value = "id") Long id) {
        try {
            hospitalService.deleteHospital(id);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //根据id获取单个
    @RequestMapping(value = "hospital")
    @ResponseBody
    public String getHospital(@RequestParam(value = "id") Long id) {
        try {
            Hospital hospital = hospitalService.getHospital(id);
            return write(200, "操作成功!", "hos", hospital);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //获取列表(不分页)
    @RequestMapping(value = "hospitalsNoPage")
    @ResponseBody
    public String searchHospitalNoPage(@RequestParam(value = "name", required = false) String name) {
        try {
            List<Hospital> hospitals = hospitalService.searchHospitalNoPage(name);
            return write(200, "操作成功!", "hoss", hospitals);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //获取列表type = 1 根据城市获取  type = 2 根据区获取
    @RequestMapping(value = "hospitalsByType")
    @ResponseBody
    public String getHospitalByType(@RequestParam(value = "type", required = true) Integer type,@RequestParam(value = "code", required = true) String code) {
        try {
            List<Hospital> hospitals = hospitalService.getHospitalByType(type,code);
            return write(200, "操作成功!", "list", hospitals);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //获取列表(分页)
    @RequestMapping(value = "hospitalList")
    @ResponseBody
    public String searchHospitals(String name, String doctorName, String doctorMobile, int page, int rows) {
        try {
            Page<Hospital> hospitals = hospitalService.searchHospitals(name, doctorName, doctorMobile, page, rows);
            return write(200, "操作成功!", page, rows, hospitals);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //医院名字是否存在
    @RequestMapping(value = "isNameExist")
    @ResponseBody
    public String isNameExist(String name) {
        try {
            return hospitalService.isNameExist(name);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 按城市查找社区
     *
     * @param city
     * @return
     */
    @RequestMapping(value = "community")
    @ResponseBody
    public String community(String city) {
        try {
            List<Map<String, String>> roleMap = (List<Map<String, String>>) request.getSession().getAttribute("roleMap");
            Map<String, JSONObject> map = new HashMap<String, JSONObject>();
            if (roleMap.size() > 0) {//管理员
                List<Hospital> list = hospitalDao.findByCity(city);
                if (list != null && list.size() > 0) {
                    String areaString = "";
                    String communityString = "";
                    Boolean cityFlag = false;
                    for (Map<String, String> rmap : roleMap) {
                        String code = rmap.get("code");
                        if ("350200".equals(code)) {
                            cityFlag = true;
                            break;
                        } else if (code.length() == 6) {
                            areaString += rmap.get("areas") + ",";
                        } else {
                            communityString += rmap.get("areas") + ",";
                        }
                    }
                    for (Hospital hos : list) {
                        String town = hos.getTown() + ":" + hos.getTownName();
                        JSONArray jsonArray = null;
                        JSONObject jsonObject = null;
                        String hosCode = hos.getCode();
                        String hosName = hos.getName();
                        if (!cityFlag) {
                            if (areaString.length() > 0) {
                                if (areaString.indexOf(hos.getTown() + ",") < 0) {
                                    continue;
                                }
                            } else {
                                if (communityString.indexOf(hosCode + ",") < 0) {
                                    continue;
                                }
                            }
                        }
                        JSONObject json = new JSONObject();
                        json.put("code", hosCode);
                        json.put("name", hosName);
                        if (map.containsKey(town)) {
                            jsonObject = map.get(town);
                            jsonArray = jsonObject.getJSONArray(town);
                            jsonArray.put(json);
                        } else {
                            jsonObject = new JSONObject();
                            jsonArray = new JSONArray();
                            jsonArray.put(json);
                            jsonObject.put(town, jsonArray);
                            map.put(town, jsonObject);
                        }
                    }
                }
            } else {
                //医生
                String mobile = (String) request.getSession().getAttribute("mobile");
                Doctor doctor = doctorDao.findByMobile(mobile);
                Hospital hos = hospitalDao.findByCode(doctor.getHospital());
                String town = hos.getTown() + ":" + hos.getTownName();
                JSONArray jsonArray = new JSONArray();
                ;
                JSONObject jsonObject = new JSONObject();
                ;
                JSONObject json = new JSONObject();
                json.put("code", hos.getCode());
                json.put("name", hos.getName());
                jsonArray.put(json);
                jsonObject.put(town, jsonArray);
                map.put(town, jsonObject);
            }
            JSONArray jsonArray = new JSONArray();
            for (String key : map.keySet()) {
                JSONObject json = new JSONObject();
                json.put("town", key);
                json.put("community", map.get(key).get(key));
                jsonArray.put(json);
            }
            return write(200, "查询成功!", "list", jsonArray);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    //医院名字是否存在
    @RequestMapping(value = "isCcodeExist")
    @ResponseBody
    public String isCodeExist(String code) {
        try {
            return hospitalService.isCodeExist(code);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "importData", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importData(HttpServletRequest request) {
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook workbook = Workbook.getWorkbook(inputStream);
            hospitalService.importData(workbook);
            return write(200, "操作成功");
        } catch (IOException | BiffException e) {
            e.printStackTrace();
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 613 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/hos/HosDoctorController.java

@ -0,0 +1,613 @@
package com.yihu.wlyy.controller.manager.hos;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.WlyyAdminTeam;
import com.yihu.wlyy.service.manager.hos.HosDoctorService;
import com.yihu.wlyy.service.manager.team.WlyyAdminTeamService;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.MD5;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.ParseException;
import java.util.*;
/**
 * Created by yww on 2016/9/28.
 */
@Controller
@RequestMapping(value = "/admin/hos/doctor")
public class HosDoctorController extends BaseController {
    @Autowired
    private HosDoctorService doctorService;
    @Autowired
    private WlyyAdminTeamService wlyyAdminTeamService;
    //跳转到医生列表页
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String list(Model model, @RequestParam(required = true) String orgId, String doctorName, @RequestParam String orgCode, @RequestParam String orgName) {
        model.addAttribute("orgId", orgId);
        model.addAttribute("doctorName", doctorName);
        model.addAttribute("orgCode", orgCode);
        model.addAttribute("orgName", orgName);
        return "hos/doctor/doctor_list";
    }
    //进入人员添加界面
    @RequestMapping(value = "createInit", method = RequestMethod.GET)
    public String add() {
        String orgCode = request.getParameter("orgCode");
        request.setAttribute("UUID", UUID.randomUUID().toString().replace("-", ""));
        request.setAttribute("orgCode", orgCode);
        return "hos/doctor/doctor_modify";
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String createDoctor(String jsonData) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Doctor doctor = objectMapper.readValue(jsonData, Doctor.class);
            doctorService.saveDoctor(doctor);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!" + e.getMessage());
        }
    }
    //进入人员查看、编辑界面
    @RequestMapping(value = "updateInit/{id}", method = RequestMethod.GET)
    public String update(@PathVariable("id") Long id) {
        try {
            request.setAttribute("doctorId", id);
            request.setAttribute("type", request.getParameter("type"));
        } catch (Exception e) {
            error(e);
        }
        return "hos/doctor/doctor_modify";
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String updateDoctor(String jsonData) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Doctor doctor = objectMapper.readValue(jsonData, Doctor.class);
            doctorService.updateDoctor(doctor);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!" + e.getMessage());
        }
    }
    /**
     * 删除用户
     *
     * @param id
     * @param code
     * @return
     */
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deleteDoctor(
            @RequestParam(value = "id", required = true) Long id,
            @RequestParam(value = "code", required = true) String code) {
        try {
            doctorService.deleteDoctorByid(id, code);
            return success("操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 查找用户列表
     *
     * @param page
     * @param rows
     * @param hospital 医院标识
     * @param deptName 科室标识
     * @param jobName  职称标识
     * @param status   状态
     * @param name     姓名
     * @return
     */
    @RequestMapping(value = "doctorList")
    @ResponseBody
    public String doctorList(
            @RequestParam(value = "page", required = true) int page,
            @RequestParam(value = "rows", required = true) int rows,
            @RequestParam(value = "hospital", required = true) String hospital,
            @RequestParam(value = "deptName", required = false) String deptName,
            @RequestParam(value = "jobName", required = false) String jobName,
            @RequestParam(value = "status", required = false) String status,
            @RequestParam(value = "mobile", required = false) String mobile,
            @RequestParam(value = "name", required = false) String name) {
        try {
            if (StringUtils.isEmpty(hospital)) {
                return error(-1, "所属机构编码不能为空!");
            }
            Page<Doctor> doctors = doctorService.getDoctorList(page, rows, hospital, deptName, jobName, status, mobile, name);
            return write(200, "", page, rows, doctors);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 查找单个用户
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "findOneDoctor")
    @ResponseBody
    public String findOneDoctor(
            @RequestParam(value = "id", required = true) Long id) {
        try {
            Doctor doctor = doctorService.getDoctor(id);
            return write(200, "操作成功!", "doc", doctor);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 查找单个用户
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "findDoctor")
    @ResponseBody
    public String findDoctor(
            @RequestParam(value = "code", required = true) String code) {
        try {
            Doctor doctor = doctorService.getDoctorByCode(code);
            List<WlyyAdminTeam> wlyyAdminTeams = wlyyAdminTeamService.getTeamsByDoctor(doctor.getCode());
            JSONObject object = new JSONObject(doctor);
            String teamName = "";
            for(WlyyAdminTeam wlyyAdminTeam:wlyyAdminTeams){
                teamName=teamName+wlyyAdminTeam.getName()+",";
            }
            if(teamName.lastIndexOf(",")>=0){
                teamName = teamName.substring(0,teamName.lastIndexOf(","));
            }
            object.put("teamName",teamName.toString());
            return write(200, "操作成功!", "doc", object);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "sign")
    public String sign(@RequestParam(value = "doctorIdList", required = true) String ids) {
        request.setAttribute("doctorIdList", ids);
        return "hos/doctor/sign_modify";
    }
//    @RequestMapping(value = "updateStatus",method = RequestMethod.POST)
//    @ResponseBody
//    public String updateSign(
//            @RequestParam(value = "doctorIdList", required = true) String ids,
//            @RequestParam(value = "status", required = true) String status) {
//        try {
//            doctorService.updateStatus(ids, status);
//            return write(200, "操作成功!");
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "操作失败!");
//        }
//    }
    @RequestMapping(value = "updateStatus", method = RequestMethod.POST)
    @ResponseBody
    public String updateStatus(
            @RequestParam(value = "doctorId", required = true) Long doctorId,
            @RequestParam(value = "mobile", required = true) String mobile,
            @RequestParam(value = "status", required = true) Integer status) {
        try {
            if (doctorId == null) {
                return error(-1, "医生id不能为空!!");
            }
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "电话号码不能为空!");
            }
            if (status == null) {
                return error(-1, "状态不能为空!!");
            }
            //生失效前判断是否有同手机号的生效数据(有则不允许生效)
            //因为基卫导入时,手机号码为空的情况下都是设置为1,所以对该部分数据允许进行生效
            boolean existMobile = false;
            if(!mobile.equals("1")){
                if (status == 1) {
                    existMobile = doctorService.isExistMobile(mobile);
                }
                if (existMobile) {
                    return error(-1, "同个手机号只能有一条生效医生信息!");
                }
            }
            boolean res = doctorService.updateDel(status, doctorId);
            return res == true ? write(200, "操作成功!") : error(-1, "操作失败!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //跳转上传结果页面
    @RequestMapping("/importResult")
    public String importResult() {
        return "hos/doctor/doctor_import_result";
    }
    @RequestMapping(value = "/importFromExcel", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importFromExcel(HttpServletRequest request, @RequestParam(value = "orgCode", required = true) String orgCode, @RequestParam(value = "orgName", required = true) String orgName) {
        List errorLs = new ArrayList<>();
        List correctLs = new ArrayList<>();
        IdcardValidator idcardValidator = new IdcardValidator();
        //判断表中数据是否重复
        //名字、手机号、身份证号
        Set<String> nameSet = new HashSet<>(); //存放表中名字
        Set<String> mobileSet = new HashSet<>();//存放表中手机号
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook rwb = Workbook.getWorkbook(inputStream);
            Sheet[] sheets = rwb.getSheets();
            int rows;
            int row;
            List<Doctor> doctorList = new ArrayList<>();
            String name = null;// 姓名
            Integer sex = null;// 性别(1男,2女)
            String birthday = null;// 生日
            String mobile = null;// 手机号
            String password = null;// 登录密码 ---默认值手机后六位
            Integer status = 1;// 状态(1正常,0禁用)
            String province = null;// 省
            String city = null;    // 市
            String town = null;// 區縣代碼
            String hospital = orgCode;// 医院标识
            String hospitalName = null;// 医院名称
            String deptName = null;// 科室名
            String jobName = null;// 职称名
            String expertise = null;// 医生专长
            String introduce = null;// 医生介绍
            Integer level = 0;// 类型:1专科医生,2全科医生,3健康管理师  默认0
            String idCard = null;//身份证号
            String isFamous = "0";//是否名医
            String shequType = null; //社区内类型
            Sheet sheet = sheets[0];    //第一张表
            rows = sheet.getRows();
            for (int j = 1; j < rows; j++) {
                if (sheet.getRow(j).length == 0) {
                    continue;
                }
                String errorMsg = "";
                Doctor doctor = new Doctor();
                Map<String, String> errorMsgMap = doctor.getErrorMsgMap();
                row = j;
                name = sheet.getCell(0, row).getContents().trim();    // 0 姓名
                idCard = sheet.getCell(1, row).getContents().trim();  //1 身份证号
                mobile = sheet.getCell(2, row).getContents().trim();   //2 手机号
                //3 人员类型(对应字段?)
                jobName = sheet.getCell(4, row).getContents().trim(); //4 临床职称
                //5 行政职称(对应字段?)
                expertise = sheet.getCell(6, row).getContents().trim();  //6 人员专长
                hospitalName = sheet.getCell(7, row).getContents().trim(); //7 机构名称
                deptName = sheet.getCell(8, row).getContents().trim(); //8 科室
                introduce = sheet.getCell(9, row).getContents().trim();//9 医生简介
                String levelName = sheet.getCell(10, row).getContents().trim();//10 三师类型
                shequType = sheet.getCell(11, row).getContents().trim();//11 社区内类型
                if (
                        StringUtils.isEmpty(name) && StringUtils.isEmpty(idCard)
                                && StringUtils.isEmpty(mobile) && StringUtils.isEmpty(jobName)
                                && StringUtils.isEmpty(expertise) && StringUtils.isEmpty(hospitalName)
                                && StringUtils.isEmpty(deptName) && StringUtils.isEmpty(introduce)
                                && StringUtils.isEmpty(levelName) && StringUtils.isEmpty(shequType)) {
                    continue;
                }
                doctor.setName(name);
                doctor.setIdCard(idCard);
                doctor.setMobile(mobile);
                doctor.setJobName(jobName);
                doctor.setExpertise(expertise);
                doctor.setHospitalName(hospitalName);
                doctor.setDeptName(deptName);
                doctor.setIntroduce(introduce);
                doctor.setLevelName(levelName);
                doctor.setShequType(shequType);
                boolean isRepeatFlag = false;//表中姓名、手机号、身份证号是否重复(有重复保存第一个,其余返回)
                //表中的机构名不能为空,且需与机构列表传递过来的一致
                if (StringUtils.isEmpty(hospitalName)) {
                    errorMsgMap.put("hospitalName", "表中的机构名称不能为空!;");
                    errorMsg += "表中的机构名称不能为空!;";
                } else if (!StringUtils.equals(hospitalName, orgName)) {
                    errorMsgMap.put("hospitalName", "表中的机构名称与已建立的机构名称不一致!!");
                    errorMsg += "表中的机构名称与已建立的机构名称不一致!;";
                }
                //手机号不能为空、唯一性
                if (StringUtils.isEmpty(mobile)) {
                    errorMsgMap.put("mobile", "手机号码不能为空;");
                    errorMsg += "手机号码不能为空!;";
                } else {
                    //手机格式判断
                    //
                    boolean flag = doctorService.isExistMobile(mobile);
                    if (!mobile.matches("^[0-9]{11}$")) {
                        errorMsgMap.put("mobile", "手机格式不正确;");
                        errorMsg += "手机格式不正确;";
                    } else if (flag) {
                        errorMsgMap.put("mobile", "手机号已注册;");
                        errorMsg += "手机号已注册;";
                    } else if (mobileSet.contains(mobile)) {
                        errorMsgMap.put("mobile", "-表中存在重复电话号码,只导入第一条;");
                        errorMsg += "表中存在重复电话号码;";
                        isRepeatFlag = true;
                    } else {
                        mobileSet.add(mobile);
                    }
                }
                //唯一性验证
                if (StringUtils.isEmpty(name)) {
                    errorMsgMap.put("name", "医生姓名不能为空!;");
                    errorMsg += "医生姓名不能为空!;";
                } else {
                    boolean flag = doctorService.findByNameHospital(name, orgCode);
                    if (flag) {
                        errorMsgMap.put("name", "该机构下该医生姓名已存在,请确认!!");
                        errorMsg += "该机构下该医生姓名已存在,请确认,若是存在同名情况,请手工新增!;";
                    }
                    if (nameSet.contains(name)) {
                        errorMsgMap.put("name", errorMsg.indexOf("name") + "-表中存在重复人名,只导入第一条;");
                        errorMsg += "表中存在重复人名;";
                        isRepeatFlag = true;
                    } else {
                        nameSet.add(name);
                    }
                }
                //判断身份证是否为空,取相关信息
                if (!StringUtils.isEmpty(idCard)) {
                    if (!idcardValidator.isValidatedAllIdcard(idCard)) {
                        errorMsgMap.put("idCard", "身份证格式有误;");
                        errorMsg += "身份证格式有误;";
                    } else if (doctorService.isExistIdCard(idCard)) {
                        errorMsgMap.put("idCard", "医生身份证已存在,请确认!;");
                        errorMsg += "医生身份证已存在,请确认!;";
                    } else {
                        sex = doctorService.getGenderByIdCard(idCard);
                        birthday = doctorService.getBirthdayByIdCard(idCard);
                    }
                }
                //三师类型不能为空
                if (StringUtils.isEmpty(levelName)) {
                    errorMsgMap.put("levelName", "三师类型不能为空!;");
                    errorMsg += "三师类型不能为空!;";
                }
                if (StringUtils.equals(levelName, "专科医生")) {
                    level = 1;
                } else if (StringUtils.equals(levelName, "全科医生")) {
                    level = 2;
                } else if (StringUtils.equals(levelName, "健康管理师")) {
                    level = 3;
                } else if (StringUtils.equals(levelName, "管理员")) {
                    level = 10;
                } else {
                    errorMsgMap.put("levelName", "三师类型不正确!;");
                    errorMsg += "三师类型不正确!;";
                }
                if (!StringUtils.isEmpty(errorMsg.trim())) {
                    doctor.setErrorMsg(errorMsg);
                    errorLs.add(doctor);
                    continue;
                }
                //插入数据集信息
                doctor.setCode(UUID.randomUUID().toString().replace("-", ""));
                doctor.setBirthday(StringUtils.isEmpty(birthday) == true ? null : DateUtils.parseDate(birthday, "yyyy-MM-dd"));
                doctor.setSex(sex);
                //初始密码、salt值
                String subMobile = mobile.substring(5);
                String salt = UUID.randomUUID().toString().replace("-", "");
                doctor.setSalt(salt);
                doctor.setPassword(MD5.GetMD5Code(subMobile + salt));
                doctor.setStatus(status);
                doctor.setHospital(hospital);
                doctor.setIscertified(0);
                doctor.setCzrq(new Date());
                doctor.setLevel(level);
                doctor.setShequType(shequType);
                doctor.setIsFamous(isFamous);
                doctor.setErrorMsgMap(errorMsgMap);
                doctor.setPhoto("../../../images/d-male.png");
                correctLs.add(doctor);
            }
            doctorService.saveDoctorList(correctLs);
            //包装导入结果(导入成功数量、错误对象集合)
            Map<String, Object> map = new HashMap<>();
            map.put("successNum", correctLs.size());
            map.put("failedNum", errorLs.size());
            map.put("errorData", errorLs);
            return write(200, "操作成功", "data", map);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "/importData", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importData(HttpServletRequest request) {
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook workbook = Workbook.getWorkbook(inputStream);
            doctorService.importData(workbook);
            return write(200, "操作成功");
        } catch (IOException | BiffException | ParseException e) {
            e.printStackTrace();
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //导入失败数据生成Excel表
    @RequestMapping(value = "toExcel", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public void errorDataToExcel(@RequestParam(value = "errorData") String errorData, HttpServletResponse response) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, Doctor.class);
            List<Doctor> lst = (List<Doctor>) objectMapper.readValue(errorData, javaType);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("errorTable.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os, lst);
        } catch (Exception ex) {
            error(ex);
        }
    }
    public void addHeader(WritableSheet ws) throws WriteException {
        String[] header = {"姓名", "身份证号", "手机号", "人员类型", "临床职称", "行政职称", "人员专长", "机构名称", "科室", "医生简介", "三师类型", "社区内类型"};
        int i = 0;
        for (String h : header) {
            addCell(ws, 0, i, h);//表名,行,列,header
            i++;
        }
    }
    public void write(WritableWorkbook wwb, List ls) throws Exception {
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            addHeader(ws);
            int i = 1;
            for (Doctor doc : (List<Doctor>) ls) {
                Map<String, String> map = doc.getErrorMsgMap();
                addCell(ws, i, 0, doc.getName(), map.get("name"));
                addCell(ws, i, 1, doc.getIdCard(), map.get("idCard"));
                addCell(ws, i, 2, doc.getMobile(), map.get("mobile"));
                addCell(ws, i, 3, "", "");
                addCell(ws, i, 4, doc.getJobName(), map.get("jobName"));
                addCell(ws, i, 5, "", "");
                addCell(ws, i, 6, doc.getExpertise(), map.get("expertise"));
                addCell(ws, i, 7, doc.getHospitalName(), map.get("hospitalName"));
                addCell(ws, i, 8, doc.getDeptName(), map.get("deptName"));
                addCell(ws, i, 9, doc.getIntroduce(), map.get("introduce"));
                addCell(ws, i, 10, doc.getLevelName(), map.get("levelName"));
                addCell(ws, i, 11, doc.getShequType(), map.get("shequType"));
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void write(OutputStream os, List ls) throws Exception {
        write(Workbook.createWorkbook(os), ls);
    }
    ;
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column, row, data);
        if (!org.springframework.util.StringUtils.isEmpty(memo)) {
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
    //初始化密码
    @RequestMapping(value = "initPassword")
    @ResponseBody
    public String initPassword(
            @RequestParam(value = "doctorId", required = true) Long doctorId,
            @RequestParam(value = "mobile", required = true) String mobile) {
        try {
            boolean res = doctorService.initPassword(doctorId, mobile);
            return res == true ? write(200, "操作成功!") : error(-1, "操作失败!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //电话号码唯一性验证
    @RequestMapping(value = "isExistMobile")
    @ResponseBody
    public String isExistMobile(@RequestParam(value = "mobile", required = true) String mobile) {
        if (doctorService.isExistMobile(mobile)) {
            return "true";
        }
        return "false";
    }
    //身份证号唯一性验证
    @RequestMapping(value = "isExistIdCard")
    @ResponseBody
    public String isExistIdCard(@RequestParam(value = "idCard", required = true) String idCard) {
        if (doctorService.isExistIdCard(idCard)) {
            return "true";
        }
        return "false";
    }
}

+ 362 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/NotificationController.java

@ -0,0 +1,362 @@
package com.yihu.wlyy.controller.manager.notification;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.WlyyAuditNotice;
import com.yihu.wlyy.entity.WlyyAuditNoticeScope;
import com.yihu.wlyy.entity.WlyyUserRole;
import com.yihu.wlyy.service.manager.notification.WlyyAuditNoticeScopeService;
import com.yihu.wlyy.service.manager.notification.WlyyAuditNoticeService;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyUserRoleService;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by yww on 2017/1/22.
 */
@Controller
@RequestMapping("/admin/notification")
public class NotificationController extends BaseController {
    @Autowired
    private WlyyAuditNoticeService wlyyAuditNoticeService;
    @Autowired
    private WlyyAuditNoticeScopeService wlyyAuditNoticeScopeService;
    @Autowired
    private WlyyUserRoleService wlyyUserRoleService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    @ApiIgnore
    public String notificationListInitial(Model model) {
        User currentUser = (User) request.getSession().getAttribute("current_user");
        model.addAttribute("isAuditor", wlyyAuditNoticeService.isAuditor(currentUser));
        return "notification/notification_list";
    }
    //跳转消息通知详情页
    @RequestMapping(value = "view", method = RequestMethod.GET)
    @ApiIgnore
    public String notificationView(Model model, @RequestParam(value = "id", required = true) Long id, String mode) {
        User currentUser = (User) request.getSession().getAttribute("current_user");
        WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
        WlyyAuditNoticeScope noticeScope = wlyyAuditNoticeScopeService.findByNoticeId(id);
        model.addAttribute("notice", notice);
        model.addAttribute("noticeId", notice.getId());
        model.addAttribute("title", notice.getTitle());
        model.addAttribute("status", notice.getStatus());
        model.addAttribute("time", notice.getSendTime());
        model.addAttribute("scope", notice.getConditionDescription());
        model.addAttribute("content", notice.getContent());
        model.addAttribute("totalCount", "总共 " + notice.getTotalCount() + " 人");
        model.addAttribute("isAuditor", wlyyAuditNoticeService.isAuditor(currentUser));
        model.addAttribute("isOwned", false);//页面判断用于显示操作按钮
        if (StringUtils.equals(notice.getApplyUserId(), currentUser.getCode())) {
            model.addAttribute("isOwned", true);
        }
        if (noticeScope != null) {
            if (!StringUtils.isEmpty(noticeScope.getServerTypeContent())) {
                model.addAttribute("serverTypeContent", noticeScope.getServerTypeContent());
            }
            if (!StringUtils.isEmpty(noticeScope.getHealthSituationContent())) {
                model.addAttribute("healthSituationContent", noticeScope.getHealthSituationContent());
            }
            if (!StringUtils.isEmpty(noticeScope.getDiseaseTypeContent())) {
                model.addAttribute("diseaseTypeContent", noticeScope.getDiseaseTypeContent());
            }
        }
        model.addAttribute("mode",mode);
        return "notification/notification_view";
    }
    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    public String searchNotificationList(
            @ApiParam(name = "searchNm", value = "标题/提交人名")
            @RequestParam(value = "searchNm", required = false) String searchNm,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "page")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "rows")
            @RequestParam(value = "rows") int pageSize) {
        try {
            User currentUser = (User) request.getSession().getAttribute("current_user");
            Page<WlyyAuditNotice> notices = wlyyAuditNoticeService.searchList(searchNm, status, currentUser, page, pageSize);
            return write(200, "操作成功", page, pageSize, notices);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //页面跳转(详情页面)
    @RequestMapping(value ="infoInit/{id}",method = RequestMethod.GET)
    public String infoInit(@PathVariable("id") Long id, String mode){
        if(id==0){
            request.setAttribute("UUID", UUID.randomUUID().toString().replace("-", ""));
        }
        User currentUser = (User) request.getSession().getAttribute("current_user");
        //范围权限
        String city = "350200";
        String cityAuthority = "0";
        String areaAuthority = "0";
        String communityAuthority = "0";
        List<Map<String, String>> roleMap = (List<Map<String, String>>)request.getSession().getAttribute("roleMap");
        if(roleMap.size()>0){//管理员
            for (Map<String, String> map : roleMap){
                String code = map.get("code");
                if(city.equals(code)){
                    cityAuthority = "1";
                    areaAuthority = "1";
                    communityAuthority = "1";
                }else if(code.length()==6){
                    areaAuthority = "1";
                    communityAuthority = "1";
                }else {
                    communityAuthority = "1";
                }
            }
        }else{
            //社区医生
            communityAuthority = "2";
        }
        request.setAttribute("cityAuthority", cityAuthority);
        request.setAttribute("areaAuthority", areaAuthority);
        request.setAttribute("communityAuthority", communityAuthority);
        request.setAttribute("id", id);
        request.setAttribute("mode",mode);
        request.setAttribute("isAuditor", wlyyAuditNoticeService.isAuditor(currentUser));
        return "notification/notification_edit";
    }
    //根据id获取单个
    @RequestMapping(value = "notice")
    @ResponseBody
    public String getNotice(@RequestParam(value = "id") Long id){
        try {
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            WlyyAuditNoticeScope noticeScope = wlyyAuditNoticeScopeService.findByNoticeId(id);
            JSONObject json = new JSONObject();
            json.put("noticeId",notice.getId());
            json.put("title",notice.getTitle());
            json.put("content",notice.getContent());
            json.put("sendTime",notice.getSendTime());
            json.put("sendType",notice.getSendType());
            json.put("scope",noticeScope.getScope());
            json.put("scopeId",noticeScope.getScopeId());
            json.put("condition",noticeScope.getCondition());
            json.put("diseaseTypeId",noticeScope.getDiseaseTypeId());
            json.put("healthSituationId",noticeScope.getHealthSituationId());
            json.put("serverTypeId",noticeScope.getServerTypeId());
            return write(200,"操作成功!","data",json);
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 是否有有审核权限
     * @return
     */
    @RequestMapping(value = "isNoticeAuditor")
    @ResponseBody
    public String isNoticeAuditor(){
        try {
            User currentUser = (User) request.getSession().getAttribute("current_user");
            boolean flag = wlyyAuditNoticeService.isNoticeAuditor(currentUser.getCode(),String.valueOf(currentUser.getOrganizationId()));
            if(flag){
                return write(200,"有权限!","authority","1");
            }
            return write(200,"没权限!","authority","0");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //新增
    @RequestMapping(value = "create")
    @ResponseBody
    public String createNotice(String jsonData) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String,String> map = objectMapper.readValue(jsonData, Map.class);
            User currentUser = (User) request.getSession().getAttribute("current_user");
            wlyyAuditNoticeService.create(map, currentUser);
            return success("新增成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "新增失败!");
        }
    }
    /**
     * 提交
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "submit")
    @ResponseBody
    public String submit(
            @RequestParam(value = "id", required = true) Long id) {
        try {
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            User currentUser = (User) request.getSession().getAttribute("current_user");
            //判断是否为审核者(审核者只能看到非本人的待审核通知,看不到待提交通知)
            if (!StringUtils.equals("1", notice.getStatus())) {
                return error(-1, "提交状态的消息通知才能进行提交操作!");
            }
            boolean res = wlyyAuditNoticeService.isAuditor(currentUser);
            if (res) {
                //审核者自己的消息通知,直接通过+发信息+保存发送对象信息
                wlyyAuditNoticeService.approve(id, notice, currentUser);
                return write(200, "操作成功");
            } else {
                notice.setStatus("2");
                wlyyAuditNoticeService.save(notice);
                return write(200, "操作成功");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    /**
     * 撤回
     * @param id
     * @return
     */
    @RequestMapping(value = "revoke")
    @ResponseBody
    public String revoke(
            @RequestParam(value = "id", required = true) Long id){
        try {
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            if("2".equals(notice.getStatus())){//待审核
                notice.setStatus("6");//撤回
                wlyyAuditNoticeService.save(notice);
            }else{
                return error(-1, "撤回失败,只有待审核才能撤回!");
            }
            return success("撤回成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "撤回失败!");
        }
    }
    //修改
    @RequestMapping(value = "update")
    @ResponseBody
    public String updateNotice(String jsonData){
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String,String> map = objectMapper.readValue(jsonData, Map.class);
            User currentUser = (User) request.getSession().getAttribute("current_user");
            wlyyAuditNoticeService.updateNotice(map, currentUser);
            return success("修改成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "修改失败!");
        }
    }
    //删除
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deleteNotification(long id) {
        try {
            User currentUser = (User) request.getSession().getAttribute("current_user");
            //是本人的消息通知才能删除
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            if (notice == null) {
                return error(-1, "id有误!");
            }
            if (!StringUtils.equals(notice.getApplyUserId(), currentUser.getCode())) {
                return error(-1, "非本人的消息通知,没有权限删除!");
            }
            wlyyAuditNoticeService.deleteNotice(id);
            return write(200, "操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    //审核通过
    @RequestMapping(value = "approve")
    @ResponseBody
    public String approve(long id) {
        try {
            User currentUser = (User) request.getSession().getAttribute("current_user");
            //验证消息通知为待审核
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            if (notice == null) {
                return error(-1, "提供的id有误!");
            }
            if (!StringUtils.equals("2", notice.getStatus())) {
                return error(-1, "消息状态不符,待审核状态才能进行审核操作!");
            }
            String auditorCode = currentUser.getCode();
            String noticeHospital = notice.getApplyUserHospital();
            if (StringUtils.isEmpty(noticeHospital)) {
                return error(-1, "消息通知机构信息有误,为空值!");
            }
            //审核权限验证(审核者的下辖机构有此消息通知编辑者所属机构)
            boolean res = wlyyAuditNoticeService.isNoticeAuditor(auditorCode, noticeHospital);
            wlyyAuditNoticeService.approve(id, notice, currentUser);
            return write(200, "操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "refuse")
    @ResponseBody
    public String refuse(
            @RequestParam(value = "id", required = true) Long id) {
        try {
            if (id == null) {
                return error(-1, "id不能为空!");
            }
            User currentUser = (User) request.getSession().getAttribute("current_user");
            //是本人的消息通知才能删除
            WlyyAuditNotice notice = wlyyAuditNoticeService.retrieve(id);
            if (notice == null) {
                return error(-1, "id有误!");
            }
            notice.setStatus("5");
            wlyyAuditNoticeService.save(notice);
            return write(200, "操作成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeController.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.controller.manager.notification;
/**
 * Created by Administrator on 2017/1/22.
 */
public class WlyyAuditNoticeController {
}

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeObjectController.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.controller.manager.notification;
/**
 * Created by Administrator on 2017/1/22.
 */
public class WlyyAuditNoticeObjectController {
}

+ 8 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WlyyAuditNoticeScopeController.java

@ -0,0 +1,8 @@
package com.yihu.wlyy.controller.manager.notification;
/**
 * Created by Administrator on 2017/1/22.
 */
public class WlyyAuditNoticeScopeController {
}

+ 267 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/patient/AdminPatientController.java

@ -0,0 +1,267 @@
package com.yihu.wlyy.controller.manager.patient;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.UUID;
/**
 * Created by yww on 2016/10/8.
 * 后台管理 患者信息维护
 */
@Controller
@RequestMapping(value="admin/patient")
public class AdminPatientController extends BaseController {
    @Autowired
    private AdminPatientService adminPatientService;
    @Autowired
    private ObjectMapper objectMapper;
    //患者列表页跳转
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listInit(){
        return "patient/patient_list";
    }
    //患者详情页跳转(uuid)
    @RequestMapping(value="infoInit/{id}",method = RequestMethod.GET)
    public String InfoInit(Model model, @PathVariable("id") Long id, String mode) throws Exception {
        model.addAttribute("patient", "{}");
        if(id==0){
            request.setAttribute("UUID", UUID.randomUUID().toString().replace("-", ""));
            model.addAttribute("UUID", UUID.randomUUID().toString().replace("-", ""));
        }
        if (id > 0) {
            Patient patient = adminPatientService.getPatient(id);
            if (patient != null)
                model.addAttribute("patient", objectMapper.writeValueAsString(patient));
        }
        request.setAttribute("mode", mode);
        request.setAttribute("id",id);
        return "patient/patient_modify";
    }
    //获取患者列表
    @RequestMapping(value = "patientList")
    @ResponseBody
    public String searchPatientList(
            String name,String idcard,String ssc,String mobile,Integer openIdStatus,int page,int rows){
        try {
            Page<Patient> patients = adminPatientService.searchPatientList(name, idcard, ssc,mobile,openIdStatus, page, rows);
            return write(200,"操作成功",page,rows,patients);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //根据id获取
    @RequestMapping(value = "patient")
    @ResponseBody
    public String getPatient(Long id){
        try{
            Patient patient = adminPatientService.getPatient(id);
            return write(200,"操作成功","patient",patient);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //新增
    @RequestMapping(value = "create")
    @ResponseBody
    public String createPatient(String jsonData){
        try{
            ObjectMapper objectMapper = new ObjectMapper();
            Patient patient = objectMapper.readValue(jsonData,Patient.class);
            String msg = "";
            if(StringUtils.isEmpty(patient.getName())){
                msg += "姓名不能为空;";
            }
            if(StringUtils.isEmpty(patient.getIdcard())){
                msg += "身份证不能为空;";
            }
            if(StringUtils.isEmpty(patient.getSsc())){
                msg += "社保卡不能为空;";
            }
            if(!StringUtils.isEmpty(msg)){
                return error(-1,msg);
            }
//            String idcard = patient.getIdcard();
//            if(idcard == null){
//                return error(-1,"身份证不能为空!");
//            }
//            //姓名+身份证号+社保卡号 检验
//            SocialSecurityInfo info = adminPatientService.findSocialSecurityInfo(idcard);
//            boolean flag = true;
//            if(StringUtils.equals(info.getXming0(),patient.getName())){
//                //名字不符
//                flag = false;
//            }
//            if(StringUtils.equals(info.getCardno(),patient.getSsc()) || StringUtils.equals(info.getCard16(),patient.getSsc())){
//                //社保卡不符(两种社保卡形式)
//                flag = false;
//            }
//            if(!flag){
//                return error(-1, "姓名,身份证,社保卡信息不对应,请核对!");
//            }
            adminPatientService.createPatient(patient);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //修改
    @RequestMapping(value = "update")
    @ResponseBody
    public String updatePatient(String jsonData){
        try{
            ObjectMapper objectMapper = new ObjectMapper();
            Patient patient = objectMapper.readValue(jsonData,Patient.class);
            String msg = "";
            if(patient.getId() ==0){
                msg += "id不能为空;";
            }
            if(StringUtils.isEmpty(patient.getName())){
                msg += "姓名不能为空;";
            }
            if(StringUtils.isEmpty(patient.getIdcard())){
                msg += "身份证不能为空;";
            }
            if(StringUtils.isEmpty(patient.getSsc())){
                msg += "社保卡不能为空;";
            }
            if(!StringUtils.isEmpty(msg)){
                return error(-1,msg);
            }
//            String idcard = patient.getIdcard();
//            if(idcard == null){
//                return error(-1,"身份证不能为空!");
//            }
//            //姓名+身份证号+社保卡号 检验
//            SocialSecurityInfo info = adminPatientService.findSocialSecurityInfo(idcard);
//            if(info == null){
//                return error(-1,"根据该身份证,没有找到相关的社保信息!");
//            }
//            boolean flag = true;//是否符合
//            if(!StringUtils.equals(info.getXming0().trim(),patient.getName().trim())){
//                //名字不符
//                flag = false;
//            }
//            if(!(StringUtils.equals(info.getCardno().trim(),patient.getSsc().trim()) || StringUtils.equals(info.getCard16().trim(),patient.getSsc().trim()))){
//                //社保卡不符(两种社保卡形式)
//                flag = false;
//            }
//            if(!flag){
//                return error(-1,"姓名,身份证,社保卡信息不对应,请核对!");
//            }
            adminPatientService.updatePatient(patient);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //根据删除
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deletePatient(Long id){
        try{
            adminPatientService.deletePatient(id);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //患者死亡
    @RequestMapping(value = "death")
    @ResponseBody
    public String death(Long id){
        try{
            adminPatientService.death(id);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //手机号唯一
    @RequestMapping(value = "isMoblieExist")
    @ResponseBody
    public String isMobileExist(String mobile){
        try{
            return adminPatientService.isMobileExist(mobile);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //身份证号唯一
    @RequestMapping(value = "isIdCardExist")
    @ResponseBody
    public String isIdCardExist(String idcard){
        try{
            Patient patient = adminPatientService.findByIdcard(idcard);
            return patient == null?"false":"true";
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //社保卡号唯一
    @RequestMapping(value = "isSscExist")
    @ResponseBody
    public String isSscExist(String ssc){
        try{
            Patient patient = adminPatientService.findBySsc(ssc);
            return patient == null?"false":"true";
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //初始化密码
    @RequestMapping(value = "initPassword")
    @ResponseBody
    public String initPassword(
            @RequestParam(value = "patientId", required = true) Long patientId,
            @RequestParam(value = "idCard", required = true) String idCard) {
        try {
            boolean res = adminPatientService.initPassword(patientId, idCard);
            return res == true?write(200, "操作成功!"):error(-1, "操作失败!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "updateStatus",method = RequestMethod.POST)
    @ResponseBody
    public String updateStatus(
            @RequestParam(value = "patientId", required = true) Long patientId,
            @RequestParam(value = "status", required = true) Integer status) {
        try {
            boolean res = adminPatientService.updataStatus(status, patientId);
            return res == true?write(200, "操作成功!"):error(-1, "操作失败!");
        } catch (Exception e) {
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 235 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/sign/SignFamilyController.java

@ -0,0 +1,235 @@
package com.yihu.wlyy.controller.manager.sign;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.entity.WlyyAdminTeamMember;
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
import com.yihu.wlyy.service.manager.team.WlyyAdminTeamMemberService;
import com.yihu.wlyy.service.manager.team.WlyyAdminTeamService;
import io.swagger.annotations.ApiParam;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2016/10/26.
 */
@Controller
@RequestMapping(value="admin/sign")
public class SignFamilyController extends BaseController {
    @Autowired
    private SignFamilyService signFamilyService;
    @Autowired
    private WlyyAdminTeamMemberService teamMemberService;
    //签约居民管理*******************************
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listInit(){
        return "sign/sign_family_list";
    }
    @RequestMapping(value = "signList")
    @ResponseBody
    public String searchPatientList(
            @RequestParam(value = "name",required = false)String name,
            @RequestParam(value = "idcard",required = false)String idcard,
            @RequestParam(value = "address",required = false)String address,
            @RequestParam(value = "hospitalName",required = false)String hospitalName,
            @RequestParam(value = "signDoctorName",required = false)String signDoctorName,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "rows",required = false)Integer pageSize
    ){
        try {
            Page<SignFamily> signFamilies = signFamilyService.searchList(name, idcard,address,hospitalName,signDoctorName, page, pageSize);
            return write(200,"操作成功",page,pageSize,signFamilies);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "infoInit/{id}",method = RequestMethod.GET)
    public String infoInit(@PathVariable(value = "id") Long id){
        return "sign/sign_family_modify";
    }
    @RequestMapping(value = "signInfo/{id}")
    @ResponseBody
    public String findById(@PathVariable(value = "id")Long id){
        try {
            SignFamily signFamily = signFamilyService.findById(id);
            return write(200,"success","data",signFamily);
        }catch (Exception e){
            error(e);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "memberList", method = RequestMethod.POST)
    @ResponseBody
    public String memberList(
            @ApiParam(name = "teamId", value = "团队Id")
            @RequestParam(value = "teamId") Long teamId,
            @ApiParam(name = "doctorCode", value = "医生编码")
            @RequestParam(value = "doctorCode", required = false) String doctorCode) {
        try {
            List<WlyyAdminTeamMember> members = teamMemberService.searchTeamMembers(teamId, doctorCode);
            return write(200, "操作成功", "detailModelList", members);
        } catch (Exception ex) {
            error(ex);
            return error(200, "操作失败");
        }
    }
    //签约居民管理******************************
    //签约居民分配******************************
    //用于签约居民分配的签约居民显示
    @RequestMapping(value = "allocate/initial", method = RequestMethod.GET)
    public String initAllocateListPage(){
        return "team/patient/sign_family_allocate_list";
    }
    @RequestMapping(value = "allocate/list",method = RequestMethod.POST)
    @ResponseBody
    public String searchListForAllocate(
            @RequestParam(value = "name",required = false)String name,
            @RequestParam(value = "idcard",required = false)String idcard,
            @RequestParam(value = "address",required = false)String address,
            @RequestParam(value = "hospitalName",required = false)String hospitalName,
            @RequestParam(value = "signDoctorName",required = false)String signDoctorName,
            @RequestParam(value = "adminTeamId",required = false)Integer adminTeamId,
            @RequestParam(value = "adminTeamName",required = false)String adminTeamName,
            @RequestParam(value = "leaderName",required = false)String leaderName,
            @RequestParam(value = "doctorHealthName",required = false)String doctorHealthName,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "rows",required = false)Integer pageSize){
        try {
            Page<SignFamily> signFamilies = signFamilyService.searchListForAllocate(name, idcard,address, hospitalName, signDoctorName, adminTeamId,adminTeamName,leaderName,doctorHealthName, page, pageSize);
            return write(200,"操作成功",page,pageSize,signFamilies);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "allocate",method = RequestMethod.GET)
    public String initAllocatePage(){
        return "team/patient/sign_family_allocate";
    }
    @RequestMapping(value = "allocate",method = RequestMethod.POST)
    @ResponseBody
    public String allocate(
            @RequestParam(value = "ids",required = true)Long[] ids,
            @RequestParam(value = "doctor",required = false)String doctor,
            @RequestParam(value = "doctorHealth",required = false)String doctorHealth){
        try {
            if(ids.length <=0){
                return error(-1,"批量分配签约ids不能为空!");
            }
            //全科和健管师都为空,全科和健管有一个为空,全科和健管都不为空。
            if(StringUtils.isEmpty(doctor) && StringUtils.isEmpty(doctorHealth)){
                return error(-1,"分配的全科医生,健康管理师不能同时为空!");
            }
//            if(StringUtils.equals(doctor,doctorHealth)){
//                return error(-1,"分配的全科医生,健康管理师不能为同一个人!");
//            }
            Map<String,Object> res = signFamilyService.batchAllocate(ids, doctor, doctorHealth);
            if(res.get("errorMsg") != null){
                return write(-1,res.get("errorMsg").toString());
            }
            return write(200,"操作成功","data",res);
        }catch (Exception e){
            error(e);
            return error(-1,"操作失败!");
        }
    }
    //签约居民批量分配失败记录导出Excel
    //导入失败数据生成Excel表
    @RequestMapping(value = "toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void errorDataToExcel(@RequestParam(value = "errorData")String errorData,HttpServletResponse response){
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, SignFamily.class);
            List<SignFamily> lst =  (List<SignFamily>)objectMapper.readValue(errorData, javaType);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "errorAllocateTable.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,lst);
        }catch (Exception ex){
            error(ex);
        }
    }
    public void addHeader(WritableSheet ws) throws WriteException {
        String[] header = {"签约id","患者编码","患者姓名", "身份证号", "团队id", "签约人","全科医生", "健康管理师", "分配失败原因"};
        int i = 0;
        for (String h : header) {
            addCell(ws, 0, i, h);//表名,行,列,header
            i++;
        }
    }
    public void write(WritableWorkbook wwb, List ls) throws Exception {
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet",1);
            addHeader(ws);
            int i = 1;
            for (SignFamily m : (List<SignFamily>) ls) {
                addCell(ws, i, 0, m.getId()+"","");
                addCell(ws, i, 1, m.getPatient(),"");
                addCell(ws, i, 2, m.getName(),"");
                addCell(ws, i, 3, m.getIdcard(),"");
                addCell(ws, i, 4, m.getAdminTeamId()+"","");
                addCell(ws, i, 5, m.getSignDoctorName(),"");
                addCell(ws, i, 6, m.getDoctorName(),"");
                addCell(ws, i, 7, m.getDoctorHealthName(),"");
                addCell(ws, i, 8, m.getMsg());
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void write(OutputStream os, List ls) throws Exception{
        write(Workbook.createWorkbook(os), ls);
    };
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
}

+ 208 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyQuestionController.java

@ -0,0 +1,208 @@
package com.yihu.wlyy.controller.manager.survey;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.survey.SurveyQuestion;
import com.yihu.wlyy.service.manager.survey.SurveyQuestionOptionService;
import com.yihu.wlyy.service.manager.survey.SurveyQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
 * Created by yeshijie on 2017/3/7.
 */
@Controller
@RequestMapping(value="admin/surveyQuestion")
//@Api(description = "问题题库数据接口")
@Api(value = "surveyQuestion", description = "问题题库数据接口", tags = {"问题题库"})
public class SurveyQuestionController extends BaseController{
    @Autowired
    private SurveyQuestionService surveyQuestionService;
    @Autowired
    private SurveyQuestionOptionService surveyQuestionOptionService;
    //---问题管理列表---
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "问题管理列表")
    public String initQuestionList(){
        return "questionnaire/question/question_list";
    }
    //页面跳转(新增问题页面)
    @RequestMapping(value ="infoInit",method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "页面跳转(新增问题页面)")
    public String infoInit(String id,String mode){
        request.setAttribute("id",id);
        request.setAttribute("mode",mode);
        return "questionnaire/question/question_add";
    }
    //页面跳转(编辑问题页面)
    @RequestMapping(value ="editQuestion",method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "页面跳转(编辑问题页面)")
    public String editQuestion(String id,String mode){
        request.setAttribute("id",id);
        request.setAttribute("mode",mode);
        return "questionnaire/question/question_edit";
    }
    //跳转到问题查看页
    @RequestMapping(value = "seeQuestion", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "跳转到问题查看页")
    public String seeQuestion(String id,String type) {
        request.setAttribute("id",id);
        request.setAttribute("type",type);
        return "questionnaire/question/see_question";
    }
    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "问题列表数据")
    public String searchQuestionList(
            @ApiParam(name = "title", value = "标题",defaultValue = "")
            @RequestParam(value = "title", required = false) String title,
            @ApiParam(name = "questionType", value = "问题类型(0单选 1多选 2问答)",defaultValue = "0")
            @RequestParam(value = "questionType", required = false) Integer questionType,
            @ApiParam(name = "page",value = "第几页",defaultValue = "1")
            @RequestParam(value = "page",required = true) int page,
            @ApiParam(name = "rows",value = "页面大小",defaultValue = "2")
            @RequestParam(value = "rows",required = true) int rows) {
        try {
            Page<SurveyQuestion> res = surveyQuestionService.findQuestion(page,rows,title,questionType);
            return write(200, "操作成功", page, rows, res);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    /**
     * 问题新增页面
     * @param model
     * @return
     */
    @RequestMapping(value = "addQuestionInitial", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "问题列表数据")
    public String addQuestionInitial(Model model) {
        return "survey/question/addQuestion";
    }
    @RequestMapping(value = "addQuestions", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "新增问题(可批量新增)")
    public String addQuestions(@ApiParam(name = "jsonData", value = "新增json",defaultValue = "")
                                @RequestParam(value = "jsonData", required = true) String jsonData) {
        try {
            System.out.println("jsonData:"+jsonData);
            surveyQuestionService.saveOrUpdateQuestion(jsonData);
            return success("新增成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "新增失败!");
        }
    }
    @RequestMapping(value = "getQuestion", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "根据id获取单个问题")
    public String getQuestion(@ApiParam(name = "id", value = "问题id",defaultValue = "1")
                               @RequestParam(value = "id", required = true) Long id) {
        try {
            SurveyQuestion question = surveyQuestionService.findById(id);
            if(question == null){
                return error(-1, "获取问题Id不存在");
            }else if("0".equals(question.getDel())){
                return error(-1, "该问题已被删除");
            }else{
                JSONObject json = surveyQuestionService.getQuestion(question);
                return write(200,"获取成功","data",json);
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getQuestions", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "根据id获取单个问题")
    public String getQuestion(@ApiParam(name = "id", value = "问题id",defaultValue = "1")
                              @RequestParam(value = "ids", required = true) String  ids) {
        try {
            JSONArray questions = surveyQuestionService.findByIds(ids);
             return write(200,"获取成功","data",questions);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "delQuestion", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "根据id删除单个问题")
    public String delQuestion(@ApiParam(name = "id", value = "问题id",defaultValue = "1")
                              @RequestParam(value = "id", required = true) Long id) {
        try {
            surveyQuestionService.delQuestion(id);
            return success("删除成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "删除失败!");
        }
    }
    @RequestMapping(value = "delQuestions", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "批量删除")
    public String delQuestions(@ApiParam(name = "ids", value = "问题ids",defaultValue = "1;2;3")
                              @RequestParam(value = "ids", required = true) String ids) {
        try {
            if(StringUtils.isEmpty(ids)){
                return error(-1, "删除问题ids不能为空!");
            }
            surveyQuestionService.delQuestions(ids);
            return success("删除成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "删除失败!");
        }
    }
    @RequestMapping(value = "updQuestion", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "更新问题")
    public String updQuestion(@ApiParam(name = "questionData", value = "问题json",defaultValue = "{}")
                               @RequestParam(value = "questionData", required = true) String questionData) {
        try {
            System.out.println(questionData);
            return success("更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败!");
        }
    }
}

+ 179 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/survey/SurveyTemplateController.java

@ -0,0 +1,179 @@
package com.yihu.wlyy.controller.manager.survey;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.survey.SurveyTemplate;
import com.yihu.wlyy.service.manager.survey.SurveyTemplateService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
/**
 * Created by yeshijie on 2017/3/7.
 */
@Controller
@RequestMapping(value="admin/surveyTemplate/")
public class SurveyTemplateController extends BaseController{
    @Autowired
    SurveyTemplateService surveyTemplateService;
    //---问卷模板管理列表---
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initTeamList(){
        return "questionnaire/template/template_list";
    }
    //跳转到问题查看页
    @RequestMapping(value = "importQuestion", method = RequestMethod.GET)
    @ApiIgnore
    @ApiOperation(value = "跳转到问题查看页")
    public String importQuestion() {
        return "questionnaire/template/import_question";
    }
    @RequestMapping(value = "list", method = RequestMethod.GET)
    @ResponseBody
    public String list(
            @ApiParam(name = "title", value = "标题",defaultValue = "")
            @RequestParam(value = "title", required = false) String title,
            @ApiParam(name = "label", value = "标签信息",defaultValue = "0")
            @RequestParam(value = "label", required = false) Integer labelCode,
            @ApiParam(name = "page",value = "第几页",defaultValue = "1")
            @RequestParam(value = "page",required = true) int page,
            @ApiParam(name = "rows",value = "页面大小",defaultValue = "2")
            @RequestParam(value = "rows",required = true) int rows){
        try {
            Page<JSONObject> res = surveyTemplateService.queryList(page,rows,title,labelCode);
            return write(200, "操作成功", page, rows, res);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "list/options", method = RequestMethod.GET)
    @ResponseBody
    public String listOption(
            @ApiParam(name = "q", value = "标题",defaultValue = "")
            @RequestParam(value = "q", required = false) String title,
            @ApiParam(name = "label", value = "标签信息",defaultValue = "0")
            @RequestParam(value = "label", required = false) Integer labelCode,
            @ApiParam(name = "page",value = "第几页",defaultValue = "1")
            @RequestParam(value = "page",required = true) int page,
            @ApiParam(name = "rows",value = "页面大小",defaultValue = "2")
            @RequestParam(value = "rows",required = true) int rows){
        try {
            Page<JSONObject> res = surveyTemplateService.queryList(page,rows,title,labelCode);
            JSONArray array = new JSONArray();
            for(JSONObject p:res.getContent()){
                JSONObject optionObj = new JSONObject();
                optionObj.put("id",p.get("id"));
                optionObj.put("text",p.get("title"));
                array.put(optionObj);
            }
            return write(200,"获取成功","list",array);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //---新增问卷模板---
    @RequestMapping(value = "addTemplate", method = RequestMethod.GET)
    public String addTemplate(String id,String mode){
        request.setAttribute("templateId",id);
        request.setAttribute("mode",mode);
        return "questionnaire/template/add_template";
    }
    //---编辑问卷模板---
    @RequestMapping(value = "editTemplate", method = RequestMethod.GET)
    public String editTemplate(String id,String mode){
        request.setAttribute("id",id);
        request.setAttribute("mode",mode);
        return "questionnaire/template/edit_template";
    }
    //---保存标签---
    @RequestMapping(value = "editLabel", method = RequestMethod.POST)
    public String editLabel(@ApiParam(name = "模板id", value = "模板id",defaultValue = "0")
                                @RequestParam(value = "templateId", required = true) long templateId,
                            @ApiParam(name = "标签JSON", value = "标签JSON",defaultValue = "")
                            @RequestParam(value = "jsonData", required = true) String jsonData){
        try {
            surveyTemplateService.saveLabel(templateId,jsonData);
            return write(200,"保存成功");
        }catch (Exception e){
            return write(-1,"保存失败");
        }
    }
    @RequestMapping(value = "save", method = RequestMethod.POST)
    @ResponseBody
    public String saveTemplate(@ApiParam(name = "jsonData", value = "新增json",defaultValue = "")
                                   @RequestParam(value = "jsonData", required = true) String jsonData,
                               HttpServletRequest request){
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        try {
            surveyTemplateService.saveOrUpdate(jsonData,loginUser.getCode());
            return write(200,"保存成功");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败");
        }
    }
    @RequestMapping(value = "template", method = RequestMethod.GET)
    @ResponseBody
    public String getTemplate(@ApiParam(name = "id", value = "模板id",defaultValue = "0")
                              @RequestParam(value = "id", required = true) long id,
                              @ApiParam(name = "question", value = "是否加载问题",defaultValue = "0")
                              @RequestParam(value = "question", required = false) long question,
                              HttpServletRequest request){
        try {
            JSONObject surveyTemplate =  surveyTemplateService.getTemplate(id,question);
            return write(200,"获取成功","data",surveyTemplate);
        }catch (Exception e){
            return write(-1,"获取失败");
        }
    }
    @RequestMapping(value = "template/title", method = RequestMethod.GET)
    @ResponseBody
    public String getTemplate(@ApiParam(name = "title", value = "模板title",defaultValue = "")
                              @RequestParam(value = "title", required = true) String  title){
        try {
            SurveyTemplate surveyTemplate =  surveyTemplateService.findByTitle(title);
            return write(200,"获取成功","data",surveyTemplate);
        }catch (Exception e){
            return write(-1,"获取失败");
        }
    }
    @RequestMapping(value = "delete", method = RequestMethod.POST)
    @ResponseBody
    public String delete(@ApiParam(name = "模板ID", value = "模板ID",defaultValue = "0")
                              @RequestParam(value = "templateId", required = true) Long templateId){
        try {
           surveyTemplateService.deleteTemplate(templateId);
            return write(200,"删除成功");
        }catch (Exception e){
            return write(-1,"获取失败");
        }
    }
}

+ 300 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/team/WlyyAdminTeamController.java

@ -0,0 +1,300 @@
package com.yihu.wlyy.controller.manager.team;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.WlyyAdminTeam;
import com.yihu.wlyy.entity.WlyyAdminTeamMember;
import com.yihu.wlyy.service.manager.hos.HosDoctorService;
import com.yihu.wlyy.service.manager.team.WlyyAdminTeamMemberService;
import com.yihu.wlyy.service.manager.team.WlyyAdminTeamService;
import com.yihu.wlyy.util.HttpUtil;
import io.swagger.annotations.ApiParam;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by yww on 2016/11/15.
 */
@Controller
@RequestMapping("admin/team")
public class WlyyAdminTeamController extends BaseController {
    @Autowired
    private WlyyAdminTeamService teamService;
    @Value("${service-gateway.update-team-url}")
    private String loadTeamInfoUrl;
    //----------------------------------------团队成员列表--------------------------------
    @Autowired
    private WlyyAdminTeamMemberService teamMemberService;
    @Autowired
    private HosDoctorService doctorService;
    //---医生团队查询 开始---
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initTeamList() {
        return "team/doctor/team_list";
    }
    //分页查询团队列表
    @RequestMapping(value = "teamList", method = RequestMethod.POST)
    @ResponseBody
    public String searchTeams(
            @ApiParam(name = "orgName", value = "机构名称")
            @RequestParam(value = "orgName", required = false) String orgName,
            @ApiParam(name = "teamName", value = "团队名称")
            @RequestParam(value = "teamName", required = false) String teamName,
            @ApiParam(name = "leaderName", value = "团队长")
            @RequestParam(value = "leaderName", required = false) String leaderName,
            @ApiParam(name = "memberName", value = "团队成员名")
            @RequestParam(value = "memberName", required = false) String memberName,
            @ApiParam(name = "memberMobile", value = "团队成员名电话")
            @RequestParam(value = "memberMobile", required = false) String memberMobile,
            @ApiParam(name = "page")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "rows")
            @RequestParam(value = "rows") int pageSize) {
        try {
            //按医生code信息外查询,
            Page<WlyyAdminTeam> wlyyTeams = teamService.searchTeams(orgName, teamName, leaderName, memberName, memberMobile, page, pageSize);
            return writeToJson(200, "操作成功", page, pageSize, wlyyTeams);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //获取某个机构下的所有团队
    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    public String searchTeams(
            @ApiParam(name = "orgCode", value = "机构编码")
            @RequestParam(value = "orgCode", required = false) String orgCode) {
        try {
            //按医生code信息外查询,
            List<WlyyAdminTeam> wlyyTeams = teamService.getByOrgCode(orgCode);
            return write(200, "操作成功", "list",wlyyTeams);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //-----居民签约团队信息查询开始(团队信息、团队成员列表)-----
    @RequestMapping(value = "signTeamInfo/{adminTeamId}", method = RequestMethod.GET)
    public String initTeamPatientList(
            @ApiParam(name = "adminTeamId", value = "居民签约行政团队id")
            @PathVariable Long adminTeamId) throws Exception {
        ObjectMapper objectMapper = new ObjectMapper();
        WlyyAdminTeam team = teamService.findById(adminTeamId);
        team = teamService.searchOrgName(team);
        request.setAttribute("teamInfo", objectMapper.writeValueAsString(team));
        request.setAttribute("adminTeamId", adminTeamId);
        return "sign/sign_team_info";
    }
    @RequestMapping(value = "signTeamInfo", method = RequestMethod.POST)
    @ResponseBody
    public String signTeamInfo(
            @ApiParam(name = "teamId", value = "居民签约行政团队id")
            @RequestParam(value = "teamId", required = true) Long teamId) {
        try {
            WlyyAdminTeam signTeamInfo = teamService.getSignTeamInfo(teamId);
            return write(200, "操作成功", "data", signTeamInfo);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //修改团队状态
    @RequestMapping(value = "updateStatus", method = RequestMethod.POST)
    @ResponseBody
    public String updateTeamStatus(
            @ApiParam(name = "id", value = "团队id")
            @RequestParam(value = "id", required = true) Long id,
            @ApiParam(name = "available", value = "修改状态值 1,0")
            @RequestParam(value = "available") String available) {
        try {
            boolean res = teamService.updateStatus(available, id);
            if (!res) {
                return error(-1, "操作失败!");
            }
            return write(200, "操作成功");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //查看团队信息
    @RequestMapping(value = "teamInfo/{id}", method = RequestMethod.GET)
    public String teamInfoPage(
            @ApiParam(name = "id", value = "团队id")
            @PathVariable(value = "id") Long id) {
        request.setAttribute("id", id);
        return "team/doctor/team_info";
    }
    @RequestMapping(value = "teamInfo", method = RequestMethod.POST)
    @ResponseBody
    public String teamInfo(
            @ApiParam(name = "id", value = "团队id")
            @RequestParam(value = "id") Long id) {
        try {
            WlyyAdminTeam team = teamService.findById(id);
            return write(200, "操作成功", "data", team);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    //同步团队
    @RequestMapping(value = "loadTeamInfo", method = RequestMethod.POST)
    @ResponseBody
    public String loadTeamInfo() {
        try {
            String res = HttpUtil.sendPost(loadTeamInfoUrl, "");
            if (!StringUtils.isEmpty(res)) {
                return write(200, "操作成功");
            }
            return write(-1, "操作失败");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "系统异常");
        }
    }
    //团队成员列表页(不分页查询)
    @RequestMapping(value = "memberList/{teamId}", method = RequestMethod.GET)
    public String memberListPage(
            @ApiParam(name = "teamId", value = "团队Id")
            @PathVariable Long teamId) {
        request.setAttribute("teamId", teamId);
        return "team/doctor/team_member_list";
    }
    @RequestMapping(value = "memberList", method = RequestMethod.POST)
    @ResponseBody
    public String memberList(
            @ApiParam(name = "teamId", value = "团队Id")
            @RequestParam(value = "teamId") Long teamId,
            @ApiParam(name = "doctorCode", value = "医生编码")
            @RequestParam(value = "doctorCode", required = false) String doctorCode) {
        try {
            List<WlyyAdminTeamMember> members = teamMemberService.searchTeamMembers(teamId, doctorCode);
            return write(200, "操作成功", "detailModelList", members);
        } catch (Exception ex) {
            error(ex);
            return error(200, "操作失败");
        }
    }
    //团队成员信息
    @RequestMapping(value = "memberInfo/{doctorCode}", method = RequestMethod.GET)
    public String memberInfoPage(
            @ApiParam(name = "doctorCode", value = "团队医生编码")
            @PathVariable String doctorCode) {
        request.setAttribute("doctorCode", doctorCode);
        return "team/doctor/member_info";
    }
    @RequestMapping(value = "memberInfo", method = RequestMethod.POST)
    @ResponseBody
    public String memberInfo(
            @ApiParam(name = "doctorCode", value = "团队医生编码")
            @RequestParam(value = "doctorCode") String doctorCode) {
        try {
            Doctor doctor = doctorService.getDoctorByCode(doctorCode);
            return write(200, "操作成功", "data", doctor);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    public String writeToJson(int code, String errorMsg, int page, int rows, Page<WlyyAdminTeam> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("successFlg", code == 0);
            map.put("errorMsg", errorMsg);
            // 是否为第一页
            map.put("errorCode", code);
            // 是否为最后一页
            map.put("currPage", page);
            // 分页大小
            map.put("pageSize", rows);
            // 总条数
            map.put("totalCount", list.getTotalElements());
            // 总页数
            map.put("totalPage", list.getTotalPages());
            List<WlyyAdminTeam> teamList = list.getContent();
            if (teamList != null && teamList.size() > 0) {
                for (WlyyAdminTeam team : teamList) {
                    team = teamService.searchOrgName(team);
                }
            }
            // 结果集
            map.put("detailModelList", teamList);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    //获取团队成员下拉列表框(类型:专科1,全科2,健管师3
    @RequestMapping(value = "memberCodes", method = RequestMethod.POST)
    @ResponseBody
    public String searchMemberCodes(
            @RequestParam(value = "teamId", required = true) Long teamId,
            @RequestParam(value = "doctorLevel", required = true) Integer[] doctorLevel) {//逗号隔开:如 1,2,3
        try {
            if (doctorLevel.length < 0) {
                return error(-1, "医生角色类型不能为空");
            }
//            String[] level = doctorLevel.split(",");
            List<Doctor> members = teamMemberService.searchTeamMemberCodes(teamId, doctorLevel);
            return write(200, "操作成功", "detailModelList", members);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "importData", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importData(HttpServletRequest request) {
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook workbook = Workbook.getWorkbook(inputStream);
            teamService.importData(workbook);
            return write(200, "操作成功");
        } catch (IOException | BiffException e) {
            e.printStackTrace();
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 429 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageFeatureController.java

@ -0,0 +1,429 @@
package com.yihu.wlyy.controller.manager.user;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageFeature;
import com.yihu.wlyy.filter.RoleCache;
import com.yihu.wlyy.model.FeatureTree;
import com.yihu.wlyy.service.manager.user.ManageFeatureService;
import com.yihu.wlyy.util.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by yww on 2016/12/29.
 */
@Controller
@RequestMapping("admin/feature")
@Api(description = "管理系统权限")
public class ManageFeatureController extends BaseController {
    @Autowired
    RoleCache roleCache;
    @Autowired
    private ManageFeatureService featureService;
    @Autowired
    private ObjectMapper objectMapper;
    //页面跳转
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    @ApiIgnore
    public String featureListInit() {
        return "user/feature/featureGrid";
    }
    @RequestMapping(value = "/tree", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Object tree() {
        try {
            List<ManageFeature> features = featureService.search("type<>3;");
            Map<Long, FeatureTree> map = new HashMap<>();
            map.put(new Long(0), new FeatureTree(0, "三师后台管理系统", -1, "0", ""));
            for (ManageFeature model : features) {
                map.put(model.getId(), new FeatureTree(
                        model.getId(), model.getName(), model.getParentId(), model.getType(), model.getIconUrl()));
            }
            FeatureTree p;
            for (FeatureTree model : map.values()) {
                if ((p = map.get(model.getParentId())) != null)
                    p.addChild(model);
            }
            List rs = new ArrayList<>();
            rs.add(map.get(new Long(0)));
            Envelop envelop = new Envelop();
            envelop.setSuccessFlg(true);
            envelop.setDetailModelList(rs);
            return objectMapper.writeValueAsString(envelop);
        } catch (Exception ex) {
            ex.printStackTrace();
            return write(-1, "系统错误!");
        }
    }
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public Object search(String fields, String filters, String sorts, int page, int rows, String extParms) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("fields", nullToSpace(fields));
            params.put("filters", nullToSpace(filters));
            params.put("sorts", nullToSpace(sorts));
            params.put("page", page);
            params.put("size", rows);
            List<ManageFeature> features = featureService.search(nullToSpace(fields), nullToSpace(filters), nullToSpace(sorts), page, rows);
            Envelop envelop = new Envelop();
            envelop.setSuccessFlg(true);
            envelop.setDetailModelList(features);
            return objectMapper.writeValueAsString(envelop);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "系统错误!");
        }
    }
    @RequestMapping("/gotoModify")
    @ApiIgnore
    public String gotoModify(Model model, String id, String mode, String extParms) {
        try {
            if (StringUtils.isEmpty(id)) {
                return error(-1, "权限id不能为空!");
            }
            if ("new".equals(mode)) {
                model.addAttribute("model", "");
                model.addAttribute("parentId", id);
            } else {
                ManageFeature feature = featureService.retrieve(Long.parseLong(id));
                model.addAttribute("model", objectMapper.writeValueAsString(feature));
                model.addAttribute("parentId", feature.getParentId());
            }
            model.addAttribute("mode", mode);
            model.addAttribute("extParms", extParms);
            return "user/feature/featureInfoDialog";
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "系统错误");
        }
    }
    @RequestMapping("/existence")
    @ResponseBody
    public String isExistence(String filters) {
        try {
            List list = featureService.search(filters);
            if (list != null && list.size() > 0) {
                return write(200, "存在子项", "data", list.get(0));
            }
            return write(200, "不存在子项", "data", "");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "系统错误!");
        }
    }
    @RequestMapping("/delete")
    @ResponseBody
    public Object delete(String ids, String idField, String extParms, String type) {
        try {
            if (StringUtils.isEmpty(ids)) {
                return error(-1, "权限id不能为空!");
            }
            boolean res;
            if ("unique".equals(type)) {
                Long id = Long.parseLong(ids);
                res = featureService.deleteUnique(id);
                if (res) {
                    return write(200, "删除成功");
                }
                return error(-1, "删除失败");
            } else {
                return error(-1, "只允许删除单个权限!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "系统错误!");
        }
    }
    @RequestMapping("/update")
    @ResponseBody
    public Object update(String id, String model, String modelName, String extParms) {
        try {
            ManageFeature feature = objectMapper.readValue(model, ManageFeature.class);
            String errorMsg = "";
            if (StringUtils.isEmpty(feature.getCode())) {
                errorMsg += errorMsg + "编码不能为空!;";
            }
            if (StringUtils.isEmpty(feature.getName())) {
                errorMsg += errorMsg + "名称不能为空!;";
            }
            if (StringUtils.isEmpty(feature.getType())) {
                errorMsg += errorMsg + "类型不能为空!;";
            }
            if (!StringUtils.isEmpty(errorMsg)) {
                return error(-1, errorMsg);
            }
            if (StringUtils.isEmpty(id) || "0".equals(id)) {
                boolean res = featureService.createFeature(feature);
                if (res) {
                    return write(200, "新增成功!", "obj", feature);
                }
                return error(-1, "新增失败!");
            } else {
                boolean res = featureService.updateFeature(feature);
                if (res) {
                    return write(200, "修改成功!", "obj", feature);
                }
                return error(-1, "修改失败!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败!");
        }
    }
    public String nullToSpace(String str) {
        if (str == null)
            return "";
        return str;
    }
    //    @Autowired
//    private ManageFeatureService featureService;
//
//    @Autowired
//    private ObjectMapper objectMapper;
//
//    //页面跳转
//    @RequestMapping(value = "list",method = RequestMethod.GET)
//    @ApiIgnore
//    public String featureListInit(){
//        return "user/feature/featureGrid";
//    }
//
//    @RequestMapping(value = "info",method = RequestMethod.GET)
//    @ApiIgnore
//    public String featureInfoInit(){
//        return "user/feature/featureInfoDialog";
//    }
//    //增删改查
//    @RequestMapping(value = "create",method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "新增权限", notes = "*")
//    public String createFeature(
//            @ApiParam(name = "dataJson",value = "权限对象Json串")
//            @RequestParam(value = "dataJson")String dataJson){
//        try{
//            ManageFeature feature = objectMapper.readValue(dataJson, ManageFeature.class);
//            //数据验证操作
//            String errorMsg = "";
//            if(StringUtils.isEmpty(feature.getCode())){
//                errorMsg += errorMsg +"权限编码不能为空!;";
//            }else {
//                if(featureService.isCodeExist(feature.getCode())){
//                    errorMsg += errorMsg+"权限编码已存在!;";
//                }
//            }
//            if(StringUtils.isEmpty(feature.getName())){
//                errorMsg += errorMsg +"权限名称不能为空!;";
//            }else {
//                if(featureService.isNameExist(feature.getName())){
//                    errorMsg += errorMsg+ "权限名称已存在!;";
//                }
//            }
//            if(!StringUtils.isEmpty(errorMsg)){
//                return error(-1, errorMsg);
//            }
//            //新增操作(新增失败抛异常)
//            Envelop envelop = featureService.createFeature(feature);
//            if(!envelop.isSuccessFlg()){
//                return error(-1,envelop.getErrorMsg());
//            }
//            return write(200,"操作成功");
//        }catch (JsonProcessingException jex){
//            error(jex);
//            return error(-1,"JSON参数有误,请核对");
//        }catch (Exception ex){
//            error(ex);
//            return error(-1,"操作失败");
//        }
//    }
//
//    @RequestMapping(value = "update",method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "修改权限", notes = "*")
//    public String updateFeature(
//            @ApiParam(name = "dataJson",value = "权限对象Json串")
//            @RequestParam(value = "dataJson")String dataJson){
//        try{
//            ManageFeature feature = objectMapper.readValue(dataJson, ManageFeature.class);
//            //数据验证操作
//            String errorMsg = "";
//            if(feature == null || feature.getId() == 0){
//                errorMsg += errorMsg+"权限id不能为空!;";
//            }
//            if(StringUtils.isEmpty(feature.getCode())){
//                errorMsg += errorMsg +"权限编码不能为空!;";
//            }else {
//                if(featureService.isCodeExist(feature.getCode())){
//                    errorMsg += errorMsg+"权限编码已存在!;";
//                }
//            }
//            if(StringUtils.isEmpty(feature.getName())){
//                errorMsg += errorMsg +"权限名称不能为空!;";
//            }else {
//                if(featureService.isNameExist(feature.getName())){
//                    errorMsg += errorMsg+ "权限名称已存在!;";
//                }
//            }
//            if(!StringUtils.isEmpty(errorMsg)){
//                return error(-1, errorMsg);
//            }
//            //新增操作(新增失败抛异常)
//            Envelop envelop = featureService.updateFeature(feature);
//            if(!envelop.isSuccessFlg()){
//                return error(-1,envelop.getErrorMsg());
//            }
//            return write(200,"操作成功");
//        }catch (JsonProcessingException jex){
//            error(jex);
//            return error(-1,"JSON参数有误,请核对");
//        }catch (Exception ex){
//            error(ex);
//            return error(-1,"操作失败");
//        }
//    }
//
//    @RequestMapping(value = "delete",method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "删除权限", notes = "")
//    public String deleteFeature(
//            @ApiParam(name = "id",value = "权限id")
//            @RequestParam(name = "id")int id,
//            @ApiParam(name = "code",value = "权限编码")
//            @RequestParam(name = "code")String code){
//        try{
//            if(id<=0){
//                return error(-1,"权限id不能为空!");
//            }
//            if(StringUtils.isEmpty(code)){
//                return error(-1,"权限编码不能为空!");
//            }
//            featureService.deleteFeature(id, code);
//            return write(200,"操作成功");
//        }catch (Exception ex){
//            return error(-1,"操作失败!");
//        }
//    }
//
//    @RequestMapping(value = "deleteNoRole",method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "删除权限", notes = "")
//    public String deleteFeatureNoUser(
//            @ApiParam(name = "id",value = "权限id")
//            @RequestParam(name = "id")int id,
//            @ApiParam(name = "code",value = "权限编码")
//            @RequestParam(name = "code") String code){
//        try{
//            if(id<=0){
//                return error(-1,"权限id不能为空!");
//            }
//            if(StringUtils.isEmpty(code)){
//                return error(-1,"权限编码不能为空!");
//            }
//            featureService.deleteFeatureNoRole(id, code);
//            return write(200,"操作成功");
//        }catch (Exception ex){
//            return error(-1,"操作失败!");
//        }
//    }
//
//    @RequestMapping(value = "role",method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "获取权限", notes = "根据id获取权限")
//    public String getFeature(
//            @ApiParam(name = "id",value = "权限id")
//            @RequestParam(name = "id")int id){
//        ManageFeature feature = featureService.getFeature(id);
//        return write(200,"操作成功","data",feature);
//    }
//
//    @RequestMapping(value = "roles")
//    @ResponseBody
//    @ApiOperation(value = "获取权限列表-分页", notes = "*")
//    public String searchFeatures(
//            @ApiParam(name = "name",value = "权限名称",defaultValue = "")
//            @RequestParam(value = "name",required = false)String name,
//            @ApiParam(name = "page",value = "页码",defaultValue = "1")
//            @RequestParam(value = "page",required = false)Integer page,
//            @ApiParam(name = "rows",value = "每页数",defaultValue = "15")
//            @RequestParam(value = "rows",required = false)Integer pageSize){
//        try{
//            Page<ManageFeature> manageFeatures = featureService.searchFeatures(name, page, pageSize);
//            return write(200,"操作成功",page,pageSize,manageFeatures);
//        }catch (Exception ex){
//            error(ex);
//            return error(-1,"操作失败!");
//        }
//
//    }
//
    @RequestMapping(value = "featuresNoPage")
    @ResponseBody
    @ApiOperation(value = "获取权限列表-不分页", notes = "*")
    public Object searchFeaturesNoPage(String searchNm) {
        try {
            return featureService.search("nam?" + searchNm + ";");
        } catch (Exception ex) {
            error(ex);
            return "[]";
        }
    }
    @RequestMapping(value = "isCodeExist", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断权限编码是否存在,唯一", notes = "*")
    public Object isCodeExist(
            @ApiParam(name = "code", value = "权限编码", defaultValue = "")
            @RequestParam(name = "code") String code) {
        return featureService.isCodeExist(code);
    }
    @RequestMapping(value = "isNameExist", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断权限名称是否存在,同一级唯一", notes = "*")
    public Object isNameExist(
            @ApiParam(name = "name", value = "权限名称", defaultValue = "")
            @RequestParam(name = "name") String name,
            @ApiParam(name = "parentId", value = "上一级权限id")
            @RequestParam(value = "parentId") long parentId) {
        return featureService.isNameExist(name, parentId);
    }
    @RequestMapping(value = "isUrlExist", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断权限名称是否存在,唯一", notes = "*")
    public Object isUrlExist(
            @ApiParam(name = "url", value = "权限名称", defaultValue = "")
            @RequestParam(name = "url") String url) {
        return featureService.isUrlExist(url);
    }
}

+ 235 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRoleFeatureController.java

@ -0,0 +1,235 @@
package com.yihu.wlyy.controller.manager.user;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageFeature;
import com.yihu.wlyy.entity.ManageRoleFeature;
import com.yihu.wlyy.service.manager.user.ManageFeatureService;
import com.yihu.wlyy.service.manager.user.ManageRoleFeatureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
 * Created by yww on 2016/12/29.
 */
@Controller
@RequestMapping("admin/roleFeature")
@Api(description = "管理系统角色-权限关系")
public class ManageRoleFeatureController extends BaseController {
    @Autowired
    private ManageRoleFeatureService roleFeatureService;
    @Autowired
    private ManageFeatureService featureService;
    @RequestMapping(value = "initial")
    public String initial(Model model, String obj) {
        model.addAttribute("obj", obj);
        return "user/roles/rolesFeature";
    }
    /**
     * 角色组权限列表查询接口(左侧查询出所有权限,不分页,页面检索)(右侧查询角色组已配置的权限,不分页)
     *
     * @param treeType(查询列表类型:所有权限;角色组已配置权限)
     * @param roleId
     * @return
     * @throws Exception
     */
    @RequestMapping("/searchFeatureTree")
    @ResponseBody
    public Object searchFeatureTree(String treeType, long roleId) throws Exception {
        if (treeType.equals("configFeature")) {
            return featureService.findByRoleId(roleId);
        } else {
            List<ManageFeature> features = featureService.search("");
            if (features.size() > 0) {
                for (ManageFeature m : features) {
                    ManageRoleFeature relation = roleFeatureService.findRelation(m.getId(), roleId);
                    m.setIschecked(false);
                    if (relation != null) {
                        m.setIschecked(true);
                    }
                }
            }
            return features;
        }
    }
    @RequestMapping(value = "updateFeatureConfig")
    @ApiOperation(value = "根据角色组、应用权限id批量修改,一对多")
    @ResponseBody
    public String batchUpdateRoleFeatureRelation(
            @ApiParam(name = "roleId", value = "角色组Id")
            @RequestParam(value = "roleId") long roleId,
            @ApiParam(name = "featureIds", value = "选择的应用权限ids", defaultValue = "")
            @RequestParam(name = "featureIds", required = false) String featureIds) throws Exception {
        boolean bo = false;
        //根据传入的参数获取新增、删除ids
        if (StringUtils.isEmpty(featureIds)) {
            //删除角色组下配置的所有应用权限
            bo = roleFeatureService.deleteRoleFeatureRelationByRoleId(roleId);
            if (bo)
                return write(200, "操作成功!");
            return error(-1, "操作成功!");
        }
        //获取新增和删除ids
        String[] featureIdsStr = featureIds.split(",");
        List<Long> newFeatureIds = new ArrayList<>();
        for (int i = 0; i < featureIdsStr.length; i++) {
            newFeatureIds.add(Long.parseLong(featureIdsStr[i]));
        }
        Collection<ManageRoleFeature> roleFeatures = roleFeatureService.findByField("roleId", roleId);
        if (roleFeatures == null || roleFeatures.size() == 0) {
            //原角色组不存在配置权限则直接新增
            Long[] ids = new Long[newFeatureIds.size()];
            bo = roleFeatureService.batchUpdateRoleFeatureRelation(roleId, newFeatureIds.toArray(ids), "");
            if (bo)
                return write(200, "操作成功!");
            return error(-1, "操作成功!");
        }
        String deleteFeatureIds = "";
        StringBuffer deleteBuffer = new StringBuffer();
        for (ManageRoleFeature m : roleFeatures) {
            Long featureId = m.getFeatureId();
            if (newFeatureIds.contains(featureId)) {
                newFeatureIds.remove(featureId);
                continue;
            }
            deleteBuffer.append(featureId);
            deleteBuffer.append(",");
        }
        if (deleteBuffer.length() > 0) {
            deleteFeatureIds = deleteBuffer.substring(0, deleteBuffer.length() - 1);
        }
        Long[] addFeatureIds = newFeatureIds.toArray(new Long[newFeatureIds.size()]);
        bo = roleFeatureService.batchUpdateRoleFeatureRelation(roleId, addFeatureIds, deleteFeatureIds);
        if (bo)
            return write(200, "操作成功!");
        return error(-1, "操作成功!");
    }
//    @RequestMapping(value = "create",method = RequestMethod.POST)
//    @ApiOperation(value = "为角色组配置功能权限,单个")
//    @ResponseBody
//    public String createRoleFeature(String roleId,String featureId){
//        if(StringUtils.isEmpty(featureId)){
//            return error(-1, "权限不能为空!");
//        }
//        if(StringUtils.isEmpty(roleId)){
//            return error(-1,"角色组id不能为空!");
//        }
//        try{
//            ManageRoleFeature model = new ManageRoleFeature();
//            model.setRoleId(Long.parseLong(roleId));
//            model.setFeatureId(Long.parseLong(featureId));
//            ManageRoleFeature roleFeatureRelationNew = roleFeatureService.save(model);
//            return write(200, "操作成功");
//        }catch (Exception ex){
//            return error(-1,"操作失败!");
//        }
//    }
//    @RequestMapping(value = "delete",method = RequestMethod.POST)
//    @ApiOperation(value = "根据角色组id,权限Id删除角色组-功能权限关系")
//    @ResponseBody
//    public boolean deleteRoleFeature(
//            @ApiParam(name = "featureId",value = "功能权限id")
//            @RequestParam(value = "featureId") String featureId,
//            @ApiParam(name = "roleId",value = "角色组id")
//            @RequestParam(value = "roleId") String roleId){
//        ManageRoleFeature relation = roleFeatureService.findRelation(Long.parseLong(featureId), Long.parseLong(roleId));
//        if(null != relation){
//            roleFeatureService.delete(relation.getId());
//        }
//        return true;
//    }
//
//    @RequestMapping(value = "delete/byRoleId",method = RequestMethod.POST)
//    @ApiOperation(value = "根据角色组id删除所配置的应用权限")
//    @ResponseBody
//    public boolean deleteRoleFeatureRelationByRoleId(
//            @ApiParam(name = "roleId",value = "角色组id")
//            @RequestParam(value = "roleId") Long roleId){
//        return  roleFeatureService.deleteRoleFeatureRelationByRoleId(roleId);
//    }
//
//    @RequestMapping(value = "update/batch",method = RequestMethod.POST)
//    @ApiOperation(value = "批量修改角色组-应用权限关系,一对多")
//    @ResponseBody
//    public boolean batchUpdateRoleFeatureRelation(
//            @ApiParam(name = "roleId",value = "角色组Id")
//            @RequestParam(value = "roleId") Long roleId,
//            @ApiParam(name = "addFeatureIds",value = "要新增的featureIds",defaultValue = "")
//            @RequestParam(name = "addFeatureIds",required = false) Long[] addFeatureIds,
//            @ApiParam(name = "deleteFeatureIds",value = "要删除的featureIds",defaultValue = "")
//            @RequestParam(value = "deleteFeatureIds",required = false) String deleteFeatureIds) throws Exception{
//        roleFeatureService.batchUpdateRoleFeatureRelation(roleId,addFeatureIds,deleteFeatureIds);
//        return true;
//    }
//
//    @RequestMapping(value = "roleFeatures",method = RequestMethod.GET)
//    @ApiOperation(value = "查询角色组-功能权限关系列表---分页")
//    @ResponseBody
//    public String searchRoleFeature(
//            @ApiParam(name = "roleId", value = "角色id", defaultValue = "1")
//            @RequestParam(value = "size", required = true) long roleId,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            @ApiParam(name = "rows", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "rows", required = false) int pageSize){
//
//        try{
//            String filters = "roleId="+roleId+";";
//            if(page<=0){
//                page = 1;
//            }
//            if (pageSize<=0){
//                pageSize = 15;
//            }
//            List list = roleFeatureService.search("", filters, "", page, pageSize);
//            long total = roleFeatureService.getCount(filters);
//            return write(200,"操作成功",page,pageSize,total,list);
//        }catch (Exception ex){
//            error(ex);
//            return error(-1,"操作失败!");
//        }
//    }
//    @RequestMapping(value = "roleFeaturesNoPage",method = RequestMethod.GET)
//    @ApiOperation(value = "查询角色组-功能权限关系列表---不分页")
//    @ResponseBody
//    public String searchRoleFeatureNoPaging(
//            @ApiParam(name = "roleId", value = "", defaultValue = "1")
//            @RequestParam(value = "roleId", required = true) String roleId) {
//        try {
//            String filters = "roleId=" + roleId + ";";
//            List list = roleFeatureService.search(filters);
//            return write(200, "操作成功", "data", list);
//        } catch (Exception ex) {
//            error(ex);
//            return error(-1, "操作失败!");
//        }
//    }
//
//    @RequestMapping(value = "isExist", method = RequestMethod.GET)
//    @ApiOperation(value = "通用根据过滤条件,判断是否存在")
//    @ResponseBody
//    public boolean getAppFeaturesFilter(
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters) throws Exception {
//        Long count = roleFeatureService.getCount(filters);
//        return count>0?true:false;
//    }
}

+ 173 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRoleUserController.java

@ -0,0 +1,173 @@
package com.yihu.wlyy.controller.manager.user;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageRoleUser;
import com.yihu.wlyy.service.manager.user.ManageRoleUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
 * Created by yww on 2016/12/29.
 */
@Controller
@RequestMapping("admin/roleUser")
@Api(description = "管理系统角色组人员配置")
public class ManageRoleUserController extends BaseController {
    @Autowired
    private ManageRoleUserService roleUserService;
    @RequestMapping("/initial")
    public String initial(Model model, String obj) {
        model.addAttribute("obj", obj);
        return "user/roles/rolesUsers";
    }
    @RequestMapping(value = "update", method = RequestMethod.POST)
    @ApiOperation(value = "单个角色组人员的增删")
    @ResponseBody
    public boolean updateRoleUser(
            @ApiParam(name = "userCode", value = "人员编码")
            @RequestParam(value = "userCode") String userCode,
            @ApiParam(name = "roleId", value = "角色组id")
            @RequestParam(value = "roleId") long roleId,
            @ApiParam(name = "mode", value = "增/删,create/delete")
            @RequestParam(value = "mode") String mode) {
        if (StringUtils.equals("create", mode)) {
            return roleUserService.create(userCode, roleId);
        }
        if (StringUtils.equals("delete", mode)) {
            ManageRoleUser roleUser = roleUserService.findRelation(userCode, roleId);
            if (null != roleUser) {
                roleUserService.delete(roleUser.getId());
            }
        }
        return true;
    }
    @RequestMapping(value = "create", method = RequestMethod.POST)
    @ApiOperation(value = "为角色组配置人员,单个")
    @ResponseBody
    public boolean createRoleUser(
            @ApiParam(name = "userCode", value = "人员编码")
            @RequestParam(value = "userCode") String userCode,
            @ApiParam(name = "roleId", value = "角色组id")
            @RequestParam(value = "roleId") long roleId) {
        return roleUserService.create(userCode, roleId);
    }
    @RequestMapping(value = "delete", method = RequestMethod.POST)
    @ApiOperation(value = "根据角色组编码,人员Id删除角色组人员,单个")
    @ResponseBody
    public boolean deleteRoleUser(
            @ApiParam(name = "userCode", value = "人员编码")
            @RequestParam(value = "userCode") String userCode,
            @ApiParam(name = "roleId", value = "角色组id")
            @RequestParam(value = "roleId") String roleId) {
        ManageRoleUser roleUser = roleUserService.findRelation(userCode, Long.parseLong(roleId));
        if (null != roleUser) {
            roleUserService.delete(roleUser.getId());
        }
        return true;
    }
    @RequestMapping(value = "delete/roleUsers", method = RequestMethod.POST)
    @ApiOperation(value = "根据人员编码,删除其与所有角色组关系")
    @ResponseBody
    public boolean deleteRoleUserBuUserId(
            @ApiParam(name = "userCode", value = "人员编码")
            @RequestParam(value = "userCode") String userCode) throws Exception {
        Collection<ManageRoleUser> roleUsers = roleUserService.search("userCode=" + userCode);
        List<Long> ids = new ArrayList<>();
        for (ManageRoleUser roleUser : roleUsers) {
            ids.add(roleUser.getId());
        }
        roleUserService.delete(ids);
        return true;
    }
//    @RequestMapping(value = "deleteBatch/roleUsers",method = RequestMethod.POST)
//    @ApiOperation(value = "人员id,角色组ids,批量删除人员-角色组关系")
//    @ResponseBody
//    public boolean batchDeleteRoleUserRelation(
//            @ApiParam(name = "userCode",value = "人员编码")
//            @RequestParam(value = "userCode") String userCode,
//            @ApiParam(name = "roleIds",value = "角色组ids")
//            @RequestParam(value = "roleIds") String roleIds) throws Exception{
//        return roleUserService.batchDeleteRoleUserRelation(userCode, roleIds);
//    }
//    @RequestMapping(value = "create/roleUsers",method = RequestMethod.POST)
//    @ApiOperation(value = "批量新增人员所属角色组,一对多")
//    @ResponseBody
//    public boolean batchCreateRolUsersRelation(
//            @ApiParam(name = "userCode",value = "人员编码")
//            @RequestParam(value = "userCode") String userCode,
//            @ApiParam(name = "roleIds",value = "角色组ids,多个用逗号隔开")
//            @RequestParam(value = "roleIds") String roleIds) throws Exception{
//        roleUserService.batchCreateRoleUsersRelation(userCode,roleIds);
//        return true;
//    }
//    @RequestMapping(value = "update/roleUsers",method = RequestMethod.POST)
//    @ApiOperation(value = "批量修改人员所属角色组关系,一对多")
//    @ResponseBody
//    public boolean batchUpdateRoleUsersRelation(
//            @ApiParam(name = "userCode",value = "人员编码")
//            @RequestParam(value = "userCode") String userCode,
//            @ApiParam(name = "roleIds",value = "角色组ids,多个用逗号隔开")
//            @RequestParam(value = "roleIds") String roleIds) throws Exception{
//        roleUserService.batchUpdateRoleUsersRelation(userCode,roleIds);
//        return true;
//    }
    @RequestMapping(value = "roleUsers", method = RequestMethod.POST)
    @ApiOperation(value = "查询角色组人员关系列表---分页")
    @ResponseBody
    public String searchRoleUser(
            @ApiParam(name = "roleId", value = "", defaultValue = "1")
            @RequestParam(value = "roleId", required = true) String roleId,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            @ApiParam(name = "rows", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "rows", required = false) int pageSize) {
        try {
            Page<ManageRoleUser> manageRoleUsers = roleUserService.searchRoleUser(roleId, page, pageSize);
            return write(200, "操作成功", page, pageSize, manageRoleUsers);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "roleUsersNoPage", method = RequestMethod.POST)
    @ApiOperation(value = "查询角色组人员关系列表---不分页")
    @ResponseBody
    public String searchRoleUserNoPaging(
            @ApiParam(name = "roleId", value = "", defaultValue = "1")
            @RequestParam(value = "roleId", required = true) String roleId) {
        try {
            String filters = "roleId=" + roleId + ";";
            List list = roleUserService.search(filters);
            return write(200, "操作成功", "detailModelList", list);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
}

+ 255 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/ManageRolesController.java

@ -0,0 +1,255 @@
package com.yihu.wlyy.controller.manager.user;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.ManageRoles;
import com.yihu.wlyy.service.manager.user.ManageRoleUserService;
import com.yihu.wlyy.service.manager.user.ManageRolesService;
import com.yihu.wlyy.util.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
 * Created by yww on 2016/12/29.
 */
@Controller
@RequestMapping("admin/roles")
@Api(description = "管理系统用户角色")
public class ManageRolesController extends BaseController {
    @Autowired
    private ManageRolesService rolesService;
    @Autowired
    private ManageRoleUserService roleUserService;
    @Autowired
    private ObjectMapper objectMapper;
    //页面跳转
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    @ApiIgnore
    public String rolesListInit() {
        return "user/roles/roles";
    }
    @RequestMapping(value = "info")
    @ApiIgnore
    public String roleInfoInit(Model model, @RequestParam(value = "id", required = false) long id, String mode) throws Exception {
        model.addAttribute("mode", mode);
        if (id > 0 && (StringUtils.equals("modify", mode) || StringUtils.equals("view", mode))) {
            model.addAttribute("obj", objectMapper.writeValueAsString(rolesService.retrieve(id)));
        } else {
            model.addAttribute("obj", "{}");
        }
        return "user/roles/rolesInfoDialog";
    }
    @RequestMapping(value = "create", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "创建角色", notes = "*")
    public String createRole(
            @ApiParam(name = "dataJson", value = "角色对象Json串")
            @RequestParam(value = "dataJson") String dataJson) {
        try {
            ManageRoles role = objectMapper.readValue(dataJson, ManageRoles.class);
            //数据验证操作
            String errorMsg = "";
            if (StringUtils.isEmpty(role.getCode())) {
                errorMsg += errorMsg + "角色编码不能为空!;";
            } else {
                if (rolesService.isCodeExist(role.getCode())) {
                    errorMsg += errorMsg + "角色编码已存在!;";
                }
            }
            if (StringUtils.isEmpty(role.getName())) {
                errorMsg += errorMsg + "角色名称不能为空!;";
            } else {
                if (rolesService.isNameExist(role.getName())) {
                    errorMsg += errorMsg + "角色名称已存在!;";
                }
            }
            if (!StringUtils.isEmpty(errorMsg)) {
                return error(-1, errorMsg);
            }
            //新增操作(新增失败抛异常)
            Envelop envelop = rolesService.createRole(role);
            if (!envelop.isSuccessFlg()) {
                return error(-1, envelop.getErrorMsg());
            }
            return write(200, "操作成功");
        } catch (JsonProcessingException jex) {
            error(jex);
            return error(-1, "JSON参数有误,请核对");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "update", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "修改角色", notes = "*")
    public String updateRole(
            @ApiParam(name = "dataJson", value = "角色对象Json串")
            @RequestParam(value = "dataJson") String dataJson) {
        try {
            ManageRoles role = objectMapper.readValue(dataJson, ManageRoles.class);
            //数据验证操作
            String errorMsg = "";
            if (role == null || role.getId() == 0) {
                errorMsg += errorMsg + "角色id不能为空!;";
            }
            //manage角色不允许修改
            if (role.getId() == 1 || StringUtils.equals(role.getCode(), "systemManager")) {
                return error(-1, "系统管理员角色不允许修改!");
            }
            ManageRoles old = rolesService.retrieve(role.getId());
            if (StringUtils.isEmpty(role.getCode())) {
                errorMsg += errorMsg + "角色编码不能为空!;";
            } else {
                if (rolesService.isCodeExist(role.getCode()) && !StringUtils.equals(role.getCode(), old.getCode())) {
                    errorMsg += errorMsg + "角色编码已存在!;";
                }
            }
            if (StringUtils.isEmpty(role.getName())) {
                errorMsg += errorMsg + "角色名称不能为空!;";
            } else {
                if (rolesService.isNameExist(role.getName()) && !StringUtils.equals(role.getName(), old.getName())) {
                    errorMsg += errorMsg + "角色名称已存在!;";
                }
            }
            if (!StringUtils.isEmpty(errorMsg)) {
                return error(-1, errorMsg);
            }
            //新增操作(新增失败抛异常)
            Envelop envelop = rolesService.updateRole(role);
            if (!envelop.isSuccessFlg()) {
                return error(-1, envelop.getErrorMsg());
            }
            return write(200, "操作成功");
        } catch (JsonProcessingException jex) {
            error(jex);
            return error(-1, "JSON参数有误,请核对");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "delete", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "删除角色", notes = "删除未配置人员角色,并删除角色权限关系")
    public String deleteRoleNoUser(
            @ApiParam(name = "id", value = "角色id")
            @RequestParam(name = "id") long id,
            @ApiParam(name = "code", value = "角色编码")
            @RequestParam(name = "code") String code) {
        try {
            if (id <= 0) {
                return error(-1, "角色id不能为空!");
            }
            if (id == 1 || StringUtils.equals(code, "systemManager")) {
                return error(-1, "系统管理员角色不允许删除!");
            }
            if (StringUtils.isEmpty(code)) {
                return error(-1, "角色编码不能为空!");
            }
            //判断角色组是否有配置人员,有配置则不能删除
            boolean bo = roleUserService.isRoleExistUser(id);
            if (bo) {
                return error(-1, "角色存在人员配置,请先删除!");
            }
            rolesService.deleteRoleNoUser(id, code);
            return write(200, "操作成功");
        } catch (Exception ex) {
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "role", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "获取角色", notes = "根据id获取角色")
    public String getRole(
            @ApiParam(name = "id", value = "角色id")
            @RequestParam(name = "id") int id) {
        ManageRoles role = rolesService.getRole(id);
        return write(200, "操作成功", "data", role);
    }
    @RequestMapping(value = "rolesList")
    @ResponseBody
    @ApiOperation(value = "获取角色列表-分页", notes = "*")
    public String searchRoles(
            @ApiParam(name = "searchNm", value = "角色编码或名称", defaultValue = "")
            @RequestParam(value = "searchNm", required = false) String searchNm,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "rows", value = "每页数", defaultValue = "15")
            @RequestParam(value = "rows", required = false) Integer pageSize) {
        try {
            Page<ManageRoles> manageRoles = rolesService.searchRoles(searchNm, page, pageSize);
            return write(200, "操作成功", page, pageSize, manageRoles);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "rolesNoPage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取角色列表-不分页", notes = "*")
    public String searchRolesNoPage(
            @ApiParam(name = "name", value = "角色名称", defaultValue = "")
            @RequestParam(name = "name", required = false) String name) {
        try {
            List<ManageRoles> manageRoles = rolesService.searchRolesNoPage(name);
            return write(200, "操作成功", "data", manageRoles);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "isCodeExist", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断角色编码是否存在", notes = "*")
    public boolean isCodeExist(
            @ApiParam(name = "code", value = "角色编码", defaultValue = "")
            @RequestParam(name = "code") String code) {
        return rolesService.isCodeExist(code.trim());
    }
    @RequestMapping(value = "isNameExist", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断角色名称是否存在", notes = "*")
    public boolean isNameExist(
            @ApiParam(name = "name", value = "角色名称", defaultValue = "")
            @RequestParam(name = "name") String name) {
        return rolesService.isNameExist(name.trim());
    }
    @RequestMapping(value = "isRoleExistUser", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "判断角色是否配置人员", notes = "*")
    public boolean isRoleExistUser(
            @ApiParam(name = "id", value = "角色id", defaultValue = "")
            @RequestParam(value = "id") long id) {
        return roleUserService.isRoleExistUser(id);
    }
}

+ 220 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/user/UserController.java

@ -0,0 +1,220 @@
package com.yihu.wlyy.controller.manager.user;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.util.Envelop;
import com.yihu.wlyy.util.MD5;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
 * Created by yww on 2016/12/6.
 */
@Controller
@RequestMapping(value = "admin/user")
public class UserController extends BaseController {
    @Autowired
    private UserService userService;
    @Autowired
    private ObjectMapper objectMapper;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listPageInit(){
        return "user/user_list";
    }
    @RequestMapping(value = "infoInit",method = RequestMethod.GET)
    public String infoPageInit(Long id,String mode){
        request.setAttribute("id",id);
        request.setAttribute("mode",mode);
        return "user/user_modify";
    }
    @RequestMapping(value = "userList")
    @ResponseBody
    public String searchList(
            @RequestParam(value = "code",required = false) String code,
            @RequestParam(value = "name",required = false) String name,
            @RequestParam(value = "mobile",required = false) String mobile,
            @RequestParam(value= "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            Page<User> userPage = userService.searchList(code, name, mobile, page, pageSize);
            return write(200,"操作成功",page,pageSize,userPage);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "user")
    @ResponseBody
    public String getUser(
            @ApiParam(name = "id", defaultValue = "2")
            @RequestParam(name = "id", required = true) Long id) {
        try{
            User user = userService.retrieve(id);
            return write(200,"操作成功","data",user);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "isCodeExist")
    @ResponseBody
    public String isCodeExist(String code){
        List<User> users = userService.findByField("code", code);
        if(users != null && users.size()>0){
            return "true";
        }
        return "false";
    }
    @RequestMapping(value = "isMobileExist")
    @ResponseBody
    public String isMobileExist(String mobile){
        List<User> users = userService.findByField("mobile", mobile);
        if(users != null && users.size()>0){
            return "true";
        }
        return "false";
    }
    @RequestMapping(value = "delete")
    @ResponseBody
    public String deleteUser(Long id){
        try{
            if (id == null) {
                return error(-1, "id不能为空!");
            }
            User user = userService.retrieve(id);
            if (StringUtils.equals(user.getCode(), "admin")) {
                return error(-1, "超级管理员admin不允许删除!");
            }
            userService.deleteUser(id);
            return write(200,"操作成功!");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String createUser(String jsonData){
        try{
            User user = objectMapper.readValue(jsonData, User.class);
            String mobile = user.getMobile();
            if(mobile == null){
                return write(-1,"手机号不能为空");
            }
            user.setCzrq(new Date());
            String password=user.getMobile().substring(5);
            String salt= UUID.randomUUID().toString().replace("-", "");
            password = MD5.GetMD5Code(password+salt);
            user.setPassword(password);
            user.setSalt(salt);
            User userNew = userService.save(user);
            return write(200,"操作成功!");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String updateUser(String jsonData){
        try{
            User user = objectMapper.readValue(jsonData, User.class);
            String mobile = user.getMobile();
            if(mobile == null){
                return write(-1,"手机号不能为空");
            }
            User userNew = userService.retrieve(user.getId());
            userNew.setCode(user.getCode());
            userNew.setName(user.getName());
            userNew.setType(user.getType());
            userNew.setMobile(user.getMobile());
            userNew.setOrganizationId(user.getOrganizationId());
            userNew.setRoles(user.getRoles());
            //修改手机号对应初始化密码(因暂未提供修改密码操作)-手机号后六位
            if(userNew.getMobile() != user.getMobile()){
                String password=mobile.substring(5);
                String salt= UUID.randomUUID().toString().replace("-", "");
                password = MD5.GetMD5Code(password+salt);
                userNew.setPassword(password);
                userNew.setSalt(salt);
            }
            userNew = userService.save(userNew);
            return write(200,"操作成功!");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //初始化密码
    @RequestMapping(value = "initPwd")
    @ResponseBody
    public String initPwd(
            @RequestParam(value = "mobile",required = true)String mobile){
        try{
            boolean res = userService.initPwd(mobile);
            if(!res){
                return error(-1,"操作失败!");
            }
            return write(200,"操作成功!");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    //修改密码
    @RequestMapping(value = "changePwd")
    @ResponseBody
    public String changePwd(
            @RequestParam(value = "mobile")String mobile,
            @RequestParam(value = "oldPwd")String oldPwd,
            @RequestParam(value = "newPwd")String newPwd){
        try {
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    //根据姓名获取所有有效用户列表(用于分页下拉框)
    @RequestMapping("/searchUsers")
    @ResponseBody
    public Object searchUsers(String searchNm, int page, int rows) {
        try {
            Page<User> users = userService.searchUsers(searchNm, page, rows);
            return write(200, "操作成功", page, rows, users);
        } catch (Exception ex) {
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 44 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/wlyyrole/WlyyRoleController.java

@ -0,0 +1,44 @@
package com.yihu.wlyy.controller.manager.wlyyrole;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.WlyyRole;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by yww on 2016/12/13.
 */
@Controller
@RequestMapping("/admin/wlyyRole")
public class WlyyRoleController extends BaseController {
    @Autowired
    private WlyyRoleService wlyyRoleService;
    @RequestMapping(value = "list",method = RequestMethod.GET)
    public String listPageInit(){
        return "wlyyrole/wlyy_role_list";
    }
    @RequestMapping(value = "list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(value = "name",required = false)String name,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "rows",required = false)Integer pageSize){
        try{
            Page<WlyyRole> wlyyRoles = wlyyRoleService.searchList(name, page, pageSize);
            return write(200,"操作成功",page,pageSize,wlyyRoles);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 60 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/wlyyrole/WlyyUserRoleController.java

@ -0,0 +1,60 @@
package com.yihu.wlyy.controller.manager.wlyyrole;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.WlyyRole;
import com.yihu.wlyy.entity.WlyyUserRole;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyUserRoleService;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
/**
 * Created by yww on 2016/12/13.
 */
@Controller
@RequestMapping("/admin/wlyyUserRole")
public class WlyyUserRoleController extends BaseController {
    @Autowired
    private WlyyUserRoleService wlyyUserRoleService;
    @RequestMapping(value = "list")
    @ResponseBody
    public String searchList(
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "rows",required = false)Integer pageSize){
        try{
            Page<WlyyUserRole> wlyyUserRoles = wlyyUserRoleService.searchList("",page, pageSize);
            return write(200,"操作成功",page,pageSize,wlyyUserRoles);
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "/importData", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String importData(HttpServletRequest request) {
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = request.getInputStream();
            Workbook workbook = Workbook.getWorkbook(inputStream);
            wlyyUserRoleService.importData(workbook);
            return write(200, "操作成功");
        } catch (IOException | BiffException | ParseException e) {
            e.printStackTrace();
            error(e);
            return error(-1, "操作失败!");
        }
    }
}

+ 205 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndex.java

@ -0,0 +1,205 @@
package com.yihu.wlyy.device.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by yww on 2016/12/5.
 * 体征数据表
 */
@Entity
@Table(name = "wlyy_patient_health_index", schema = "", catalog = "device")
public class DeviceHealthIndex {
    private Long id;
    private Date czrq;
    private String del;
    private String deviceSn;
    private String idcard;
    private String intervene;
    private Date recordDate;
    private Date sortDate;
    private int type;
    private String user;
    private String userName;
    private String value1;
    private String value2;
    private String value3;
    private String value4;
    private String value5;
    private String value6;
    private String value7;
    public DeviceHealthIndex() {
    }
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "czrq")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "intervene")
    public String getIntervene() {
        return intervene;
    }
    public void setIntervene(String intervene) {
        this.intervene = intervene;
    }
    @Column(name = "record_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(Date recordDate) {
        this.recordDate = recordDate;
    }
    @Column(name = "sort_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSortDate() {
        return sortDate;
    }
    public void setSortDate(Date sortDate) {
        this.sortDate = sortDate;
    }
    @Column(name = "type")
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Transient
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "value1")
    public String getValue1() {
        return value1;
    }
    public void setValue1(String value1) {
        this.value1 = value1;
    }
    @Column(name = "value2")
    public String getValue2() {
        return value2;
    }
    public void setValue2(String value2) {
        this.value2 = value2;
    }
    @Column(name = "value3")
    public String getValue3() {
        return value3;
    }
    public void setValue3(String value3) {
        this.value3 = value3;
    }
    @Column(name = "value4")
    public String getValue4() {
        return value4;
    }
    public void setValue4(String value4) {
        this.value4 = value4;
    }
    @Column(name = "value5")
    public String getValue5() {
        return value5;
    }
    public void setValue5(String value5) {
        this.value5 = value5;
    }
    @Column(name = "value6")
    public String getValue6() {
        return value6;
    }
    public void setValue6(String value6) {
        this.value6 = value6;
    }
    @Column(name = "value7")
    public String getValue7() {
        return value7;
    }
    public void setValue7(String value7) {
        this.value7 = value7;
    }
}

+ 189 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/WlyyDevice.java

@ -0,0 +1,189 @@
package com.yihu.wlyy.device.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
/**
 * Created by Administrator on 2016/12/1.
 * 设备表
 */
@Entity
@Table(name = "wlyy_devices",catalog = "device",schema = "")
public class WlyyDevice {
    private Integer id;
    private Date applyDate; //申请日期
    private String orgName;//机构名称
    private String linkman;//联系人
    private String tel;//联系电话
    private String serverIp;//服务IP地址
    private String deviceName;//设备名称
    private String deviceModel;//设备型号
    private String deviceCode;//设备唯一标识
    private String manufacturerCode;//厂家代码
    private String manufacturer;//厂家名称
    private String address;//厂家地址
    private String representative;//法人代表
    private String applicantName;//申请注册人
    private String applicantIdentity;//申请人身份证号
    private String applicantTel;//申请人手机
    private String applicantMail;//申请人邮箱
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @Column(name = "apply_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getLinkman() {
        return linkman;
    }
    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    @Column(name = "server_ip")
    public String getServerIp() {
        return serverIp;
    }
    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }
    @Basic
    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    @Column(name = "device_model")
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    @Column(name = "device_code")
    public String getDeviceCode() {
        return deviceCode;
    }
    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }
    @Column(name = "manufacturer_code")
    public String getManufacturerCode() {
        return manufacturerCode;
    }
    public void setManufacturerCode(String manufacturerCode) {
        this.manufacturerCode = manufacturerCode;
    }
    @Column(name = "manufacturer")
    public String getManufacturer() {
        return manufacturer;
    }
    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "representative")
    public String getRepresentative() {
        return representative;
    }
    public void setRepresentative(String representative) {
        this.representative = representative;
    }
    @Column(name = "applicant_name")
    public String getApplicantName() {
        return applicantName;
    }
    public void setApplicantName(String applicantName) {
        this.applicantName = applicantName;
    }
    @Column(name = "applicant_identity")
    public String getApplicantIdentity() {
        return applicantIdentity;
    }
    public void setApplicantIdentity(String applicantIdentity) {
        this.applicantIdentity = applicantIdentity;
    }
    @Column(name = "applicant_tel")
    public String getApplicantTel() {
        return applicantTel;
    }
    public void setApplicantTel(String applicantTel) {
        this.applicantTel = applicantTel;
    }
    @Column(name = "applicant_mail")
    public String getApplicantMail() {
        return applicantMail;
    }
    public void setApplicantMail(String applicantMail) {
        this.applicantMail = applicantMail;
    }
}

+ 11 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/repository/DeviceHealthIndexDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.device.repository;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yww on 2016/12/5.
 */
public interface DeviceHealthIndexDao extends PagingAndSortingRepository<DeviceHealthIndex,Long>,JpaSpecificationExecutor<DeviceHealthIndex> {
}

+ 14 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/repository/WlyyDeviceDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.device.repository;
import com.yihu.wlyy.device.entity.WlyyDevice;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yww on 2016/12/1.
 */
public interface WlyyDeviceDao extends PagingAndSortingRepository<WlyyDevice, Integer>, JpaSpecificationExecutor<WlyyDevice> {
    WlyyDevice findByDeviceCode(String deviceCode);
}

+ 55 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/City.java

@ -0,0 +1,55 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 城市信息對象
 * @author George
 *
 */
@Entity
@Table(name = "dm_city")
public class City extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 366338400555505599L;
	
	// 省編碼
	private String province;
	// 城市編碼
	private String code;
	// 城市名稱
	private String name;
	public City() {
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

+ 54 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DictEntryKey.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.entity;
import java.io.Serializable;
import java.util.Objects;
/**
 * 字典项主键(联合主键)。
 */
public class DictEntryKey implements Serializable {
    String code;
    long dictId;
    public DictEntryKey() {
    }
    public DictEntryKey(String code, Long dictId) {
        this.code = code == null ? "" : code;
        this.dictId = dictId == null ? null : dictId;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public long getDictId() {
        return dictId;
    }
    public void setDictId(long dictId) {
        this.dictId = dictId;
    }
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof DictEntryKey) {
            DictEntryKey pk = (DictEntryKey) obj;
            if (this.code == pk.getCode() && this.dictId == (pk.getDictId())) {
                return true;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(code, dictId);
    }
}

+ 108 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmDevice.java

@ -0,0 +1,108 @@
//package com.yihu.wlyy.entity;
//
//import com.fasterxml.jackson.annotation.JsonFormat;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.util.Date;
//
///**
// * 设备列表(设备厂家、设备信息)
// */
//@Entity
//@Table(name = "dm_device")
//public class DmDevice extends IdEntity {
//
//	private String categoryCode;
//	private String photo;
//	private String brands;
//	private String model;
//	private String isMultiUser;
//	private String multiUser;
//	private String name;
//	private Date czrq;
//	private String del;
//
//	@Column(name="category_code")
//	public String getCategoryCode() {
//		return categoryCode;
//	}
//
//	public void setCategoryCode(String categoryCode) {
//		this.categoryCode = categoryCode;
//	}
//
//	@Column(name="photo")
//	public String getPhoto() {
//		return photo;
//	}
//
//	public void setPhoto(String photo) {
//		this.photo = photo;
//	}
//
//	@Column(name="brands")
//	public String getBrands() {
//		return brands;
//	}
//
//	public void setBrands(String brands) {
//		this.brands = brands;
//	}
//
//	@Column(name="model")
//	public String getModel() {
//		return model;
//	}
//
//	public void setModel(String model) {
//		this.model = model;
//	}
//
//	@Column(name="is_multi_user")
//	public String getIsMultiUser() {
//		return isMultiUser;
//	}
//
//	public void setIsMultiUser(String isMultiUser) {
//		this.isMultiUser = isMultiUser;
//	}
//
//	@Column(name="multi_user")
//	public String getMultiUser() {
//		return multiUser;
//	}
//
//	public void setMultiUser(String multiUser) {
//		this.multiUser = multiUser;
//	}
//
//	@Column(name="name")
//	public String getName() {
//		return name;
//	}
//
//	public void setName(String name) {
//		this.name = name;
//	}
//
//	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
//	@Column(name="czrq")
//	public Date getCzrq() {
//		return czrq;
//	}
//
//	public void setCzrq(Date czrq) {
//		this.czrq = czrq;
//	}
//
//	@Column(name="del")
//	public String getDel() {
//		return del;
//	}
//
//	public void setDel(String del) {
//		this.del = del;
//	}
//}

+ 56 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmDeviceCategory.java

@ -0,0 +1,56 @@
//package com.yihu.wlyy.entity;
//
//import com.fasterxml.jackson.annotation.JsonFormat;
//
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.util.Date;
//
///**
// * 设备分类表
// */
//@Entity
//@Table(name = "dm_device_category")
//public class DmDeviceCategory extends IdEntity {
//
//	// 设备类型标识
//	private String code;
//	// 设备类型名称
//	private String name;
//	// 操作时间
//	private Date czrq;
//	private String del;
//
//	public String getCode() {
//		return code;
//	}
//
//	public void setCode(String code) {
//		this.code = code;
//	}
//
//	public String getName() {
//		return name;
//	}
//
//	public void setName(String name) {
//		this.name = name;
//	}
//
//	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
//	public Date getCzrq() {
//		return czrq;
//	}
//
//	public void setCzrq(Date czrq) {
//		this.czrq = czrq;
//	}
//
//	public String getDel() {
//		return del;
//	}
//
//	public void setDel(String del) {
//		this.del = del;
//	}
//}

+ 65 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmHospitalDeptType.java

@ -0,0 +1,65 @@
package com.yihu.wlyy.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
 * DmHospitalDeptType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "dm_hospital_dept_type")
public class DmHospitalDeptType extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;
	private String name;
	private String del;
	// Constructors
	/** default constructor */
	public DmHospitalDeptType() {
	}
	/** full constructor */
	public DmHospitalDeptType(String code, String name, String del) {
		this.code = code;
		this.name = name;
		this.del = del;
	}
	@Column(name = "code", length = 200)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 200)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "del", length = 10)
	public String getDel() {
		return this.del;
	}
	public void setDel(String del) {
		this.del = del;
	}
}

+ 59 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/DmJob.java

@ -0,0 +1,59 @@
package com.yihu.wlyy.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * DmJob entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "dm_job")
public class DmJob extends IdEntity  {
	// Fields
	private String code;
	private String name;
	private String del;//0 是没有删除 1是删除
	// Constructors
	/** default constructor */
	public DmJob() {
	}
	/** full constructor */
	public DmJob(String code, String name, String del) {
		this.code = code;
		this.name = name;
		this.del = del;
	}
	@Column(name = "code", length = 50)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 20)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "del", length = 1)
	public String getDel() {
		return this.del;
	}
	public void setDel(String del) {
		this.del = del;
	}
}

+ 408 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java

@ -0,0 +1,408 @@
package com.yihu.wlyy.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 医生信息
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_doctor")
public class Doctor extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6585552029939285364L;
	// 业务主键
	private String code;
	// 姓名
	private String name;
	// 性别(1男,2女)
	private Integer sex;
	// 生日
	private Date birthday;
	// 头像
	private String photo;
	// 手机号
	private String mobile;
	// 登录密码
	private String password;
	// 密码标识
	private String salt;
	// 状态(1正常,0禁用)
	private Integer status;
	// 省
	private String province;
	// 市
	private String city;	
	// 區縣代碼
	private String town;
	// 省名
	private String provinceName;
	// 市名
	private String cityName;
	// 區縣名
    private String townName;
	// 医院标识
	private String hospital;
	// 医院名称
	private String hospitalName;
	// 科室标识
	private String dept;
	// 科室名
	private String deptName;
	// 职称
	private String job;
	// 职称名
	private String jobName;
	// 医生专长
	private String expertise;
	// 医生介绍
	private String introduce;
	// 类型:1专科医生,2全科医生,3健康管理师
	private Integer level;
	// 资格是否认证通过,1是,0否
	private Integer iscertified;
	// 二维码
	private String qrcode;
	// 更新时间
	private Date czrq;
    //身份证号
    private String idCard;
	
	//add by cws 20160830
	private String shequType;
    //是否名医
    private String isFamous;
    //前端用
    private String levelName;
    private String errorMsg;
    private Map<String,String> errorMsgMap = new HashMap<>();
    //所属团队信息
    private String adminTeamId;
    private String adminTeamName;
    @Column(name = "idcard")
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    @Column(name = "shequ_type")
    public String getShequType() {
		return shequType;
	}
	public void setShequType(String shequType) {
		this.shequType = shequType;
	}
    @Column(name = "is_famous")
    public String getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(String isFamous) {
        this.isFamous = isFamous;
    }
    public Doctor() {
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public Doctor(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	
	@Column(name = "province_name")
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	@Column(name = "city_name")
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	@Column(name = "town_name")
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	
	@Column(name = "hospital_name")
	public String getHospitalName() {
		return hospitalName;
	}
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	@Column(name = "dept_name")
	public String getDeptName() {
		return deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Column(name = "job_name")
	public String getJobName() {
		return jobName;
	}
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}
	public String getHospital() {
		return hospital;
	}
	public void setHospital(String hospital) {
		this.hospital = hospital;
	}
	public String getDept() {
		return dept;
	}
	public void setDept(String dept) {
		this.dept = dept;
	}
	public String getJob() {
		return job;
	}
	public void setJob(String job) {
		this.job = job;
	}
	public String getExpertise() {
		return expertise;
	}
	public void setExpertise(String expertise) {
		this.expertise = expertise;
	}
	public String getIntroduce() {
		return introduce;
	}
	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
    public Integer getIscertified() {
		return iscertified;
	}
	public void setIscertified(Integer iscertified) {
		this.iscertified = iscertified;
	}
	public String getQrcode() {
		return qrcode;
	}
	public void setQrcode(String qrcode) {
		this.qrcode = qrcode;
	}
	// 设定JSON序列化时的日期格式
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
    @Transient
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
    @Transient
    public String getErrorMsg() {
        return errorMsg;
    }
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
    @Transient
    public Map<String, String> getErrorMsgMap() {
        return errorMsgMap;
    }
    public void setErrorMsgMap(Map<String, String> errorMsgMap) {
        this.errorMsgMap = errorMsgMap;
    }
    @Transient
    public String getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(String adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @Transient
    public String getAdminTeamName() {
        return adminTeamName;
    }
    public void setAdminTeamName(String adminTeamName) {
        this.adminTeamName = adminTeamName;
    }
}

+ 244 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Followup.java

@ -0,0 +1,244 @@
package com.yihu.wlyy.entity;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
/**
 * 随访记录表
 * @author hzp add 2016-12-07
 *
 */
@Entity
@Table(name = "wlyy_followup")
public class Followup extends IdEntity {
    //随访编号【基卫】
    private String followupNo;
    //随访时间
    private Date followupDate;
    //随访计划时间
    private Date followupPlanDate;
    //计划下次随访时间
    private Date followupNextDate;
    //随访方式【字典FOLLOWUP_WAY_DICT】
    private String followupType;
    //随访类别【1.高血压 2.糖尿病】
    private String followupClass;
    //随访管理状态【字典FOLLOWUP_MANAGER_STATUS】
    private String followupManagerStatus;
    //医生代码
    private String doctorCode;
    //医生姓名
    private String doctorName;
    //社区代码
    private String orgCode;
    //社区名称
    private String orgName;
    //患者代码
    private String patientCode;
    //患者姓名
    private String patientName;
    //患者身份证
    private String idcard;
    //数据来源 1基卫 2APP
    private String dataFrom;
    //状态 0取消 1已完成 2未开始 3进行中
    private String status;
    //电话随访内容
    private String followupContentPhone;
    //创建时间
    private Date createTime;
    //更新时间
    private Date updateTime;
    //创建者
    private String creater;
    // 签约类型 1三师 2家庭
    private Integer signType;
    // 行政团队
    private Long adminTeamCode;
    public Date getFollowupPlanDate() {
        return followupPlanDate;
    }
    public void setFollowupPlanDate(Date followupPlanDate) {
        this.followupPlanDate = followupPlanDate;
    }
    public String getFollowupNo() {
        return followupNo;
    }
    public void setFollowupNo(String followupNo) {
        this.followupNo = followupNo;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getFollowupDate() {
        return followupDate;
    }
    public void setFollowupDate(Date followupDate) {
        this.followupDate = followupDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getFollowupNextDate() {
        return followupNextDate;
    }
    public void setFollowupNextDate(Date followupNextDate) {
        this.followupNextDate = followupNextDate;
    }
    public String getFollowupType() {
        return followupType;
    }
    public void setFollowupType(String followupType) {
        this.followupType = followupType;
    }
    public String getFollowupClass() {
        return followupClass;
    }
    public void setFollowupClass(String followupClass) {
        this.followupClass = followupClass;
    }
    public String getFollowupManagerStatus() {
        return followupManagerStatus;
    }
    public void setFollowupManagerStatus(String followupManagerStatus) {
        this.followupManagerStatus = followupManagerStatus;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getDataFrom() {
        return dataFrom;
    }
    public void setDataFrom(String dataFrom) {
        this.dataFrom = dataFrom;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getFollowupContentPhone() {
        return followupContentPhone;
    }
    public void setFollowupContentPhone(String followupContentPhone) {
        this.followupContentPhone = followupContentPhone;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public Integer getSignType() {
        return signType;
    }
    public void setSignType(Integer signType) {
        this.signType = signType;
    }
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

+ 174 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Hospital.java

@ -0,0 +1,174 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 城市信息對象
 * @author George
 *
 */
@Entity
@Table(name = "dm_hospital")
public class Hospital extends IdEntity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8039389705624435301L;
	
	// 医院編碼
	private String code;
	// 医院名稱
	private String name;	
	// 作废标志
	private String del;
	//省份标志
	private String province;
	//省份名称
	private String provinceName;
	//城市标志
	private String city;
	//城市名称
	private String cityName;
	//区县标志
	private String town;
	//区县名称
	private String townName;
	//级别,1医院,2社区医院
	private int level;
	//医院详细地址
	private String address;
	//医院简介
	private String intro;
	
	//医院图片
	private String photo;
	
	//add by cws 20160830
	private String roadCode;
	private String centerSite;
	public String getRoadCode() {
		return roadCode;
	}
	public void setRoadCode(String roadCode) {
		this.roadCode = roadCode;
	}
	public String getCenterSite() {
		return centerSite;
	}
	public void setCenterSite(String centerSite) {
		this.centerSite = centerSite;
	}
	public String getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getIntro() {
		return intro;
	}
	public void setIntro(String intro) {
		this.intro = intro;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	
	
}

+ 61 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/HospitalDept.java

@ -0,0 +1,61 @@
package com.yihu.wlyy.entity;
import java.io.UnsupportedEncodingException;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 城市信息對象
 * 
 * @author George
 * 
 */
@Entity
@Table(name = "dm_hospital_dept")
public class HospitalDept extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5296182461037390028L;
	private String code;
	private String name;
	private String del;
	private String hospital;
	
	public String getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getHospital() {
		return hospital;
	}
	public void setHospital(String hospital) {
		this.hospital = hospital;
	}
}

+ 44 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/IdEntity.java

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

+ 86 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageDict.java

@ -0,0 +1,86 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.util.phonics.PinyinUtil;
import javax.persistence.*;
import java.util.Date;
/**
 * @author Sand
 * @version 1.0
 * @created 2015.07.30 14:43
 */
@Entity
@Table(name = "manage_dicts")
@Access(value = AccessType.PROPERTY)
public class ManageDict {
    long id;
    String name;
    String reference;
    String authorId;
    String phoneticCode;
    Date createDate = new Date();
    public ManageDict() {
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    @Column(name = "name", nullable = false)
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
        this.phoneticCode = PinyinUtil.getPinYinHeadChar(name, true);
    }
    @Column(name = "reference", nullable = true)
    public String getReference() {
        return reference;
    }
    public void setReference(String reference) {
        this.reference = reference;
    }
    @Column(name = "author", nullable = false)
    public String getAuthorId() {
        return authorId;
    }
    public void setAuthorId(String authorId) {
        this.authorId = authorId;
    }
    @Column(name = "phonetic_code", nullable = false)
    public String getPhoneticCode() {
        return phoneticCode;
    }
    public void setPhoneticCode(String phoneticCode) {
        this.phoneticCode = phoneticCode;
    }
    @Column(name = "create_date", nullable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}

+ 91 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageDictEntry.java

@ -0,0 +1,91 @@
package com.yihu.wlyy.entity;
import com.yihu.wlyy.util.phonics.PinyinUtil;
import javax.persistence.*;
import java.io.Serializable;
/**
 * 字典项。
 *
 * @author Sand
 * @version 1.0
 * @created 2015.07.30 15:11
 */
@Entity
@Table(name = "manage_dict_entries")
@Access(value = AccessType.PROPERTY)
@Embeddable
@IdClass(DictEntryKey.class)
public class ManageDictEntry implements Serializable {
    private static final long serialVersionUID = 1L;
    long dictId;
    String code;
    String value;
    Integer sort;
    String phoneticCode;
    String catalog;
    public ManageDictEntry() {
    }
    @Id
    @Column(name = "code", unique = true, nullable = false, insertable = false, updatable = false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Id
    @Column(name = "dictId", unique = true, nullable = false, insertable = false, updatable = false)
    public long getDictId() {
        return dictId;
    }
    public void setDictId(long dictId) {
        this.dictId = dictId;
    }
    @Column(name = "value", nullable = true)
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
        this.phoneticCode = PinyinUtil.getPinYinHeadChar(value, true);
    }
    @Column(name = "phoneticCode", nullable = true)
    public String getPhoneticCode() {
        return phoneticCode;
    }
    public void setPhoneticCode(String phoneticCode) {
        this.phoneticCode = phoneticCode;
    }
    @Column(name = "sort", nullable = true)
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "catalog", nullable = true)
    public String getCatalog() {
        return catalog;
    }
    public void setCatalog(String catalog) {
        this.catalog = catalog;
    }
}

+ 104 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageFeature.java

@ -0,0 +1,104 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * Created by yww on 2016/7/7.
 */
@Entity
@Table(name = "manage_feature")
public class ManageFeature {
    private Long id;
    private String code;
    private String name;
    private String description;
    private String type;
    private Long parentId;
    private String url;
    private String iconUrl;
    private Boolean ischecked;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "name", nullable = true)
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "description", nullable = true)
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "code", nullable = true)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "type", nullable = true)
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "parent_id", nullable = true)
    public Long getParentId() {
        return parentId;
    }
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    @Column(name = "url", nullable = true)
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "icon_url", nullable = true)
    public String getIconUrl() {
        return iconUrl;
    }
    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }
    @Transient
    public Boolean getIschecked() {
        return ischecked;
    }
    public void setIschecked(Boolean ischecked) {
        this.ischecked = ischecked;
    }
}

+ 57 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoleFeature.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * Created by yww on 2016/7/7.
 */
@Entity
@Table(name = "manage_role_feature")
@Access(value = AccessType.PROPERTY)
public class ManageRoleFeature {
    private Long id;
    private Long roleId;
    private Long featureId;
    private String featureName;
    public ManageRoleFeature() {
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "role_id", nullable = false)
    public Long getRoleId() {
        return roleId;
    }
    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }
    @Column(name = "feature_id", nullable = false)
    public Long getFeatureId() {
        return featureId;
    }
    public void setFeatureId(Long featureId) {
        this.featureId = featureId;
    }
    @Transient
    public String getFeatureName() {
        return featureName;
    }
    public void setFeatureName(String featureName) {
        this.featureName = featureName;
    }
}

+ 57 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoleUser.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * Created by yww on 2016/7/7.
 */
@Entity
@Table(name = "manage_role_user")
@Access(value = AccessType.PROPERTY)
public class ManageRoleUser {
    private Long id;
    private Long roleId;
    private String userCode;
    private String userName;
    public ManageRoleUser() {
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "role_id", nullable = false)
    public Long getRoleId() {
        return roleId;
    }
    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }
    @Column(name = "user_Code", nullable = false)
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    @Transient
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
}

+ 67 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/ManageRoles.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * Created by yww on 2016/7/7.
 */
@Entity
@Table(name = "manage_roles")
@Access(value = AccessType.PROPERTY)
public class ManageRoles {
    private Long id;
    private String code;
    private String name;
    private String description;
    private String type;
    public ManageRoles() {
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "code", nullable = true)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name", nullable = true)
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "description", nullable = true)
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "type", nullable = true)
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 285 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java


+ 327 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java

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

+ 45 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Province.java

@ -0,0 +1,45 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 省份信息對象
 * @author George
 *
 */
@Entity
@Table(name = "dm_province")
public class Province extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1126538739936773663L;
	
	// 省編碼
	private String code;
	// 省名稱
	private String name;
	public Province() {
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

+ 90 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SMS.java

@ -0,0 +1,90 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 手机短信
 *
 * @author George
 */
@Entity
@Table(name = "wlyy_sms")
public class SMS extends IdEntity {
    private static final long serialVersionUID = -1438212901585781994L;
    private String mobile;// 手机号
    private String ip;// ip地址
    private Integer type;// 消息类型:1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录
    private String captcha;// 验证码
    private String content;// 消息内容
    private Date deadline;// 过期时间
    private Integer status;// 状态,0未发送,1已发送
    private Date czrq;
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getCaptcha() {
        return captcha;
    }
    public void setCaptcha(String captcha) {
        this.captcha = captcha;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Date getDeadline() {
        return deadline;
    }
    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 505 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java

@ -0,0 +1,505 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 家庭签约
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_sign_family")
public class SignFamily extends IdEntity {
    private static final long serialVersionUID = 364799142991631092L;
    private String code;        // 签约标识
    private String lwCode;      // 两网标识
    private Integer type;       // 签约类型:1三师签约,2网络签约
    private String patient;     // 患者标识
    private String openid;      // 微信OPENID
    private String name;        // 患者姓名
    private String idcard;      // 身份证号
    private String ssc;         // 社保卡号
    private String mobile;      // 手机号
    private String emerMobile;  // 紧急联系人手机号
    private String hospital;    // 签约医院标识
    private String hospitalName;    // 签约医院名称
    private String doctor;      // 全科医生
    private String doctorName;  // 全科医生姓名
    private String doctorHealth;    // 健康管理师
    private String doctorHealthName;    // 健康管理师姓名
    private Date begin;         // 签约开始日期
    private Date end;           // 签约结束日期
    private Integer status;     // 签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约
    private String images;      // 签约图片附件URL,多图以逗号分隔
    private String reason;      // 解约原因
    private Date czrq;          // 操作时间
    private String teamCode;
    private Date applyDate;     //签约时间
    private Date applyUnsignDate;//解约时间
    private Date patientApplyDate;//患者发起签约时间
    private Date patientApplyUnsignDate;//患者发起解约时间
    private String signType;//1 用户自己申请  2医生手工带签  3.医生发起邀请
    private String familyCode;//签约code
    private Double expenses;//签约费用
    private String expensesStatus;//扣费状态【0未扣费 1已扣费 2已退费】
    private String signSource;// 签约来源【1 社区签约 2 移动签约】
    private String signDoctorCode;//簽約人code
    private String signDoctorName;//簽約人銘
    private String signDoctorLevel;//簽約人等级
    private String expensesType;//补贴类型(4种类型:01无补贴,02全部贴,03补个人承担部分(20),04补统筹基金(70))
    private String signYear;//签约年度
    private String medicalInsuranceNum;//医保流水号
    private String agentDoctorCode;//代理簽約人code
    private String agentDoctorName;//代理簽約人銘
    private String agentDoctorLevel;//代理簽約人等级
    private Long adminTeamId;//行政团队ID
    private Date expensesTime;//缴费时间
    //不对应字段
    private String adminTeamName;//行政团队名
    private String leaderCode;//行政团团队长code
    private String leaderName;//行政团团队长姓名
    private String Msg;
    private String patientAddress;//签约居民地址
    private String releaseSpeak;//解约说明
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getLwCode() {
        return lwCode;
    }
    public void setLwCode(String lwCode) {
        this.lwCode = lwCode;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "emer_mobile")
    public String getEmerMobile() {
        return emerMobile;
    }
    public void setEmerMobile(String emerMobile) {
        this.emerMobile = emerMobile;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "doctor_health")
    public String getDoctorHealth() {
        return doctorHealth;
    }
    public void setDoctorHealth(String doctorHealth) {
        this.doctorHealth = doctorHealth;
    }
    @Column(name = "doctor_health_name")
    public String getDoctorHealthName() {
        return doctorHealthName;
    }
    public void setDoctorHealthName(String doctorHealthName) {
        this.doctorHealthName = doctorHealthName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getBegin() {
        return begin;
    }
    public void setBegin(Date begin) {
        this.begin = begin;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getEnd() {
        return end;
    }
    public void setEnd(Date end) {
        this.end = end;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    @Column(name = "sign_type")
    public String getSignType() {
        return signType;
    }
    public void setSignType(String signType) {
        this.signType = signType;
    }
    @Column(name = "apply_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
    @Column(name = "patient_apply_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getPatientApplyDate() {
        return patientApplyDate;
    }
    public void setPatientApplyDate(Date patientApplyDate) {
        this.patientApplyDate = patientApplyDate;
    }
    @Column(name = "patient_apply_unsgin_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getPatientApplyUnsignDate() {
        return patientApplyUnsignDate;
    }
    public void setPatientApplyUnsignDate(Date patientApplyUnsignDate) {
        this.patientApplyUnsignDate = patientApplyUnsignDate;
    }
    @Column(name = "family_code")
    public String getFamilyCode() {
        return familyCode;
    }
    public void setFamilyCode(String familyCode) {
        this.familyCode = familyCode;
    }
    @Column(name = "expenses")
    public Double getExpenses() {
        return expenses;
    }
    public void setExpenses(Double expenses) {
        this.expenses = expenses;
    }
    @Column(name = "sign_doctor_code")
    public String getSignDoctorCode() {
        return signDoctorCode;
    }
    public void setSignDoctorCode(String signDoctorCode) {
        this.signDoctorCode = signDoctorCode;
    }
    @Column(name = "sign_doctor_name")
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    @Column(name = "sign_doctor_level")
    public String getSignDoctorLevel() {
        return signDoctorLevel;
    }
    public void setSignDoctorLevel(String signDoctorLevel) {
        this.signDoctorLevel = signDoctorLevel;
    }
    @Column(name = "apply_unsign_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getApplyUnsignDate() {
        return applyUnsignDate;
    }
    public void setApplyUnsignDate(Date applyUnsignDate) {
        this.applyUnsignDate = applyUnsignDate;
    }
    @Column(name = "expenses_type")
    public String getExpensesType() {
        return expensesType;
    }
    public void setExpensesType(String expensesType) {
        this.expensesType = expensesType;
    }
    @Column(name = "sign_year")
    public String getSignYear() {
        return signYear;
    }
    public void setSignYear(String signYear) {
        this.signYear = signYear;
    }
    @Column(name = "medical_insurance_num")
    public String getMedicalInsuranceNum() {
        return medicalInsuranceNum;
    }
    public void setMedicalInsuranceNum(String medicalInsuranceNum) {
        this.medicalInsuranceNum = medicalInsuranceNum;
    }
    @Column(name = "agent_doctor_code")
    public String getAgentDoctorCode() {
        return agentDoctorCode;
    }
    public void setAgentDoctorCode(String agentDoctorCode) {
        this.agentDoctorCode = agentDoctorCode;
    }
    @Column(name = "agent_doctor_name")
    public String getAgentDoctorName() {
        return agentDoctorName;
    }
    public void setAgentDoctorName(String agentDoctorName) {
        this.agentDoctorName = agentDoctorName;
    }
    @Column(name = "agent_doctor_level")
    public String getAgentDoctorLevel() {
        return agentDoctorLevel;
    }
    public void setAgentDoctorLevel(String agentDoctorLevel) {
        this.agentDoctorLevel = agentDoctorLevel;
    }
    @Column(name = "expenses_status")
    public String getExpensesStatus() {
        return expensesStatus;
    }
    public void setExpensesStatus(String expensesStatus) {
        this.expensesStatus = expensesStatus;
    }
    @Column(name = "sign_source")
    public String getSignSource() {
        return signSource;
    }
    public void setSignSource(String signSource) {
        this.signSource = signSource;
    }
    @Column(name = "admin_team_code")
    public Long getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(Long adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getExpensesTime() {
        return expensesTime;
    }
    public void setExpensesTime(Date expensesTime) {
        this.expensesTime = expensesTime;
    }
    @Transient
    public String getAdminTeamName() {
        return adminTeamName;
    }
    public void setAdminTeamName(String adminTeamName) {
        this.adminTeamName = adminTeamName;
    }
    @Transient
    public String getLeaderCode() {
        return leaderCode;
    }
    public void setLeaderCode(String leaderCode) {
        this.leaderCode = leaderCode;
    }
    @Transient
    public String getLeaderName() {
        return leaderName;
    }
    public void setLeaderName(String leaderName) {
        this.leaderName = leaderName;
    }
    @Transient
    public String getMsg() {
        return Msg;
    }
    public void setMsg(String msg) {
        Msg = msg;
    }
    @Transient
    public String getPatientAddress() {
        return patientAddress;
    }
    public void setPatientAddress(String patientAddress) {
        this.patientAddress = patientAddress;
    }
    @Column(name = "release_speak")
    public String getReleaseSpeak() {
        return releaseSpeak;
    }
    public void setReleaseSpeak(String releaseSpeak) {
        this.releaseSpeak = releaseSpeak;
    }
}

+ 94 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignPatientLabel.java

@ -0,0 +1,94 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by lyr on 2016/10/9.
 */
@Entity
@Table(name = "wlyy_sign_patient_label")
public class SignPatientLabel extends IdEntity {
    // 标签code
    private String labelCode;
    // 标签名称
    private String labelName;
    // 标签类型 1:卫计委三大分组 2:健康情况 3:疾病类型 4:自定义
    private String labelType;
    // 是否系统标签
    private Integer isSystem;
    // 创建者
    private String creator;
    // 所属团队code
    private Long teamCode;
    // 排序
    private Integer sort;
    // 状态 0:无效 1:有效
    private Integer status;
    // 操作日期
    private Date czrq;
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    public Integer getIsSystem() {
        return isSystem;
    }
    public void setIsSystem(Integer isSystem) {
        this.isSystem = isSystem;
    }
    public String getCreator() {
        return creator;
    }
    public void setCreator(String creator) {
        this.creator = creator;
    }
    public Long getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Long teamCode) {
        this.teamCode = teamCode;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 133 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SocialSecurityInfo.java

@ -0,0 +1,133 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * 社保信息
 *
 * @author lyr
 */
@Entity
@Table(name = "sb_info")
public class SocialSecurityInfo {
    private String id;
    private String xming0;
    private String xbie00;
    private String csrqi0;
    private String zjlxbh;
    private String sfzh18;
    private String grsfen;
    private String id0000;
    private String gzztai;
    private String cardno;
    private String card16;
    private String zhgxsj;
    private String bjlxbh;
    @Id
    @GeneratedValue
    @Column(name = "id",unique = true, nullable = false)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    @Column(name = "XMING0",nullable = false)
    public String getXming0() {
        return xming0;
    }
    public void setXming0(String xming0) {
        this.xming0 = xming0;
    }
    @Column(name = "XBIE00",nullable = false)
    public String getXbie00() {
        return xbie00;
    }
    public void setXbie00(String xbie00) {
        this.xbie00 = xbie00;
    }
    @Column(name = "CSRQI0",nullable = false)
    public String getCsrqi0() {
        return csrqi0;
    }
    public void setCsrqi0(String csrqi0) {
        this.csrqi0 = csrqi0;
    }
    @Column(name = "ZJLXBH")
    public String getZjlxbh() {
        return zjlxbh;
    }
    public void setZjlxbh(String zjlxbh) {
        this.zjlxbh = zjlxbh;
    }
    @Column(name = "SFZH18")
    public String getSfzh18() {
        return sfzh18;
    }
    public void setSfzh18(String sfzh18) {
        this.sfzh18 = sfzh18;
    }
    @Column(name = "GRSFEN",nullable = false)
    public String getGrsfen() {
        return grsfen;
    }
    public void setGrsfen(String grsfen) {
        this.grsfen = grsfen;
    }
    @Column(name = "ID0000")
    public String getId0000() {
        return id0000;
    }
    public void setId0000(String id0000) {
        this.id0000 = id0000;
    }
    @Column(name = "GZZTAI",nullable = false)
    public String getGzztai() {
        return gzztai;
    }
    public void setGzztai(String gzztai) {
        this.gzztai = gzztai;
    }
    @Column(name = "CARDNO")
    public String getCardno() {
        return cardno;
    }
    public void setCardno(String cardno) {
        this.cardno = cardno;
    }
    @Column(name = "CARD16",nullable = false)
    public String getCard16() {
        return card16;
    }
    public void setCard16(String card16) {
        this.card16 = card16;
    }
    @Column(name = "ZHGXSJ")
    public String getZhgxsj() {
        return zhgxsj;
    }
    public void setZhgxsj(String zhgxsj) {
        this.zhgxsj = zhgxsj;
    }
    @Column(name = "BJLXBH")
    public String getBjlxbh() {
        return bjlxbh;
    }
    public void setBjlxbh(String bjlxbh) {
        this.bjlxbh = bjlxbh;
    }
}

+ 75 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Street.java

@ -0,0 +1,75 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 街道信息对象
 * @author George
 *
 */
@Entity
@Table(name = "dm_street")
public class Street extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2307784886255268677L;
	
	// 省編碼
	private String province;
	// 城市編碼
	private String city;
	// 区县编码
	private String town;
	// 區縣編碼
	private String code;
	// 區縣名稱
	private String name;
	public Street() {
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

+ 106 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SystemDict.java

@ -0,0 +1,106 @@
package com.yihu.wlyy.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
 * SystemDict entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "system_dict")
public class SystemDict  implements java.io.Serializable {
	// Fields
	private String dictName;
	private String code;
	private String value;
	private String pyCode;
	private Integer sort;
	private String id;
	// Constructors
	/** default constructor */
	public SystemDict() {
	}
	/** minimal constructor */
	public SystemDict(String dictName, String code, String value) {
		this.dictName = dictName;
		this.code = code;
		this.value = value;
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	/** full constructor */
	public SystemDict(String dictName, String code, String value,
			String pyCode, Integer sort) {
		this.dictName = dictName;
		this.code = code;
		this.value = value;
		this.pyCode = pyCode;
		this.sort = sort;
	}
	@Column(name = "dict_name", nullable = false, length = 50)
	public String getDictName() {
		return this.dictName;
	}
	public void setDictName(String dictName) {
		this.dictName = dictName;
	}
	@Column(name = "code", nullable = false, length = 50)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "value", nullable = false, length = 50)
	public String getValue() {
		return this.value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	@Column(name = "py_code", length = 50)
	public String getPyCode() {
		return this.pyCode;
	}
	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}
	@Column(name = "sort")
	public Integer getSort() {
		return this.sort;
	}
	public void setSort(Integer sort) {
		this.sort = sort;
	}
}

+ 152 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SystemDictList.java

@ -0,0 +1,152 @@
package com.yihu.wlyy.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
 * SystemDictList entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "system_dict_list")
public class SystemDictList   implements java.io.Serializable {
	// Fields
	private String dictName;
	private String chineseName;
	private String pyCode;
	private String pid;
	private String remark;
	private String relationTable;
	private String relationColCode;
	private String relationColValue;
	private String relationColExtend;
	private String id;
	// Constructors
	/** default constructor */
	public SystemDictList() {
	}
	/** minimal constructor */
	public SystemDictList(String dictName, String chineseName, String pid) {
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pid = pid;
	}
	/** full constructor */
	public SystemDictList(String dictName, String chineseName, String pyCode,
			String pid, String remark, String relationTable,
			String relationColCode, String relationColValue,
			String relationColExtend) {
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pyCode = pyCode;
		this.pid = pid;
		this.remark = remark;
		this.relationTable = relationTable;
		this.relationColCode = relationColCode;
		this.relationColValue = relationColValue;
		this.relationColExtend = relationColExtend;
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Column(name = "dict_name", nullable = false, length = 50)
	public String getDictName() {
		return this.dictName;
	}
	public void setDictName(String dictName) {
		this.dictName = dictName;
	}
	@Column(name = "chinese_name", nullable = false, length = 50)
	public String getChineseName() {
		return this.chineseName;
	}
	public void setChineseName(String chineseName) {
		this.chineseName = chineseName;
	}
	@Column(name = "py_code", length = 50)
	public String getPyCode() {
		return this.pyCode;
	}
	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}
	@Column(name = "pid", nullable = false, length = 50)
	public String getPid() {
		return this.pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	@Column(name = "remark", length = 200)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@Column(name = "relation_table", length = 50)
	public String getRelationTable() {
		return this.relationTable;
	}
	public void setRelationTable(String relationTable) {
		this.relationTable = relationTable;
	}
	@Column(name = "relation_col_code", length = 50)
	public String getRelationColCode() {
		return this.relationColCode;
	}
	public void setRelationColCode(String relationColCode) {
		this.relationColCode = relationColCode;
	}
	@Column(name = "relation_col_value", length = 50)
	public String getRelationColValue() {
		return this.relationColValue;
	}
	public void setRelationColValue(String relationColValue) {
		this.relationColValue = relationColValue;
	}
	@Column(name = "relation_col_extend", length = 50)
	public String getRelationColExtend() {
		return this.relationColExtend;
	}
	public void setRelationColExtend(String relationColExtend) {
		this.relationColExtend = relationColExtend;
	}
}

+ 75 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Town.java

@ -0,0 +1,75 @@
package com.yihu.wlyy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 區縣信息對象
 * @author George
 *
 */
@Entity
@Table(name = "dm_town")
public class Town extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3851597133734507811L;
	
	// 省編碼
	private String province;
	// 城市編碼
	private String city;
	// 區縣編碼
	private String code;
	// 區縣名稱
	private String name;
	//区图片
	private String photo;
	
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public Town() {
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

+ 413 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/User.java

@ -0,0 +1,413 @@
package com.yihu.wlyy.entity;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ImmutableList;
/**
 * 用户表
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_user")
public class User extends IdEntity {
    private static final long serialVersionUID = 5397123441067268436L;
	// 用户标识
	private String code;
    // 姓名
    private String name;
    // 手机号
    private String mobile;
    // 登录密码
    private String password;
    // 密码加密密钥
    private String salt;
    // 用户类型:1超级管理员,2医生
    private int type;
    //用户类型名称
    private String typeName;
    //用户拥有的权限标识,以逗号分隔
    private String roles;
    // 用户找拥有的权限以逗号分隔
    private String roleName;
	// 添加日期
	private Date czrq;
	// 所属机构
	private long organizationId;
    // 所属机构名称
    private String organizationName;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    @Transient
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getRoles() {
        return roles;
    }
    public void setRoles(String roles) {
        this.roles = roles;
    }
    @Transient
    @JsonIgnore
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "organization_id")
    public long getOrganizationId() {
        return organizationId;
    }
    public void setOrganizationId(long organizationId) {
        this.organizationId = organizationId;
    }
    @Transient
    public String getOrganizationName() {
        return organizationName;
    }
    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
    @Transient
    @JsonIgnore
    public List<String> getRoleList() {
        // 角色列表在数据库中实际以逗号分隔字符串存储,因此返回不能修改的List.
        return ImmutableList.copyOf(StringUtils.split("", ","));
    }
    /**
	 * 
	 */
//	private static final long serialVersionUID = 5397123441067268436L;
//
//	// 用户标识
//	private String code;
//	// 添加日期
//	private Date czrq;
//	//科室code
//	private String hospitalDept;
//	//是否签约 1是 0否
//	private String isSign;
//	//职务code
//	private String mbjob;
//	// 手机号
//	private String mobile;
//	// 姓名
//	private String name;
//	//部门code
//	private String organizationDept;
//	// 所属机构
//	private long organizationId;
//	// 登录密码
//	private String password;
//	//简介
//	private String  remark;
//	// 密码加密密钥
//	private String salt;
//	//性别
//	private String  sex;
//	//专场
//	private String speciality;
//	// 用户类型:1超级管理员,2医生
//	private int type;
//
//	// 用户找拥有的权限以逗号分隔
//	private String roles;
//	// 用户找拥有的权限以逗号分隔
//	private String roleName;
//	private String photo;
//	//职务code
//	private String mbjobName;;
//	//科室code
//	private String hospitalDeptName;
//
//	private String organizationDeptName;
//
//	public String getCode() {
//		return code;
//	}
//
//	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
//	public Date getCzrq() {
//		return czrq;
//	}
//
//	@Column(name = "hospital_dept")
//	public String getHospitalDept() {
//		return hospitalDept;
//	}
//
//	@Column(name = "is_sign")
//	public String getIsSign() {
//		return isSign;
//	}
//
//	@Column(name = "mbjob")
//	public String getMbjob() {
//		return mbjob;
//	}
//
//	public String getMobile() {
//		return mobile;
//	}
//
//	public String getName() {
//		return name;
//	}
//
//	@Column(name = "organization_dept")
//	public String getOrganizationDept() {
//		return organizationDept;
//	}
//
//	@Column(name = "organization_id")
//	public long getOrganizationId() {
//		return organizationId;
//	}
//
//	public String getPassword() {
//		return password;
//	}
//
//	@Column(name = "remark")
//	public String getRemark() {
//		return remark;
//	}
//
//	@Transient
//	@JsonIgnore
//	public List<String> getRoleList() {
//		// 角色列表在数据库中实际以逗号分隔字符串存储,因此返回不能修改的List.
//		return ImmutableList.copyOf(StringUtils.split("", ","));
//	}
//
//	public String getRoles() {
//		return roles;
//	}
//
//	public String getSalt() {
//		return salt;
//	}
//
//	public String getSex() {
//		return sex;
//	}
//
//
//
//	public String getPhoto() {
//		return photo;
//	}
//
//	public void setPhoto(String photo) {
//		this.photo = photo;
//	}
//
//	@Column(name = "speciality")
//	public String getSpeciality() {
//		return speciality;
//	}
//
//	public int getType() {
//		return type;
//	}
//
//	public void setCode(String code) {
//		this.code = code;
//	}
//
//	public void setCzrq(Date czrq) {
//		this.czrq = czrq;
//	}
//
//	public void setHospitalDept(String hospitalDept) {
//		this.hospitalDept = hospitalDept;
//	}
//
//	public void setIsSign(String isSign) {
//		this.isSign = isSign;
//	}
//
//	public void setMbjob(String mbjob) {
//		this.mbjob = mbjob;
//	}
//
//	public void setMobile(String mobile) {
//		this.mobile = mobile;
//	}
//
//	public void setName(String name) {
//		this.name = name;
//	}
//
//	public void setOrganizationDept(String organizationDept) {
//		this.organizationDept = organizationDept;
//	}
//
//	public void setOrganizationId(long organizationId) {
//		this.organizationId = organizationId;
//	}
//
//	public void setPassword(String password) {
//		this.password = password;
//	}
//
//	public void setRemark(String remark) {
//		this.remark = remark;
//	}
//
//	public void setRoles(String roles) {
//		this.roles = roles;
//	}
//
//	public void setSalt(String salt) {
//		this.salt = salt;
//	}
//
//	public void setSex(String sex) {
//		this.sex = sex;
//	}
//
//	public void setSpeciality(String speciality) {
//		this.speciality = speciality;
//	}
//
//	public void setType(int type) {
//		this.type = type;
//	}
//
//	@Override
//	public String toString() {
//		return ToStringBuilder.reflectionToString(this);
//	}
//
//	@Transient
//	public String getRoleName() {
//		return roleName;
//	}
//
//	public void setRoleName(String roleName) {
//		this.roleName = roleName;
//	}
//
//	@Transient
//	public String getMbjobName() {
//		return mbjobName;
//	}
//
//	public void setMbjobName(String mbjobName) {
//		this.mbjobName = mbjobName;
//	}
//
//	@Transient
//	public String getHospitalDeptName() {
//		return hospitalDeptName;
//	}
//
//	public void setHospitalDeptName(String hospitalDeptName) {
//		this.hospitalDeptName = hospitalDeptName;
//	}
//
//	@Transient
//	public String getOrganizationDeptName() {
//		return organizationDeptName;
//	}
//
//	public void setOrganizationDeptName(String organizationDeptName) {
//		this.organizationDeptName = organizationDeptName;
//	}
	
}

+ 64 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/UserRole.java

@ -0,0 +1,64 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 用户权限关联表
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_user_role")
public class UserRole extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3214122136638053177L;
	
	// 用户标识
	private String user;
	// 角色标识
	private String role;
	// 操作员标识
	private String czy;
	// 添加日期
	private Date czrq;
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	public String getCzy() {
		return czy;
	}
	public void setCzy(String czy) {
		this.czy = czy;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
}

+ 124 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAdminTeam.java

@ -0,0 +1,124 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by yww on 2016/11/15.
 */
@Entity
@Table(name = "wlyy_admin_team")
public class WlyyAdminTeam extends IdEntity{
    private static final long serialVersionUID = 1L;
    private String name;            //团队名称
    private Date createTime;              //创建时间
    private String available;
    private String orgCode;
    private String orgName;
    private String leaderCode;
    private String leaderName;
    private String mappingCode;
    private String mappingName;
    private Date lastModified;
    //不对应表中字段
    private List<WlyyAdminTeamMember> memberList = new ArrayList<>();
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getAvailable() {
        return available;
    }
    public void setAvailable(String available) {
        this.available = available;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Transient
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "leader_code")
    public String getLeaderCode() {
        return leaderCode;
    }
    public void setLeaderCode(String leaderCode) {
        this.leaderCode = leaderCode;
    }
    @Transient
    public String getLeaderName() {
        return leaderName;
    }
    public void setLeaderName(String leaderName) {
        this.leaderName = leaderName;
    }
    @Column(name = "mapping_code")
    public String getMappingCode() {
        return mappingCode;
    }
    public void setMappingCode(String mappingCode) {
        this.mappingCode = mappingCode;
    }
    @Transient
    public String getMappingName() {
        return mappingName;
    }
    public void setMappingName(String mappingName) {
        this.mappingName = mappingName;
    }
    @Column(name = "last_modified")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getLastModified() {
        return lastModified;
    }
    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }
    @Transient
    public List<WlyyAdminTeamMember> getMemberList() {
        return memberList;
    }
    public void setMemberList(List<WlyyAdminTeamMember> memberList) {
        this.memberList = memberList;
    }
}

+ 140 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAdminTeamMember.java

@ -0,0 +1,140 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by yww on 2016/11/15.
 */
@Entity
@Table(name = "wlyy_admin_team_member")
public class WlyyAdminTeamMember extends IdEntity {
    private static final long serialVersionUID = 1L;
    private Long teamId;
    private String doctorCode;
    private Date joinTime;
    private String available;
    private Date lastModified;
    //不对应表字段
    private String doctorName;
    private String mobile;
    private String jobName;
    private Integer level;
    private String levelName;
    private boolean teamLeader;
    private String idcard;
    @Transient
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Transient
    public boolean isTeamLeader() {
        return teamLeader;
    }
    public void setTeamLeader(boolean teamLeader) {
        this.teamLeader = teamLeader;
    }
    @Column(name = "team_id")
    public Long getTeamId() {
        return teamId;
    }
    public void setTeamId(Long teamId) {
        this.teamId = teamId;
    }
    @Column(name = "doctor_code")
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    @Column(name = "join_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getJoinTime() {
        return joinTime;
    }
    public void setJoinTime(Date joinTime) {
        this.joinTime = joinTime;
    }
    public String getAvailable() {
        return available;
    }
    public void setAvailable(String available) {
        this.available = available;
    }
    @Column(name = "last_modified")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getLastModified() {
        return lastModified;
    }
    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }
    @Transient
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Transient
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Transient
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    @Transient
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    @Transient
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
}

+ 183 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNotice.java

@ -0,0 +1,183 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Administrator on 2017/1/22.
 */
@Entity
@Table(name = "wlyy_audit_notice", schema = "", catalog = "wlyy")
public class WlyyAuditNotice extends IdEntity {
    private String title;
    private String content;
    private String status;//0 - 创建(瞬间状态) 1- 待提交  2 - 待审核 3 - 待发送 4 - 已发送 5 - 已拒绝 6 - 撤回
    private String conditionDescription;
    private Integer totalCount;
    private String sendType;// 0- 立即发送  1 - 定时发送
    private Date sendTime;
    private String applyUserId;
    private String applyUserName;
    private String applyUserHospital;
    private Date applyTime;
    private String auditUserId;
    private String auditUserName;
    private Date auditTime;
    private boolean owned;//是否是本人的消息通知,默认是
    private boolean auditor;//是否是审核者,默认不是
    public WlyyAuditNotice() {
        this.owned = true;
        this.auditor = false;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "condition_description")
    public String getConditionDescription() {
        return conditionDescription;
    }
    public void setConditionDescription(String conditionDescription) {
        this.conditionDescription = conditionDescription;
    }
    @Column(name = "total_count")
    public Integer getTotalCount() {
        return totalCount;
    }
    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }
    @Column(name = "send_type")
    public String getSendType() {
        return sendType;
    }
    public void setSendType(String sendType) {
        this.sendType = sendType;
    }
    @Column(name = "send_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSendTime() {
        return sendTime;
    }
    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }
    @Column(name = "apply_user_id")
    public String getApplyUserId() {
        return applyUserId;
    }
    public void setApplyUserId(String applyUserId) {
        this.applyUserId = applyUserId;
    }
    @Column(name = "apply_user_name")
    public String getApplyUserName() {
        return applyUserName;
    }
    public void setApplyUserName(String applyUserName) {
        this.applyUserName = applyUserName;
    }
    @Column(name = "apply_user_hospital")
    public String getApplyUserHospital() {
        return applyUserHospital;
    }
    public void setApplyUserHospital(String applyUserHospital) {
        this.applyUserHospital = applyUserHospital;
    }
    @Column(name = "apply_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getApplyTime() {
        return applyTime;
    }
    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }
    @Column(name = "audit_user_id")
    public String getAuditUserId() {
        return auditUserId;
    }
    public void setAuditUserId(String auditUserId) {
        this.auditUserId = auditUserId;
    }
    @Column(name = "audit_user_name")
    public String getAuditUserName() {
        return auditUserName;
    }
    public void setAuditUserName(String auditUserName) {
        this.auditUserName = auditUserName;
    }
    @Column(name = "audit_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getAuditTime() {
        return auditTime;
    }
    public void setAuditTime(Date auditTime) {
        this.auditTime = auditTime;
    }
    @Transient
    public boolean isOwned() {
        return owned;
    }
    public void setOwned(boolean owned) {
        this.owned = owned;
    }
    @Transient
    public boolean isAuditor() {
        return auditor;
    }
    public void setAuditor(boolean auditor) {
        this.auditor = auditor;
    }
}

+ 89 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNoticeObject.java

@ -0,0 +1,89 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by Administrator on 2017/1/22.
 */
@Entity
@Table(name = "wlyy_audit_notice_object", schema = "", catalog = "wlyy")
public class WlyyAuditNoticeObject extends IdEntity {
    private Long noticeId;
    private String toUserId;
    private String toUserTel;
    private String content;
    private String status;
    private Date sendTime;
    private Date insertTime;
    @Column(name = "notice_id")
    public Long getNoticeId() {
        return noticeId;
    }
    public void setNoticeId(Long noticeId) {
        this.noticeId = noticeId;
    }
    @Column(name = "to_user_id")
    public String getToUserId() {
        return toUserId;
    }
    public void setToUserId(String toUserId) {
        this.toUserId = toUserId;
    }
    @Column(name = "to_user_tel")
    public String getToUserTel() {
        return toUserTel;
    }
    public void setToUserTel(String toUserTel) {
        this.toUserTel = toUserTel;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "send_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSendTime() {
        return sendTime;
    }
    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }
    @Column(name = "insert_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getInsertTime() {
        return insertTime;
    }
    public void setInsertTime(Date insertTime) {
        this.insertTime = insertTime;
    }
}

+ 133 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyAuditNoticeScope.java

@ -0,0 +1,133 @@
package com.yihu.wlyy.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Administrator on 2017/1/22.
 */
@Entity
@Table(name = "wlyy_audit_notice_scope", schema = "", catalog = "wlyy")
public class WlyyAuditNoticeScope extends IdEntity {
    private Long noticeId;
    private String scope;
    private String scopeId;
    private String scopeContent;
    private String condition;
    private String serverTypeId;
    private String serverTypeContent;
    private String healthSituationId;
    private String healthSituationContent;
    private String diseaseTypeId;
    private String diseaseTypeContent;
    private String conditionDescription;
    @Column(name = "notice_id")
    public Long getNoticeId() {
        return noticeId;
    }
    public void setNoticeId(Long noticeId) {
        this.noticeId = noticeId;
    }
    @Column(name = "scope")
    public String getScope() {
        return scope;
    }
    public void setScope(String scope) {
        this.scope = scope;
    }
    @Column(name = "scope_id")
    public String getScopeId() {
        return scopeId;
    }
    public void setScopeId(String scopeId) {
        this.scopeId = scopeId;
    }
    @Column(name = "scope_content")
    public String getScopeContent() {
        return scopeContent;
    }
    public void setScopeContent(String scopeContent) {
        this.scopeContent = scopeContent;
    }
    @Column(name = "screening_condition")
    public String getCondition() {
        return condition;
    }
    public void setCondition(String condition) {
        this.condition = condition;
    }
    @Column(name = "server_type_id")
    public String getServerTypeId() {
        return serverTypeId;
    }
    public void setServerTypeId(String serverTypeId) {
        this.serverTypeId = serverTypeId;
    }
    @Column(name = "server_type_content")
    public String getServerTypeContent() {
        return serverTypeContent;
    }
    public void setServerTypeContent(String serverTypeContent) {
        this.serverTypeContent = serverTypeContent;
    }
    @Column(name = "health_situation_id")
    public String getHealthSituationId() {
        return healthSituationId;
    }
    public void setHealthSituationId(String healthSituationId) {
        this.healthSituationId = healthSituationId;
    }
    @Column(name = "health_situation_content")
    public String getHealthSituationContent() {
        return healthSituationContent;
    }
    public void setHealthSituationContent(String healthSituationContent) {
        this.healthSituationContent = healthSituationContent;
    }
    @Column(name = "disease_type_id")
    public String getDiseaseTypeId() {
        return diseaseTypeId;
    }
    public void setDiseaseTypeId(String diseaseTypeId) {
        this.diseaseTypeId = diseaseTypeId;
    }
    @Column(name = "disease_type_content")
    public String getDiseaseTypeContent() {
        return diseaseTypeContent;
    }
    public void setDiseaseTypeContent(String diseaseTypeContent) {
        this.diseaseTypeContent = diseaseTypeContent;
    }
    @Column(name = "condition_description")
    public String getConditionDescription() {
        return conditionDescription;
    }
    public void setConditionDescription(String conditionDescription) {
        this.conditionDescription = conditionDescription;
    }
}

+ 138 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyConsult.java

@ -0,0 +1,138 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by Administrator on 2016/12/19.
 */
@Entity
@Table(name = "wlyy_consult", schema = "", catalog = "wlyy")
public class WlyyConsult {
    private Integer id;
    private String code;
    private String patient;
    private Integer type;
    private String title;
    private String symptoms;
    private String images;
    private Integer guidance;
    private Date czrq;
    private String del;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "type")
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name = "symptoms")
    public String getSymptoms() {
        return symptoms;
    }
    public void setSymptoms(String symptoms) {
        this.symptoms = symptoms;
    }
    @Column(name = "images")
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    @Column(name = "guidance")
    public Integer getGuidance() {
        return guidance;
    }
    public void setGuidance(Integer guidance) {
        this.guidance = guidance;
    }
    @Basic
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WlyyConsult that = (WlyyConsult) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(type, that.type) &&
                Objects.equals(code, that.code) &&
                Objects.equals(patient, that.patient) &&
                Objects.equals(title, that.title) &&
                Objects.equals(symptoms, that.symptoms) &&
                Objects.equals(images, that.images) &&
                Objects.equals(guidance, that.guidance) &&
                Objects.equals(czrq, that.czrq) &&
                Objects.equals(del, that.del);
    }
    @Override
    public int hashCode() {
        return Objects.hash(id, code, patient, type, title, symptoms, images, guidance, czrq, del);
    }
}

+ 295 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyConsultTeam.java

@ -0,0 +1,295 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;
/**
 * Created by Administrator on 2016/12/19.
 */
@Entity
@Table(name = "wlyy_consult_team", schema = "", catalog = "wlyy")
public class WlyyConsultTeam {
    private Integer id;
    private String consult;
    private String doctor;
    private String team;
    private Integer type;
    private String patient;
    private String name;
    private Date birthday;
    private String photo;
    private String fbsj;
    private String symptoms;
    private Integer status;
    private String images;
    private String voice;
    private String comment;
    private String commentContent;
    private Integer commentStar;
    private Integer doctorRead;
    private Integer patientRead;
    private String del;
    private Date czrq;
    private Integer sex;
    private Integer adminTeamCode;
    private Integer guidance;
    private String endMsgId;
    private String startMsgId;
    private String endOperator;
    private Integer endType;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @Column(name = "consult")
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "team")
    public String getTeam() {
        return team;
    }
    public void setTeam(String team) {
        this.team = team;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "birthday")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    @Column(name = "fbsj")
    public String getFbsj() {
        return fbsj;
    }
    public void setFbsj(String fbsj) {
        this.fbsj = fbsj;
    }
    @Column(name = "symptoms")
    public String getSymptoms() {
        return symptoms;
    }
    public void setSymptoms(String symptoms) {
        this.symptoms = symptoms;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "images")
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    @Column(name = "voice")
    public String getVoice() {
        return voice;
    }
    public void setVoice(String voice) {
        this.voice = voice;
    }
    @Column(name = "comment")
    public String getComment() {
        return comment;
    }
    public void setComment(String comment) {
        this.comment = comment;
    }
    @Column(name = "comment_content")
    public String getCommentContent() {
        return commentContent;
    }
    public void setCommentContent(String commentContent) {
        this.commentContent = commentContent;
    }
    @Column(name = "comment_star")
    public Integer getCommentStar() {
        return commentStar;
    }
    public void setCommentStar(Integer commentStar) {
        this.commentStar = commentStar;
    }
    @Column(name = "doctor_read")
    public Integer getDoctorRead() {
        return doctorRead;
    }
    public void setDoctorRead(Integer doctorRead) {
        this.doctorRead = doctorRead;
    }
    @Column(name = "patient_read")
    public Integer getPatientRead() {
        return patientRead;
    }
    public void setPatientRead(Integer patientRead) {
        this.patientRead = patientRead;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "sex")
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    @Column(name = "admin_team_code")
    public Integer getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Integer adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @Column(name = "guidance")
    public Integer getGuidance() {
        return guidance;
    }
    public void setGuidance(Integer guidance) {
        this.guidance = guidance;
    }
    @Column(name = "end_msg_id")
    public String getEndMsgId() {
        return endMsgId;
    }
    public void setEndMsgId(String endMsgId) {
        this.endMsgId = endMsgId;
    }
    @Column(name = "start_msg_id")
    public String getStartMsgId() {
        return startMsgId;
    }
    public void setStartMsgId(String startMsgId) {
        this.startMsgId = startMsgId;
    }
    @Column(name = "end_operator")
    public String getEndOperator() {
        return endOperator;
    }
    public void setEndOperator(String endOperator) {
        this.endOperator = endOperator;
    }
    @Column(name = "end_type")
    public Integer getEndType() {
        return endType;
    }
    public void setEndType(Integer endType) {
        this.endType = endType;
    }
}

+ 118 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyDoctorTeam.java

@ -0,0 +1,118 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by Administrator on 2016/12/15.
 */
@Entity
@Table(name = "wlyy_doctor_team", schema = "", catalog = "wlyy")
public class WlyyDoctorTeam {
    private Integer id;
    private String code;
    private String name;
    private String icon;
    private Integer members;
    private Date czrq;
    private String del;
    private String signType;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "icon")
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
    @Column(name = "members")
    public Integer getMembers() {
        return members;
    }
    public void setMembers(Integer members) {
        this.members = members;
    }
    @Column(name = "czrq")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "sign_type")
    public String getSignType() {
        return signType;
    }
    public void setSignType(String signType) {
        this.signType = signType;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WlyyDoctorTeam that = (WlyyDoctorTeam) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(code, that.code) &&
                Objects.equals(name, that.name) &&
                Objects.equals(icon, that.icon) &&
                Objects.equals(members, that.members) &&
                Objects.equals(czrq, that.czrq) &&
                Objects.equals(del, that.del) &&
                Objects.equals(signType, that.signType);
    }
    @Override
    public int hashCode() {
        return Objects.hash(id, code, name, icon, members, czrq, del, signType);
    }
}

+ 98 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyDoctorTeamMember.java

@ -0,0 +1,98 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by Administrator on 2016/12/19.
 */
@Entity
@Table(name = "wlyy_doctor_team_member", schema = "", catalog = "wlyy")
public class WlyyDoctorTeamMember {
    private Integer id;
    private String team;
    private String memberCode;
    private String name;
    private Integer type;
    private Date czrq;
    private String del;
    private String code;
    private String signType;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getTeam() {
        return team;
    }
    public void setTeam(String team) {
        this.team = team;
    }
    @Column(name = "member_code")
    public String getMemberCode() {
        return memberCode;
    }
    public void setMemberCode(String memberCode) {
        this.memberCode = memberCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "sign_type")
    public String getSignType() {
        return signType;
    }
    public void setSignType(String signType) {
        this.signType = signType;
    }
}

+ 129 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDevice.java

@ -0,0 +1,129 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by Administrator on 2016/12/7.
 */
@Entity
@Table(name = "wlyy_patient_device", schema = "", catalog = "wlyy")
public class WlyyPatientDevice {
    private Integer id;
    private Integer deviceId;
    private String user;
    private String userName;
    private String categoryCode;
    private String deviceName;
    private String deviceSn;
    private String userType;
    private String userIdcard;
    private Date czrq;
    private String doctor;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @Column(name = "device_id")
    public Integer getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(Integer deviceId) {
        this.deviceId = deviceId;
    }
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Transient
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "category_code")
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name = "user_type")
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
    @Column(name = "user_idcard")
    public String getUserIdcard() {
        return userIdcard;
    }
    public void setUserIdcard(String userIdcard) {
        this.userIdcard = userIdcard;
    }
    @Column(name = "czrq")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
}

+ 57 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyRole.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by yww on 2016/12/13.
 */
@Entity
@Table(name = "wlyy_role")
public class WlyyRole extends IdEntity {
    private String code;        // 角色编码
    private String name;        // 角色名称
    private String czy;       // 操作员
    private Date czrq;       // 操作日期
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "czy")
    public String getCzy() {
        return czy;
    }
    public void setCzy(String czy) {
        this.czy = czy;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 33 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyRoleArea.java

@ -0,0 +1,33 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
/**
 * Created by yww on 2016/12/13.
 */
@Entity
@Table(name = "wlyy_role_area")
public class WlyyRoleArea extends IdEntity {
    // 角色编码
    private String roleCode;
    // 区域编码
    private String areaCode;
    @Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    @Column(name = "area_code")
    public String getAreaCode() {
        return areaCode;
    }
    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }
}

+ 67 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyUserRole.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;
/**
 * Created by yww on 2016/12/13.
 */
@Entity
@Table(name = "wlyy_user_role")
public class WlyyUserRole extends IdEntity {
    private String user;    // 用户编码
    private String userName;
    private String role;    // 角色编码
    private String czy;     // 操作员
    private Date czrq;      // 操作日期
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Transient
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "role")
    public String getRole() {
        return role;
    }
    public void setRole(String role) {
        this.role = role;
    }
    public String getCzy() {
        return czy;
    }
    @Column(name = "czy")
    public void setCzy(String czy) {
        this.czy = czy;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 111 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/consult/WlyyConsultRemindLog.java

@ -0,0 +1,111 @@
package com.yihu.wlyy.entity.consult;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by 卓 on 2017/5/15.
 */
@Entity
@Table(name = "wlyy_consult_remind_log", schema = "", catalog = "wlyy")
public class WlyyConsultRemindLog extends IdEntity {
    private String doctor;//医生CODE
    private String doctorName;//医生NAME
    private String hospital;//医院
    private String hospitalName;//医院名称
    private String city;//所属城市
    private String cityName;//城市名称
    private String town;//区代码
    private String townName;//区名称
    private Date remindTime;//提醒时间
    private Integer remindType;//提醒方式 1、应用内提醒 2、短信提醒 3、电话提醒
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public Date getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(Date remindTime) {
        this.remindTime = remindTime;
    }
    public Integer getRemindType() {
        return remindType;
    }
    public void setRemindType(Integer remindType) {
        this.remindType = remindType;
    }
    public static final int REMIND_SYSTEM = 1;
    public static final int REMIND_SMS = 2;
    public static final int REMIND_PHONE = 3;
}

+ 220 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/consult/WlyyReplyConsult.java

@ -0,0 +1,220 @@
package com.yihu.wlyy.entity.consult;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by 卓 on 2017/5/15.
 */
@Entity
@Table(name = "wlyy_reply_consult", schema = "", catalog = "wlyy")
public class WlyyReplyConsult extends IdEntity {
    private String code;
    private String patient;
    private String patientName;
    private String doctorName;
    private String doctorCode;
    private String healthDoctorCode;
    private String healthDoctorName;
    private String hospital;
    private String hospitalName;
    private String city;
    private String cityName;
    private String town;
    private String townName;
    private String teamName;
    private String teamCode;
    private Date createTime;
    private Integer status;
    private Integer reply;
    /**
     * 非u数据库字段
     */
    private String consultContent;
    /**
     * 非u数据库字段
     */
    private Integer isRemindDoctor;
    /**
     * 非u数据库字段
     */
    private Integer isRemindHealthDoctor;
    @Transient
    public String getConsultContent() {
        return consultContent;
    }
    public void setConsultContent(String consultContent) {
        this.consultContent = consultContent;
    }
    @Transient
    public Integer getIsRemindDoctor() {
        return isRemindDoctor;
    }
    public void setIsRemindDoctor(Integer isRemindDoctor) {
        this.isRemindDoctor = isRemindDoctor;
    }
    @Transient
    public Integer getIsRemindHealthDoctor() {
        return isRemindHealthDoctor;
    }
    public void setIsRemindHealthDoctor(Integer isRemindHealthDoctor) {
        this.isRemindHealthDoctor = isRemindHealthDoctor;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getHealthDoctorCode() {
        return healthDoctorCode;
    }
    public void setHealthDoctorCode(String healthDoctorCode) {
        this.healthDoctorCode = healthDoctorCode;
    }
    public String getHealthDoctorName() {
        return healthDoctorName;
    }
    public void setHealthDoctorName(String healthDoctorName) {
        this.healthDoctorName = healthDoctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getTeamName() {
        return teamName;
    }
    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getReply() {
        return reply;
    }
    public void setReply(Integer reply) {
        this.reply = reply;
    }
}

+ 128 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/feedback/Appeal.java

@ -0,0 +1,128 @@
package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 账号申诉表
 * Created by Reece on 2017/5/6.
 */
@Entity
@Table(name = "wlyy_appeal")
public class Appeal extends IdEntity {
    //   '账号申诉编码'
    private String code;
    //    申诉人编码
    private String creater;
    //    '问题描述'
    private String description;
    //    申诉类别:1、手机号变更、2、重置密码、3、其他
    private int type;
    //    图片路径,逗号分隔
    private String images;
    //    联系手机号
    private String phone;
    //    状态 0、未读 1、待处理  2、已处理
    private int status;
    //    '处理结果'
    private String result;
    //    申诉人身份:1、患者  2、医生
    private int identity;
    //    是否删除 0、删除 1、正常
    private int del;
    //    创建人姓名
    private String createrName;
    public Appeal() {
    }
    public String getCreaterName() {
        return createrName;
    }
    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public int getIdentity() {
        return identity;
    }
    public void setIdentity(int identity) {
        this.identity = identity;
    }
}

+ 118 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java

@ -0,0 +1,118 @@
package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 意见反馈表
 * Created by Reece on 2017/5/6.
 */
@Entity
@Table(name = "wlyy_feedback")
public class Feedback extends IdEntity {
    //    意见反馈编码
    private String code;
    //    反馈人编码
    private String creater;
    //    反馈人身份 1、患者  2、医生
    private int identity;
    //    问题描述
    private String description;
    //    反馈类别:1、优化建议、2、提交bug、3、新功能建议、4、其他
    private int type;
    //    图片路径,逗号分隔
    private String images;
    //    联系方式: qq号或者邮箱
    private String contact;
    //    状态 0、未读 1、已读
    private int status;
    //    是否删除 0、删除 1、正常
    private int del;
    //    创建人姓名
    private String createrName;
    public Feedback() {
    }
    public String getCreaterName() {
        return createrName;
    }
    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public int getIdentity() {
        return identity;
    }
    public void setIdentity(int identity) {
        this.identity = identity;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getContact() {
        return contact;
    }
    public void setContact(String contact) {
        this.contact = contact;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
}

+ 0 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyLabelInfo.java


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä