Procházet zdrojové kódy

新增record记录和更新图片和笔记

zhangdan před 6 roky
rodič
revize
47e7ad7a59
100 změnil soubory, kde provedl 12244 přidání a 0 odebrání
  1. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseCityDO.java
  2. 62 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseProvinceDO.java
  3. 101 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseStreetDO.java
  4. 88 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseTownDO.java
  5. 88 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHealthProblemDO.java
  6. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java
  7. 127 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictIcd10DO.java
  8. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictJobTitleDO.java
  9. 88 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictMedicineDO.java
  10. 390 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  11. 127 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  12. 62 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDictDO.java
  13. 64 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ImGetuiConfigDO.java
  14. 62 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/message/MqMessageDO.java
  15. 57 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/message/MqMessageSubscriberDO.java
  16. 341 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrg.java
  17. 288 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  18. 478 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  19. 230 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java
  20. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDetailTimeDO.java
  21. 97 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDetailsDO.java
  22. 125 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageNormcatDO.java
  23. 153 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackagePropDO.java
  24. 124 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackagePropvalueDO.java
  25. 220 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  26. 124 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSkuDO.java
  27. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/DimensionDO.java
  28. 86 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/DimensionQuotaDO.java
  29. 185 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/JobConfigDO.java
  30. 65 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/QuotaDO.java
  31. 101 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java
  32. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java
  33. 71 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseCityVO.java
  34. 115 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorHospitalVO.java
  35. 60 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorRoleDictVO.java
  36. 335 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorVO.java
  37. 236 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseOrgVO.java
  38. 412 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BasePatientVO.java
  39. 60 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseProvinceVO.java
  40. 93 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseStreetVO.java
  41. 71 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTeamMemberVO.java
  42. 93 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTeamVO.java
  43. 82 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTownVO.java
  44. 82 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHealthProblemVO.java
  45. 71 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java
  46. 115 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictIcd10VO.java
  47. 71 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictJobTitleVO.java
  48. 82 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictMedicineVO.java
  49. 64 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/im/ImGetuiConfigVO.java
  50. 54 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/message/MqMessageSubscriberVO.java
  51. 59 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/message/MqMessageVO.java
  52. 34 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/RehabilitationVO.java
  53. 46 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageDetailTimeVO.java
  54. 96 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageDetailsVO.java
  55. 211 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageLogVO.java
  56. 106 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageNormcatVO.java
  57. 156 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackagePropVO.java
  58. 124 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackagePropvalueDO.java
  59. 196 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageSignRecordVO.java
  60. 133 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageSkuVO.java
  61. 151 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageVO.java
  62. 84 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/DimensionQuotaVO.java
  63. 86 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/DimensionVO.java
  64. 184 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/JobConfigVO.java
  65. 64 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/QuotaVO.java
  66. 96 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientDisseaseInfoVO.java
  67. 69 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/config/WlyyWebSecurityConfigurerAdapter.java
  68. 228 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/SaltUser.java
  69. 65 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  70. 52 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/Oauth2Envelop.java
  71. 220 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserDetails.java
  72. 165 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java
  73. 65 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/common/WlyyOAuth2AccessToken.java
  74. 100 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/config/WlyyAuthorizationServerConfigurerAdapter.java
  75. 49 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/jdbc/WlyyJdbcUserSecurityService.java
  76. 44 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java
  77. 338 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java
  78. 60 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/client/WlyyJdbcClientRedirectUriService.java
  79. 699 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyAuthorizationEndpoint.java
  80. 336 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  81. 254 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyTokenEndpoint.java
  82. 148 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/error/WlyyOAuth2ExceptionTranslator.java
  83. 134 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/web/authentication/WlyyAuthenticationFailureHandler.java
  84. 18 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/web/endpoint/BaseLoginEndpoint.java
  85. 38 0
      server/svr-authentication/src/main/resources/application.yml
  86. 29 0
      server/svr-authentication/src/main/resources/banner.txt
  87. 32 0
      server/svr-authentication/src/main/resources/bootstrap.yml
  88. 356 0
      sql/init.sql
  89. 71 0
      svr/svr-base/doc/es/服务包执行日志记录索引.txt
  90. 87 0
      svr/svr-base/src/main/java/com/yihu/jw/base/activemq/ConsumerRunner.java
  91. 60 0
      svr/svr-base/src/main/java/com/yihu/jw/base/activemq/MessageManager.java
  92. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseCityDao.java
  93. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorDao.java
  94. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorHospitalDao.java
  95. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorRoleDictDao.java
  96. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseOrgDao.java
  97. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BasePatientDao.java
  98. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseProvinceDao.java
  99. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseStreetDao.java
  100. 0 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseTeamDao.java

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseCityDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.base.area;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 城市字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_city")
public class BaseCityDO extends IntegerIdentityEntity {
    /**
	* 省编码
	*/
    private String province;
    /**
	* 城市编码
	*/
    private String code;
    /**
	* 城市名称
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "province")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 62 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseProvinceDO.java

@ -0,0 +1,62 @@
package com.yihu.jw.entity.base.area;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 省字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_province")
public class BaseProvinceDO extends IntegerIdentityEntity {
    /**
	* 省份编码
	*/
    private String code;
    /**
	* 省份名称
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 101 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseStreetDO.java

@ -0,0 +1,101 @@
package com.yihu.jw.entity.base.area;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 街道字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_street")
public class BaseStreetDO extends IntegerIdentityEntity {
    /**
	* 省标识
	*/
    private String province;
    /**
	* 市标识
	*/
    private String city;
    /**
	* 区县标识
	*/
    private String town;
    /**
	* 街道标识
	*/
    private String code;
    /**
	* 街道名称
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "province")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@Column(name = "city")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
	@Column(name = "town")
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 88 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseTownDO.java

@ -0,0 +1,88 @@
package com.yihu.jw.entity.base.area;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 区县字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_town")
public class BaseTownDO extends IntegerIdentityEntity {
    /**
	* 省编码
	*/
    private String province;
    /**
	* 城市编码
	*/
    private String city;
    /**
	* 区县编码
	*/
    private String code;
    /**
	* 区县名称
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "province")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@Column(name = "city")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 88 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHealthProblemDO.java

@ -0,0 +1,88 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 健康问题字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "dict_health_problem")
public class DictHealthProblemDO extends IntegerIdentityEntity {
    /**
	* saas配置id,null标识公共字典
	*/
    private String saasId;
    /**
	* 字典编码
	*/
    private String code;
    /**
	* 字典名称
	*/
    private String name;
    /**
	* 描述
	*/
    private String description;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@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 = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医院科室字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "dict_hospital_dept")
public class DictHospitalDeptDO extends IntegerIdentityEntity {
    /**
	* saas配置id,null标识公共字典
	*/
    private String saasId;
    /**
	* 科室标识
	*/
    private String code;
    /**
	* 科室名称
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 127 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictIcd10DO.java

@ -0,0 +1,127 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * ICD10字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "dict_icd10")
public class DictIcd10DO extends IntegerIdentityEntity {
    /**
	* saas配置id,null标识公共字典
	*/
    private String saasId;
    /**
	* icd10字典编码
	*/
    private String code;
    /**
	* icd10字典名称
	*/
    private String name;
    /**
	* 字典名称拼音首字母
	*/
    private String phoneticCode;
    /**
	* 是否慢病
	*/
    private String chronicFlag;
    /**
	* 是否传染病
	*/
    private String infectiousFlag;
    /**
	* 描述
	*/
    private String description;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@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 = "phonetic_code")
    public String getPhoneticCode() {
        return phoneticCode;
    }
    public void setPhoneticCode(String phoneticCode) {
        this.phoneticCode = phoneticCode;
    }
	@Column(name = "chronic_flag")
    public String getChronicFlag() {
        return chronicFlag;
    }
    public void setChronicFlag(String chronicFlag) {
        this.chronicFlag = chronicFlag;
    }
	@Column(name = "infectious_flag")
    public String getInfectiousFlag() {
        return infectiousFlag;
    }
    public void setInfectiousFlag(String infectiousFlag) {
        this.infectiousFlag = infectiousFlag;
    }
	@Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictJobTitleDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 职称字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "dict_job_title")
public class DictJobTitleDO extends IntegerIdentityEntity {
    /**
	* saas配置id,null标识公共字典
	*/
    private String saasId;
    /**
	* 职称标识
	*/
    private String code;
    /**
	* 职称名
	*/
    private String name;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@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 = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 88 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictMedicineDO.java

@ -0,0 +1,88 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 药品字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "dict_medicine")
public class DictMedicineDO extends IntegerIdentityEntity {
    /**
	* saas配置id,null标识公共字典
	*/
    private String saasId;
    /**
	* 药品编码
	*/
    private String code;
    /**
	* 药品名称
	*/
    private String name;
    /**
	* 药品类型:1健康记录
	*/
    private String type;
    /**
	* 创建时间
	*/
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@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 = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 390 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -0,0 +1,390 @@
package com.yihu.jw.entity.base.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 医生基础信息实体
*
* @author litaohong on  2018年08月31日
*
*/
@Entity
@Table(name = "base_doctor")
public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    /**
	* 机构id
	*/
    private String orgId;
    /**
	* 密码
	*/
    private String password;
    /**
	* 
	*/
    private String salt;
    /**
	* 姓名
	*/
    private String name;
    /**
	* 性别(1男,2女) 用国家标准字典
	*/
    private String sex;
    /**
	* 医生专长
	*/
    private String expertise;
    /**
	* 医生介绍
	*/
    private String introduce;
    /**
	*  身份证
	*/
    private String idcard;
    /**
	* 生日
	*/
    private Date birthday;
    /**
	* 头像http地址
	*/
    private String photo;
    /**
	* 手机号
	*/
    private String mobile;
    /**
	* 医生二维码
	*/
    private String qrcode;
    /**
	* 省代码
	*/
    private String provinceCode;
    /**
	* 省名称
	*/
    private String provinceName;
    /**
	* 市代码
	*/
    private String cityCode;
    /**
	* 市名称
	*/
    private String cityName;
    /**
	* 区县代码
	*/
    private String townCode;
    /**
	* 区县名称
	*/
    private String townName;
    /**
	* 街道代码
	*/
    private String streetCode;
    /**
	* 街道名称
	*/
    private String streetName;
    /**
	* 资格是否认证通过,1是,0否
	*/
    private String iscertified;
    /**
	* 是否是名医,1是,0否
	*/
    private String isFamous;
    /**
	* 是否提示设置密码  1 提示过 0未提示
	*/
    private String isPasswordPrompt;
    /**
	* 名称拼音首字母
	*/
    private String spell;
    /**
	* CA证书过期时间
	*/
    private Date certifiedOvertime;
    /**
	* CA证书编号
	*/
    private String certificateNum;
    /**
	* 
	*/
    private String openid;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
	@Column(name = "org_id")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@Column(name = "password")
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
	@Column(name = "salt")
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@Column(name = "sex")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
	@Column(name = "expertise")
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
	@Column(name = "introduce")
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
	@Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@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 = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@Column(name = "qrcode")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
	@Column(name = "province_code")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@Column(name = "province_name")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
	@Column(name = "city_code")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
	@Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
	@Column(name = "town_code")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
	@Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
	@Column(name = "street_code")
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
	@Column(name = "street_name")
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
	@Column(name = "iscertified")
    public String getIscertified() {
        return iscertified;
    }
    public void setIscertified(String iscertified) {
        this.iscertified = iscertified;
    }
	@Column(name = "is_famous")
    public String getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(String isFamous) {
        this.isFamous = isFamous;
    }
	@Column(name = "is_password_prompt")
    public String getIsPasswordPrompt() {
        return isPasswordPrompt;
    }
    public void setIsPasswordPrompt(String isPasswordPrompt) {
        this.isPasswordPrompt = isPasswordPrompt;
    }
	@Column(name = "spell")
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@Column(name = "certified_overtime")
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
	@Column(name = "certificate_num")
    public String getCertificateNum() {
        return certificateNum;
    }
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
	@Column(name = "openid")
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 127 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java

@ -0,0 +1,127 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医生职业信息实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_doctor_hospital")
public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
    /**
	* 医院标识
	*/
    private String hospCode;
    /**
	* 医院名称
	*/
    private String hospName;
    /**
	* 医生角色标识
	*/
    private String roleCode;
    /**
	* 医院角色名称
	*/
    private String roleName;
    /**
	* 职称代码
	*/
    private String jobTitleCode;
    /**
	* 职称名称
	*/
    private String jobTitleName;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
    /**
	* 
	*/
    private Date createTime;
	@Column(name = "hosp_code")
    public String getHospCode() {
        return hospCode;
    }
    public void setHospCode(String hospCode) {
        this.hospCode = hospCode;
    }
	@Column(name = "hosp_name")
    public String getHospName() {
        return hospName;
    }
    public void setHospName(String hospName) {
        this.hospName = hospName;
    }
	@Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
	@Column(name = "role_name")
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
	@Column(name = "job_title_code")
    public String getJobTitleCode() {
        return jobTitleCode;
    }
    public void setJobTitleCode(String jobTitleCode) {
        this.jobTitleCode = jobTitleCode;
    }
	@Column(name = "job_title_name")
    public String getJobTitleName() {
        return jobTitleName;
    }
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 62 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDictDO.java

@ -0,0 +1,62 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医生角色字典实体
 * 
 * @author litaohong on  2018年08月31日
 *
 */
@Entity
@Table(name = "base_doctor_role_dict")
public class BaseDoctorRoleDictDO extends IntegerIdentityEntity {
    /**
	* 角色code
	*/
    private String code;
    /**
	* 角色名称:全科医生、专科医生、健康管理师、管理员等
	*/
    private String name;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
	@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 = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 64 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ImGetuiConfigDO.java

@ -0,0 +1,64 @@
package com.yihu.jw.entity.base.im;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * im个推配置表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_im_getui_config")
public class ImGetuiConfigDO extends UuidIdentityEntity {
    private String saasId;//个推url
    private String host;
    private String appId;//个推appid
    private String appkey;//个推appkey
    private String mastersecret;//个推的秘钥
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getHost() {
        return host;
    }
    public void setHost(String host) {
        this.host = host;
    }
    @Column(name = "app_id")
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppkey() {
        return appkey;
    }
    public void setAppkey(String appkey) {
        this.appkey = appkey;
    }
    public String getMastersecret() {
        return mastersecret;
    }
    public void setMastersecret(String mastersecret) {
        this.mastersecret = mastersecret;
    }
}

+ 62 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/message/MqMessageDO.java

@ -0,0 +1,62 @@
package com.yihu.jw.entity.base.message;
import com.yihu.jw.entity.UuidIdentityEntity;
import org.springframework.stereotype.Component;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Entity - 基于MQ的消息推送
 * Created by progr1mmer on 2018/8/30.
 */
@Entity
@Table(name = "base_mq_message")
public class MqMessageDO extends UuidIdentityEntity {
    //主题
    private String topic;
    //名称
    private String name;
    //备注
    private String remark;
    //模板
    private String template;
    @Column(name = "topic", nullable = false)
    public String getTopic() {
        return topic;
    }
    public void setTopic(String topic) {
        this.topic = topic;
    }
    @Column(name = "name", nullable = false)
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "template")
    public String getTemplate() {
        return template;
    }
    public void setTemplate(String template) {
        this.template = template;
    }
}

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/message/MqMessageSubscriberDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.base.message;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Entity - 基于MQ的消息推送订阅者
 * Created by progr1mmer on 2018/8/14.
 */
@Entity
@Table(name = "base_mq_message_subscriber")
public class MqMessageSubscriberDO extends UuidIdentityEntity {
    private String saasId; //saas id
    private String topic; //主题
    private String url; //推送地址
    private String remark; //备注
    @Column(name = "saas_id", nullable = false, length = 50)
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "topic", nullable = false)
    public String getTopic() {
        return topic;
    }
    public void setTopic(String topic) {
        this.topic = topic;
    }
    @Column(name = "url", nullable = false)
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 341 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrg.java

@ -0,0 +1,341 @@
/**
 *  @author  
 *  @create 2018-08-29 12:41:02 
*/
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.Column;
import javax.persistence.Id;
@Entity
@Table(name = "base_org")
public class BaseOrg extends UuidIdentityEntityWithOperator {
/**
* saas化配置
*/
private String saasid;
/**
* 省份标识
*/
private String provinceCode;
/**
* 城市标识
*/
private String cityCode;
/**
* 区县标识
*/
private String townCode;
/**
* 机构名称
*/
private String name;
/**
* 机构别名
*/
private String alias;
/**
* 机构名称拼音首字母
*/
private String spell;
/**
* 机构类型: 1.  医疗机构2.  企事业单位3.  政府机关4.  社会团体 5.药店 0.  部门 6.单位或者独立子公司7.基层机构 8.专业公共机构
*/
private String type;
/**
* 机构简介
*/
private String brief;
/**
* 机构详细地址
*/
private String address;
/**
* 机构图片
*/
private String photo;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 法人
*/
private String legalperson;
/**
* 机构管理员
*/
private String orgAdmin;
/**
* 机构网址
*/
private String orgUrl;
/**
* 机构简介
*/
private String intro;
/**
* 机构二维码
*/
private String qrcode;
/**
* 作废标识,1正常,0作废
*/
private String del;
@Column(name = "saasid")
public String getSaasid()
{
    return saasid;
}
public void setSaasid(String saasid)
{
    this.saasid = saasid;
}
@Column(name = "province_code")
public String getProvinceCode()
{
    return provinceCode;
}
public void setProvinceCode(String provinceCode)
{
    this.provinceCode = provinceCode;
}
@Column(name = "city_code")
public String getCityCode()
{
    return cityCode;
}
public void setCityCode(String cityCode)
{
    this.cityCode = cityCode;
}
@Column(name = "town_code")
public String getTownCode()
{
    return townCode;
}
public void setTownCode(String townCode)
{
    this.townCode = townCode;
}
@Column(name = "name")
public String getName()
{
    return name;
}
public void setName(String name)
{
    this.name = name;
}
@Column(name = "alias")
public String getAlias()
{
    return alias;
}
public void setAlias(String alias)
{
    this.alias = alias;
}
@Column(name = "spell")
public String getSpell()
{
    return spell;
}
public void setSpell(String spell)
{
    this.spell = spell;
}
@Column(name = "type")
public String getType()
{
    return type;
}
public void setType(String type)
{
    this.type = type;
}
@Column(name = "brief")
public String getBrief()
{
    return brief;
}
public void setBrief(String brief)
{
    this.brief = brief;
}
@Column(name = "address")
public String getAddress()
{
    return address;
}
public void setAddress(String address)
{
    this.address = address;
}
@Column(name = "photo")
public String getPhoto()
{
    return photo;
}
public void setPhoto(String photo)
{
    this.photo = photo;
}
@Column(name = "longitude")
public String getLongitude()
{
    return longitude;
}
public void setLongitude(String longitude)
{
    this.longitude = longitude;
}
@Column(name = "latitude")
public String getLatitude()
{
    return latitude;
}
public void setLatitude(String latitude)
{
    this.latitude = latitude;
}
@Column(name = "legalperson")
public String getLegalperson()
{
    return legalperson;
}
public void setLegalperson(String legalperson)
{
    this.legalperson = legalperson;
}
@Column(name = "org_admin")
public String getOrgAdmin()
{
    return orgAdmin;
}
public void setOrgAdmin(String orgAdmin)
{
    this.orgAdmin = orgAdmin;
}
@Column(name = "org_url")
public String getOrgUrl()
{
    return orgUrl;
}
public void setOrgUrl(String orgUrl)
{
    this.orgUrl = orgUrl;
}
@Column(name = "intro")
public String getIntro()
{
    return intro;
}
public void setIntro(String intro)
{
    this.intro = intro;
}
@Column(name = "qrcode")
public String getQrcode()
{
    return qrcode;
}
public void setQrcode(String qrcode)
{
    this.qrcode = qrcode;
}
@Column(name = "del")
public String getDel()
{
    return del;
}
public void setDel(String del)
{
    this.del = del;
}
}

+ 288 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -0,0 +1,288 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 机构信息实体
 *
 * @author litaohong on  2018年08月31日
 */
@Entity
@Table(name = "base_org")
public class BaseOrgDO extends UuidIdentityEntityWithOperator {
    /**
     * saas化配置
     */
    private String saasid;
    /**
     * 省份标识
     */
    private String provinceCode;
    /**
     * 城市标识
     */
    private String cityCode;
    /**
     * 区县标识
     */
    private String townCode;
    /**
     * 机构名称
     */
    private String name;
    /**
     * 机构别名
     */
    private String alias;
    /**
     * 机构名称拼音首字母
     */
    private String spell;
    /**
     * 机构类型: 1.  医疗机构2.  企事业单位3.  政府机关4.  社会团体 5.药店 0.  部门 6.单位或者独立子公司7.基层机构 8.专业公共机构
     */
    private String type;
    /**
     * 机构简介
     */
    private String brief;
    /**
     * 机构详细地址
     */
    private String address;
    /**
     * 机构图片
     */
    private String photo;
    /**
     * 经度
     */
    private String longitude;
    /**
     * 纬度
     */
    private String latitude;
    /**
     * 法人
     */
    private String legalperson;
    /**
     * 机构管理员
     */
    private String orgAdmin;
    /**
     * 机构网址
     */
    private String orgUrl;
    /**
     * 机构简介
     */
    private String intro;
    /**
     * 机构二维码
     */
    private String qrcode;
    /**
     * 作废标识,1正常,0作废
     */
    private String del;
    @Column(name = "saasid")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
    @Column(name = "province_code")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    @Column(name = "city_code")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    @Column(name = "town_code")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "alias")
    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }
    @Column(name = "spell")
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "brief")
    public String getBrief() {
        return brief;
    }
    public void setBrief(String brief) {
        this.brief = brief;
    }
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    @Column(name = "longitude")
    public String getLongitude() {
        return longitude;
    }
    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }
    @Column(name = "latitude")
    public String getLatitude() {
        return latitude;
    }
    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }
    @Column(name = "legalperson")
    public String getLegalperson() {
        return legalperson;
    }
    public void setLegalperson(String legalperson) {
        this.legalperson = legalperson;
    }
    @Column(name = "org_admin")
    public String getOrgAdmin() {
        return orgAdmin;
    }
    public void setOrgAdmin(String orgAdmin) {
        this.orgAdmin = orgAdmin;
    }
    @Column(name = "org_url")
    public String getOrgUrl() {
        return orgUrl;
    }
    public void setOrgUrl(String orgUrl) {
        this.orgUrl = orgUrl;
    }
    @Column(name = "intro")
    public String getIntro() {
        return intro;
    }
    public void setIntro(String intro) {
        this.intro = intro;
    }
    @Column(name = "qrcode")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 478 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -0,0 +1,478 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 居民信息实体
*
* @author litaohong on  2018年08月31日
*
*/
@Entity
@Table(name = "base_patient")
public class BasePatientDO extends UuidIdentityEntityWithOperator {
    /**
	* saas配置id
	*/
    private String saasId;
    /**
	* 身份证号
	*/
    private String idcard;
    /**
	* 登录密码
	*/
    private String password;
    /**
	* 
	*/
    private String salt;
    /**
	* 姓名
	*/
    private String name;
    /**
	* 生日
	*/
    private Date birthday;
    /**
	* 性别,1男,2女
	*/
    private String sex;
    /**
	* 手机号
	*/
    private String mobile;
    /**
	* 联系电话
	*/
    private String phone;
    /**
	* 社保卡号
	*/
    private String ssc;
    /**
	* 头像http地址
	*/
    private String photo;
    /**
	* 省编码
	*/
    private String provinceCode;
    /**
	* 市编码
	*/
    private String cityCode;
    /**
	* 区县编码
	*/
    private String townCode;
    /**
	* 街道编码
	*/
    private String streetCode;
    /**
	* 具体详细地址
	*/
    private String address;
    /**
	* 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	*/
    private String disease;
    /**
	* 病情:0绿标,1黄标,2红标,3重点关注,
	*/
    private String diseaseCondition;
    /**
	* 总积分
	*/
    private String points;
    /**
	* 病历总数
	*/
    private String recordAmount;
    /**
	* 微信编号
	*/
    private String openid;
    /**
	* 用户状态:1正常,0禁用,-1恶意注册,2审核中
	*/
    private String patientStatus;
    /**
	* 联系方式备注【基卫】
	*/
    private String mobileRemarks;
    /**
	* 第一次添加open的时间
	*/
    private Date openidTime;
    /**
	* 居委会代码
	*/
    private String sickVillage;
    /**
	* 
	*/
    private String sickVillageName;
    /**
	* 绑定电子社保卡主体(共济为操作人code)
	*/
    private String principalCode;
    /**
	* 是否绑定电子社保卡 (0否 1是)
	*/
    private String sicardStatus;
    /**
	* 电子社保卡绑定时间
	*/
    private Date sicardTime;
    /**
	* 是否分配过微信标签
	*/
    private Integer isWxtag;
    /**
	* 微信tagId
	*/
    private String wxtagid;
    /**
	* 居民预警状态:0为标准,1为预警状态
	*/
    private Integer standardStatus;
    /**
	* 医疗保险号
	*/
    private String medicareNumber;
    /**
	* unionId 开发平台唯一标识
	*/
    private String unionid;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
	@Column(name = "password")
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
	@Column(name = "salt")
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
	@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 = "sex")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
	@Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
	@Column(name = "ssc")
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
	@Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
	@Column(name = "province_code")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@Column(name = "city_code")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
	@Column(name = "town_code")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
	@Column(name = "street_code")
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
	@Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
	@Column(name = "disease")
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
	@Column(name = "disease_condition")
    public String getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(String diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
	@Column(name = "points")
    public String getPoints() {
        return points;
    }
    public void setPoints(String points) {
        this.points = points;
    }
	@Column(name = "record_amount")
    public String getRecordAmount() {
        return recordAmount;
    }
    public void setRecordAmount(String recordAmount) {
        this.recordAmount = recordAmount;
    }
	@Column(name = "openid")
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
	@Column(name = "patient_status")
    public String getPatientStatus() {
        return patientStatus;
    }
    public void setPatientStatus(String patientStatus) {
        this.patientStatus = patientStatus;
    }
	@Column(name = "mobile_remarks")
    public String getMobileRemarks() {
        return mobileRemarks;
    }
    public void setMobileRemarks(String mobileRemarks) {
        this.mobileRemarks = mobileRemarks;
    }
	@Column(name = "openid_time")
    public Date getOpenidTime() {
        return openidTime;
    }
    public void setOpenidTime(Date openidTime) {
        this.openidTime = openidTime;
    }
	@Column(name = "sick_village")
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
	@Column(name = "sick_village_name")
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
	@Column(name = "principal_code")
    public String getPrincipalCode() {
        return principalCode;
    }
    public void setPrincipalCode(String principalCode) {
        this.principalCode = principalCode;
    }
	@Column(name = "sicard_status")
    public String getSicardStatus() {
        return sicardStatus;
    }
    public void setSicardStatus(String sicardStatus) {
        this.sicardStatus = sicardStatus;
    }
	@Column(name = "sicard_time")
    public Date getSicardTime() {
        return sicardTime;
    }
    public void setSicardTime(Date sicardTime) {
        this.sicardTime = sicardTime;
    }
	@Column(name = "is_wxtag")
    public Integer getIsWxtag() {
        return isWxtag;
    }
    public void setIsWxtag(Integer isWxtag) {
        this.isWxtag = isWxtag;
    }
	@Column(name = "wxtagid")
    public String getWxtagid() {
        return wxtagid;
    }
    public void setWxtagid(String wxtagid) {
        this.wxtagid = wxtagid;
    }
	@Column(name = "standard_status")
    public Integer getStandardStatus() {
        return standardStatus;
    }
    public void setStandardStatus(Integer standardStatus) {
        this.standardStatus = standardStatus;
    }
	@Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@Column(name = "unionid")
    public String getUnionid() {
        return unionid;
    }
    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 230 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java

@ -0,0 +1,230 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * 服务包表
 * @author yeshijie on 2018/8/17.
 */
@Entity
@Table(name = "base_service_package")
public class ServicePackageDO extends UuidIdentityEntity implements Serializable {
    public enum Level {
        system("系统", "0"),
        doctor("医生", "1"),
        team("团队", "2"),
        hospital("社区", "3"),
        town("区", "4");
        private String name;
        private String value;
        Level(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    public enum Status {
        waiting("待审核", "0"),
        pass("审核通过", "1"),
        unpass("审核不通过", "2");
        private String name;
        private String value;
        Status(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    public enum Type {
        rehabilitation("康复计划", "1");
        private String name;
        private String value;
        Type(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    private String saasId;
    private String name;//服务包名称
    private String type;//服务包类型
    private Integer num;//服务项数量
    private Long price;//预售价//单位分
    private String level;//服务包级别(0系统,1.医生,2团队,3社区,4区)
    private String levelCode;//关联code
    private String creater;//创建者
    private Date createTime;//创建时间
    private String introduce;//服务介绍
    private String status;//审核状态(预留字段0待审核,1审核通过,2审核不通过)
    private Integer del;//是否有效(1有效,0失效)
    private List<ServicePackageDetailsDO> detailsDOList;//服务项
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    public String getLevel() {
        return level;
    }
    public void setLevel(String level) {
        this.level = level;
    }
    @Column(name = "level_code")
    public String getLevelCode() {
        return levelCode;
    }
    public void setLevelCode(String levelCode) {
        this.levelCode = levelCode;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Transient
    public List<ServicePackageDetailsDO> getDetailsDOList() {
        return detailsDOList;
    }
    public void setDetailsDOList(List<ServicePackageDetailsDO> detailsDOList) {
        this.detailsDOList = detailsDOList;
    }
}

+ 49 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDetailTimeDO.java

@ -0,0 +1,49 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包明细执行时间表
 * @author yeshijie on 2018/8/17.
 */
@Entity
@Table(name = "base_service_package_detail_time")
public class ServicePackageDetailTimeDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String detailId;//服务包明细id
    private Date excutionTime;//执行时间
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "detail_id")
    public String getDetailId() {
        return detailId;
    }
    public void setDetailId(String detailId) {
        this.detailId = detailId;
    }
    @Column(name = "excution_time")
    public Date getExcutionTime() {
        return excutionTime;
    }
    public void setExcutionTime(Date excutionTime) {
        this.excutionTime = excutionTime;
    }
}

+ 97 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDetailsDO.java

@ -0,0 +1,97 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包明细表
 * @author yeshijie on 2018/8/17.
 */
@Entity
@Table(name = "base_service_package_details")
public class ServicePackageDetailsDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String servicePackageId;//服务包id',
    private String code;//服务项目编码',
    private String name;//服务项目名称',
    private Date createTime;//创建时间',
    private Date executionTime;//执行时间',
    private String executionType;//执行类型(1固定时间,2固定次数(不固定时间),3长期)',
    private Integer executionNum;//最少执行次数',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "service_package_id")
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    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;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "execution_type")
    public String getExecutionType() {
        return executionType;
    }
    public void setExecutionType(String executionType) {
        this.executionType = executionType;
    }
    @Column(name = "execution_num")
    public Integer getExecutionNum() {
        return executionNum;
    }
    public void setExecutionNum(Integer executionNum) {
        this.executionNum = executionNum;
    }
    @Column(name = "execution_time")
    public Date getExecutionTime() {
        return executionTime;
    }
    public void setExecutionTime(Date executionTime) {
        this.executionTime = executionTime;
    }
}

+ 125 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageNormcatDO.java

@ -0,0 +1,125 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包类目表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_service_package_normcat")
public class ServicePackageNormcatDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private Long cid;//商品所属类目ID
    private Long parentCid;//父类目ID=0时,代表的是一级的类目
    private String name;//类目名称
    private Integer isParent;//该类目是否为父类目(即:该类目是否还有子类目),1为true,0为false
    private Long sortOrder;//排列序号,表示同级类目的展现次序,如数值相等则按名称次序排列。取值范围:大于零的整数
    private String alias;//alias
    private String picUrl;//类型图片
    private String simpleName;//分类简称
    private Date createTime;//创建时间
    private Integer del;//状态。可选值:1(正常),0(删除)
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    @Column(name = "parent_cid")
    public Long getParentCid() {
        return parentCid;
    }
    public void setParentCid(Long parentCid) {
        this.parentCid = parentCid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "is_parent")
    public Integer getIsParent() {
        return isParent;
    }
    public void setIsParent(Integer isParent) {
        this.isParent = isParent;
    }
    @Column(name = "sort_order")
    public Long getSortOrder() {
        return sortOrder;
    }
    public void setSortOrder(Long sortOrder) {
        this.sortOrder = sortOrder;
    }
    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }
    @Column(name = "pic_url")
    public String getPicUrl() {
        return picUrl;
    }
    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }
    @Column(name = "simple_name")
    public String getSimpleName() {
        return simpleName;
    }
    public void setSimpleName(String simpleName) {
        this.simpleName = simpleName;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 153 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackagePropDO.java

@ -0,0 +1,153 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包属性表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_service_package_prop")
public class ServicePackagePropDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private Long pid;//属性 ID
    private Long parentPid;//上级属性ID
    private Long parentVid;//上级属性值ID
    private String name;//属性名
    private Integer isKeyProp;//是否关键属性。可选值:true(是),false(否)
    private Integer isSaleProp;//是否销售属性。可选值:true(是),false(否)
    private Integer isItemProp;//是否商品属性。可选值:true(是),false(否)
    private Integer must;//是否为必选属性。可选值:true(是),false(否)
    private Integer multi;//是否可以多选。可选值:true(是),false(否)
    private Long sortOrder;
    private Long cid;//类目ID
    private Date createTime;
    private Integer del;//状态。可选值:1(正常),0(删除)
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getPid() {
        return pid;
    }
    public void setPid(Long pid) {
        this.pid = pid;
    }
    @Column(name = "parent_pid")
    public Long getParentPid() {
        return parentPid;
    }
    public void setParentPid(Long parentPid) {
        this.parentPid = parentPid;
    }
    @Column(name = "parent_vid")
    public Long getParentVid() {
        return parentVid;
    }
    public void setParentVid(Long parentVid) {
        this.parentVid = parentVid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "is_key_prop")
    public Integer getIsKeyProp() {
        return isKeyProp;
    }
    public void setIsKeyProp(Integer isKeyProp) {
        this.isKeyProp = isKeyProp;
    }
    @Column(name = "is_sale_prop")
    public Integer getIsSaleProp() {
        return isSaleProp;
    }
    public void setIsSaleProp(Integer isSaleProp) {
        this.isSaleProp = isSaleProp;
    }
    @Column(name = "is_item_prop")
    public Integer getIsItemProp() {
        return isItemProp;
    }
    public void setIsItemProp(Integer isItemProp) {
        this.isItemProp = isItemProp;
    }
    public Integer getMust() {
        return must;
    }
    public void setMust(Integer must) {
        this.must = must;
    }
    public Integer getMulti() {
        return multi;
    }
    public void setMulti(Integer multi) {
        this.multi = multi;
    }
    @Column(name = "sort_order")
    public Long getSortOrder() {
        return sortOrder;
    }
    public void setSortOrder(Long sortOrder) {
        this.sortOrder = sortOrder;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 124 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackagePropvalueDO.java

@ -0,0 +1,124 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包属性值表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_service_package_propvalue")
public class ServicePackagePropvalueDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private Long cid;//类目ID',
    private Long pid;//属性 ID',
    private String propName;//属性名',
    private Long vid;//属性值ID',
    private String name;//属性值',
    private String nameAlias;//属性值别名',
    private Integer isParent;//是否为父类目属性',
    private Long sortOrder;//排列序号。取值范围:大于零的整数',
    private Date createTime;
    private Integer del;//状态。可选值:1(正常),0(删除)',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    public Long getPid() {
        return pid;
    }
    public void setPid(Long pid) {
        this.pid = pid;
    }
    @Column(name = "prop_name")
    public String getPropName() {
        return propName;
    }
    public void setPropName(String propName) {
        this.propName = propName;
    }
    public Long getVid() {
        return vid;
    }
    public void setVid(Long vid) {
        this.vid = vid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "name_alias")
    public String getNameAlias() {
        return nameAlias;
    }
    public void setNameAlias(String nameAlias) {
        this.nameAlias = nameAlias;
    }
    @Column(name = "is_parent")
    public Integer getIsParent() {
        return isParent;
    }
    public void setIsParent(Integer isParent) {
        this.isParent = isParent;
    }
    @Column(name = "sort_order")
    public Long getSortOrder() {
        return sortOrder;
    }
    public void setSortOrder(Long sortOrder) {
        this.sortOrder = sortOrder;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 220 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -0,0 +1,220 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包签约记录表
 * @author yeshijie on 2018/8/17.
 */
@Entity
@Table(name = "base_service_package_sign_record")
public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Serializable {
    public enum Status {
        create("新建", "1"),
        complete("已完成", "2");
        private String name;
        private String value;
        Status(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    private String saasId;
    private String servicePackageId;//服务包id
    private String servicePackageName;//服务包名称
    private String patient;//居民code
    private String name;//居民姓名
    private String idcard;//居民身份证
    private String ssc;//社保卡号
    private String signDoctor;//签约医生code
    private String signDoctorName;//签约医生名称
    private String hospital;//医院code
    private String hospitalName;//医院名称
    private Long adminTeamCode;//行政团队id
    private Long price;//服务总价
    private Date startTime;//服务开始时间
    private Date endTime;//服务结束时间
    private String status;//状态(1新建,2已完成)
    private String doctorTeamCode;//医生服务团队code
    private Date createTime;//创建时间
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "service_package_id")
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    @Column(name = "service_package_name")
    public String getServicePackageName() {
        return servicePackageName;
    }
    public void setServicePackageName(String servicePackageName) {
        this.servicePackageName = servicePackageName;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    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;
    }
    @Column(name = "sign_doctor")
    public String getSignDoctor() {
        return signDoctor;
    }
    public void setSignDoctor(String signDoctor) {
        this.signDoctor = signDoctor;
    }
    @Column(name = "sign_doctor_name")
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "admin_team_code")
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    @Column(name = "start_time")
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    @Column(name = "end_time")
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "doctor_team_code")
    public String getDoctorTeamCode() {
        return doctorTeamCode;
    }
    public void setDoctorTeamCode(String doctorTeamCode) {
        this.doctorTeamCode = doctorTeamCode;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 124 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSkuDO.java

@ -0,0 +1,124 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包sku表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_service_package_sku")
public class ServicePackageSkuDO extends UuidIdentityEntity implements Serializable {
    private String saasId;//
    private String servicePackageId;//服务包id',
    private String properties;//sku的销售属性组合字符串(颜色,大小,等等,可通过类目API获取某类目下的销售属性),格式是p1:v1;p2:v2',
    private Long quantity;//属于这个sku的商品的数量,',
    private Long price;//属于这个sku的商品的价格 取值范围:0-100000000;单位:分。如:200,表示:2元。',
    private String propertiesName;//sku所对应的销售属性的中文名字串,格式如:pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2……',
    private String barcode;//商品级别的条形码',
    private Long minPrice;//促销价',
    private Date createTime;//sku创建日期 时间格式:yyyy-MM-dd HH:mm:ss',
    private Date updateTime;//sku最后修改日期 时间格式:yyyy-MM-dd HH:mm:ss',
    private Integer del;//sku状态。 1:正常 ;0:删除',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "service_package_id")
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getProperties() {
        return properties;
    }
    public void setProperties(String properties) {
        this.properties = properties;
    }
    public Long getQuantity() {
        return quantity;
    }
    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    @Column(name = "properties_name")
    public String getPropertiesName() {
        return propertiesName;
    }
    public void setPropertiesName(String propertiesName) {
        this.propertiesName = propertiesName;
    }
    public String getBarcode() {
        return barcode;
    }
    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }
    @Column(name = "min_price")
    public Long getMinPrice() {
        return minPrice;
    }
    public void setMinPrice(Long minPrice) {
        this.minPrice = minPrice;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 84 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/DimensionDO.java

@ -0,0 +1,84 @@
package com.yihu.jw.entity.base.statistics;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 统计维度表
 * @author yeshijie on 2018/8/31.
 */
@Entity
@Table(name = "base_dimension")
public class DimensionDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String code;//业务代码
    private String type;//类型
    private String name;//指标名称
    private Integer status;//状态(1: 正常 0:不可以用 -1 已删除)
    private Date createTime;
    private String remark;//备注
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 86 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/DimensionQuotaDO.java

@ -0,0 +1,86 @@
package com.yihu.jw.entity.base.statistics;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 统计维度指标表
 * @author yeshijie on 2018/8/31.
 */
@Entity
@Table(name = "base_dimension_quota")
public class DimensionQuotaDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String quotaCode;//关联base_quota的code
    private String dimensionCode;//关联base_dimension的code
    private String dictSql;//查询字典的sql语句
    private String convertClazz;//数据转换的类
    private Integer sort;//维度顺序
    private String key;//查询出来的key
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "quota_code")
    public String getQuotaCode() {
        return quotaCode;
    }
    public void setQuotaCode(String quotaCode) {
        this.quotaCode = quotaCode;
    }
    @Column(name = "dimension_code")
    public String getDimensionCode() {
        return dimensionCode;
    }
    public void setDimensionCode(String dimensionCode) {
        this.dimensionCode = dimensionCode;
    }
    @Column(name = "dict_sql")
    public String getDictSql() {
        return dictSql;
    }
    public void setDictSql(String dictSql) {
        this.dictSql = dictSql;
    }
    @Column(name = "convert_clazz")
    public String getConvertClazz() {
        return convertClazz;
    }
    public void setConvertClazz(String convertClazz) {
        this.convertClazz = convertClazz;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
}

+ 185 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/JobConfigDO.java

@ -0,0 +1,185 @@
package com.yihu.jw.entity.base.statistics;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 统计job配置表
 * @author yeshijie on 2018/8/31.
 */
@Entity
@Table(name = "base_job_config")
public class JobConfigDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String jobName;//任务名称
    private String jobInfo;//任务描述
    private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
    private String jobClass;//任务执行的class
    private String sql;//统计sql语句
    private String sqlCount;//统计总数语句
    private String sqlDay;//天数条件
    private String sqlYear;//年份条件
    private String cacheKey;//缓存的key
    private String quartzCron;//quartz表达式
    private String status;//1 启动 0停止
    private String quotaCode;//指标code
    private Integer del;//1: 正常 0: 删除
    private String extractType;//抽取类型   1或者为空:数据库 2ES
    private String timeLevel;//1增量 2到达量 3生成到达量也生成增量
    private Integer incrementInterval;//增量时间间隔1天,2周,3月
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "job_name")
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    @Column(name = "job_info")
    public String getJobInfo() {
        return jobInfo;
    }
    public void setJobInfo(String jobInfo) {
        this.jobInfo = jobInfo;
    }
    @Column(name = "job_type")
    public String getJobType() {
        return jobType;
    }
    public void setJobType(String jobType) {
        this.jobType = jobType;
    }
    @Column(name = "job_class")
    public String getJobClass() {
        return jobClass;
    }
    public void setJobClass(String jobClass) {
        this.jobClass = jobClass;
    }
    public String getSql() {
        return sql;
    }
    public void setSql(String sql) {
        this.sql = sql;
    }
    @Column(name = "sql_count")
    public String getSqlCount() {
        return sqlCount;
    }
    public void setSqlCount(String sqlCount) {
        this.sqlCount = sqlCount;
    }
    @Column(name = "sql_day")
    public String getSqlDay() {
        return sqlDay;
    }
    public void setSqlDay(String sqlDay) {
        this.sqlDay = sqlDay;
    }
    @Column(name = "sql_year")
    public String getSqlYear() {
        return sqlYear;
    }
    public void setSqlYear(String sqlYear) {
        this.sqlYear = sqlYear;
    }
    @Column(name = "cache_key")
    public String getCacheKey() {
        return cacheKey;
    }
    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }
    @Column(name = "quartz_cron")
    public String getQuartzCron() {
        return quartzCron;
    }
    public void setQuartzCron(String quartzCron) {
        this.quartzCron = quartzCron;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "quota_code")
    public String getQuotaCode() {
        return quotaCode;
    }
    public void setQuotaCode(String quotaCode) {
        this.quotaCode = quotaCode;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "extract_type")
    public String getExtractType() {
        return extractType;
    }
    public void setExtractType(String extractType) {
        this.extractType = extractType;
    }
    @Column(name = "time_level")
    public String getTimeLevel() {
        return timeLevel;
    }
    public void setTimeLevel(String timeLevel) {
        this.timeLevel = timeLevel;
    }
    @Column(name = "increment_interval")
    public Integer getIncrementInterval() {
        return incrementInterval;
    }
    public void setIncrementInterval(Integer incrementInterval) {
        this.incrementInterval = incrementInterval;
    }
}

+ 65 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/statistics/QuotaDO.java

@ -0,0 +1,65 @@
package com.yihu.jw.entity.base.statistics;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 统计指标表
 * @author yeshijie on 2018/8/31.
 */
@Entity
@Table(name = "base_quota")
public class QuotaDO extends UuidIdentityEntity implements Serializable {
    private String code;//指标code',
    private String name;//指标名称',
    private String createTime;
    private String updateTime;
    private Integer del;//1: 正常 0: 删除
    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;
    }
    @Column(name = "create_time")
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_time")
    public String getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 101 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java

@ -0,0 +1,101 @@
package com.yihu.jw.entity.base.team;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 团队信息实体
*
* @author litaohong on  2018年08月31日
*
*/
@Entity
@Table(name = "base_team")
public class BaseTeamDO extends UuidIdentityEntityWithOperator {
    /**
	* 机构id
	*/
    private String orgId;
    /**
	* 团队名称
	*/
    private String name;
    /**
	* 领导医生标识
	*/
    private String leaderId;
    /**
	* 团队人数
	*/
    private String teamNum;
    /**
	* 团队二维码
	*/
    private String qrcode;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
	@Column(name = "org_id")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@Column(name = "leader_id")
    public String getLeaderId() {
        return leaderId;
    }
    public void setLeaderId(String leaderId) {
        this.leaderId = leaderId;
    }
	@Column(name = "team_num")
    public String getTeamNum() {
        return teamNum;
    }
    public void setTeamNum(String teamNum) {
        this.teamNum = teamNum;
    }
	@Column(name = "qrcode")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.base.team;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 团队成员实体
*
* @author litaohong on  2018年08月31日
*
*/
@Entity
@Table(name = "base_team_member")
public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
    /**
	* 团队ID
	*/
    private String teamId;
    /**
	* 机构标识
	*/
    private String orgId;
    /**
	* 医生标识,多个医生以逗号分开
	*/
    private String doctorId;
    /**
	* 作废标识,1正常,0作废
	*/
    private String del;
	@Column(name = "team_id")
    public String getTeamId() {
        return teamId;
    }
    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }
	@Column(name = "org_id")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@Column(name = "doctor_id")
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 71 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseCityVO.java

@ -0,0 +1,71 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 城市字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseCityVO", description = "城市字典")
public class BaseCityVO extends IntegerIdentityVO{
    /**
	省编码	*/
    private String province;
    /**
	城市编码	*/
    private String code;
    /**
	城市名称	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "省编码", example = "模块1")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@ApiModelProperty(value = "城市编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "城市名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 115 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorHospitalVO.java

@ -0,0 +1,115 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 医生职业信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorHospitalVO", description = "医生职业信息")
public class BaseDoctorHospitalVO extends IntegerIdentityVO{
    /**
	医院标识	*/
    private String hospCode;
    /**
	医院名称	*/
    private String hospName;
    /**
	医生角色标识	*/
    private String roleCode;
    /**
	医院角色名称	*/
    private String roleName;
    /**
	职称代码	*/
    private String jobTitleCode;
    /**
	职称名称	*/
    private String jobTitleName;
    /**
	作废标识,1正常,0作废	*/
    private String del;
    /**
		*/
    private Date createTime;
	@ApiModelProperty(value = "医院标识", example = "模块1")
    public String getHospCode() {
        return hospCode;
    }
    public void setHospCode(String hospCode) {
        this.hospCode = hospCode;
    }
	@ApiModelProperty(value = "医院名称", example = "模块1")
    public String getHospName() {
        return hospName;
    }
    public void setHospName(String hospName) {
        this.hospName = hospName;
    }
	@ApiModelProperty(value = "医生角色标识", example = "模块1")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
	@ApiModelProperty(value = "医院角色名称", example = "模块1")
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
	@ApiModelProperty(value = "职称代码", example = "模块1")
    public String getJobTitleCode() {
        return jobTitleCode;
    }
    public void setJobTitleCode(String jobTitleCode) {
        this.jobTitleCode = jobTitleCode;
    }
	@ApiModelProperty(value = "职称名称", example = "模块1")
    public String getJobTitleName() {
        return jobTitleName;
    }
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
	@ApiModelProperty(value = "", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 60 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorRoleDictVO.java

@ -0,0 +1,60 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 医生角色字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorRoleDictVO", description = "医生角色字典")
public class BaseDoctorRoleDictVO extends IntegerIdentityVO{
    /**
	角色code	*/
    private String code;
    /**
	角色名称:全科医生、专科医生、健康管理师、管理员等	*/
    private String name;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "角色code", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 335 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseDoctorVO.java

@ -0,0 +1,335 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 医生基础信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorVO", description = "医生基础信息")
public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    /**
	机构id	*/
    private String orgId;
    /**
	密码	*/
    private String password;
    /**
		*/
    private String salt;
    /**
	姓名	*/
    private String name;
    /**
	性别(1男,2女) 用国家标准字典	*/
    private String sex;
    /**
	医生专长	*/
    private String expertise;
    /**
	医生介绍	*/
    private String introduce;
    /**
	 身份证	*/
    private String idcard;
    /**
	生日	*/
    private Date birthday;
    /**
	头像http地址	*/
    private String photo;
    /**
	手机号	*/
    private String mobile;
    /**
	医生二维码	*/
    private String qrcode;
    /**
	省代码	*/
    private String provinceCode;
    /**
	省名称	*/
    private String provinceName;
    /**
	市代码	*/
    private String cityCode;
    /**
	市名称	*/
    private String cityName;
    /**
	区县代码	*/
    private String townCode;
    /**
	区县名称	*/
    private String townName;
    /**
	街道代码	*/
    private String streetCode;
    /**
	街道名称	*/
    private String streetName;
    /**
	资格是否认证通过,1是,0否	*/
    private String iscertified;
    /**
	是否是名医,1是,0否	*/
    private String isFamous;
    /**
	是否提示设置密码  1 提示过 0未提示	*/
    private String isPasswordPrompt;
    /**
	名称拼音首字母	*/
    private String spell;
    /**
	CA证书过期时间	*/
    private Date certifiedOvertime;
    /**
	CA证书编号	*/
    private String certificateNum;
    /**
		*/
    private String openid;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "机构id", example = "模块1")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@ApiModelProperty(value = "密码", example = "模块1")
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
	@ApiModelProperty(value = "", example = "模块1")
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
	@ApiModelProperty(value = "姓名", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "性别(1男,2女) 用国家标准字典", example = "模块1")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
	@ApiModelProperty(value = "医生专长", example = "模块1")
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
	@ApiModelProperty(value = "医生介绍", example = "模块1")
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
	@ApiModelProperty(value = " 身份证", example = "模块1")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
	@ApiModelProperty(value = "生日", example = "模块1")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
	@ApiModelProperty(value = "头像http地址", example = "模块1")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
	@ApiModelProperty(value = "手机号", example = "模块1")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@ApiModelProperty(value = "医生二维码", example = "模块1")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
	@ApiModelProperty(value = "省代码", example = "模块1")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@ApiModelProperty(value = "省名称", example = "模块1")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
	@ApiModelProperty(value = "市代码", example = "模块1")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
	@ApiModelProperty(value = "市名称", example = "模块1")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
	@ApiModelProperty(value = "区县代码", example = "模块1")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
	@ApiModelProperty(value = "区县名称", example = "模块1")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
	@ApiModelProperty(value = "街道代码", example = "模块1")
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
	@ApiModelProperty(value = "街道名称", example = "模块1")
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
	@ApiModelProperty(value = "资格是否认证通过,1是,0否", example = "模块1")
    public String getIscertified() {
        return iscertified;
    }
    public void setIscertified(String iscertified) {
        this.iscertified = iscertified;
    }
	@ApiModelProperty(value = "是否是名医,1是,0否", example = "模块1")
    public String getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(String isFamous) {
        this.isFamous = isFamous;
    }
	@ApiModelProperty(value = "是否提示设置密码  1 提示过 0未提示", example = "模块1")
    public String getIsPasswordPrompt() {
        return isPasswordPrompt;
    }
    public void setIsPasswordPrompt(String isPasswordPrompt) {
        this.isPasswordPrompt = isPasswordPrompt;
    }
	@ApiModelProperty(value = "名称拼音首字母", example = "模块1")
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
	@ApiModelProperty(value = "CA证书过期时间", example = "模块1")
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
	@ApiModelProperty(value = "CA证书编号", example = "模块1")
    public String getCertificateNum() {
        return certificateNum;
    }
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
	@ApiModelProperty(value = "", example = "模块1")
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 236 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseOrgVO.java

@ -0,0 +1,236 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 机构信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseOrgVO", description = "机构信息")
public class BaseOrgVO extends UuidIdentityVOWithOperator {
    /**
	saas化配置	*/
    private String saasid;
    /**
	省份标识	*/
    private String provinceCode;
    /**
	城市标识	*/
    private String cityCode;
    /**
	区县标识	*/
    private String townCode;
    /**
	机构名称	*/
    private String name;
    /**
	机构别名	*/
    private String alias;
    /**
	机构名称拼音首字母	*/
    private String spell;
    /**
	机构类型: 1.  医疗机构2.  企事业单位3.  政府机关4.  社会团体 5.药店 0.  部门 6.单位或者独立子公司7.基层机构 8.专业公共机构	*/
    private String type;
    /**
	机构简介	*/
    private String brief;
    /**
	机构详细地址	*/
    private String address;
    /**
	机构图片	*/
    private String photo;
    /**
	经度	*/
    private String longitude;
    /**
	纬度	*/
    private String latitude;
    /**
	法人	*/
    private String legalperson;
    /**
	机构管理员	*/
    private String orgAdmin;
    /**
	机构网址	*/
    private String orgUrl;
    /**
	机构简介	*/
    private String intro;
    /**
	机构二维码	*/
    private String qrcode;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "saas化配置", example = "模块1")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
	@ApiModelProperty(value = "省份标识", example = "模块1")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@ApiModelProperty(value = "城市标识", example = "模块1")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
	@ApiModelProperty(value = "区县标识", example = "模块1")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
	@ApiModelProperty(value = "机构名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "机构别名", example = "模块1")
    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }
	@ApiModelProperty(value = "机构名称拼音首字母", example = "模块1")
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
	@ApiModelProperty(value = "机构类型: 1.  医疗机构2.  企事业单位3.  政府机关4.  社会团体 5.药店 0.  部门 6.单位或者独立子公司7.基层机构 8.专业公共机构", example = "模块1")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@ApiModelProperty(value = "机构简介", example = "模块1")
    public String getBrief() {
        return brief;
    }
    public void setBrief(String brief) {
        this.brief = brief;
    }
	@ApiModelProperty(value = "机构详细地址", example = "模块1")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
	@ApiModelProperty(value = "机构图片", example = "模块1")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
	@ApiModelProperty(value = "经度", example = "模块1")
    public String getLongitude() {
        return longitude;
    }
    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }
	@ApiModelProperty(value = "纬度", example = "模块1")
    public String getLatitude() {
        return latitude;
    }
    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }
	@ApiModelProperty(value = "法人", example = "模块1")
    public String getLegalperson() {
        return legalperson;
    }
    public void setLegalperson(String legalperson) {
        this.legalperson = legalperson;
    }
	@ApiModelProperty(value = "机构管理员", example = "模块1")
    public String getOrgAdmin() {
        return orgAdmin;
    }
    public void setOrgAdmin(String orgAdmin) {
        this.orgAdmin = orgAdmin;
    }
	@ApiModelProperty(value = "机构网址", example = "模块1")
    public String getOrgUrl() {
        return orgUrl;
    }
    public void setOrgUrl(String orgUrl) {
        this.orgUrl = orgUrl;
    }
	@ApiModelProperty(value = "机构简介", example = "模块1")
    public String getIntro() {
        return intro;
    }
    public void setIntro(String intro) {
        this.intro = intro;
    }
	@ApiModelProperty(value = "机构二维码", example = "模块1")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 412 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BasePatientVO.java

@ -0,0 +1,412 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 居民信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BasePatientVO", description = "居民信息")
public class BasePatientVO extends UuidIdentityVOWithOperator {
    /**
	saas配置id	*/
    private String saasId;
    /**
	身份证号	*/
    private String idcard;
    /**
	登录密码	*/
    private String password;
    /**
		*/
    private String salt;
    /**
	姓名	*/
    private String name;
    /**
	生日	*/
    private Date birthday;
    /**
	性别,1男,2女	*/
    private String sex;
    /**
	手机号	*/
    private String mobile;
    /**
	联系电话	*/
    private String phone;
    /**
	社保卡号	*/
    private String ssc;
    /**
	头像http地址	*/
    private String photo;
    /**
	省编码	*/
    private String provinceCode;
    /**
	市编码	*/
    private String cityCode;
    /**
	区县编码	*/
    private String townCode;
    /**
	街道编码	*/
    private String streetCode;
    /**
	具体详细地址	*/
    private String address;
    /**
	疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病	*/
    private String disease;
    /**
	病情:0绿标,1黄标,2红标,3重点关注,	*/
    private String diseaseCondition;
    /**
	总积分	*/
    private String points;
    /**
	病历总数	*/
    private String recordAmount;
    /**
	微信编号	*/
    private String openid;
    /**
	用户状态:1正常,0禁用,-1恶意注册,2审核中	*/
    private String patientStatus;
    /**
	联系方式备注【基卫】	*/
    private String mobileRemarks;
    /**
	第一次添加open的时间	*/
    private Date openidTime;
    /**
	居委会代码	*/
    private String sickVillage;
    /**
		*/
    private String sickVillageName;
    /**
	绑定电子社保卡主体(共济为操作人code)	*/
    private String principalCode;
    /**
	是否绑定电子社保卡 (0否 1是)	*/
    private String sicardStatus;
    /**
	电子社保卡绑定时间	*/
    private Date sicardTime;
    /**
	是否分配过微信标签	*/
    private Integer isWxtag;
    /**
	微信tagId	*/
    private String wxtagid;
    /**
	居民预警状态:0为标准,1为预警状态	*/
    private Integer standardStatus;
    /**
	医疗保险号	*/
    private String medicareNumber;
    /**
	unionId 开发平台唯一标识	*/
    private String unionid;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "saas配置id", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "身份证号", example = "模块1")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
	@ApiModelProperty(value = "登录密码", example = "模块1")
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
	@ApiModelProperty(value = "", example = "模块1")
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
	@ApiModelProperty(value = "姓名", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "生日", example = "模块1")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
	@ApiModelProperty(value = "性别,1男,2女", example = "模块1")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
	@ApiModelProperty(value = "手机号", example = "模块1")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@ApiModelProperty(value = "联系电话", example = "模块1")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
	@ApiModelProperty(value = "社保卡号", example = "模块1")
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
	@ApiModelProperty(value = "头像http地址", example = "模块1")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
	@ApiModelProperty(value = "省编码", example = "模块1")
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
	@ApiModelProperty(value = "市编码", example = "模块1")
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
	@ApiModelProperty(value = "区县编码", example = "模块1")
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
	@ApiModelProperty(value = "街道编码", example = "模块1")
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
	@ApiModelProperty(value = "具体详细地址", example = "模块1")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
	@ApiModelProperty(value = "疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病", example = "模块1")
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
	@ApiModelProperty(value = "病情:0绿标,1黄标,2红标,3重点关注,", example = "模块1")
    public String getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(String diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
	@ApiModelProperty(value = "总积分", example = "模块1")
    public String getPoints() {
        return points;
    }
    public void setPoints(String points) {
        this.points = points;
    }
	@ApiModelProperty(value = "病历总数", example = "模块1")
    public String getRecordAmount() {
        return recordAmount;
    }
    public void setRecordAmount(String recordAmount) {
        this.recordAmount = recordAmount;
    }
	@ApiModelProperty(value = "微信编号", example = "模块1")
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
	@ApiModelProperty(value = "用户状态:1正常,0禁用,-1恶意注册,2审核中", example = "模块1")
    public String getPatientStatus() {
        return patientStatus;
    }
    public void setPatientStatus(String patientStatus) {
        this.patientStatus = patientStatus;
    }
	@ApiModelProperty(value = "联系方式备注【基卫】", example = "模块1")
    public String getMobileRemarks() {
        return mobileRemarks;
    }
    public void setMobileRemarks(String mobileRemarks) {
        this.mobileRemarks = mobileRemarks;
    }
	@ApiModelProperty(value = "第一次添加open的时间", example = "模块1")
    public Date getOpenidTime() {
        return openidTime;
    }
    public void setOpenidTime(Date openidTime) {
        this.openidTime = openidTime;
    }
	@ApiModelProperty(value = "居委会代码", example = "模块1")
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
	@ApiModelProperty(value = "", example = "模块1")
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
	@ApiModelProperty(value = "绑定电子社保卡主体(共济为操作人code)", example = "模块1")
    public String getPrincipalCode() {
        return principalCode;
    }
    public void setPrincipalCode(String principalCode) {
        this.principalCode = principalCode;
    }
	@ApiModelProperty(value = "是否绑定电子社保卡 (0否 1是)", example = "模块1")
    public String getSicardStatus() {
        return sicardStatus;
    }
    public void setSicardStatus(String sicardStatus) {
        this.sicardStatus = sicardStatus;
    }
	@ApiModelProperty(value = "电子社保卡绑定时间", example = "模块1")
    public Date getSicardTime() {
        return sicardTime;
    }
    public void setSicardTime(Date sicardTime) {
        this.sicardTime = sicardTime;
    }
	@ApiModelProperty(value = "是否分配过微信标签", example = "模块1")
    public Integer getIsWxtag() {
        return isWxtag;
    }
    public void setIsWxtag(Integer isWxtag) {
        this.isWxtag = isWxtag;
    }
	@ApiModelProperty(value = "微信tagId", example = "模块1")
    public String getWxtagid() {
        return wxtagid;
    }
    public void setWxtagid(String wxtagid) {
        this.wxtagid = wxtagid;
    }
	@ApiModelProperty(value = "居民预警状态:0为标准,1为预警状态", example = "模块1")
    public Integer getStandardStatus() {
        return standardStatus;
    }
    public void setStandardStatus(Integer standardStatus) {
        this.standardStatus = standardStatus;
    }
	@ApiModelProperty(value = "医疗保险号", example = "模块1")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@ApiModelProperty(value = "unionId 开发平台唯一标识", example = "模块1")
    public String getUnionid() {
        return unionid;
    }
    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 60 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseProvinceVO.java

@ -0,0 +1,60 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 省字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseProvinceVO", description = "省字典")
public class BaseProvinceVO extends IntegerIdentityVO{
    /**
	省份编码	*/
    private String code;
    /**
	省份名称	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "省份编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "省份名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 93 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseStreetVO.java

@ -0,0 +1,93 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 街道字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseStreetVO", description = "街道字典")
public class BaseStreetVO extends IntegerIdentityVO{
    /**
	省标识	*/
    private String province;
    /**
	市标识	*/
    private String city;
    /**
	区县标识	*/
    private String town;
    /**
	街道标识	*/
    private String code;
    /**
	街道名称	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "省标识", example = "模块1")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@ApiModelProperty(value = "市标识", example = "模块1")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
	@ApiModelProperty(value = "区县标识", example = "模块1")
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
	@ApiModelProperty(value = "街道标识", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "街道名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 71 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTeamMemberVO.java

@ -0,0 +1,71 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 团队成员vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseTeamMemberVO", description = "团队成员")
public class BaseTeamMemberVO extends UuidIdentityVOWithOperator {
    /**
	团队ID	*/
    private String teamId;
    /**
	机构标识	*/
    private String orgId;
    /**
	医生标识,多个医生以逗号分开	*/
    private String doctorId;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "团队ID", example = "模块1")
    public String getTeamId() {
        return teamId;
    }
    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }
	@ApiModelProperty(value = "机构标识", example = "模块1")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@ApiModelProperty(value = "医生标识,多个医生以逗号分开", example = "模块1")
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 93 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTeamVO.java

@ -0,0 +1,93 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 团队信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseTeamVO", description = "团队信息")
public class BaseTeamVO extends UuidIdentityVOWithOperator {
    /**
	机构id	*/
    private String orgId;
    /**
	团队名称	*/
    private String name;
    /**
	领导医生标识	*/
    private String leaderId;
    /**
	团队人数	*/
    private String teamNum;
    /**
	团队二维码	*/
    private String qrcode;
    /**
	作废标识,1正常,0作废	*/
    private String del;
	@ApiModelProperty(value = "机构id", example = "模块1")
    public String getOrgId() {
        return orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
	@ApiModelProperty(value = "团队名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "领导医生标识", example = "模块1")
    public String getLeaderId() {
        return leaderId;
    }
    public void setLeaderId(String leaderId) {
        this.leaderId = leaderId;
    }
	@ApiModelProperty(value = "团队人数", example = "模块1")
    public String getTeamNum() {
        return teamNum;
    }
    public void setTeamNum(String teamNum) {
        this.teamNum = teamNum;
    }
	@ApiModelProperty(value = "团队二维码", example = "模块1")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 82 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/BaseTownVO.java

@ -0,0 +1,82 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 区县字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseTownVO", description = "区县字典")
public class BaseTownVO extends IntegerIdentityVO{
    /**
	省编码	*/
    private String province;
    /**
	城市编码	*/
    private String city;
    /**
	区县编码	*/
    private String code;
    /**
	区县名称	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "省编码", example = "模块1")
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
	@ApiModelProperty(value = "城市编码", example = "模块1")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
	@ApiModelProperty(value = "区县编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "区县名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 82 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHealthProblemVO.java

@ -0,0 +1,82 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 健康问题字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictHealthProblemVO", description = "健康问题字典")
public class DictHealthProblemVO extends IntegerIdentityVO{
    /**
	saas配置id,null标识公共字典	*/
    private String saasId;
    /**
	字典编码	*/
    private String code;
    /**
	字典名称	*/
    private String name;
    /**
	描述	*/
    private String description;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "字典编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "字典名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "描述", example = "模块1")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 71 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java

@ -0,0 +1,71 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 医院科室字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictHospitalDeptVO", description = "医院科室字典")
public class DictHospitalDeptVO extends IntegerIdentityVO{
    /**
	saas配置id,null标识公共字典	*/
    private String saasId;
    /**
	科室标识	*/
    private String code;
    /**
	科室名称	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "科室标识", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "科室名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 115 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictIcd10VO.java

@ -0,0 +1,115 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * ICD10字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictIcd10VO", description = "ICD10字典")
public class DictIcd10VO extends IntegerIdentityVO{
    /**
	saas配置id,null标识公共字典	*/
    private String saasId;
    /**
	icd10字典编码	*/
    private String code;
    /**
	icd10字典名称	*/
    private String name;
    /**
	字典名称拼音首字母	*/
    private String phoneticCode;
    /**
	是否慢病	*/
    private String chronicFlag;
    /**
	是否传染病	*/
    private String infectiousFlag;
    /**
	描述	*/
    private String description;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "icd10字典编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "icd10字典名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "字典名称拼音首字母", example = "模块1")
    public String getPhoneticCode() {
        return phoneticCode;
    }
    public void setPhoneticCode(String phoneticCode) {
        this.phoneticCode = phoneticCode;
    }
	@ApiModelProperty(value = "是否慢病", example = "模块1")
    public String getChronicFlag() {
        return chronicFlag;
    }
    public void setChronicFlag(String chronicFlag) {
        this.chronicFlag = chronicFlag;
    }
	@ApiModelProperty(value = "是否传染病", example = "模块1")
    public String getInfectiousFlag() {
        return infectiousFlag;
    }
    public void setInfectiousFlag(String infectiousFlag) {
        this.infectiousFlag = infectiousFlag;
    }
	@ApiModelProperty(value = "描述", example = "模块1")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 71 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictJobTitleVO.java

@ -0,0 +1,71 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 职称字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictJobTitleVO", description = "职称字典")
public class DictJobTitleVO extends IntegerIdentityVO{
    /**
	saas配置id,null标识公共字典	*/
    private String saasId;
    /**
	职称标识	*/
    private String code;
    /**
	职称名	*/
    private String name;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "职称标识", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "职称名", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 82 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictMedicineVO.java

@ -0,0 +1,82 @@
package com.yihu.jw.restmodel.base.dict;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 药品字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictMedicineVO", description = "药品字典")
public class DictMedicineVO extends IntegerIdentityVO{
    /**
	saas配置id,null标识公共字典	*/
    private String saasId;
    /**
	药品编码	*/
    private String code;
    /**
	药品名称	*/
    private String name;
    /**
	药品类型:1健康记录	*/
    private String type;
    /**
	创建时间	*/
    private Date createTime;
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "模块1")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@ApiModelProperty(value = "药品编码", example = "模块1")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@ApiModelProperty(value = "药品名称", example = "模块1")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@ApiModelProperty(value = "药品类型:1健康记录", example = "模块1")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@ApiModelProperty(value = "创建时间", example = "模块1")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 64 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/im/ImGetuiConfigVO.java

@ -0,0 +1,64 @@
package com.yihu.jw.restmodel.base.im;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 *
 * @author yeshijie on 2018/8/29.
 */
@ApiModel(value = "ImGetuiConfigVO", description = "im个推配置表")
public class ImGetuiConfigVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saas id", example = "EwC0iRSrcS")
    private String saasId;
    @ApiModelProperty(value = "个推url", example = "EwC0iRSrcS")
    private String host;
    @ApiModelProperty(value = "个推appid", example = "EwC0iRSrcS")
    private String appId;//个推appid
    @ApiModelProperty(value = "个推appkey", example = "EwC0iRSrcS")
    private String appkey;//个推appkey
    @ApiModelProperty(value = "个推的秘钥", example = "EwC0iRSrcS")
    private String mastersecret;//
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getHost() {
        return host;
    }
    public void setHost(String host) {
        this.host = host;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppkey() {
        return appkey;
    }
    public void setAppkey(String appkey) {
        this.appkey = appkey;
    }
    public String getMastersecret() {
        return mastersecret;
    }
    public void setMastersecret(String mastersecret) {
        this.mastersecret = mastersecret;
    }
}

+ 54 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/message/MqMessageSubscriberVO.java

@ -0,0 +1,54 @@
package com.yihu.jw.restmodel.base.message;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * VO - 基于MQ的消息推送订阅者
 * Created by progr1mmer on 2018/8/14.
 */
@ApiModel(value = "MqMessageSubscriberVO", description = "基于MQ的消息推送订阅者")
public class MqMessageSubscriberVO extends UuidIdentityVO {
    @ApiModelProperty(value = "SAAS ID", example = "402803ee656498890165649ad2xaaba2")
    private String saasId;
    @ApiModelProperty(value = "主题", example = "dailyReport")
    private String topic;
    @ApiModelProperty(value = "推送地址", example = "http://www.example.com/api")
    private String url;
    @ApiModelProperty(value = "备注", example = "我是备注")
    private String remark;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getTopic() {
        return topic;
    }
    public void setTopic(String topic) {
        this.topic = topic;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 59 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/message/MqMessageVO.java

@ -0,0 +1,59 @@
package com.yihu.jw.restmodel.base.message;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * VO - 基于MQ的消息推送
 * Created by progr1mmer on 2018/9/3.
 */
@ApiModel(value = "MqMessageVO", description = "基于MQ的消息推送")
public class MqMessageVO extends UuidIdentityVO {
    //主题
    @ApiModelProperty(value = "主题", example = "dailyReport")
    private String topic;
    //名称
    @ApiModelProperty(value = "名称", example = "日常统计数据")
    private String name;
    //备注
    @ApiModelProperty(value = "备注", example = "我是备注")
    private String remark;
    //模板
    @ApiModelProperty(value = "模板")
    private String template;
    public String getTopic() {
        return topic;
    }
    public void setTopic(String topic) {
        this.topic = topic;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getTemplate() {
        return template;
    }
    public void setTemplate(String template) {
        this.template = template;
    }
}

+ 34 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/RehabilitationVO.java

@ -0,0 +1,34 @@
package com.yihu.jw.restmodel.base.servicePackage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * @author yeshijie on 2018/8/30.
 */
@ApiModel(value = "RehabilitationVO", description = "康复计划服务包")
public class RehabilitationVO implements Serializable {
    @ApiModelProperty(value = "服务包")
    private ServicePackageVO servicePackageVO;
    @ApiModelProperty(value = "服务包签约信息")
    private ServicePackageSignRecordVO signRecordVO;
    public ServicePackageVO getServicePackageVO() {
        return servicePackageVO;
    }
    public void setServicePackageVO(ServicePackageVO servicePackageVO) {
        this.servicePackageVO = servicePackageVO;
    }
    public ServicePackageSignRecordVO getSignRecordVO() {
        return signRecordVO;
    }
    public void setSignRecordVO(ServicePackageSignRecordVO signRecordVO) {
        this.signRecordVO = signRecordVO;
    }
}

+ 46 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageDetailTimeVO.java

@ -0,0 +1,46 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 服务包明细执行时间表
 * @author yeshijie on 2018/8/17.
 */
@ApiModel(value = "ServicePackageDetailTimeVO", description = "服务包明细执行时间表")
public class ServicePackageDetailTimeVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saas id", example = "EwC0iRSrcS")
    private String saasId;
    @ApiModelProperty(value = "服务包明细id", example = "EwC0iRSrcS")
    private String detailId;//服务包明细id
    @ApiModelProperty(value = "执行时间")
    private Date excutionTime;//执行时间
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getDetailId() {
        return detailId;
    }
    public void setDetailId(String detailId) {
        this.detailId = detailId;
    }
    public Date getExcutionTime() {
        return excutionTime;
    }
    public void setExcutionTime(Date excutionTime) {
        this.excutionTime = excutionTime;
    }
}

+ 96 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageDetailsVO.java

@ -0,0 +1,96 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
@ApiModel(value = "ServicePackageDetailsVO", description = "服务包明细表")
public class ServicePackageDetailsVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saas id", example = "EwC0iRSrcS")
    private String saasId;
    @ApiModelProperty(value = "服务包id", example = "EwC0iRSrcS")
    private String servicePackageId;//服务包id',
    @ApiModelProperty(value = "服务项目编码", example = "EwC0iRSrcS")
    private String code;//服务项目编码',
    @ApiModelProperty(value = "服务项目名称", example = "康复计划")
    private String name;//服务项目名称',
    @ApiModelProperty(value = "创建时间")
    private Date createTime;//创建时间',
    @ApiModelProperty(value = "执行时间")
    private Date executionTime;//执行时间',
    @ApiModelProperty(value = "执行类型", example = "1")
    private String executionType;//执行类型(1固定时间,2固定次数(不固定时间),3长期)',
    @ApiModelProperty(value = "最少执行次数", example = "1")
    private Integer exceutionNum;//最少执行次数',
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    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 Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getExecutionType() {
        return executionType;
    }
    public void setExecutionType(String executionType) {
        this.executionType = executionType;
    }
    public Integer getExceutionNum() {
        return exceutionNum;
    }
    public void setExceutionNum(Integer exceutionNum) {
        this.exceutionNum = exceutionNum;
    }
    public Date getExecutionTime() {
        return executionTime;
    }
    public void setExecutionTime(Date executionTime) {
        this.executionTime = executionTime;
    }
}

+ 211 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageLogVO.java

@ -0,0 +1,211 @@
package com.yihu.jw.restmodel.base.servicePackage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * @author yeshijie on 2018/8/30.
 */
@ApiModel(value = "ServicePackageLogVO", description = "服务包日志")
public class ServicePackageLogVO implements Serializable {
    public enum Flag {
        success("成功", 0),
        failure("失败", 1);
        private String name;
        private int value;
        Flag(String name, int value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    public enum UserType {
        patient("居民", "1"),
        doctor("医生", "2");
        private String name;
        private String value;
        UserType(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    @ApiModelProperty(value = "uuid")
    private String id;//uuid
    @ApiModelProperty(value = "时间")
    private Date createTime;//时间
    @ApiModelProperty(value = "saasid")
    private String saasId;//saasid
    @ApiModelProperty(value = "服务包id")
    private String sevicePackageId;//服务包id
    @ApiModelProperty(value = "服务包明细id")
    private String sevicePackageDetailId;//服务包明细id
    @ApiModelProperty(value = "医生或者患者code")
    private String userCode;//医生或者患者code
    @ApiModelProperty(value = "医生或者患者name")
    private String userName;//医生或者患者name
    @ApiModelProperty(value = "1 患者 2医生")
    private String userType;// 1 患者 2医生
    @ApiModelProperty(value = "关联类型(1健康指导,2健康文章,3代预约)")
    private String relationType;//关联类型(1健康指导,2健康文章,3代预约)
    @ApiModelProperty(value = "关联id")
    private String relationId;//关联id
    @ApiModelProperty(value = "操作说明")
    private String message;//操作说明
    @ApiModelProperty(value = "操作是否成功 1成功 0失败")
    private Integer flag;//操作是否成功 1成功 0失败
    @ApiModelProperty(value = "完成项目数")
    private Integer finish;//完成项目数
    @ApiModelProperty(value = "扩展字段存json")
    private String ext;//扩展字段存json
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getSevicePackageId() {
        return sevicePackageId;
    }
    public void setSevicePackageId(String sevicePackageId) {
        this.sevicePackageId = sevicePackageId;
    }
    public String getSevicePackageDetailId() {
        return sevicePackageDetailId;
    }
    public void setSevicePackageDetailId(String sevicePackageDetailId) {
        this.sevicePackageDetailId = sevicePackageDetailId;
    }
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
    public String getRelationType() {
        return relationType;
    }
    public void setRelationType(String relationType) {
        this.relationType = relationType;
    }
    public String getRelationId() {
        return relationId;
    }
    public void setRelationId(String relationId) {
        this.relationId = relationId;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    public Integer getFinish() {
        return finish;
    }
    public void setFinish(Integer finish) {
        this.finish = finish;
    }
    public String getExt() {
        return ext;
    }
    public void setExt(String ext) {
        this.ext = ext;
    }
}

+ 106 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageNormcatVO.java

@ -0,0 +1,106 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 服务包类目表
 * @author yeshijie on 2018/8/29.
 */
@ApiModel(value = "ServicePackageNormcatVO", description = "服务包类目表")
public class ServicePackageNormcatVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saas id", example = "EwC0iRSrcS")
    private String saasId;
    @ApiModelProperty(value = "商品所属类目ID", example = "465")
    private Long cid;//商品所属类目ID
    @ApiModelProperty(value = "父类目ID", example = "0")
    private Long parentCid;//父类目ID=0时,代表的是一级的类目
    @ApiModelProperty(value = "类目名称", example = "服务")
    private String name;//类目名称
    @ApiModelProperty(value = "别名", example = "福")
    private String alias;//alias
    @ApiModelProperty(value = "类型图片")
    private String picUrl;//类型图片
    @ApiModelProperty(value = "分类简称")
    private String simpleName;//分类简称
    @ApiModelProperty(value = "创建时间")
    private Date createTime;//创建时间
    @ApiModelProperty(value = "状态。可选值:1(正常),0(删除)", example = "1")
    private Integer del;//状态。可选值:1(正常),0(删除)
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    public Long getParentCid() {
        return parentCid;
    }
    public void setParentCid(Long parentCid) {
        this.parentCid = parentCid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }
    public String getPicUrl() {
        return picUrl;
    }
    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }
    public String getSimpleName() {
        return simpleName;
    }
    public void setSimpleName(String simpleName) {
        this.simpleName = simpleName;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 156 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackagePropVO.java

@ -0,0 +1,156 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 *
 * @author yeshijie on 2018/8/29.
 */
@ApiModel(value = "ServicePackagePropVO", description = "服务包属性表")
public class ServicePackagePropVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId", example = "xsaasdaqq")
    private String saasId;
    @ApiModelProperty(value = "属性 id", example = "123412")
    private Long pid;//属性 ID
    @ApiModelProperty(value = "上级属性ID", example = "134")
    private Long parentPid;//上级属性ID
    @ApiModelProperty(value = "上级属性值ID", example = "1324")
    private Long parentVid;//上级属性值ID
    @ApiModelProperty(value = "属性名", example = "爱迪生")
    private String name;//属性名
    @ApiModelProperty(value = "是否关键属性", example = "1")
    private Integer isKeyProp;//是否关键属性。可选值:true(是),false(否)
    @ApiModelProperty(value = "是否销售属性", example = "1")
    private Integer isSaleProp;//是否销售属性。可选值:true(是),false(否)
    @ApiModelProperty(value = "是否商品属性", example = "1")
    private Integer isItemProp;//是否商品属性。可选值:true(是),false(否)
    @ApiModelProperty(value = "是否为必选属性", example = "1")
    private Integer must;//是否为必选属性。可选值:true(是),false(否)
    @ApiModelProperty(value = "是否可以多选", example = "1")
    private Integer multi;//是否可以多选。可选值:true(是),false(否)
    @ApiModelProperty(value = "排序", example = "1")
    private Long sortOrder;
    @ApiModelProperty(value = "类目ID", example = "123")
    private Long cid;//类目ID
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "状态。可选值:1(正常),0(删除)", example = "1")
    private Integer del;//状态。可选值:1(正常),0(删除)
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getPid() {
        return pid;
    }
    public void setPid(Long pid) {
        this.pid = pid;
    }
    public Long getParentPid() {
        return parentPid;
    }
    public void setParentPid(Long parentPid) {
        this.parentPid = parentPid;
    }
    public Long getParentVid() {
        return parentVid;
    }
    public void setParentVid(Long parentVid) {
        this.parentVid = parentVid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getIsKeyProp() {
        return isKeyProp;
    }
    public void setIsKeyProp(Integer isKeyProp) {
        this.isKeyProp = isKeyProp;
    }
    public Integer getIsSaleProp() {
        return isSaleProp;
    }
    public void setIsSaleProp(Integer isSaleProp) {
        this.isSaleProp = isSaleProp;
    }
    public Integer getIsItemProp() {
        return isItemProp;
    }
    public void setIsItemProp(Integer isItemProp) {
        this.isItemProp = isItemProp;
    }
    public Integer getMust() {
        return must;
    }
    public void setMust(Integer must) {
        this.must = must;
    }
    public Integer getMulti() {
        return multi;
    }
    public void setMulti(Integer multi) {
        this.multi = multi;
    }
    public Long getSortOrder() {
        return sortOrder;
    }
    public void setSortOrder(Long sortOrder) {
        this.sortOrder = sortOrder;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 124 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackagePropvalueDO.java

@ -0,0 +1,124 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 服务包属性值表
 * @author yeshijie on 2018/8/29.
 */
@Entity
@Table(name = "base_service_package_propvalue")
public class ServicePackagePropvalueDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private Long cid;//类目ID',
    private Long pid;//属性 ID',
    private String propName;//属性名',
    private Long vid;//属性值ID',
    private String name;//属性值',
    private String nameAlias;//属性值别名',
    private Integer isParent;//是否为父类目属性',
    private Long sortOrder;//排列序号。取值范围:大于零的整数',
    private Date createTime;
    private Integer del;//状态。可选值:1(正常),0(删除)',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Long getCid() {
        return cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    public Long getPid() {
        return pid;
    }
    public void setPid(Long pid) {
        this.pid = pid;
    }
    @Column(name = "prop_name")
    public String getPropName() {
        return propName;
    }
    public void setPropName(String propName) {
        this.propName = propName;
    }
    public Long getVid() {
        return vid;
    }
    public void setVid(Long vid) {
        this.vid = vid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "name_alias")
    public String getNameAlias() {
        return nameAlias;
    }
    public void setNameAlias(String nameAlias) {
        this.nameAlias = nameAlias;
    }
    @Column(name = "is_parent")
    public Integer getIsParent() {
        return isParent;
    }
    public void setIsParent(Integer isParent) {
        this.isParent = isParent;
    }
    @Column(name = "sort_order")
    public Long getSortOrder() {
        return sortOrder;
    }
    public void setSortOrder(Long sortOrder) {
        this.sortOrder = sortOrder;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 196 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageSignRecordVO.java

@ -0,0 +1,196 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
@ApiModel(value = "ServicePackageSignRecordVO", description = "服务包签约记录表")
public class ServicePackageSignRecordVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId", example = "EwC0iRSrcS")
    private String saasId;
    @ApiModelProperty(value = "服务包id", example = "EwC0iRSrcS")
    private String servicePackageId;//服务包id
    @ApiModelProperty(value = "服务包名称", example = "康复计划")
    private String servicePackageName;//服务包名称
    @ApiModelProperty(value = "居民code", example = "EwC0iRSrcS")
    private String patient;//居民code
    @ApiModelProperty(value = "居民姓名", example = "李四")
    private String name;//居民姓名
    @ApiModelProperty(value = "居民身份证", example = "350124199584724")
    private String idcard;//居民身份证
    @ApiModelProperty(value = "社保卡号", example = "568241")
    private String ssc;//社保卡号
    @ApiModelProperty(value = "签约医生code", example = "EwC0iRSrcS")
    private String signDoctor;//签约医生code
    @ApiModelProperty(value = "签约医生名称", example = "张飒")
    private String signDoctorName;//签约医生名称
    @ApiModelProperty(value = "医院code", example = "EwC0iRSrcS")
    private String hospital;//医院code
    @ApiModelProperty(value = "医院名称", example = "第一医院")
    private String hospitalName;//医院名称
    @ApiModelProperty(value = "行政团队id", example = "EwC0iRSrcS")
    private Long adminTeamCode;//行政团队id
    @ApiModelProperty(value = "服务总价", example = "445554")
    private Long price;//服务总价
    @ApiModelProperty(value = "服务开始时间")
    private Date startTime;//服务开始时间
    @ApiModelProperty(value = "服务结束时间")
    private Date endTime;//服务结束时间
    @ApiModelProperty(value = "状态(1新建,2已完成)")
    private String status;//状态(1新建,2已完成)
    @ApiModelProperty(value = "医生服务团队code", example = "EwC0iRSrcS")
    private String doctorTeamCode;//医生服务团队code
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getServicePackageName() {
        return servicePackageName;
    }
    public void setServicePackageName(String servicePackageName) {
        this.servicePackageName = servicePackageName;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    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 getSignDoctor() {
        return signDoctor;
    }
    public void setSignDoctor(String signDoctor) {
        this.signDoctor = signDoctor;
    }
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    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 Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getDoctorTeamCode() {
        return doctorTeamCode;
    }
    public void setDoctorTeamCode(String doctorTeamCode) {
        this.doctorTeamCode = doctorTeamCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 133 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageSkuVO.java

@ -0,0 +1,133 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.util.Date;
/**
 *
 * @author yeshijie on 2018/8/29.
 */
@ApiModel(value = "ServicePackageSkuVO", description = "服务包sku表")
public class ServicePackageSkuVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId", example = "xsaasdaqq")
    private String saasId;//
    @ApiModelProperty(value = "服务包id", example = "xsaasdaqq")
    private String servicePackageId;//服务包id',
    @ApiModelProperty(value = "sku的销售属性组合字符串", example = "p1:v1;p2:v2")
    private String properties;//sku的销售属性组合字符串(颜色,大小,等等,可通过类目API获取某类目下的销售属性),格式是p1:v1;p2:v2',
    @ApiModelProperty(value = "属于这个sku的商品的数量", example = "1234")
    private Long quantity;//属于这个sku的商品的数量,',
    @ApiModelProperty(value = "属于这个sku的商品的价格", example = "5600")
    private Long price;//属于这个sku的商品的价格 取值范围:0-100000000;单位:分。如:200,表示:2元。',
    @ApiModelProperty(value = "sku所对应的销售属性的中文名字串", example = "pid1:vid1:pid_name1:vid_name1;")
    private String propertiesName;//sku所对应的销售属性的中文名字串,格式如:pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2……',
    @ApiModelProperty(value = "商品级别的条形码", example = "xsaasdaqq")
    private String barcode;//商品级别的条形码',
    @ApiModelProperty(value = "促销价", example = "123")
    private Long minPrice;//促销价',
    @ApiModelProperty(value = "sku创建日期")
    private Date createTime;//sku创建日期 时间格式:yyyy-MM-dd HH:mm:ss',
    @ApiModelProperty(value = "sku最后修改日期")
    private Date updateTime;//sku最后修改日期 时间格式:yyyy-MM-dd HH:mm:ss',
    @ApiModelProperty(value = "sku状态。 1:正常 ;0:删除", example = "1")
    private Integer del;//sku状态。 1:正常 ;0:删除',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "service_package_id")
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getProperties() {
        return properties;
    }
    public void setProperties(String properties) {
        this.properties = properties;
    }
    public Long getQuantity() {
        return quantity;
    }
    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    @Column(name = "properties_name")
    public String getPropertiesName() {
        return propertiesName;
    }
    public void setPropertiesName(String propertiesName) {
        this.propertiesName = propertiesName;
    }
    public String getBarcode() {
        return barcode;
    }
    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }
    @Column(name = "min_price")
    public Long getMinPrice() {
        return minPrice;
    }
    public void setMinPrice(Long minPrice) {
        this.minPrice = minPrice;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 151 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/servicePackage/ServicePackageVO.java

@ -0,0 +1,151 @@
package com.yihu.jw.restmodel.base.servicePackage;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.util.Date;
import java.util.List;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
@ApiModel(value = "ServicePackageVO", description = "服务包表")
public class ServicePackageVO extends UuidIdentityVO  {
    @ApiModelProperty(value = "saasId", example = "xsaasdaqq")
    private String saasId;
    @ApiModelProperty(value = "服务包名称", example = "服务")
    private String name;//服务包名称
    @ApiModelProperty(value = "服务包类型", example = "1")
    private String type;//服务包类型
    @ApiModelProperty(value = "服务项数量", example = "20")
    private Integer num;//服务项数量
    @ApiModelProperty(value = "预售价", example = "50000")
    private Long price;//预售价//单位分
    @ApiModelProperty(value = "服务包级别(0系统,1.医生,2团队,3社区,4区)", example = "1")
    private String level;//服务包级别(0系统,1.医生,2团队,3社区,4区)
    @ApiModelProperty(value = "关联code", example = "xsaasdaqq")
    private String levelCode;//关联code
    @ApiModelProperty(value = "创建者", example = "张武1")
    private String creater;//创建者
    @ApiModelProperty(value = "创建时间")
    private Date createTime;//创建时间
    @ApiModelProperty(value = "服务介绍", example = "xsaasdaqq")
    private String introduce;//服务介绍
    @ApiModelProperty(value = "审核状态", example = "1")
    private String status;//审核状态(预留字段0待审核,1审核通过,2审核不通过)
    @ApiModelProperty(value = "是否有效(1有效,0失效)", example = "1")
    private Integer del;//是否有效(1有效,0失效)
    @ApiModelProperty(value = "服务项")
    private List<ServicePackageDetailsVO> detailsVOList;
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    public String getLevel() {
        return level;
    }
    public void setLevel(String level) {
        this.level = level;
    }
    @Column(name = "level_code")
    public String getLevelCode() {
        return levelCode;
    }
    public void setLevelCode(String levelCode) {
        this.levelCode = levelCode;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public List<ServicePackageDetailsVO> getDetailsVOList() {
        return detailsVOList;
    }
    public void setDetailsVOList(List<ServicePackageDetailsVO> detailsVOList) {
        this.detailsVOList = detailsVOList;
    }
}

+ 84 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/DimensionQuotaVO.java

@ -0,0 +1,84 @@
package com.yihu.jw.restmodel.base.statistics;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 *
 * @author yeshijie on 2018/8/31.
 */
@ApiModel(value = "DimensionQuotaVO", description = "统计维度指标")
public class DimensionQuotaVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId")
    private String saasId;
    @ApiModelProperty(value = "关联base_quota的code")
    private String quotaCode;//
    @ApiModelProperty(value = "关联base_dimension的code")
    private String dimensionCode;//
    @ApiModelProperty(value = "查询字典的sql语句")
    private String dictSql;//
    @ApiModelProperty(value = "数据转换的类")
    private String convertClazz;//
    @ApiModelProperty(value = "维度顺序")
    private Integer sort;//
    @ApiModelProperty(value = "查询出来的key")
    private String key;//
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getQuotaCode() {
        return quotaCode;
    }
    public void setQuotaCode(String quotaCode) {
        this.quotaCode = quotaCode;
    }
    public String getDimensionCode() {
        return dimensionCode;
    }
    public void setDimensionCode(String dimensionCode) {
        this.dimensionCode = dimensionCode;
    }
    public String getDictSql() {
        return dictSql;
    }
    public void setDictSql(String dictSql) {
        this.dictSql = dictSql;
    }
    public String getConvertClazz() {
        return convertClazz;
    }
    public void setConvertClazz(String convertClazz) {
        this.convertClazz = convertClazz;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
}

+ 86 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/DimensionVO.java

@ -0,0 +1,86 @@
package com.yihu.jw.restmodel.base.statistics;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 统计维度表
 * @author yeshijie on 2018/8/31.
 */
@ApiModel(value = "DimensionVO", description = "统计维度")
public class DimensionVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId")
    private String saasId;
    @ApiModelProperty(value = "业务代码")
    private String code;//
    @ApiModelProperty(value = "类型")
    private String type;//
    @ApiModelProperty(value = "指标名称")
    private String name;//
    @ApiModelProperty(value = "状态(1: 正常 0:不可以用 -1 已删除)")
    private Integer status;//
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "备注")
    private String remark;//
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 184 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/JobConfigVO.java

@ -0,0 +1,184 @@
package com.yihu.jw.restmodel.base.statistics;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 *
 * @author yeshijie on 2018/8/31.
 */
@ApiModel(value = "JobConfigVO", description = "统计job配置")
public class JobConfigVO extends UuidIdentityVO {
    @ApiModelProperty(value = "saasId")
    private String saasId;
    @ApiModelProperty(value = "任务名称")
    private String jobName;//
    @ApiModelProperty(value = "任务描述")
    private String jobInfo;//
    @ApiModelProperty(value = "任务类型(0--单次执行  1--周期执行 2--监听任务)")
    private String jobType;//
    @ApiModelProperty(value = "任务执行的class")
    private String jobClass;//
    @ApiModelProperty(value = "统计sql语句")
    private String sql;//
    @ApiModelProperty(value = "统计总数语句")
    private String sqlCount;//
    @ApiModelProperty(value = "天数条件")
    private String sqlDay;//
    @ApiModelProperty(value = "年份条件")
    private String sqlYear;//
    @ApiModelProperty(value = "缓存的key")
    private String cacheKey;//
    @ApiModelProperty(value = "quartz表达式")
    private String quartzCron;//
    @ApiModelProperty(value = "1 启动 0停止")
    private String status;//
    @ApiModelProperty(value = "指标code")
    private String quotaCode;//
    @ApiModelProperty(value = "1: 正常 0: 删除")
    private Integer del;//
    @ApiModelProperty(value = "抽取类型   1或者为空:数据库 2ES")
    private String extractType;//
    @ApiModelProperty(value = "1增量 2到达量 3生成到达量也生成增量")
    private String timeLevel;//
    @ApiModelProperty(value = "增量时间间隔1天,2周,3月")
    private Integer incrementInterval;//
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    public String getJobInfo() {
        return jobInfo;
    }
    public void setJobInfo(String jobInfo) {
        this.jobInfo = jobInfo;
    }
    public String getJobType() {
        return jobType;
    }
    public void setJobType(String jobType) {
        this.jobType = jobType;
    }
    public String getJobClass() {
        return jobClass;
    }
    public void setJobClass(String jobClass) {
        this.jobClass = jobClass;
    }
    public String getSql() {
        return sql;
    }
    public void setSql(String sql) {
        this.sql = sql;
    }
    public String getSqlCount() {
        return sqlCount;
    }
    public void setSqlCount(String sqlCount) {
        this.sqlCount = sqlCount;
    }
    public String getSqlDay() {
        return sqlDay;
    }
    public void setSqlDay(String sqlDay) {
        this.sqlDay = sqlDay;
    }
    public String getSqlYear() {
        return sqlYear;
    }
    public void setSqlYear(String sqlYear) {
        this.sqlYear = sqlYear;
    }
    public String getCacheKey() {
        return cacheKey;
    }
    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }
    public String getQuartzCron() {
        return quartzCron;
    }
    public void setQuartzCron(String quartzCron) {
        this.quartzCron = quartzCron;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getQuotaCode() {
        return quotaCode;
    }
    public void setQuotaCode(String quotaCode) {
        this.quotaCode = quotaCode;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getExtractType() {
        return extractType;
    }
    public void setExtractType(String extractType) {
        this.extractType = extractType;
    }
    public String getTimeLevel() {
        return timeLevel;
    }
    public void setTimeLevel(String timeLevel) {
        this.timeLevel = timeLevel;
    }
    public Integer getIncrementInterval() {
        return incrementInterval;
    }
    public void setIncrementInterval(Integer incrementInterval) {
        this.incrementInterval = incrementInterval;
    }
}

+ 64 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/statistics/QuotaVO.java

@ -0,0 +1,64 @@
package com.yihu.jw.restmodel.base.statistics;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 *
 * @author yeshijie on 2018/8/31.
 */
@ApiModel(value = "QuotaVO", description = "统计指标")
public class QuotaVO extends UuidIdentityVO {
    @ApiModelProperty(value = "指标code")
    private String code;//指标code
    @ApiModelProperty(value = "指标名称")
    private String name;//指标名称
    @ApiModelProperty(value = "创建时间")
    private String createTime;
    @ApiModelProperty(value = "更新时间")
    private String updateTime;
    @ApiModelProperty(value = "删除标志:1: 正常 0: 删除")
    private Integer 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 getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public String getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 96 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientDisseaseInfoVO.java

@ -0,0 +1,96 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by humingfen on 2018/8/30.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民签约疾病信息", description = "居民签约疾病信息")
public class PatientDisseaseInfoVO {
    @ApiModelProperty("疾病")
    private String disease;
    @ApiModelProperty("疾病名称")
    private String diseaseName;
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("年龄")
    private String age;
    @ApiModelProperty("性别")
    private String sex;
    @ApiModelProperty("身份证")
    private String idcard;
    @ApiModelProperty("生日")
    private String  birthday;
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
    public String getDiseaseName() {
        return diseaseName;
    }
    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }
    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 getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getBirthday() {
        return birthday;
    }
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}

+ 69 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/config/WlyyWebSecurityConfigurerAdapter.java

@ -0,0 +1,69 @@
package com.yihu.jw.security.config;
import com.yihu.jw.security.web.authentication.WlyyAuthenticationFailureHandler;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.authentication.dao.ReflectionSaltSource;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
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 javax.sql.DataSource;
/**
 * Config - Spring Security
 * Created by progr1mmer on 2018/8/29.
 */
@Configuration
@EnableWebSecurity
public class WlyyWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
    @Autowired
    private DataSource dataSource;
    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers("/oauth/**");
    }
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/login/**").permitAll()
                .antMatchers("/**").hasRole("USER")
                .and().formLogin().loginPage("/login").failureHandler(new WlyyAuthenticationFailureHandler())
                .and().logout().logoutUrl("/logout").logoutSuccessUrl("/login")
                .and().headers().frameOptions().disable()
                .and().csrf().disable();
    }
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(authenticationProvider());
    }
    @Bean
    WlyyUserDetailsService wlyyUserDetailsService(){
        return new WlyyUserDetailsService(dataSource);
    }
    @Bean
    AuthenticationProvider authenticationProvider() {
        DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
        authenticationProvider.setUserDetailsService(wlyyUserDetailsService());
        authenticationProvider.setPasswordEncoder(new Md5PasswordEncoder());
        ReflectionSaltSource reflectionSaltSource = new ReflectionSaltSource();
        reflectionSaltSource.setUserPropertyToUse("salt");
        authenticationProvider.setSaltSource(reflectionSaltSource);
        authenticationProvider.setSaltSource(reflectionSaltSource);
        return authenticationProvider;
    }
}

+ 228 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/SaltUser.java

@ -0,0 +1,228 @@
package com.yihu.jw.security.core.userdetails;
import org.springframework.security.core.CredentialsContainer;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.Assert;
import java.io.Serializable;
import java.util.*;
/**
 * Created by progr1mmer on 2018/8/29.
 */
public class SaltUser implements UserDetails, CredentialsContainer {
    private static final long serialVersionUID = 420L;
    private String password;
    private final String username;
    private final Set<GrantedAuthority> authorities;
    private final boolean accountNonExpired;
    private final boolean accountNonLocked;
    private final boolean credentialsNonExpired;
    private final boolean enabled;
    private final String salt;
    public SaltUser(String username, String password, String salt, Collection<? extends GrantedAuthority> authorities) {
        this(username, password, salt, true, true, true, true, authorities);
    }
    public SaltUser(String username, String password, String salt, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        if(username != null && !"".equals(username) && password != null) {
            this.username = username;
            this.password = password;
            this.salt = salt;
            this.enabled = enabled;
            this.accountNonExpired = accountNonExpired;
            this.credentialsNonExpired = credentialsNonExpired;
            this.accountNonLocked = accountNonLocked;
            this.authorities = Collections.unmodifiableSet(sortAuthorities(authorities));
        } else {
            throw new IllegalArgumentException("Cannot pass null or empty values to constructor");
        }
    }
    public Collection<GrantedAuthority> getAuthorities() {
        return this.authorities;
    }
    public String getPassword() {
        return this.password;
    }
    public String getUsername() {
        return this.username;
    }
    public String getSalt() {
        return salt;
    }
    public boolean isEnabled() {
        return this.enabled;
    }
    public boolean isAccountNonExpired() {
        return this.accountNonExpired;
    }
    public boolean isAccountNonLocked() {
        return this.accountNonLocked;
    }
    public boolean isCredentialsNonExpired() {
        return this.credentialsNonExpired;
    }
    public void eraseCredentials() {
        this.password = null;
    }
    private static SortedSet<GrantedAuthority> sortAuthorities(Collection<? extends GrantedAuthority> authorities) {
        Assert.notNull(authorities, "Cannot pass a null GrantedAuthority collection");
        SortedSet<GrantedAuthority> sortedAuthorities = new TreeSet(new SaltUser.AuthorityComparator());
        Iterator var2 = authorities.iterator();
        while(var2.hasNext()) {
            GrantedAuthority grantedAuthority = (GrantedAuthority)var2.next();
            Assert.notNull(grantedAuthority, "GrantedAuthority list cannot contain any null elements");
            sortedAuthorities.add(grantedAuthority);
        }
        return sortedAuthorities;
    }
    public boolean equals(Object rhs) {
        return rhs instanceof SaltUser?this.username.equals(((SaltUser)rhs).username):false;
    }
    public int hashCode() {
        return this.username.hashCode();
    }
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.toString()).append(": ");
        sb.append("Username: ").append(this.username).append("; ");
        sb.append("Password: [PROTECTED]; ");
        sb.append("Enabled: ").append(this.enabled).append("; ");
        sb.append("AccountNonExpired: ").append(this.accountNonExpired).append("; ");
        sb.append("credentialsNonExpired: ").append(this.credentialsNonExpired).append("; ");
        sb.append("AccountNonLocked: ").append(this.accountNonLocked).append("; ");
        if(!this.authorities.isEmpty()) {
            sb.append("Granted Authorities: ");
            boolean first = true;
            Iterator var3 = this.authorities.iterator();
            while(var3.hasNext()) {
                GrantedAuthority auth = (GrantedAuthority)var3.next();
                if(!first) {
                    sb.append(",");
                }
                first = false;
                sb.append(auth);
            }
        } else {
            sb.append("Not granted any authorities");
        }
        return sb.toString();
    }
    public static SaltUser.UserBuilder withUsername(String username) {
        return (new SaltUser.UserBuilder()).username(username);
    }
    public static class UserBuilder {
        private String username;
        private String password;
        private List<GrantedAuthority> authorities;
        private boolean accountExpired;
        private boolean accountLocked;
        private boolean credentialsExpired;
        private boolean disabled;
        private UserBuilder() {
        }
        private SaltUser.UserBuilder username(String username) {
            Assert.notNull(username, "username cannot be null");
            this.username = username;
            return this;
        }
        public SaltUser.UserBuilder password(String password) {
            Assert.notNull(password, "password cannot be null");
            this.password = password;
            return this;
        }
        public SaltUser.UserBuilder roles(String... roles) {
            List<GrantedAuthority> authorities = new ArrayList(roles.length);
            String[] var3 = roles;
            int var4 = roles.length;
            for(int var5 = 0; var5 < var4; ++var5) {
                String role = var3[var5];
                Assert.isTrue(!role.startsWith("ROLE_"), role + " cannot start with ROLE_ (it is automatically added)");
                authorities.add(new SimpleGrantedAuthority("ROLE_" + role));
            }
            return this.authorities((List)authorities);
        }
        public SaltUser.UserBuilder authorities(GrantedAuthority... authorities) {
            return this.authorities(Arrays.asList(authorities));
        }
        public SaltUser.UserBuilder authorities(List<? extends GrantedAuthority> authorities) {
            this.authorities = new ArrayList(authorities);
            return this;
        }
        public SaltUser.UserBuilder authorities(String... authorities) {
            return this.authorities(AuthorityUtils.createAuthorityList(authorities));
        }
        public SaltUser.UserBuilder accountExpired(boolean accountExpired) {
            this.accountExpired = accountExpired;
            return this;
        }
        public SaltUser.UserBuilder accountLocked(boolean accountLocked) {
            this.accountLocked = accountLocked;
            return this;
        }
        public SaltUser.UserBuilder credentialsExpired(boolean credentialsExpired) {
            this.credentialsExpired = credentialsExpired;
            return this;
        }
        public SaltUser.UserBuilder disabled(boolean disabled) {
            this.disabled = disabled;
            return this;
        }
        public UserDetails build() {
            return new User(this.username, this.password, !this.disabled, !this.accountExpired, !this.credentialsExpired, !this.accountLocked, this.authorities);
        }
    }
    private static class AuthorityComparator implements Comparator<GrantedAuthority>, Serializable {
        private static final long serialVersionUID = 420L;
        private AuthorityComparator() {
        }
        public int compare(GrantedAuthority g1, GrantedAuthority g2) {
            return g2.getAuthority() == null?-1:(g1.getAuthority() == null?1:g1.getAuthority().compareTo(g2.getAuthority()));
        }
    }
}

+ 65 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -0,0 +1,65 @@
package com.yihu.jw.security.core.userdetails.jdbc;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
 * Service - 用户加载
 * Created by progr1mmer on 2018/8/29.
 */
public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetailsService {
    private static final String DEFAULT_USER_DETAILS_STATEMENT = "SELECT * FROM base_user u WHERE u.username = ? OR u.mobile = ? OR u.idcard = ?";
    public WlyyUserDetailsService(DataSource dataSource) {
        this.setDataSource(dataSource);
    }
    /**
     * 用户登录判读接口
     *
     * @param username
     * @return
     * @throws UsernameNotFoundException
     */
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        List<WlyyUserDetails> users = this.getJdbcTemplate().query(DEFAULT_USER_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class), username, username, username);
        if (users == null || users.size() == 0) {
            throw new UsernameNotFoundException(username);
        }
        return new SaltUser(username, users.get(0).getPassword(), users.get(0).getSalt(), getGrantedAuthorities(username));
    }
    private Collection<? extends GrantedAuthority> getGrantedAuthorities(String username) {
        Collection<GrantedAuthority> authorities = new ArrayList<>(1);
        authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
        return authorities;
    }
    public WlyyUserSimple authSuccess (String username) throws UsernameNotFoundException {
        //更新登陆时间
        this.getJdbcTemplate().update("update base_user u set u.login_date = ? where u.username = ? or u.mobile = ? or u.idcard = ?", new Date(), username, username, username);
        //加载用户简略信息
        List<WlyyUserSimple> users = this.getJdbcTemplate().query(DEFAULT_USER_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), username, username, username);
        if (users == null || users.size() == 0) {
            throw new UsernameNotFoundException(username);
        }
        return users.get(0);
    }
}

+ 52 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/model/Oauth2Envelop.java

@ -0,0 +1,52 @@
package com.yihu.jw.security.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.HashMap;
/**
 * Model - 认证失败信息
 * Created by progr1mmer on 2018/8/29.
 */
public class Oauth2Envelop<T> {
    protected String message;
    protected Integer status;
    private T obj = (T)new HashMap<>();
    public Oauth2Envelop(String message, Integer status) {
        this.message = message;
        this.status = status;
    }
    public Oauth2Envelop(String message, Integer status, T obj) {
        this.message = message;
        this.status = status;
        this.obj = obj;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @JsonInclude(value = JsonInclude.Include.NON_EMPTY)
    public T getObj() {
        return obj;
    }
    public void setObj(T obj) {
        this.obj = obj;
    }
}

+ 220 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserDetails.java

@ -0,0 +1,220 @@
package com.yihu.jw.security.model;
import java.io.Serializable;
import java.util.Date;
/**
 * Model - 认证用户详细信息
 * Created by progr1mmer on 2018/8/29.
 */
public class WlyyUserDetails implements Serializable {
    /**
     * 性别
     */
    public enum Gender {
        //男
        male,
        //女
        female
    }
    private String id;
    //创建时间
    private Date createTime;
    //创建者
    private String createUser;
    //创建者
    private String createUserName;
    //更新时间
    private Date updateTime;
    //更新者
    private String updateUser;
    //更新者
    private String updateUserName;
    //用户名
    private String username;
    //密码
    private String password;
    //密码散列值
    private String salt;
    //姓名
    private String name;
    //性别
    private Gender gender;
    //身份证号码
    private String idcard;
    //手机号码
    private String mobile;
    //邮箱
    private String email;
    //是否可用
    private Boolean enabled;
    //是否锁定
    private Boolean locked;
    //锁定时间
    private Date lockedDate;
    //最后登陆时间
    private Date loginDate;
    //登陆失败次数
    private Integer loginFailureCount;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    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;
    }
    public Gender getGender() {
        return gender;
    }
    public void setGender(Gender gender) {
        this.gender = gender;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public Boolean isEnabled() {
        return enabled;
    }
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
    public Boolean isLocked() {
        return locked;
    }
    public void setLocked(Boolean locked) {
        this.locked = locked;
    }
    public Date getLockedDate() {
        return lockedDate;
    }
    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }
    public Date getLoginDate() {
        return loginDate;
    }
    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }
    public Integer getLoginFailureCount() {
        return loginFailureCount;
    }
    public void setLoginFailureCount(Integer loginFailureCount) {
        this.loginFailureCount = loginFailureCount;
    }
}

+ 165 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java

@ -0,0 +1,165 @@
package com.yihu.jw.security.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * Model - 认证用户简略信息
 * Created by progr1mmer on 2018/8/29.
 */
public class WlyyUserSimple implements Serializable {
    /**
     * 性别
     */
    public enum Gender {
        //男
        male,
        //女
        female
    }
    private String id;
    //用户名
    private String username;
    //姓名
    private String name;
    //性别
    private Gender gender;
    //身份证号码
    private String idcard;
    //手机号码
    private String mobile;
    //邮箱
    private String email;
    //最后登陆时间
    private Date loginDate;
    //扩展字段
    private String user; //当前登陆凭证
    private String accessToken;
    private String refreshToken;
    private String tokenType;
    private int expiresIn;
    private String state;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Gender getGender() {
        return gender;
    }
    public void setGender(Gender gender) {
        this.gender = gender;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getLoginDate() {
        return loginDate;
    }
    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    //@JsonProperty(value = "access_token")
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    //@JsonProperty(value = "refresh_token")
    public String getRefreshToken() {
        return refreshToken;
    }
    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }
    //@JsonProperty(value = "token_type")
    public String getTokenType() {
        return tokenType;
    }
    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }
    //@JsonProperty(value = "expires_in")
    public int getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
}

+ 65 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/common/WlyyOAuth2AccessToken.java

@ -0,0 +1,65 @@
package com.yihu.jw.security.oauth2.common;
import java.io.Serializable;
/**
 * Created by progr1mmer on 2018/8/29.
 */
public class WlyyOAuth2AccessToken implements Serializable {
    private String accessToken;
    private String refreshToken;
    private String tokenType;
    private int expiresIn;
    private String scope;
    private String state;
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public String getRefreshToken() {
        return refreshToken;
    }
    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }
    public String getTokenType() {
        return tokenType;
    }
    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }
    public int getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }
    public String getScope() {
        return scope;
    }
    public void setScope(String scope) {
        this.scope = scope;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
}

+ 100 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/config/WlyyAuthorizationServerConfigurerAdapter.java

@ -0,0 +1,100 @@
package com.yihu.jw.security.oauth2.config;
import com.yihu.jw.security.oauth2.provider.client.WlyyJdbcClientRedirectUriService;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import javax.sql.DataSource;
/**
 * Config - Spring Oauth2
 * Created by progr1mmer on 2018/8/29.
 */
@Configuration
@EnableAuthorizationServer
public class WlyyAuthorizationServerConfigurerAdapter extends AuthorizationServerConfigurerAdapter {
    @Autowired
    private DataSource dataSource;
    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private RedisTemplate redisTemplate;
    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        endpoints.tokenStore(redisTokenStore());
        endpoints.authorizationCodeServices(authorizationCodeServices());
    }
    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients.withClientDetails(clientDetailsService());
    }
    /*@Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
        security.passwordEncoder(new StandardPasswordEncoder());
    }*/
    @Bean
    @Primary
    WlyyTokenGranter wlyyTokenGranter (
            AuthenticationManager authenticationManager,
            AuthorizationServerTokenServices authorizationServerTokenServices) {
        WlyyTokenGranter tokenGranter = new WlyyTokenGranter(
                authenticationManager,
                authorizationServerTokenServices,
                authorizationCodeServices(),
                clientDetailsService(),
                new DefaultOAuth2RequestFactory(clientDetailsService()),
                wlyyRedisVerifyCodeService());
        return tokenGranter;
    }
    @Bean
    ClientDetailsService clientDetailsService() {
        return new JdbcClientDetailsService(dataSource);
    }
    @Bean
    RedisTokenStore redisTokenStore() {
        return new RedisTokenStore(jedisConnectionFactory);
    }
    @Bean
    WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService() {
        return new WlyyRedisVerifyCodeService(redisTemplate);
    }
    @Bean
    AuthorizationCodeServices authorizationCodeServices() {
        return new InMemoryAuthorizationCodeServices();
    }
    @Bean
    WlyyJdbcClientRedirectUriService wlyyJdbcClientRedirectUriService() {
        return new WlyyJdbcClientRedirectUriService(jdbcTemplate);
    }
}

+ 49 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/jdbc/WlyyJdbcUserSecurityService.java

@ -0,0 +1,49 @@
package com.yihu.jw.security.oauth2.core.jdbc;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.util.List;
/**
 * Created by progr1mmer on 2018/1/8.
 */
public class WlyyJdbcUserSecurityService {
    private static final String DEFAULT_KEY_ID_SELECT_STATEMENT = "SELECT id FROM user_security WHERE public_key = ?";
    private static final String DEFAULT_USER_ID_BY_KEY_ID_SELECT_STATEMENT = "SELECT user_id FROM user_key WHERE key_id = ?";
    private static final String DEFAULT_USER_NAME_BY_USER_ID = "SELECT login_code FROM users WHERE id = ?";
    private JdbcTemplate jdbcTemplate;
    public WlyyJdbcUserSecurityService(DataSource dataSource) {
        Assert.notNull(dataSource, "DataSource required");
        this.jdbcTemplate = new JdbcTemplate(dataSource);
    }
    public String getDefaultKeyIdSelectStatement(String publicKey) {
        List<String> keyId = jdbcTemplate.queryForList(DEFAULT_KEY_ID_SELECT_STATEMENT, new String []{publicKey}, String.class);
        if(keyId.size() <= 0) {
            throw new InsufficientAuthenticationException("Illegal authorized pk.");
        }
        return keyId.get(0);
    }
    public String getDefaultUserIdByKeyIdSelectStatement(String keyId) {
        List<String> userId =  jdbcTemplate.queryForList(DEFAULT_USER_ID_BY_KEY_ID_SELECT_STATEMENT, new String []{keyId}, String.class);
        if(userId.size() <= 0) {
            throw new InsufficientAuthenticationException("Unauthorized security key. please check you pk.");
        }
        return userId.get(0);
    }
    public String getDefaultUserNameByUserId(String userId) {
        List<String> username = jdbcTemplate.queryForList(DEFAULT_USER_NAME_BY_USER_ID, new String []{userId}, String.class);
        if(username.size() <= 0) {
            throw new InsufficientAuthenticationException("Illegal user id. please check you pk.");
        }
        return username.get(0);
    }
}

+ 44 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java

@ -0,0 +1,44 @@
package com.yihu.jw.security.oauth2.core.redis;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import java.util.concurrent.TimeUnit;
/**
 * Created by progr1mmer on 2018/4/18.
 */
public class WlyyRedisVerifyCodeService {
    private final String KEY_SUFFIX = ":code";
    private final RedisTemplate redisTemplate;
    public WlyyRedisVerifyCodeService(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }
    public void store (String client_id, String username, String code, long expire) {
        String key = client_id + ":" + username + KEY_SUFFIX;
        redisTemplate.opsForValue().set(key, code);
        redisTemplate.expire(key, expire, TimeUnit.MILLISECONDS);
    }
    public Integer getExpireTime (String client_id, String username) {
        return new Long(redisTemplate.getExpire(client_id + ":" + username + KEY_SUFFIX)).intValue();
    }
    public boolean verification (String client_id, String username, String code) {
        if (StringUtils.isEmpty(code)) {
            return false;
        }
        String _code = (String) redisTemplate.opsForValue().get(client_id + ":" + username + KEY_SUFFIX);
        if (null == _code) {
            return false;
        }
        if (code.equalsIgnoreCase(_code)) {
            return true;
        }
        return false;
    }
}

+ 338 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java

@ -0,0 +1,338 @@
package com.yihu.jw.security.oauth2.provider;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import org.springframework.security.authentication.*;
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.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
import org.springframework.security.oauth2.common.exceptions.InvalidRequestException;
import org.springframework.security.oauth2.common.exceptions.RedirectMismatchException;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.implicit.ImplicitGrantService;
import org.springframework.security.oauth2.provider.implicit.ImplicitTokenRequest;
import org.springframework.security.oauth2.provider.token.AbstractTokenGranter;
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
import org.springframework.util.Assert;
import java.util.*;
/**
 * Token授权器。
 * @author Progr1mmer
 * @created 2018.01.09
 */
public class WlyyTokenGranter implements TokenGranter {
    private final Map<String, TokenGranter> tokenGranters = new HashMap<>();
    public WlyyTokenGranter(AuthenticationManager authenticationManager,
                            AuthorizationServerTokenServices tokenServices,
                            AuthorizationCodeServices authorizationCodeServices,
                            ClientDetailsService clientDetailsService,
                            OAuth2RequestFactory requestFactory,
                            WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService) {
        tokenGranters.put(EhrAuthorizationCodeGranter.GRANT_TYPE,
                new EhrAuthorizationCodeGranter(
                        tokenServices,
                        authorizationCodeServices,
                        clientDetailsService,
                        requestFactory
                ));
        tokenGranters.put(EhrResourceOwnerPasswordTokenGranter.GRANT_TYPE,
                new EhrResourceOwnerPasswordTokenGranter(
                        authenticationManager,
                        tokenServices,
                        clientDetailsService,
                        requestFactory
                ));
        tokenGranters.put(EhrRefreshTokenGranter.GRANT_TYPE,
                new EhrRefreshTokenGranter(
                        tokenServices,
                        clientDetailsService,
                        requestFactory
                ));
        tokenGranters.put(EhrImplicitTokenGranter.GRANT_TYPE,
                new EhrImplicitTokenGranter(
                        tokenServices,
                        clientDetailsService,
                        requestFactory
                ));
        tokenGranters.put(EhrVerifyCodeTokenGranter.GRANT_TYPE,
                new EhrVerifyCodeTokenGranter(
                        authenticationManager,
                        tokenServices,
                        clientDetailsService,
                        requestFactory,
                        wlyyRedisVerifyCodeService
                ));
    }
    public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
        if (tokenGranters.get(grantType) != null) {
            OAuth2AccessToken grant = tokenGranters.get(grantType).grant(grantType, tokenRequest);
            return grant;
        }
        return null;
    }
    /**
     * authorization_code模式Token授权器。
     */
    public static class EhrAuthorizationCodeGranter extends AbstractTokenGranter {
        public static final String GRANT_TYPE = "authorization_code";
        private final AuthorizationCodeServices authorizationCodeServices;
        public EhrAuthorizationCodeGranter(AuthorizationServerTokenServices tokenServices,
                                           AuthorizationCodeServices authorizationCodeServices,
                                           ClientDetailsService clientDetailsService,
                                           OAuth2RequestFactory requestFactory) {
            this(tokenServices, authorizationCodeServices, clientDetailsService, requestFactory, GRANT_TYPE);
        }
        protected EhrAuthorizationCodeGranter(AuthorizationServerTokenServices tokenServices,
                                              AuthorizationCodeServices authorizationCodeServices,
                                              ClientDetailsService clientDetailsService,
                                              OAuth2RequestFactory requestFactory,
                                              String grantType) {
            super(tokenServices, clientDetailsService, requestFactory, grantType);
            this.authorizationCodeServices = authorizationCodeServices;
        }
        @Override
        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) {
            Map<String, String> parameters = tokenRequest.getRequestParameters();
            String authorizationCode = parameters.get("code");
            String redirectUri = parameters.get(OAuth2Utils.REDIRECT_URI);
            if (authorizationCode == null) {
                throw new InvalidRequestException("An authorization code must be supplied.");
            }
            OAuth2Authentication storedAuth = authorizationCodeServices.consumeAuthorizationCode(authorizationCode);
            if (storedAuth == null) {
                throw new InvalidGrantException("Invalid authorization code: " + authorizationCode);
            }
            OAuth2Request pendingOAuth2Request = storedAuth.getOAuth2Request();
            String oauthUri;
            if (pendingOAuth2Request.getRedirectUri().indexOf("?") != -1) {
                oauthUri = pendingOAuth2Request.getRedirectUri().substring(0, pendingOAuth2Request.getRedirectUri().indexOf("?"));
            } else {
                oauthUri = pendingOAuth2Request.getRedirectUri();
            }
            // https://jira.springsource.org/browse/SECOAUTH-333
            // This might be null, if the authorization was done without the redirect_uri parameter
            String redirectUriApprovalParameter = pendingOAuth2Request.getRequestParameters().get(
                    OAuth2Utils.REDIRECT_URI);
            if ((redirectUri != null || redirectUriApprovalParameter != null)
                    && !oauthUri.equals(redirectUri)) {
                throw new RedirectMismatchException("Redirect URI mismatch.");
            }
            String pendingClientId = pendingOAuth2Request.getClientId();
            String clientId = tokenRequest.getClientId();
            if (clientId != null && !clientId.equals(pendingClientId)) {
                // just a sanity check.
                throw new InvalidClientException("Client ID mismatch");
            }
            // Secret is not required in the authorization request, so it won't be available
            // in the pendingAuthorizationRequest. We do want to check that a secret is provided
            // in the token request, but that happens elsewhere.
            Map<String, String> combinedParameters = new HashMap<String, String>(pendingOAuth2Request
                    .getRequestParameters());
            // Combine the parameters adding the new ones last so they override if there are any clashes
            combinedParameters.putAll(parameters);
            // Make a new stored request with the combined parameters
            OAuth2Request finalStoredOAuth2Request = pendingOAuth2Request.createOAuth2Request(combinedParameters);
            Authentication userAuth = storedAuth.getUserAuthentication();
            //再次通过pk获取当前请求的用户信息
            /*String pk = combinedParameters.get("pk");
            String keyId = ehrJDBCUserSecurityService.getDefaultKeyIdSelectStatement(pk);
            String userId = ehrJDBCUserSecurityService.getDefaultUserIdByKeyIdSelectStatement(keyId);
            String userName = ehrJDBCUserSecurityService.getDefaultUserNameByUserId(userId);
            UserDetails userDetails = ehrUserDetailsService.loadUserByUsername(userName);
            if (StringUtils.isEmpty(keyId) || StringUtils.isEmpty(userId) || StringUtils.isEmpty(userName)) {
                throw new InsufficientAuthenticationException("Illegal pk");
            }
            UsernamePasswordAuthenticationToken userToken = new UsernamePasswordAuthenticationToken(userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities());*/
            return new OAuth2Authentication(finalStoredOAuth2Request, userAuth);
        }
    }
    /**
     * password模式Token授权器。
     */
    public static class EhrResourceOwnerPasswordTokenGranter extends AbstractTokenGranter {
        private static final String GRANT_TYPE = "password";
        private final AuthenticationManager authenticationManager;
        public EhrResourceOwnerPasswordTokenGranter(AuthenticationManager authenticationManager,
                                                 AuthorizationServerTokenServices tokenServices, ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory) {
            this(authenticationManager, tokenServices, clientDetailsService, requestFactory, GRANT_TYPE);
        }
        protected EhrResourceOwnerPasswordTokenGranter(AuthenticationManager authenticationManager, AuthorizationServerTokenServices tokenServices,
                                                    ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory, String grantType) {
            super(tokenServices, clientDetailsService, requestFactory, grantType);
            this.authenticationManager = authenticationManager;
        }
        @Override
        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) {
            Map<String, String> parameters = new LinkedHashMap<String, String>(tokenRequest.getRequestParameters());
            String username = parameters.get("username");
            String password = parameters.get("password");
            // Protect from downstream leaks of password
            parameters.remove("password");
            Authentication userAuth = new UsernamePasswordAuthenticationToken(username, password);
            ((AbstractAuthenticationToken) userAuth).setDetails(parameters);
            try {
                userAuth = authenticationManager.authenticate(userAuth);
            }
            catch (AccountStatusException ase) {
                //covers expired, locked, disabled cases (mentioned in section 5.2, draft 31)
                throw new InvalidGrantException(ase.getMessage());
            }
            catch (BadCredentialsException e) {
                // If the username/password are wrong the spec says we should send 400/invalid grant
                throw new InvalidGrantException(e.getMessage());
            }
            if (userAuth == null || !userAuth.isAuthenticated()) {
                throw new InvalidGrantException("Could not authenticate user: " + username);
            }
            OAuth2Request storedOAuth2Request = getRequestFactory().createOAuth2Request(client, tokenRequest);
            return new OAuth2Authentication(storedOAuth2Request, userAuth);
        }
    }
    /**
     * refresh模式Token授权器。
     */
    public static class EhrRefreshTokenGranter extends AbstractTokenGranter {
        static final String GRANT_TYPE = "refresh_token";
        public EhrRefreshTokenGranter(AuthorizationServerTokenServices tokenServices,
                                      ClientDetailsService clientDetailsService,
                                      OAuth2RequestFactory requestFactory) {
            super(tokenServices, clientDetailsService, requestFactory, GRANT_TYPE);
        }
        @Override
        protected OAuth2AccessToken getAccessToken(ClientDetails client, TokenRequest tokenRequest) {
            String refreshToken = tokenRequest.getRequestParameters().get(GRANT_TYPE);
            return getTokenServices().refreshAccessToken(refreshToken, tokenRequest);
        }
    }
    /**
     * Implicit模式Token授权器。
     */
    public static class EhrImplicitTokenGranter extends AbstractTokenGranter {
        private static final String GRANT_TYPE = "implicit";
        public EhrImplicitTokenGranter(AuthorizationServerTokenServices tokenServices, ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory) {
            this(tokenServices, clientDetailsService, requestFactory, GRANT_TYPE);
        }
        protected EhrImplicitTokenGranter(AuthorizationServerTokenServices tokenServices, ClientDetailsService clientDetailsService,
                                       OAuth2RequestFactory requestFactory, String grantType) {
            super(tokenServices, clientDetailsService, requestFactory, grantType);
        }
        @Override
        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest clientToken) {
            Authentication userAuth = SecurityContextHolder.getContext().getAuthentication();
            if (userAuth == null || !userAuth.isAuthenticated()) {
                throw new InsufficientAuthenticationException("There is no currently logged in user");
            }
            Assert.state(clientToken instanceof ImplicitTokenRequest, "An ImplicitTokenRequest is required here. Caller needs to wrap the TokenRequest.");
            OAuth2Request requestForStorage = ((ImplicitTokenRequest)clientToken).getOAuth2Request();
            return new OAuth2Authentication(requestForStorage, userAuth);
        }
        @SuppressWarnings("deprecation")
        public void setImplicitGrantService(ImplicitGrantService service) {
        }
    }
    /**
     * verify_code模式Token授权器。
     */
    public static class EhrVerifyCodeTokenGranter extends AbstractTokenGranter {
        private static final String GRANT_TYPE = "verify_code";
        private final AuthenticationManager authenticationManager;
        // Ehr Properties
        private final WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
        public EhrVerifyCodeTokenGranter(AuthenticationManager authenticationManager,
                                         AuthorizationServerTokenServices tokenServices,
                                         ClientDetailsService clientDetailsService,
                                         OAuth2RequestFactory requestFactory,
                                         WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService) {
            this(authenticationManager, tokenServices, clientDetailsService, requestFactory, GRANT_TYPE, wlyyRedisVerifyCodeService);
        }
        protected EhrVerifyCodeTokenGranter(AuthenticationManager authenticationManager,
                                            AuthorizationServerTokenServices tokenServices,
                                            ClientDetailsService clientDetailsService,
                                            OAuth2RequestFactory requestFactory,
                                            String grantType,
                                            WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService) {
            super(tokenServices, clientDetailsService, requestFactory, grantType);
            this.authenticationManager = authenticationManager;
            this.wlyyRedisVerifyCodeService = wlyyRedisVerifyCodeService;
        }
        @Override
        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) {
            Map<String, String> parameters = new LinkedHashMap<String, String>(tokenRequest.getRequestParameters());
            String client_id = parameters.get("client_id");
            String username = parameters.get("username");
            String verify_code = parameters.get("verify_code");
            if (!wlyyRedisVerifyCodeService.verification(client_id, username, verify_code)){
                throw new InvalidGrantException("Invalid verify_code");
            }
            Authentication userAuth = new UsernamePasswordAuthenticationToken(username, verify_code, getGrantedAuthorities(username));
            ((AbstractAuthenticationToken) userAuth).setDetails(parameters);
            OAuth2Request storedOAuth2Request = getRequestFactory().createOAuth2Request(client, tokenRequest);
            return new OAuth2Authentication(storedOAuth2Request, userAuth);
        }
        private Collection<? extends GrantedAuthority> getGrantedAuthorities(String username) {
            Collection<GrantedAuthority> authorities = new ArrayList<>(1);
            authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
            return authorities;
        }
    }
}

+ 60 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/client/WlyyJdbcClientRedirectUriService.java

@ -0,0 +1,60 @@
package com.yihu.jw.security.oauth2.provider.client;
import com.yihu.utils.network.IPInfoUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
 * Created by progr1mmer on 2017/9/19.
 */
public class WlyyJdbcClientRedirectUriService {
    private JdbcTemplate jdbcTemplate;
    public WlyyJdbcClientRedirectUriService(JdbcTemplate jdbcTemplate) {
        Assert.notNull(jdbcTemplate, "jdbcTemplate required");
        this.jdbcTemplate = jdbcTemplate;
    }
    public String loadValidUri (String clientId, String redirectUriParameter) {
        if (null == redirectUriParameter) {
            return redirectUriParameter;
        }
        if (redirectUriParameter.indexOf("?") != -1) {
            redirectUriParameter = redirectUriParameter.substring(0, redirectUriParameter.indexOf("?"));
        }
        Map<String, Object> redirects = loadRedirectUriByClientId(clientId);
        if (redirectUriParameter.equals(redirects.get("redirect_uri")) || redirectUriParameter.equals(redirects.get("redirect_out_uri"))) {
            return redirects.get("redirect_uri").toString();
        } else {
            return redirectUriParameter;
        }
    }
    public String loadAccessUri (String clientId, String redirectUriParameter) {
        if (redirectUriParameter != null) {
            return redirectUriParameter;
        }
        Map<String, Object> redirects = loadRedirectUriByClientId(clientId);
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String ip = IPInfoUtils.getIPAddress(request);
        boolean isInnerIp = IPInfoUtils.isInnerIP(ip);
        if (isInnerIp) {
            return (String) redirects.get("redirect_uri");
        } else {
            return redirects.get("redirect_out_uri") != null ? (String) redirects.get("redirect_out_uri") : (String) redirects.get("redirect_uri");
        }
    }
    private Map<String, Object> loadRedirectUriByClientId(String clientId) {
        String selectQuery = "select web_server_redirect_uri as redirect_uri, web_server_redirect_out_uri as redirect_out_uri from oauth_client_details where client_id = ?";
        Map<String, Object> resultMap = jdbcTemplate.queryForMap(selectQuery, clientId);
        return resultMap;
    }
}

+ 699 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyAuthorizationEndpoint.java

@ -0,0 +1,699 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.oauth2.provider.client.WlyyJdbcClientRedirectUriService;
import com.yihu.utils.network.IPInfoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextHolderStrategy;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.*;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.approval.DefaultUserApprovalHandler;
import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices;
import org.springframework.security.oauth2.provider.endpoint.*;
import org.springframework.security.oauth2.provider.implicit.ImplicitTokenRequest;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.HttpSessionRequiredException;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.support.DefaultSessionAttributeStore;
import org.springframework.web.bind.support.SessionAttributeStore;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.net.URI;
import java.security.Principal;
import java.util.*;
/**
 * authorization_code & implicit & sso Endpoint
 *
 * <p>
 * Implementation of the Authorization Endpoint from the OAuth2 specification. Accepts authorization requests, and
 * handles user approval if the grant type is authorization code. The tokens themselves are obtained from the
 * {@link WlyyTokenEndpoint Token Endpoint}, except in the implicit grant type (where they come from the Authorization
 * Endpoint via <code>response_type=token</code>.
 * {@link WlyyLoginEndpoint Login Endpoint}, in order to verify the token to obtain user information.
 *
 * </p>
 *
 * <p>
 * This endpoint should be secured so that it is only accessible to fully authenticated users (as a minimum requirement)
 * since it represents a request from a valid user to act on his or her behalf.
 * </p>
 *
 * @author Progr1mmer
 * @created on 2018/8/29.
 */
@Controller
@SessionAttributes("authorizationRequest")
public class WlyyAuthorizationEndpoint extends AbstractEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    private AuthorizationCodeServices authorizationCodeServices = new InMemoryAuthorizationCodeServices();
    private RedirectResolver redirectResolver = new DefaultRedirectResolver();
    private UserApprovalHandler userApprovalHandler = new DefaultUserApprovalHandler();
    private SessionAttributeStore sessionAttributeStore = new DefaultSessionAttributeStore();
    private OAuth2RequestValidator oauth2RequestValidator = new DefaultOAuth2RequestValidator();
    private String userApprovalPage = "forward:/oauth/confirm_access";
    private String errorPage = "forward:/oauth/error";
    private Object implicitLock = new Object();
    private TokenStore tokenStore;
    @Autowired
    private WlyyUserDetailsService userDetailsService;
    @Autowired
    private AuthorizationServerEndpointsConfiguration authorizationServerEndpointsConfiguration;
    @Autowired
    private WlyyJdbcClientRedirectUriService wlyyJdbcClientRedirectUriService;
    @PostConstruct
    private void init() {
        AuthorizationServerEndpointsConfigurer authorizationServerEndpointsConfigurer = authorizationServerEndpointsConfiguration.getEndpointsConfigurer();
        super.setTokenGranter(authorizationServerEndpointsConfigurer.getTokenGranter());
        super.setClientDetailsService(authorizationServerEndpointsConfigurer.getClientDetailsService());
        this.tokenStore = authorizationServerEndpointsConfigurer.getTokenStore();
        this.authorizationCodeServices = authorizationServerEndpointsConfigurer.getAuthorizationCodeServices();
    }
    public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
        this.sessionAttributeStore = sessionAttributeStore;
    }
    public void setErrorPage(String errorPage) {
        this.errorPage = errorPage;
    }
    @RequestMapping(value = "/oauth/authorize", method = RequestMethod.GET)
    public ModelAndView authorize(Map<String, Object> model, @RequestParam Map<String, String> parameters,
                                  SessionStatus sessionStatus, Principal principal) {
        // Pull out the authorization request first, using the OAuth2RequestFactory. All further logic should
        // query off of the authorization request instead of referring back to the parameters map. The contents of the
        // parameters map will be stored without change in the AuthorizationRequest object once it is created.
        AuthorizationRequest authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(parameters);
        /* default approve */
        authorizationRequest.setApproved(true);
        Set<String> responseTypes = authorizationRequest.getResponseTypes();
        if (!responseTypes.contains("token") && !responseTypes.contains("code")) {
            throw new UnsupportedResponseTypeException("Unsupported response types: " + responseTypes);
        }
        if (authorizationRequest.getClientId() == null) {
            throw new InvalidClientException("A client id must be provided");
        }
        try {
            if (!(principal instanceof Authentication) || !((Authentication) principal).isAuthenticated()) {
                if (parameters.containsKey("ak")) {
                    String ak = parameters.get("ak");
                    UsernamePasswordAuthenticationToken userAuth = new UsernamePasswordAuthenticationToken("admin", "cdb7df66a1955b0ed7402e665ed0586a", new ArrayList<>());
                    SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
                    securityContext.setAuthentication(userAuth);
                    SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder.getContextHolderStrategy();
                    securityContextHolderStrategy.setContext(securityContext);
                    principal = userAuth;
                } else {
                    throw new InsufficientAuthenticationException("ak must be provided.");
                }
            }
            /*if (!(principal instanceof Authentication) || !((Authentication) principal).isAuthenticated()) {
                throw new InsufficientAuthenticationException(
                        "User must be authenticated with Spring Security before authorization can be completed.");
            }*/
            ClientDetails client = getClientDetailsService().loadClientByClientId(authorizationRequest.getClientId());
            // The resolved redirect URI is either the redirect_uri from the parameters or the one from
            // clientDetails. Either way we need to store it on the AuthorizationRequest.
            String redirectUriParameter = authorizationRequest.getRequestParameters().get(OAuth2Utils.REDIRECT_URI);
            String validUrl = wlyyJdbcClientRedirectUriService.loadValidUri(authorizationRequest.getClientId(), redirectUriParameter);
            String resolvedRedirect = redirectResolver.resolveRedirect(validUrl, client);
            if (!StringUtils.hasText(resolvedRedirect)) {
                throw new RedirectMismatchException(
                        "A redirectUri must be either supplied or preconfigured in the ClientDetails");
            }
            // (customize) If redirectUriParameter is empty
            // load internal and external network ip information to redirect
            String accessUri = wlyyJdbcClientRedirectUriService.loadAccessUri(authorizationRequest.getClientId(), redirectUriParameter);
            authorizationRequest.setRedirectUri(accessUri);
            // We intentionally only validate the parameters requested by the client (ignoring any data that may have
            // been added to the request by the manager).
            oauth2RequestValidator.validateScope(authorizationRequest, client);
            // Some systems may allow for approval decisions to be remembered or approved by default. Check for
            // such logic here, and set the approved flag on the authorization request accordingly.
            authorizationRequest = userApprovalHandler.checkForPreApproval(authorizationRequest,
                    (Authentication) principal);
            // TODO: is this call necessary?
            boolean approved = userApprovalHandler.isApproved(authorizationRequest, (Authentication) principal);
            authorizationRequest.setApproved(approved);
            // Validation is all done, so we can check for auto approval...
            if (authorizationRequest.isApproved()) {
                if (responseTypes.contains("token")) {
                    return getImplicitGrantResponse(authorizationRequest);
                }
                if (responseTypes.contains("code")) {
                    return new ModelAndView(getAuthorizationCodeResponse(authorizationRequest,
                            (Authentication) principal));
                }
            }
            // Place auth request into the model so that it is stored in the session
            // for approveOrDeny to use. That way we make sure that auth request comes from the session,
            // so any auth request parameters passed to approveOrDeny will be ignored and retrieved from the session.
            model.put("authorizationRequest", authorizationRequest);
            return getUserApprovalPageResponse(model, authorizationRequest, (Authentication) principal);
        } catch (RuntimeException e) {
            sessionStatus.setComplete();
            throw e;
        }
    }
    @RequestMapping(value = "/oauth/authorize", method = RequestMethod.POST, params = OAuth2Utils.USER_OAUTH_APPROVAL)
    public View approveOrDeny(@RequestParam Map<String, String> approvalParameters, Map<String, ?> model,
                              SessionStatus sessionStatus, Principal principal) {
        if (!(principal instanceof Authentication)) {
            sessionStatus.setComplete();
            throw new InsufficientAuthenticationException(
                    "User must be authenticated with Spring Security before authorizing an access token.");
        }
        AuthorizationRequest authorizationRequest = (AuthorizationRequest) model.get("authorizationRequest");
        if (authorizationRequest == null) {
            sessionStatus.setComplete();
            throw new InvalidRequestException("Cannot approve uninitialized authorization request.");
        }
        try {
            Set<String> responseTypes = authorizationRequest.getResponseTypes();
            authorizationRequest.setApprovalParameters(approvalParameters);
            authorizationRequest = userApprovalHandler.updateAfterApproval(authorizationRequest,
                    (Authentication) principal);
            boolean approved = userApprovalHandler.isApproved(authorizationRequest, (Authentication) principal);
            authorizationRequest.setApproved(approved);
            if (authorizationRequest.getRedirectUri() == null) {
                sessionStatus.setComplete();
                throw new InvalidRequestException("Cannot approve request when no redirect URI is provided.");
            }
            if (!authorizationRequest.isApproved()) {
                return new RedirectView(getUnsuccessfulRedirect(authorizationRequest,
                        new UserDeniedAuthorizationException("User denied access"), responseTypes.contains("token")),
                        false, true, false);
            }
            if (responseTypes.contains("token")) {
                return getImplicitGrantResponse(authorizationRequest).getView();
            }
            return getAuthorizationCodeResponse(authorizationRequest, (Authentication) principal);
        }
        finally {
            sessionStatus.setComplete();
        }
    }
    @RequestMapping(value = "/oauth/sso", method = RequestMethod.GET)
    public ModelAndView sso(Map<String, Object> model, @RequestParam Map<String, String> parameters,
                                  SessionStatus sessionStatus, Principal principal) {
        // Pull out the authorization request first, using the OAuth2RequestFactory. All further logic should
        // query off of the authorization request instead of referring back to the parameters map. The contents of the
        // parameters map will be stored without change in the AuthorizationRequest object once it is created.
        AuthorizationRequest authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(parameters);
        /* default approve */
        authorizationRequest.setApproved(true);
        Set<String> responseTypes = authorizationRequest.getResponseTypes();
        /* Does not accept code type verification */
        if (!responseTypes.contains("token")) {
            throw new UnsupportedResponseTypeException("Unsupported response types: " + responseTypes);
        }
        /*if (!responseTypes.contains("token") && !responseTypes.contains("code")) {
            throw new UnsupportedResponseTypeException("Unsupported response types: " + responseTypes);
        }*/
        if (authorizationRequest.getClientId() == null) {
            throw new InvalidClientException("A client id must be provided");
        }
        try {
            /*
             * load verification information by token
             */
            if (!(principal instanceof Authentication) || !((Authentication) principal).isAuthenticated()) {
                if (parameters.containsKey("access_token")) {
                    String token = parameters.get("access_token");
                    OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token);
                    if (null == oAuth2AccessToken) {
                        throw new InvalidTokenException("Invalid access_token");
                    }
                    if (oAuth2AccessToken.isExpired()) {
                        throw new InvalidTokenException("Expired accessToken");
                    }
                    OAuth2Authentication authentication = tokenStore.readAuthentication(token);
                    if (authentication != null) {
                        String userName = authentication.getName();
                        UserDetails userDetails = userDetailsService.loadUserByUsername(userName);
                        UsernamePasswordAuthenticationToken userAuth = new UsernamePasswordAuthenticationToken(userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities());
                        SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
                        securityContext.setAuthentication(userAuth);
                        SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder.getContextHolderStrategy();
                        securityContextHolderStrategy.setContext(securityContext);
                        principal = userAuth;
                    } else {
                        throw new InvalidTokenException("Cant not load authentication");
                    }
                } else {
                    throw new InvalidRequestException("access_token must be provided.");
                }
            }
            ClientDetails client = getClientDetailsService().loadClientByClientId(authorizationRequest.getClientId());
            // The resolved redirect URI is either the redirect_uri from the parameters or the one from
            // clientDetails. Either way we need to store it on the AuthorizationRequest.
            String redirectUriParameter = authorizationRequest.getRequestParameters().get(OAuth2Utils.REDIRECT_URI);
            String validUrl = wlyyJdbcClientRedirectUriService.loadValidUri(authorizationRequest.getClientId(), redirectUriParameter);
            String resolvedRedirect = redirectResolver.resolveRedirect(validUrl, client);
            if (!StringUtils.hasText(resolvedRedirect)) {
                throw new RedirectMismatchException(
                        "A redirectUri must be either supplied or preconfigured in the ClientDetails");
            }
            // (customize) If redirectUriParameter is empty
            // load internal and external network ip information to redirect
            String accessUri = wlyyJdbcClientRedirectUriService.loadAccessUri(authorizationRequest.getClientId(), redirectUriParameter);
            authorizationRequest.setRedirectUri(accessUri);
            // We intentionally only validate the parameters requested by the client (ignoring any data that may have
            // been added to the request by the manager).
            oauth2RequestValidator.validateScope(authorizationRequest, client);
            // Some systems may allow for approval decisions to be remembered or approved by default. Check for
            // such logic here, and set the approved flag on the authorization request accordingly.
            authorizationRequest = userApprovalHandler.checkForPreApproval(authorizationRequest,
                    (Authentication) principal);
            // TODO: is this call necessary?
            boolean approved = userApprovalHandler.isApproved(authorizationRequest, (Authentication) principal);
            authorizationRequest.setApproved(approved);
            // Validation is all done, so we can check for auto approval...
            if (authorizationRequest.isApproved()) {
                if (responseTypes.contains("token")) {
                    return getImplicitGrantResponse(authorizationRequest);
                }
                if (responseTypes.contains("code")) {
                    return new ModelAndView(getAuthorizationCodeResponse(authorizationRequest,
                            (Authentication) principal));
                }
            }
            // Place auth request into the model so that it is stored in the session
            // for approveOrDeny to use. That way we make sure that auth request comes from the session,
            // so any auth request parameters passed to approveOrDeny will be ignored and retrieved from the session.
            model.put("authorizationRequest", authorizationRequest);
            return getUserApprovalPageResponse(model, authorizationRequest, (Authentication) principal);
        } catch (RuntimeException e) {
            sessionStatus.setComplete();
            throw e;
        }
    }
    // We need explicit approval from the user.
    private ModelAndView getUserApprovalPageResponse(Map<String, Object> model,
                                                     AuthorizationRequest authorizationRequest, Authentication principal) {
        LOG.debug("Loading user approval page: " + userApprovalPage);
        model.putAll(userApprovalHandler.getUserApprovalRequest(authorizationRequest, principal));
        return new ModelAndView(userApprovalPage, model);
    }
    // We can grant a token and return it with implicit approval.
    private ModelAndView getImplicitGrantResponse(AuthorizationRequest authorizationRequest) {
        try {
            TokenRequest tokenRequest = getOAuth2RequestFactory().createTokenRequest(authorizationRequest, "implicit");
            OAuth2Request storedOAuth2Request = getOAuth2RequestFactory().createOAuth2Request(authorizationRequest);
            OAuth2AccessToken accessToken = getAccessTokenForImplicitGrant(tokenRequest, storedOAuth2Request);
            if (accessToken == null) {
                throw new UnsupportedResponseTypeException("Unsupported response type: token");
            }
            return new ModelAndView(new RedirectView(appendAccessToken(authorizationRequest, accessToken), false, true,
                    false));
        }
        catch (OAuth2Exception e) {
            return new ModelAndView(new RedirectView(getUnsuccessfulRedirect(authorizationRequest, e, true), false,
                    true, false));
        }
    }
    private OAuth2AccessToken getAccessTokenForImplicitGrant(TokenRequest tokenRequest,
                                                             OAuth2Request storedOAuth2Request) {
        OAuth2AccessToken accessToken = null;
        // These 1 method calls have to be atomic, otherwise the ImplicitGrantService can have a race condition where
        // one thread removes the token request before another has a chance to redeem it.
        synchronized (this.implicitLock) {
            accessToken = getTokenGranter().grant("implicit",
                    new ImplicitTokenRequest(tokenRequest, storedOAuth2Request));
        }
        return accessToken;
    }
    private View getAuthorizationCodeResponse(AuthorizationRequest authorizationRequest, Authentication authUser) {
        try {
            return new RedirectView(getSuccessfulRedirect(authorizationRequest,
                    generateCode(authorizationRequest, authUser)), false, true, false);
        }
        catch (OAuth2Exception e) {
            return new RedirectView(getUnsuccessfulRedirect(authorizationRequest, e, false), false, true, false);
        }
    }
    private String appendAccessToken(AuthorizationRequest authorizationRequest, OAuth2AccessToken accessToken) {
        Map<String, Object> vars = new LinkedHashMap<String, Object>();
        Map<String, String> keys = new HashMap<String, String>();
        if (accessToken == null) {
            throw new InvalidRequestException("An implicit grant could not be made");
        }
        vars.put("accessToken", accessToken.getValue());
        vars.put("tokenType", accessToken.getTokenType());
        String state = authorizationRequest.getState();
        if (state != null) {
            vars.put("state", state);
        }
        Date expiration = accessToken.getExpiration();
        if (expiration != null) {
            long expires_in = (expiration.getTime() - System.currentTimeMillis()) / 1000;
            vars.put("expiresIn", expires_in);
        }
        String originalScope = authorizationRequest.getRequestParameters().get(OAuth2Utils.SCOPE);
        if (originalScope == null || !OAuth2Utils.parseParameterList(originalScope).equals(accessToken.getScope())) {
            vars.put("scope", OAuth2Utils.formatParameterList(accessToken.getScope()));
        }
        Map<String, Object> additionalInformation = accessToken.getAdditionalInformation();
        for (String key : additionalInformation.keySet()) {
            Object value = additionalInformation.get(key);
            if (value != null) {
                keys.put("extra_" + key, key);
                vars.put("extra_" + key, value);
            }
        }
        // Do not include the refresh token (even if there is one)
        return append(authorizationRequest.getRedirectUri(), vars, keys, true);
    }
    private String generateCode(AuthorizationRequest authorizationRequest, Authentication authentication)
            throws AuthenticationException {
        try {
            OAuth2Request storedOAuth2Request = getOAuth2RequestFactory().createOAuth2Request(authorizationRequest);
            OAuth2Authentication combinedAuth = new OAuth2Authentication(storedOAuth2Request, authentication);
            String code = authorizationCodeServices.createAuthorizationCode(combinedAuth);
            return code;
        }
        catch (OAuth2Exception e) {
            if (authorizationRequest.getState() != null) {
                e.addAdditionalInformation("state", authorizationRequest.getState());
            }
            throw e;
        }
    }
    private String getSuccessfulRedirect(AuthorizationRequest authorizationRequest, String authorizationCode) {
        if (authorizationCode == null) {
            throw new IllegalStateException("No authorization code found in the current request scope.");
        }
        Map<String, String> query = new LinkedHashMap<String, String>();
        query.put("code", authorizationCode);
        String state = authorizationRequest.getState();
        if (state != null) {
            query.put("state", state);
        }
        return append(authorizationRequest.getRedirectUri(), query, false);
    }
    private String getUnsuccessfulRedirect(AuthorizationRequest authorizationRequest, OAuth2Exception failure,
                                           boolean fragment) {
        if (authorizationRequest == null || authorizationRequest.getRedirectUri() == null) {
            // we have no redirect for the user. very sad.
            throw new UnapprovedClientAuthenticationException("Authorization failure, and no redirect URI.", failure);
        }
        Map<String, String> query = new LinkedHashMap<String, String>();
        query.put("error", failure.getOAuth2ErrorCode());
        query.put("error_description", failure.getMessage());
        if (authorizationRequest.getState() != null) {
            query.put("state", authorizationRequest.getState());
        }
        if (failure.getAdditionalInformation() != null) {
            for (Map.Entry<String, String> additionalInfo : failure.getAdditionalInformation().entrySet()) {
                query.put(additionalInfo.getKey(), additionalInfo.getValue());
            }
        }
        return append(authorizationRequest.getRedirectUri(), query, fragment);
    }
    private String append(String base, Map<String, ?> query, boolean fragment) {
        return append(base, query, null, fragment);
    }
    private String append(String base, Map<String, ?> query, Map<String, String> keys, boolean fragment) {
        UriComponentsBuilder template = UriComponentsBuilder.newInstance();
        UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(base);
        URI redirectUri;
        try {
            // assume it's encoded to start with (if it came in over the wire)
            redirectUri = builder.build(true).toUri();
        }
        catch (Exception e) {
            // ... but allow client registrations to contain hard-coded non-encoded values
            redirectUri = builder.build().toUri();
            builder = UriComponentsBuilder.fromUri(redirectUri);
        }
        template.scheme(redirectUri.getScheme()).port(redirectUri.getPort()).host(redirectUri.getHost())
                .userInfo(redirectUri.getUserInfo()).path(redirectUri.getPath());
        if (fragment) {
            StringBuilder values = new StringBuilder();
            if (redirectUri.getFragment() != null) {
                String append = redirectUri.getFragment();
                values.append(append);
            }
            for (String key : query.keySet()) {
                if (values.length() > 0) {
                    values.append("&");
                }
                String name = key;
                if (keys != null && keys.containsKey(key)) {
                    name = keys.get(key);
                }
                values.append(name + "={" + key + "}");
            }
            if (values.length() > 0) {
                template.fragment(values.toString());
            }
            UriComponents encoded = template.build().expand(query).encode();
            builder.fragment(encoded.getFragment());
        }
        else {
            for (String key : query.keySet()) {
                String name = key;
                if (keys != null && keys.containsKey(key)) {
                    name = keys.get(key);
                }
                template.queryParam(name, "{" + key + "}");
            }
            template.fragment(redirectUri.getFragment());
            UriComponents encoded = template.build().expand(query).encode();
            builder.query(encoded.getQuery());
        }
        return builder.build().toUriString();
    }
    public void setUserApprovalPage(String userApprovalPage) {
        this.userApprovalPage = userApprovalPage;
    }
    public void setAuthorizationCodeServices(AuthorizationCodeServices authorizationCodeServices) {
        this.authorizationCodeServices = authorizationCodeServices;
    }
    public void setRedirectResolver(RedirectResolver redirectResolver) {
        this.redirectResolver = redirectResolver;
    }
    public void setUserApprovalHandler(UserApprovalHandler userApprovalHandler) {
        this.userApprovalHandler = userApprovalHandler;
    }
    public void setOAuth2RequestValidator(OAuth2RequestValidator oauth2RequestValidator) {
        this.oauth2RequestValidator = oauth2RequestValidator;
    }
    @SuppressWarnings("deprecation")
    public void setImplicitGrantService(
            org.springframework.security.oauth2.provider.implicit.ImplicitGrantService implicitGrantService) {
    }
    @ExceptionHandler(Exception.class)
    public ModelAndView handleGlobalException(Exception e) throws Exception {
        LOG.info(e.getMessage(), e);
        return new ModelAndView(errorPage, Collections.singletonMap("error", new OAuth2Exception(e.getMessage(), e)));
    }
    /*@ExceptionHandler(ClientRegistrationException.class)
    public ModelAndView handleClientRegistrationException(Exception e, ServletWebRequest webRequest) throws Exception {
        LOG.info("Handling ClientRegistrationException error: " + e.getMessage());
        return handleException(new BadClientCredentialsException(), webRequest);
    }
    @ExceptionHandler(OAuth2Exception.class)
    public ModelAndView handleOAuth2Exception(OAuth2Exception e, ServletWebRequest webRequest) throws Exception {
        LOG.info("Handling OAuth2 error: " + e.getSummary());
        return handleException(e, webRequest);
    }
    @ExceptionHandler(HttpSessionRequiredException.class)
    public ModelAndView handleHttpSessionRequiredException(HttpSessionRequiredException e, ServletWebRequest webRequest)
            throws Exception {
        LOG.info("Handling Session required error: " + e.getMessage());
        return handleException(new AccessDeniedException("Could not obtain authorization request from session", e),
                webRequest);
    }*/
    private ModelAndView handleException(Exception e, ServletWebRequest webRequest) throws Exception {
        ResponseEntity<OAuth2Exception> translate = getExceptionTranslator().translate(e);
        webRequest.getResponse().setStatus(translate.getStatusCode().value());
        if (e instanceof ClientAuthenticationException || e instanceof RedirectMismatchException) {
            return new ModelAndView(errorPage, Collections.singletonMap("error", translate.getBody()));
        }
        AuthorizationRequest authorizationRequest = null;
        try {
            authorizationRequest = getAuthorizationRequestForError(webRequest);
            String requestedRedirectParam = authorizationRequest.getRequestParameters().get(OAuth2Utils.REDIRECT_URI);
            String requestedRedirect = redirectResolver.resolveRedirect(requestedRedirectParam,
                    getClientDetailsService().loadClientByClientId(authorizationRequest.getClientId()));
            authorizationRequest.setRedirectUri(requestedRedirect);
            String redirect = getUnsuccessfulRedirect(authorizationRequest, translate.getBody(), authorizationRequest
                    .getResponseTypes().contains("token"));
            return new ModelAndView(new RedirectView(redirect, false, true, false));
        }
        catch (OAuth2Exception ex) {
            // If an AuthorizationRequest cannot be created from the incoming parameters it must be
            // an error. OAuth2Exception can be handled this way. Other exceptions will generate a standard 500
            // response.
            return new ModelAndView(errorPage, Collections.singletonMap("error", translate.getBody()));
        }
    }
    private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) {
        // If it's already there then we are in the approveOrDeny phase and we can use the saved request
        AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore.retrieveAttribute(
                webRequest, "authorizationRequest");
        if (authorizationRequest != null) {
            return authorizationRequest;
        }
        Map<String, String> parameters = new HashMap<String, String>();
        Map<String, String[]> map = webRequest.getParameterMap();
        for (String key : map.keySet()) {
            String[] values = map.get(key);
            if (values != null && values.length > 0) {
                parameters.put(key, values[0]);
            }
        }
        try {
            return getOAuth2RequestFactory().createAuthorizationRequest(parameters);
        }
        catch (Exception e) {
            return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters);
        }
    }
}

+ 336 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -0,0 +1,336 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.model.Oauth2Envelop;
import com.yihu.jw.security.model.WlyyUserSimple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.*;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint;
import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
/**
 * <p>
 * Endpoint for default login verify and sso login token verify
 * will return the user's basic information and token certificate
 * </p>
 *
 * @author Progr1mmer
 * @created on 2018/8/29.
 */
@RestController
public class WlyyLoginEndpoint extends AbstractEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    private OAuth2RequestFactory oAuth2RequestFactory;
    private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private ClientDetailsService clientDetailsService;
    @Autowired
    private WlyyTokenGranter tokenGranter;
    @Autowired
    private WlyyOAuth2ExceptionTranslator wlyyOAuth2ExceptionTranslator;
    @Autowired
    private RedisTokenStore tokenStore;
    @Autowired
    private WlyyUserDetailsService userDetailsService;
    @Autowired
    private WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
    @Autowired
    private ObjectMapper objectMapper;
    @PostConstruct
    private void init() {
        super.setTokenGranter(tokenGranter);
    }
    @RequestMapping(value = "/oauth/login", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> login(@RequestParam Map<String, String> parameters) {
        String client_id = parameters.get("client_id");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(parameters.get("verify_code"))) {
            parameters.put("grant_type", "password");
        } else {
            parameters.put("grant_type", "verify_code");
        }
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        if (authenticatedClient != null) {
            oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        }
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
            tokenStore.removeAccessToken(token.getValue());
            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        }
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        return getResponse(wlyyUserSimple);
    }
    @RequestMapping(value = "/oauth/sso", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> sso(@RequestParam Map<String, String> parameters) {
        String clientId = parameters.get("client_id");
        String accessToken = parameters.get("access_token");
        if (StringUtils.isEmpty(clientId)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(accessToken)) {
            throw new InvalidRequestException("access_token");
        }
        OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(accessToken);
        if (null == oAuth2AccessToken) {
            throw new InvalidTokenException("Invalid access_token");
        }
        if (oAuth2AccessToken.isExpired()) {
            throw new InvalidTokenException("Expired accessToken");
        }
        OAuth2Authentication authentication = tokenStore.readAuthentication(accessToken);
        if (null == authentication) {
            throw new InvalidTokenException("Cant not load authentication");
        }
        String _clientId = authentication.getOAuth2Request().getClientId();
        if (!clientId.equals(_clientId)) {
            throw new InvalidTokenException("Provided token does not belong to the request client");
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(authentication.getName());
        wlyyUserSimple.setAccessToken(oAuth2AccessToken.getValue());
        wlyyUserSimple.setTokenType(oAuth2AccessToken.getTokenType());
        wlyyUserSimple.setExpiresIn(oAuth2AccessToken.getExpiresIn());
        wlyyUserSimple.setRefreshToken(oAuth2AccessToken.getRefreshToken().getValue());
        wlyyUserSimple.setUser(authentication.getName());
        wlyyUserSimple.setState(parameters.get("state"));
        return getResponse(wlyyUserSimple);
    }
    @RequestMapping(value = "/oauth/logout", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop> logout(@RequestParam Map<String, String> parameters, HttpServletRequest request) {
        String token = request.getHeader("token");
        if (null == token) {
            token = parameters.get("token");
        }
        OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token);
        if (oAuth2AccessToken != null) {
            tokenStore.removeAccessToken(oAuth2AccessToken.getValue());
            tokenStore.removeRefreshToken(oAuth2AccessToken.getRefreshToken().getValue());
        }
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        Oauth2Envelop oauth2Envelop = new Oauth2Envelop("logout", 200);
        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
    }
    /*@RequestMapping(value = ServiceApi.Authentication.VerifyCode, method = RequestMethod.POST)
    public ResponseEntity<Envelop> verifyCode(@RequestParam Map<String, String> parameters) throws  Exception{
        Envelop envelop = new Envelop();
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(username)){
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg("手机号码【"+username+"】不能为空!");
            return new ResponseEntity<>(envelop, headers, HttpStatus.OK);
        }
        VerifyCode verifyCode = new VerifyCode();
        //手机短信验证码
        RandomUtil randomUtil = new RandomUtil();
        String random = randomUtil.getRandomString(6);
        //发送短信
        String api = "MsgGW.Sms.send";
        String content = "尊敬的用户:欢迎使用健康上饶,您的验证码为:【" + random + "】,有效期10分钟,请尽快完成注册。若非本人操作,请忽略。";
        Map<String, String> apiParamMap = new HashMap<>();
        //手机号码
        apiParamMap.put("mobile", username);
        //业务标签
        apiParamMap.put("handlerId", fzHandlerId);
        //短信内容
        apiParamMap.put("content", content);
        //渠道号
        apiParamMap.put("clientId", fzClientId);
        String result = null;
        Envelop resultEnvelop = fzApiClient.fzInnerApi(api, objectMapper.writeValueAsString(apiParamMap), 1);
        if (resultEnvelop.isSuccessFlg()) {
            result = resultEnvelop.getObj().toString();
        }
        if (!StringUtils.isEmpty(result)) {
            Map<String, Object> resultMap = objectMapper.readValue(result, Map.class);
            Integer resultCode = 0;
            if (null != resultMap.get("Code") && !"".equals(resultMap.get("Code"))) {
                resultCode = Integer.valueOf(resultMap.get("Code").toString());
            }
            if (resultCode == 10000) {
                verifyCode.setExpiresIn(600);
                verifyCode.setNextRequestTime(60);
                //验证码有效期
                ehrRedisVerifyCodeService.store(client_id, username, random, 600000);
                envelop.setSuccessFlg(true);
                envelop.setObj(verifyCode);
            } else if(resultCode == -201){
                envelop.setSuccessFlg(false);
                envelop.setErrorCode(resultCode);
                envelop.setErrorMsg("短信已达每天限制的次数(10次)!");
            } else if(resultCode == -200){
                envelop.setSuccessFlg(false);
                envelop.setErrorCode(resultCode);
                envelop.setErrorMsg("短信发送频率太快(不能低于60s)!");
            } else {
                envelop.setSuccessFlg(false);
                envelop.setErrorCode(resultCode);
                envelop.setErrorMsg("短信验证码发送失败!");
            }
        } else {
            envelop.setSuccessFlg(false);
            envelop.setErrorCode(ErrorCode.REQUEST_NOT_COMPLETED.value());
            envelop.setErrorMsg("短信验证码发送失败!");
        }
        return new ResponseEntity<>(envelop, headers, HttpStatus.OK);
    }
    @RequestMapping(value = ServiceApi.Authentication.VerifyCodeExpire, method = RequestMethod.POST)
    public ResponseEntity<VerifyCode> verifyCodeExpire(@RequestParam Map<String, String> parameters) {
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        VerifyCode verifyCode = new VerifyCode();
        int expiresIn = ehrRedisVerifyCodeService.getExpireTime(client_id, username);
        int nextRequestTime = 60 + (expiresIn - 600 ) > 0 ? 60 + (expiresIn - 600 ) : 0;
        verifyCode.setNextRequestTime(nextRequestTime);
        verifyCode.setExpiresIn(expiresIn);
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        return new ResponseEntity<>(verifyCode, headers, HttpStatus.OK);
    }
    @RequestMapping(value = ServiceApi.Authentication.VerifyCodeValidate, method = RequestMethod.POST)
    public ResponseEntity<Envelop> verifyCodeValidate(@RequestParam Map<String, String> parameters) throws  Exception{
        Envelop envelop = new Envelop();
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        String verifyCode = parameters.get("verify_code");
        if (StringUtils.isEmpty(verifyCode)){
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg("验证码不能为空!");
            return new ResponseEntity<>(envelop, headers, HttpStatus.OK);
        }
        boolean _verify = ehrRedisVerifyCodeService.verification(client_id, username, verifyCode);
        if (_verify){
            envelop.setSuccessFlg(true);
        } else {
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg("请输入正确的验证码!");
        }
        return new ResponseEntity<>(envelop, headers, HttpStatus.OK);
    }*/
    @Override
    protected TokenGranter getTokenGranter() {
        return this.tokenGranter;
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        Assert.state(clientDetailsService != null, "ClientDetailsService must be provided");
        Assert.state(authenticationManager != null, "AuthenticationManager must be provided");
        oAuth2RequestFactory = new DefaultOAuth2RequestFactory(clientDetailsService);
    }
    private ResponseEntity<Oauth2Envelop<WlyyUserSimple>> getResponse(WlyyUserSimple ehrUserSimple) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        Oauth2Envelop<WlyyUserSimple> oauth2Envelop = new Oauth2Envelop<>("login", 200, ehrUserSimple);
        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
    }
    @Override
    protected WebResponseExceptionTranslator getExceptionTranslator() {
        return wlyyOAuth2ExceptionTranslator;
    }
   @ExceptionHandler(Exception.class)
    public ResponseEntity<Oauth2Envelop> handleException(Exception e) throws Exception {
        LOG.info(e.getMessage(), e);
        if (e instanceof UsernameNotFoundException) {
            return handleOAuth2Exception(new Oauth2Envelop("用户未注册!", HttpStatus.UNAUTHORIZED.value()));
        } else if (e instanceof NoSuchClientException) {
            return handleOAuth2Exception(new Oauth2Envelop("应用未注册!", HttpStatus.UNAUTHORIZED.value()));
        } else if (e instanceof InvalidGrantException) {
            if (e.getMessage().equals("verify_code")) {
                return handleOAuth2Exception(new Oauth2Envelop("验证码有误!", HttpStatus.UNAUTHORIZED.value()));
            }
            return handleOAuth2Exception(new Oauth2Envelop("密码有误!", HttpStatus.UNAUTHORIZED.value()));
        } else if (e instanceof InvalidTokenException) {
            return handleOAuth2Exception(new Oauth2Envelop("Token有误!", HttpStatus.UNAUTHORIZED.value()));
        } else if (e instanceof InvalidRequestException) {
            return handleOAuth2Exception(new Oauth2Envelop("参数" + e.getMessage() + "缺失!", HttpStatus.UNAUTHORIZED.value()));
        }
        return handleOAuth2Exception(new Oauth2Envelop(e.getMessage(), -1));
    }
    private ResponseEntity<Oauth2Envelop> handleOAuth2Exception(Oauth2Envelop authenticationFailed) throws IOException {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        headers.set("WWW-Authenticate", String.format("%s %s", OAuth2AccessToken.BEARER_TYPE, authenticationFailed.getMessage()));
        ResponseEntity<Oauth2Envelop> response = new ResponseEntity<>(authenticationFailed, headers, HttpStatus.OK);
        return response;
    }
}

+ 254 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyTokenEndpoint.java

@ -0,0 +1,254 @@
/*
 * Copyright (c) 2015 MONKEYK Information Technology Co. Ltd
 * www.monkeyk.com
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * MONKEYK Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with MONKEYK Information Technology Co. Ltd.
 */
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.yihu.jw.security.model.Oauth2Envelop;
import com.yihu.jw.security.oauth2.common.WlyyOAuth2AccessToken;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.*;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.util.StringUtils;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.security.Principal;
import java.util.*;
/**
 * <p>
 * Endpoint for token requests as described in the OAuth2 spec. Clients post requests with a <code>grant_type</code>
 * parameter (e.g. "authorization_code") and other parameters as determined by the grant type. Supported grant types are
 * handled by the provided {@link com.yihu.jw.security.oauth2.provider.WlyyTokenGranter token
 * granter}.
 * </p>
 *
 * <p>
 * Clients must be authenticated using a Spring Security {@link Authentication} to access this endpoint, and the client
 * id is extracted from the authentication token. The best way to arrange this (as per the OAuth2 spec) is to use HTTP
 * basic authentication for this endpoint with standard Spring Security support.
 * </p>
 *
 * @author Progr1mmer
 * @created on 2018/8/29.
 */
@RestController
public class WlyyTokenEndpoint extends AbstractEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    @Autowired
    private WlyyTokenGranter tokenGranter;
    @Autowired
    private ClientDetailsService clientDetailsService;
    private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
    private Set<HttpMethod> allowedRequestMethods = new HashSet<>(Arrays.asList(HttpMethod.POST));
    @PostConstruct
    private void init() {
        super.setTokenGranter(tokenGranter);
        super.setClientDetailsService(clientDetailsService);
    }
    @RequestMapping(value = "/oauth/token", method=RequestMethod.GET)
    public ResponseEntity<WlyyOAuth2AccessToken> getAccessToken(@RequestParam
            Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
        if (!allowedRequestMethods.contains(HttpMethod.GET)) {
            throw new HttpRequestMethodNotSupportedException("GET");
        }
        return postAccessToken(parameters);
    }
    @RequestMapping(value = "/oauth/token", method=RequestMethod.POST)
    public ResponseEntity<WlyyOAuth2AccessToken> postAccessToken(@RequestParam Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
        String clientId = getClientId(parameters);
        if (StringUtils.isEmpty(clientId)) {
            throw new InvalidClientException("Missing clientId");
        }
        ClientDetails authenticatedClient = getClientDetailsService().loadClientByClientId(clientId);
        TokenRequest tokenRequest = getOAuth2RequestFactory().createTokenRequest(parameters, authenticatedClient);
        /*
         * customize
         * skip this step
         */
        /*if (clientId != null && !clientId.equals("")) {
            // Only validate the client details if a client authenticated during this
            // request.
            if (!clientId.equals(tokenRequest.getClientId())) {
                // double check to make sure that the client ID in the token request is the same as that in the
                // authenticated client
                throw new InvalidClientException("Given client ID does not match authenticated client");
            }
        }*/
        if (authenticatedClient != null) {
            oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        }
        if (!StringUtils.hasText(tokenRequest.getGrantType())) {
            throw new InvalidRequestException("Missing grant type");
        }
        if (tokenRequest.getGrantType().equals("implicit")) {
            throw new InvalidGrantException("Implicit grant type not supported from token endpoint");
        }
        if (isAuthCodeRequest(parameters)) {
            // The scope was requested or determined during the authorization step
            if (!tokenRequest.getScope().isEmpty()) {
                logger.debug("Clearing scope of incoming token request");
                tokenRequest.setScope(Collections.<String> emptySet());
            }
        }
        if (isRefreshTokenRequest(parameters)) {
            // A refresh token has its own default scopes, so we should ignore any added by the factory here.
            tokenRequest.setScope(OAuth2Utils.parseParameterList(parameters.get(OAuth2Utils.SCOPE)));
        }
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        // customize ---------------------------------
        WlyyOAuth2AccessToken wlyyOAuth2AccessToken = new WlyyOAuth2AccessToken();
        wlyyOAuth2AccessToken.setAccessToken(token.getValue());
        wlyyOAuth2AccessToken.setTokenType(token.getTokenType());
        wlyyOAuth2AccessToken.setExpiresIn(token.getExpiresIn());
        wlyyOAuth2AccessToken.setRefreshToken(token.getRefreshToken().getValue());
        wlyyOAuth2AccessToken.setScope(org.apache.commons.lang.StringUtils.join(token.getScope(), " "));
        wlyyOAuth2AccessToken.setState(parameters.get("state"));
        // customize ---------------------------------
        return getResponse(wlyyOAuth2AccessToken);
    }
    /**
     * @param principal the currently authentication principal
     * @return a client id if there is one in the principal
     */
    @Deprecated
    protected String getClientId(Principal principal) {
        Authentication client = (Authentication) principal;
        if (!client.isAuthenticated()) {
            throw new InsufficientAuthenticationException("The client is not authenticated.");
        }
        String clientId = client.getName();
        if (client instanceof OAuth2Authentication) {
            // Might be a client and user combined authentication
            clientId = ((OAuth2Authentication) client).getOAuth2Request().getClientId();
        }
        return clientId;
    }
    /**
     * @param parameters the request parameters (omit the basic certification)
     * @return a client id if there is one in the principal
     */
    protected String getClientId(Map<String, String> parameters) {
        return parameters.get("client_id");
    }
    /*@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
    public ResponseEntity<OAuth2Exception> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) throws Exception {
        logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage());
        return getExceptionTranslator().translate(e);
    }
    @ExceptionHandler(Exception.class)
    public ResponseEntity<OAuth2Exception> handleException(Exception e) throws Exception {
        logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage());
        return getExceptionTranslator().translate(e);
    }
    @ExceptionHandler(ClientRegistrationException.class)
    public ResponseEntity<OAuth2Exception> handleClientRegistrationException(Exception e) throws Exception {
        logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage());
        return getExceptionTranslator().translate(new BadClientCredentialsException());
    }
    @ExceptionHandler(OAuth2Exception.class)
    public ResponseEntity<OAuth2Exception> handleException(OAuth2Exception e) throws Exception {
        logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage());
        return getExceptionTranslator().translate(e);
    }*/
    /**
     * (customize)
     * @param e
     * @return
     * @throws Exception
     */
    @ExceptionHandler(Exception.class)
    public ResponseEntity<Oauth2Envelop> handleException(Exception e) throws Exception {
        LOG.info(e.getMessage(), e);
        return handleOAuth2Exception(new Oauth2Envelop(e.getMessage(), -1));
    }
    private ResponseEntity<WlyyOAuth2AccessToken> getResponse(WlyyOAuth2AccessToken accessToken) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        return new ResponseEntity<>(accessToken, headers, HttpStatus.OK);
    }
    /**
     * customize
     * return results directly
     * @param authenticationFailed
     * @return
     * @throws IOException
     */
    private ResponseEntity<Oauth2Envelop> handleOAuth2Exception(Oauth2Envelop authenticationFailed) throws IOException {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        headers.set("WWW-Authenticate", String.format("%s %s", OAuth2AccessToken.BEARER_TYPE, authenticationFailed.getMessage()));
        ResponseEntity<Oauth2Envelop> response = new ResponseEntity<>(authenticationFailed, headers, HttpStatus.OK);
        return response;
    }
    private boolean isRefreshTokenRequest(Map<String, String> parameters) {
        return "refresh_token".equals(parameters.get("grant_type")) && parameters.get("refresh_token") != null;
    }
    private boolean isAuthCodeRequest(Map<String, String> parameters) {
        return "authorization_code".equals(parameters.get("grant_type")) && parameters.get("code") != null;
    }
    public void setOAuth2RequestValidator(OAuth2RequestValidator oAuth2RequestValidator) {
        this.oAuth2RequestValidator = oAuth2RequestValidator;
    }
    public void setAllowedRequestMethods(Set<HttpMethod> allowedRequestMethods) {
        this.allowedRequestMethods = allowedRequestMethods;
    }
}

+ 148 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/error/WlyyOAuth2ExceptionTranslator.java

@ -0,0 +1,148 @@
package com.yihu.jw.security.oauth2.provider.error;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.oauth2.common.DefaultThrowableAnalyzer;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.InsufficientScopeException;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
import org.springframework.security.web.util.ThrowableAnalyzer;
import org.springframework.stereotype.Component;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import java.io.IOException;
/**
 * OAuth2异常转换
 */
@Component
public class WlyyOAuth2ExceptionTranslator implements WebResponseExceptionTranslator {
    private ThrowableAnalyzer throwableAnalyzer = new DefaultThrowableAnalyzer();
    public ResponseEntity<OAuth2Exception> translate(Exception e) throws Exception {
        // Try to extract a SpringSecurityException from the stacktrace
        Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e);
        Exception ase = (OAuth2Exception) throwableAnalyzer.getFirstThrowableOfType(
                OAuth2Exception.class, causeChain);
        if (ase != null) {
            return handleOAuth2Exception((OAuth2Exception) ase);
        }
        ase = (AuthenticationException) throwableAnalyzer.getFirstThrowableOfType(AuthenticationException.class,
                causeChain);
        if (ase != null) {
            return handleOAuth2Exception(new UnauthorizedException(e.getMessage(), e));
        }
        ase = (AccessDeniedException) throwableAnalyzer
                .getFirstThrowableOfType(AccessDeniedException.class, causeChain);
        if (ase instanceof AccessDeniedException) {
            return handleOAuth2Exception(new ForbiddenException(ase.getMessage(), ase));
        }
        ase = (HttpRequestMethodNotSupportedException) throwableAnalyzer
                .getFirstThrowableOfType(HttpRequestMethodNotSupportedException.class, causeChain);
        if (ase instanceof HttpRequestMethodNotSupportedException) {
            return handleOAuth2Exception(new MethodNotAllowed(ase.getMessage(), ase));
        }
        return handleOAuth2Exception(new ServerErrorException(e.getMessage(), e));
    }
    private ResponseEntity<OAuth2Exception> handleOAuth2Exception(OAuth2Exception e) throws IOException {
        int status = e.getHttpErrorCode();
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        if (status == HttpStatus.UNAUTHORIZED.value() || (e instanceof InsufficientScopeException)) {
            headers.set("WWW-Authenticate", String.format("%s %s", OAuth2AccessToken.BEARER_TYPE, e.getSummary()));
        }
        ResponseEntity<OAuth2Exception> response = new ResponseEntity<>(e, headers,
                HttpStatus.valueOf(status));
        return response;
    }
    public void setThrowableAnalyzer(ThrowableAnalyzer throwableAnalyzer) {
        this.throwableAnalyzer = throwableAnalyzer;
    }
    @SuppressWarnings("serial")
    private static class ForbiddenException extends OAuth2Exception {
        public ForbiddenException(String msg, Throwable t) {
            super(msg, t);
        }
        public String getOAuth2ErrorCode() {
            return "access_denied";
        }
        public int getHttpErrorCode() {
            return 403;
        }
    }
    @SuppressWarnings("serial")
    private static class ServerErrorException extends OAuth2Exception {
        public ServerErrorException(String msg, Throwable t) {
            super(msg, t);
        }
        public String getOAuth2ErrorCode() {
            return "server_error";
        }
        public int getHttpErrorCode() {
            return 500;
        }
    }
    @SuppressWarnings("serial")
    private static class UnauthorizedException extends OAuth2Exception {
        public UnauthorizedException(String msg, Throwable t) {
            super(msg, t);
        }
        public String getOAuth2ErrorCode() {
            return "unauthorized";
        }
        public int getHttpErrorCode() {
            return 401;
        }
    }
    @SuppressWarnings("serial")
    private static class MethodNotAllowed extends OAuth2Exception {
        public MethodNotAllowed(String msg, Throwable t) {
            super(msg, t);
        }
        public String getOAuth2ErrorCode() {
            return "method_not_allowed";
        }
        public int getHttpErrorCode() {
            return 405;
        }
    }
}

+ 134 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/web/authentication/WlyyAuthenticationFailureHandler.java

@ -0,0 +1,134 @@
package com.yihu.jw.security.web.authentication;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.DefaultRedirectStrategy;
import org.springframework.security.web.RedirectStrategy;
import org.springframework.security.web.WebAttributes;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.util.UrlUtils;
import org.springframework.util.Assert;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
 * Created by progr1mmer on 2018/8/29.
 */
public class WlyyAuthenticationFailureHandler implements AuthenticationFailureHandler {
    protected final Log logger = LogFactory.getLog(getClass());
    private String defaultFailureUrl;
    private boolean forwardToDestination = false;
    private boolean allowSessionCreation = true;
    private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
    public WlyyAuthenticationFailureHandler() {
    }
    public WlyyAuthenticationFailureHandler(String defaultFailureUrl) {
        setDefaultFailureUrl(defaultFailureUrl);
    }
    /**
     * Performs the redirect or forward to the {@code defaultFailureUrl} if set, otherwise
     * returns a 401 error code.
     * <p>
     * If redirecting or forwarding, {@code saveException} will be called to cache the
     * exception for use in the target view.
     */
    public void onAuthenticationFailure(HttpServletRequest request,
                                        HttpServletResponse response, AuthenticationException exception)
            throws IOException, ServletException {
        if (defaultFailureUrl == null) {
            logger.debug("No failure URL set, sending 401 Unauthorized error");
            response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
                    "Authentication Failed: " + exception.getMessage());
        }
        else {
            saveException(request, exception);
            if (forwardToDestination) {
                logger.debug("Forwarding to " + defaultFailureUrl);
                request.getRequestDispatcher(defaultFailureUrl)
                        .forward(request, response);
            }
            else {
                logger.debug("Redirecting to " + defaultFailureUrl);
                redirectStrategy.sendRedirect(request, response, defaultFailureUrl);
            }
        }
    }
    /**
     * Caches the {@code AuthenticationException} for use in view rendering.
     * <p>
     * If {@code forwardToDestination} is set to true, request scope will be used,
     * otherwise it will attempt to store the exception in the session. If there is no
     * session and {@code allowSessionCreation} is {@code true} a session will be created.
     * Otherwise the exception will not be stored.
     */
    protected final void saveException(HttpServletRequest request,
                                       AuthenticationException exception) {
        if (forwardToDestination) {
            request.setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, exception);
        }
        else {
            HttpSession session = request.getSession(false);
            if (session != null || allowSessionCreation) {
                request.getSession().setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION,
                        exception);
            }
        }
    }
    /**
     * The URL which will be used as the failure destination.
     *
     * @param defaultFailureUrl the failure URL, for example "/loginFailed.jsp".
     */
    public void setDefaultFailureUrl(String defaultFailureUrl) {
        Assert.isTrue(UrlUtils.isValidRedirectUrl(defaultFailureUrl), "'"
                + defaultFailureUrl + "' is not a valid redirect URL");
        this.defaultFailureUrl = defaultFailureUrl;
    }
    protected boolean isUseForward() {
        return forwardToDestination;
    }
    /**
     * If set to <tt>true</tt>, performs a forward to the failure destination URL instead
     * of a redirect. Defaults to <tt>false</tt>.
     */
    public void setUseForward(boolean forwardToDestination) {
        this.forwardToDestination = forwardToDestination;
    }
    /**
     * Allows overriding of the behaviour when redirecting to a target URL.
     */
    public void setRedirectStrategy(RedirectStrategy redirectStrategy) {
        this.redirectStrategy = redirectStrategy;
    }
    protected RedirectStrategy getRedirectStrategy() {
        return redirectStrategy;
    }
    protected boolean isAllowSessionCreation() {
        return allowSessionCreation;
    }
    public void setAllowSessionCreation(boolean allowSessionCreation) {
        this.allowSessionCreation = allowSessionCreation;
    }
}

+ 18 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/web/endpoint/BaseLoginEndpoint.java

@ -0,0 +1,18 @@
package com.yihu.jw.security.web.endpoint;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Endpoint - 基础登陆
 * Created by progr1mmer on 2018/8/29.
 */
@RestController
public class BaseLoginEndpoint {
    @GetMapping(value = "/login")
    public String login() {
        return "Get method no support for path /login";
    }
}

+ 38 - 0
server/svr-authentication/src/main/resources/application.yml

@ -0,0 +1,38 @@
server:
  port: 10260
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 20
    max-idle: 8
    min-idle: 8
    validation-query: SELECT 1
    test-on-borrow: true
  redis:
    database: 0 # Database index used by the connection factory.
    timeout: 0 # Connection timeout in milliseconds.
    pool:
      max-active: 8 # Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
      max-idle: 8 # Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
      max-wait: -1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
      min-idle: 1 # Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
logging:
  level:
    org:
      springframework:
        security: DEBUG
---
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
  redis:
    host: 172.19.103.47
    port: 6379
    password: redis!@456

+ 29 - 0
server/svr-authentication/src/main/resources/banner.txt

@ -0,0 +1,29 @@
                                   _oo8oo_
                                  o8888888o
                                  88" . "88
                                  (| -_- |)
                                  0\  =  /0
                                ___/'==='\___
                              .' \\|     |// '.
                             / \\|||  :  |||// \
                            / _||||| -:- |||||_ \
                           |   | \\\  -  /// |   |
                           | \_|  ''\---/''  |_/ |
                           \  .-\__  '-'  __/-.  /
                         ___'. .'  /--.--\  '. .'___
                      ."" '<  '.___\_<|>_/___.'  >' "".
                     | | :  `- \`.:`\ _ /`:.`/ -`  : | |
                     \  \ `-.   \_ __\ /__ _/   .-` /  /
                 =====`-.____`.___ \_____/ ___.`____.-`=====
                                   `=---=`
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      佛祖保佑     永不宕机     永无Bug
 __   _      ___        __    _    _____  _     ____  _     _____  _   __     __   _____  _   ___   _
( (` \ \  / | |_)      / /\  | | |  | |  | |_| | |_  | |\ |  | |  | | / /`   / /\   | |  | | / / \ | |\ |
_)_)  \_\/  |_| \     /_/--\ \_\_/  |_|  |_| | |_|__ |_| \|  |_|  |_| \_\_, /_/--\  |_|  |_| \_\_/ |_| \|

+ 32 - 0
server/svr-authentication/src/main/resources/bootstrap.yml

@ -0,0 +1,32 @@
spring:
  application:
    name: svr-authentication
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.17.110.212:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://172.17.110.212:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://172.17.110.212:1221}
      label: ${wlyy.spring.config.label:jwprod}

+ 356 - 0
sql/init.sql

@ -0,0 +1,356 @@
-- 机构信息表 
drop table IF EXISTS `base_org`;
CREATE TABLE `base_org` (
  `id` varchar(50) NOT NULL COMMENT 'uuid,uuid唯一标识,也是机构code',
  `saasid` varchar(50) NOT NULL COMMENT 'saas化配置',
  `province_code` varchar(50) DEFAULT NULL COMMENT '省份标识',
  `city_code` varchar(50) DEFAULT NULL COMMENT '城市标识',
  `town_code` varchar(50) DEFAULT NULL COMMENT '区县标识',
  `name` varchar(100) DEFAULT NULL COMMENT '机构名称',
  `alias` varchar(10) DEFAULT NULL COMMENT '机构别名',
  `spell` varchar(20) DEFAULT NULL COMMENT '机构名称拼音首字母',
  `type` char(2) DEFAULT '1' COMMENT '机构类型: 1.  医疗机构2.  企事业单位3.  政府机关4.  社会团体 5.药店 0.  部门 6.单位或者独立子公司7.基层机构 8.专业公共机构',
  `brief` varchar(300) DEFAULT NULL COMMENT '机构简介',
  `address` varchar(300) DEFAULT NULL COMMENT '机构详细地址',
  `photo` varchar(200) DEFAULT NULL COMMENT '机构图片',
  `longitude` varchar(10) DEFAULT NULL COMMENT '经度',
  `latitude` varchar(10) DEFAULT NULL COMMENT '纬度',
  `legalperson` varchar(50) DEFAULT NULL COMMENT '法人',
  `org_admin` varchar(50) DEFAULT NULL COMMENT '机构管理员',
  `org_url` varchar(200) DEFAULT NULL COMMENT '机构网址',
  `intro` text COMMENT '机构简介',
  `qrcode` varchar(30) DEFAULT NULL COMMENT '机构二维码',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构信息(医院)';
-- 医生信息表
drop table IF EXISTS `base_doctor`;
CREATE TABLE `base_doctor` (
  `id` varchar(50) NOT NULL COMMENT 'uuid,uuid唯一标识',
  `org_id` varchar(100) DEFAULT NULL COMMENT '机构id',
  `password` varchar(50) NOT NULL COMMENT '密码',
  `salt` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `sex` char(2) DEFAULT NULL COMMENT '性别(1男,2女) 用国家标准字典',
  `expertise` varchar(300) DEFAULT NULL COMMENT '医生专长',
  `introduce` varchar(1500) DEFAULT NULL COMMENT '医生介绍',
  `idcard` varchar(20) DEFAULT NULL COMMENT ' 身份证',
  `birthday` date DEFAULT NULL COMMENT '生日',
  `photo` varchar(100) DEFAULT NULL COMMENT '头像http地址',
  `mobile` varchar(20) NOT NULL COMMENT '手机号',
  `qrcode` varchar(30) DEFAULT NULL COMMENT '医生二维码',
  `province_code` varchar(50) DEFAULT NULL COMMENT '省代码',
  `province_name` varchar(50) DEFAULT NULL COMMENT '省名称',
  `city_code` varchar(50) DEFAULT NULL COMMENT '市代码',
  `city_name` varchar(50) DEFAULT NULL COMMENT '市名称',
  `town_code` varchar(50) DEFAULT NULL COMMENT '区县代码',
  `town_name` varchar(50) DEFAULT NULL COMMENT '区县名称',
  `street_code` varchar(50) DEFAULT NULL COMMENT '街道代码',
  `street_name` varchar(50) DEFAULT NULL COMMENT '街道名称',
  `iscertified` varchar(1) NOT NULL DEFAULT '0' COMMENT '资格是否认证通过,1是,0否',
  `is_famous` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否是名医,1是,0否',
  `is_password_prompt` char(1) DEFAULT NULL COMMENT '是否提示设置密码  1 提示过 0未提示',
  `spell` varchar(10) DEFAULT NULL COMMENT '名称拼音首字母',
  `certified_overtime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'CA证书过期时间',
  `certificate_num` varchar(100) DEFAULT NULL COMMENT 'CA证书编号',
  `openid` varchar(50) DEFAULT NULL,
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生基本信息';
-- 医生角色字典表
drop table IF EXISTS `base_doctor_role_dict`;
CREATE TABLE `base_doctor_role_dict` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `code` varchar(50) NOT NULL COMMENT '角色code',
  `name` varchar(50) NOT NULL COMMENT '角色名称:全科医生、专科医生、健康管理师、管理员等',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_doctor_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生角色字典';
-- 医生角色关联表
drop table IF EXISTS `base_doctor_role`;
/*CREATE TABLE `base_doctor_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,关联表',
  `role_code` varchar(50) NOT NULL COMMENT '医生角色id',
  `doctor_id` varchar(50) NOT NULL COMMENT '医生code',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生角色关联信息';
*/
-- 医生执业表(一个医生可在多个医院供职,角色等)
drop table IF EXISTS `base_doctor_hospital`;
CREATE TABLE `base_doctor_hospital` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `hosp_code` varchar(50) NOT NULL COMMENT '医院标识',
  `hosp_name` varchar(50) NOT NULL COMMENT '医院名称',
  `role_code` varchar(50) NOT NULL COMMENT '医生角色标识',
  `role_name` varchar(50) NOT NULL COMMENT '医院角色名称',
  `job_title_code` varchar(50) NOT NULL COMMENT '职称代码',
  `job_title_name` varchar(50) NOT NULL COMMENT '职称名称',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生执业信息';
-- 居民信息表
drop table IF EXISTS `base_patient`;
CREATE TABLE `base_patient` (
  `id` varchar(50) NOT NULL   COMMENT 'uuid,uuid唯一标识',
  `saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id',
  `idcard` varchar(50) NOT NULL COMMENT '身份证号',
  `password` varchar(50) DEFAULT NULL COMMENT '登录密码',
  `salt` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `birthday` date DEFAULT NULL COMMENT '生日',
  `sex` varchar(100) DEFAULT NULL COMMENT '性别,1男,2女',
  `mobile` varchar(100) DEFAULT NULL COMMENT '手机号',
  `phone` varchar(200) DEFAULT NULL COMMENT '联系电话',
  `ssc` varchar(50) DEFAULT NULL COMMENT '社保卡号',
  `photo` varchar(100) DEFAULT NULL COMMENT '头像http地址',
  `province_code` varchar(50) DEFAULT NULL COMMENT '省编码',
  `city_code` varchar(50) DEFAULT NULL COMMENT '市编码',
  `town_code` varchar(50) DEFAULT NULL COMMENT '区县编码',
  `street_code` varchar(50) DEFAULT NULL COMMENT '街道编码',
  `address` varchar(200) DEFAULT NULL COMMENT '具体详细地址',
  `disease` varchar(100) DEFAULT NULL COMMENT '疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病',
  `disease_condition` varchar(100) DEFAULT NULL COMMENT '病情:0绿标,1黄标,2红标,3重点关注,',
  `points` varchar(100) DEFAULT NULL COMMENT '总积分',
  `record_amount` varchar(100) DEFAULT NULL COMMENT '病历总数',
  `openid` varchar(50) DEFAULT NULL COMMENT '微信编号',
  `patient_status` varchar(100) DEFAULT NULL COMMENT '用户状态:1正常,0禁用,-1恶意注册,2审核中',
  `mobile_remarks` varchar(200) DEFAULT NULL COMMENT '联系方式备注【基卫】',
  `openid_time` datetime DEFAULT NULL COMMENT '第一次添加open的时间',
  `sick_village` varchar(50) DEFAULT NULL COMMENT '居委会代码',
  `sick_village_name` varchar(100) DEFAULT NULL,
  `principal_code` varchar(50) DEFAULT NULL COMMENT '绑定电子社保卡主体(共济为操作人code)',
  `sicard_status` varchar(100) DEFAULT NULL COMMENT '是否绑定电子社保卡 (0否 1是)',
  `sicard_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '电子社保卡绑定时间',
  `is_wxtag` int(1) DEFAULT NULL COMMENT '是否分配过微信标签',
  `wxtagid` varchar(100) DEFAULT NULL COMMENT '微信tagId',
  `standard_status` tinyint(4) DEFAULT NULL COMMENT '居民预警状态:0为标准,1为预警状态',
  `medicare_number` varchar(50) DEFAULT NULL COMMENT '医疗保险号',
  `unionid` varchar(50) DEFAULT NULL COMMENT 'unionId 开发平台唯一标识',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_patient_idcard` (`idcard`),
  KEY `idx_mobile` (`mobile`) USING BTREE,
  KEY `idx_openid` (`openid`) USING BTREE,
  KEY `idx_name` (`name`),
  KEY `idx_principal_code` (`principal_code`) USING BTREE,
  KEY `idx_unionid` (`unionid`) USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='居民信息(居民就是患者)';
-- 团队信息
drop table IF EXISTS `base_team`;
CREATE TABLE `base_team` (
  `id` varchar(50) NOT NULL   COMMENT '主键,团队uuid标识',
  `org_id` varchar(50) DEFAULT NULL COMMENT '机构id',
  `name` varchar(50) DEFAULT NULL COMMENT '团队名称',
  `leader_id` varchar(50) NOT NULL COMMENT '领导医生标识',
  `team_num` varchar(50) NOT NULL COMMENT '团队人数',
  `qrcode` varchar(50) DEFAULT NULL COMMENT '团队二维码',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='团队信息';
drop table IF EXISTS `base_team_member`;
CREATE TABLE `base_team_member` (
  `id` varchar(50) NOT NULL    COMMENT 'uuid',
  `team_id` varchar(100) NOT NULL COMMENT '团队ID',
  `org_id` varchar(100) NOT NULL COMMENT '机构标识',
  `doctor_id` varchar(500) NOT NULL COMMENT '医生标识,多个医生以逗号分开',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8mb4 COMMENT='团队成员';
-- 基础人口信息
drop table IF EXISTS `base_people_num`;
CREATE TABLE `base_people_num` (
  `id` varchar(50) NOT NULL DEFAULT '' COMMENT '主键(uuid),基础人口信息uuid',
  `saas_id`  varchar(100) NOT NULL COMMENT 'saas化的id',
  `province_code` varchar(50) DEFAULT NULL COMMENT '所属省代码',
  `city_code` varchar(50) DEFAULT NULL COMMENT '所属市代码',
  `district_code` varchar(50) DEFAULT NULL COMMENT '所属区代码',
  `name` varchar(200) DEFAULT NULL COMMENT '所属具体名称',
  `num` int(10) DEFAULT NULL COMMENT '人口数',
  `type` varchar(2) DEFAULT NULL COMMENT '类别 0是省,1是市,2是区,3是机构',
  `year` int(10) DEFAULT NULL COMMENT '每年的人口数',
  `gxy_num` int(10) DEFAULT  '0' COMMENT '高血压发病数',
  `tnb_num` int(10) DEFAULT  '0' COMMENT '糖尿病发病数',
  `six_five_num` int(10) DEFAULT  '0' COMMENT '65岁以上老年人口数',
  `gxy_task_num` int(10) DEFAULT  '0' COMMENT '高血压任务数',
  `tnb_task_num` int(10) DEFAULT  '0' COMMENT '糖尿病任务数',
  `six_five_task_num` int(10) DEFAULT  '0' COMMENT '65岁以上老年人口任务数',
  `task_num` int(10) DEFAULT  '0' COMMENT '户籍人口任务数',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='基础人口基数信息';
-- 行政区划数据  4个表 ---start----
-- 省
drop table IF EXISTS `base_province`;
CREATE TABLE `base_province` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `code` varchar(50) NOT NULL COMMENT '省份编码',
  `name` varchar(50) NOT NULL COMMENT '省份名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='省份字典';
-- 城市
drop table IF EXISTS `base_city`;
CREATE TABLE `base_city` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `province` varchar(10) DEFAULT NULL COMMENT '省编码',
  `code` varchar(50) DEFAULT NULL COMMENT '城市编码',
  `name` varchar(50) DEFAULT NULL COMMENT '城市名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_dm_city_province` (`province`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='城市字典';
-- 城镇区县
drop table IF EXISTS `base_town`;
CREATE TABLE `base_town` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `province` varchar(50) DEFAULT NULL COMMENT '省编码',
  `city` varchar(50) DEFAULT NULL COMMENT '城市编码',
  `code` varchar(50) DEFAULT NULL COMMENT '区县编码',
  `name` varchar(50) DEFAULT NULL COMMENT '区县名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_dm_town` (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区县字典';
-- 街道
drop table IF EXISTS `base_street`;
CREATE TABLE `base_street` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `province` varchar(50) DEFAULT NULL COMMENT '省标识',
  `city` varchar(50) DEFAULT NULL COMMENT '市标识',
  `town` varchar(50) DEFAULT NULL COMMENT '区县标识',
  `code` varchar(50) DEFAULT NULL COMMENT '街道标识',
  `name` varchar(100) DEFAULT NULL COMMENT '街道名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_dm_street` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='街道字典';
-- 行政区划数据  4个表 ---end----
-- 职称表
drop table IF EXISTS `dict_job_title`;
create table `dict_job_title`(
`id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
`saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
`code` varchar(50) default NULL COMMENT '职称标识',
`name` varchar(20) default NULL COMMENT '职称名',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
 KEY `idx_job_title_code` (`code`),
primary key (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='职称字典';
-- 药品
drop table IF EXISTS `dict_medicine`;
create table `dict_medicine`(
`id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
`saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
`code` varchar(100) not null COMMENT '药品编码',
`name` varchar(50) not null COMMENT '药品名称',
`type` char(1) default NULL COMMENT '药品类型:1健康记录',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
primary key (id),
key `idx_medicine_code` (`code`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='药品字典';
-- ICD10表
drop table IF EXISTS `dict_icd10`;
CREATE TABLE `dict_icd10` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
  `code` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT 'icd10字典编码',
  `name` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT 'icd10字典名称',
  `phonetic_code` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '字典名称拼音首字母',
  `chronic_flag` varchar(1) CHARACTER SET utf8 DEFAULT NULL COMMENT '是否慢病',
  `infectious_flag` varchar(1) CHARACTER SET utf8 DEFAULT NULL COMMENT '是否传染病',
  `description` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT '描述',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  key `idx_icd10_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4  COMMENT='ICD10字典';
-- 健康问题表
drop table IF EXISTS `dict_health_problem`;
CREATE TABLE `dict_health_problem` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
  `code` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '字典编码',
  `name` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT '字典名称',
  `description` varchar(200) CHARACTER SET utf8 DEFAULT NULL COMMENT '描述',
  key `idx_hea_problem_code` (`code`),
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='健康问题字典';
-- 标准科室
drop table IF EXISTS `dict_hospital_dept`;
create table `dict_hospital_dept`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
  `code` varchar(50) not null COMMENT '科室标识',
  `name` varchar(50) not null COMMENT '科室名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  key `idx_hos_dept_code` (`code`),
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医院科室字典';

+ 71 - 0
svr/svr-base/doc/es/服务包执行日志记录索引.txt

@ -0,0 +1,71 @@
创建索引
POST  http://172.19.103.68:9200/base_service_package_log
查询索引
GET http://172.19.103.68:9200/base_service_package_log/
给索引加mapping
POST http://172.19.103.68:9200/base_service_package_log/base_service_package_log/_mapping
{
	"base_service_package_log": {
		"properties": {
			"createTime": {
			    "format": "yyyy-MM-dd HH:mm:ss",
				"type": "date"
			},
            "id": {
                "type": "string",
                "index": "not_analyzed"
            },
			"saasId": {
				"type": "string",
				"index": "not_analyzed"
			},"sevicePackageId": {
				"type": "string",
				"index": "not_analyzed"
            },"sevicePackageDetailId": {
                "type": "string",
                "index": "not_analyzed"
			},"userCode": {
                "type": "string",
                "index": "not_analyzed"
            },"userName": {
                "type": "string",
                "index": "not_analyzed"
            },"userType": {
                "type": "string",
                "index": "not_analyzed"
            },"relationType": {
                "type": "string",
                "index": "not_analyzed"
            },"relationId": {
                "type": "string",
                "index": "not_analyzed"
            },"message": {
                "type": "string",
                "index": "not_analyzed"
            },"flag": {
                "type": "integer"
            },"finish": {
				"type": "integer"
			},"ext": {
                 "type": "string",
                 "index": "not_analyzed"
            }
		}
	}
}
字段说明:
"id": uuid
"createTime": 时间
"saasId": saasid
"sevicePackageId": 服务包id
"sevicePackageDetailId": 服务包明细id
"userCode": 医生或者患者code
"userName": 医生或者患者name
"userType": 1 患者 2医生
"relationType": 关联类型(1健康指导,2健康文章,3代预约)
"relationId": 关联id
"message": 操作说明
"flag": 操作是否成功 1成功 0失败
"finish": 完成项目数
"ext": 扩展字段存json

+ 87 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/activemq/ConsumerRunner.java

@ -0,0 +1,87 @@
package com.yihu.jw.base.activemq;
import com.yihu.utils.context.SpringContext;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
import javax.jms.*;
import java.util.Set;
/**
 * Runner - 消息执行者
 * Created by progr1mmer on 2018/8/2.
 */
public class ConsumerRunner implements Runnable, ExceptionListener {
    private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
    private final String topic;
    private Set<String> pushUrl;
    private TopicConnection topicConnection;
    private MessageConsumer consumer;
    private RestTemplate restTemplate;
    public ConsumerRunner(String topic, Set<String> pushUrl) throws Exception {
        Assert.notNull(topic, "Topic cannot be null");
        this.topic = topic;
        this.pushUrl = pushUrl;
        init();
    }
    private void init() throws Exception {
        ActiveMQConnectionFactory connectionFactory = SpringContext.getService(ActiveMQConnectionFactory.class);
        // Create a Connection
        topicConnection = connectionFactory.createTopicConnection();
        topicConnection.start();
        topicConnection.setExceptionListener(this);
        // Create a Session
        Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        // Create the destination (Topic or Queue)
        Destination destination = session.createTopic(topic);
        // Create a MessageConsumer from the Session to the Topic or Queue
        consumer = session.createConsumer(destination);
        restTemplate = new RestTemplate();
    }
    @Override
    public void run() {
        while (true) {
            try {
                // Wait for a message
                Message message = consumer.receive(1000);
                if (message != null) {
                    if (message instanceof TextMessage) {
                        TextMessage textMessage = (TextMessage) message;
                        String text = textMessage.getText();
                        for (String url : pushUrl) {
                            String result = restTemplate.postForObject(url, new HttpEntity<>(text), String.class);
                            LOGGER.info(result);
                        }
                    } else {
                        for (String url : pushUrl) {
                            String result = restTemplate.postForObject(url, new HttpEntity<>(message), String.class);
                            LOGGER.info(result);
                        }
                    }
                }
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
    }
    @Override
    public void onException(JMSException e) {
        LOGGER.error("Trying to recover from JMS Connection exception: " + e);
        try {
            topicConnection.close();
            topicConnection.start();
        } catch (Exception ex) {
            LOGGER.error("Failed to recover JMS Connection", ex);
        }
    }
}

+ 60 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/activemq/MessageManager.java

@ -0,0 +1,60 @@
package com.yihu.jw.base.activemq;
import com.yihu.jw.base.service.MqMessageService;
import com.yihu.jw.base.service.MqMessageSubscriberService;
import com.yihu.jw.entity.base.message.MqMessageDO;
import com.yihu.jw.entity.base.message.MqMessageSubscriberDO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;
/**
 * Component - ActiveMQ消息订阅初始化
 * Created by progr1mmer on 2018/8/30.
 */
@Component
public class MessageManager {
    private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
    private static final Pattern PATTERN  = Pattern.compile("^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\\\/])+(\\\\?{0,1}(([A-Za-z0-9-~]+\\\\={0,1})([A-Za-z0-9-~]*)\\\\&{0,1})*)$");
    private ExecutorService executorService;
    @Autowired
    private MqMessageService mqMessageService;
    @Autowired
    private MqMessageSubscriberService mqMessageSubscriberService;
    public void initConsumer() {
        try {
            Map<String, Set<String>> groups = new HashMap<>();
            List<MqMessageDO> mqMessageDos = mqMessageService.search("");
            for (MqMessageDO mqMessageDo : mqMessageDos) {
                List<MqMessageSubscriberDO> mqMessageSubscriberDOS = mqMessageSubscriberService.search("topic=" + mqMessageDo.getTopic());
                Set<String> subUrl = new HashSet<>();
                mqMessageSubscriberDOS.forEach(item -> {
                    if (item.getUrl() != null && PATTERN.matcher(item.getUrl()).find()) {
                        subUrl.add(item.getUrl());
                    } else {
                        LOGGER.error("[Topic: " + item.getTopic() + "] Illegal url: " + item.getUrl() + " of " + item.getSaasId());
                    }
                });
                groups.put(mqMessageDo.getTopic(), subUrl);
            }
            executorService = Executors.newFixedThreadPool(groups.size());
            for (String key : groups.keySet()) {
                executorService.execute(new ConsumerRunner(key, groups.get(key)));
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            System.exit(-1);
        }
    }
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseCityDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseCityDO;
/**
 * 
 * 城市字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
/**
 * 
 * 医生基础信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorHospitalDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
/**
 * 
 * 医生职业信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDoctorHospitalDO, Integer>, JpaSpecificationExecutor<BaseDoctorHospitalDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseDoctorRoleDictDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDictDO;
/**
 * 
 * 医生角色字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorRoleDictDao extends PagingAndSortingRepository<BaseDoctorRoleDictDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDictDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseOrgDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.org.BaseOrgDO;
/**
 * 
 * 机构信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String>, JpaSpecificationExecutor<BaseOrgDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BasePatientDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.patient.BasePatientDO;
/**
 * 
 * 居民信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO, String>, JpaSpecificationExecutor<BasePatientDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseProvinceDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
/**
 * 
 * 省字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseProvinceDao extends PagingAndSortingRepository<BaseProvinceDO, Integer>, JpaSpecificationExecutor<BaseProvinceDO>  {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseStreetDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseStreetDO;
/**
 * 
 * 街道字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseStreetDao extends PagingAndSortingRepository<BaseStreetDO, Integer>, JpaSpecificationExecutor<BaseStreetDO>  {
}

+ 0 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/BaseTeamDao.java


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů