Trick 6 years ago
parent
commit
273889e5bd
68 changed files with 1133 additions and 665 deletions
  1. 0 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  2. 12 65
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDO.java
  3. 17 4
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDictDO.java
  4. 48 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseModuleRoleDO.java
  5. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java
  6. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasModuleDO.java
  7. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasTypeModuleDO.java
  8. 8 8
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgUserDO.java
  9. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/role/MenuDO.java
  10. 0 37
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java
  11. 11 3
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  12. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/house/HealthyHouseMapping.java
  13. 20 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleDictVO.java
  14. 11 49
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleVO.java
  15. 51 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseModuleRoleVO.java
  16. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/ModuleVO.java
  17. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/SaasModuleVO.java
  18. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/SaasTypeModuleVO.java
  19. 2 8
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/MenuVO.java
  20. 0 32
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java
  21. 2 4
      gateway/ag-basic/src/main/resources/application.yml
  22. 1 1
      gateway/ag-basic/src/main/resources/bootstrap.yml
  23. 20 26
      sql/init.sql
  24. 0 43
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java
  25. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java
  26. 5 5
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java
  27. 0 28
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDictDao.java
  28. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleInfoDao.java
  29. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseModuleRoleDao.java
  30. 5 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  31. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgSaasDao.java
  32. 0 13
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java
  33. 0 103
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleDictEndpoint.java
  34. 5 6
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleEndpoint.java
  35. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java
  36. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseModuleRoleEndpoint.java
  37. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/module/ModuleEndpoint.java
  38. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/notice/UserNoticeEndpoint.java
  39. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  40. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java
  41. 22 10
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java
  42. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java
  43. 19 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java
  44. 0 23
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleDictService.java
  45. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java
  46. 13 9
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java
  47. 105 73
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  48. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseModuleRoleService.java
  49. 13 13
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java
  50. 55 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/module/ModuleService.java
  51. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/notice/UserNoticeService.java
  52. 8 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  53. 9 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTree.java
  54. 31 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java
  55. 14 35
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  56. 0 16
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java
  57. 95 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  58. 3 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/constant/UserConstant.java
  59. 19 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/dict/SystemDictEntryController.java
  60. 8 3
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesController.java
  61. 9 4
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesServerController.java
  62. 2 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/dict/SystemDictEntryDao.java
  63. 0 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java
  64. 0 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/listener/RedisKeyExpirationListener.java
  65. 11 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/dict/SystemDictEntry.java
  66. 44 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/dict/SystemDictEntryService.java
  67. 12 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java
  68. 1 1
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/MapUtil.java

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

@ -18,7 +18,6 @@ import java.util.Date;
*/
@Entity
@Table(name = "base_doctor")
@Where(clause = "del = 1")
public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    /**

+ 12 - 65
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDO.java

@ -1,62 +1,33 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 医生角色关联信息实体
 * 医生与业务模块角色关联信息实体
 * 
 * @author litaohong on  2018年10月19日
 * @author litaohong on  2018年10月25日
 *
 */
@Entity
@Table(name = "base_doctor_role")
public class BaseDoctorRoleDO extends IntegerIdentityEntityWithOperator {
public class BaseDoctorRoleDO extends IntegerIdentityEntity {
    /**
	 * saasid
	 */
	private String saasid;
	/**
	 * 医生code
	 */
	private String doctorCode;
    /**
	 * 角色名称
	 */
	private String name;
    /**
	 * 医生业务模块角色code
	 * 医生角色id
	 */
	private String roleModuleCode;
	private String roleCode;
	/**
	 * 角色说明
	 */
	private String description;
    /**
	 * 作废标识,1正常,0作废
	 */
	private String del;
    @Column(name = "saasid")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
    @Column(name = "doctor_code")
	@Column(name = "doctor_code")
    public String getDoctorCode() {
        return doctorCode;
    }
@ -64,38 +35,14 @@ public class BaseDoctorRoleDO extends IntegerIdentityEntityWithOperator {
        this.doctorCode = doctorCode;
    }
    @Column(name = "name")
    public String getName() {
        return name;
	@Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setName(String name) {
        this.name = name;
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    @Column(name = "role_module_code")
    public String getRoleModuleCode() {
        return roleModuleCode;
    }
    public void setRoleModuleCode(String roleModuleCode) {
        this.roleModuleCode = roleModuleCode;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 17 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDictDO.java

@ -8,14 +8,19 @@ import java.util.Date;
/**
 * 医生角色字典实体
 * 业务模块角色字典(给医生用的)实体
 * 
 * @author Administrator on  2018年09月05日
 * @author litaohong on  2018年10月25日
 *
 */
@Entity
@Table(name = "base_doctor_role_dict")
public class BaseDoctorRoleDictDO extends IntegerIdentityEntity {
@Table(name = "base_doctor_role_info")
public class BaseDoctorRoleInfoDO extends IntegerIdentityEntity {
    /**
	 * saasid,不同租户各自医生的业务模块角色信息独立
	 */
	private String saasid;
    /**
	 * 角色code
@ -33,6 +38,14 @@ public class BaseDoctorRoleDictDO extends IntegerIdentityEntity {
	private String del;
	@Column(name = "saasid")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
	@Column(name = "code")
    public String getCode() {
        return code;

+ 48 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseModuleRoleDO.java

@ -0,0 +1,48 @@
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;
/**
 * 业务模块与业务模块角色关联信息实体
 * 
 * @author litaohong on  2018年10月25日
 *
 */
@Entity
@Table(name = "base_module_role")
public class BaseModuleRoleDO extends IntegerIdentityEntity {
    /**
	 * 角色标识
	 */
	private String roleCode;
    /**
	 * 业务模块id
	 */
	private String moduleId;
	@Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
	@Column(name = "module_id")
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java

@ -141,6 +141,8 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
	private Integer status;
	//类型
	private Integer type;
	//菜单层级
	private Integer level;
	//备注
	private String remark;
	//0-表示有子节点,1-表示没有子节点
@ -235,6 +237,15 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
		this.isMust = isMust;
	}
	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	@Transient
	public List<ModuleDO> getChildren() {
		return children;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasModuleDO.java

@ -31,6 +31,8 @@ public class SaasModuleDO extends UuidIdentityEntityWithOperator {
	private Integer status;
	//类型
	private Integer type;
	//菜单层级
	private Integer level;
	//备注
	private String remark;
	//0-表示有子节点,1-表示没有子节点
@ -143,6 +145,15 @@ public class SaasModuleDO extends UuidIdentityEntityWithOperator {
		this.isMust = isMust;
	}
	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	@Transient
	public List<SaasModuleDO> getChildren() {
		return children;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasTypeModuleDO.java

@ -31,6 +31,8 @@ public class SaasTypeModuleDO extends UuidIdentityEntityWithOperator {
	private Integer status;
	//类型
	private Integer type;
	//菜单层级
	private Integer level;
	//备注
	private String remark;
	//0-表示有子节点,1-表示没有子节点
@ -143,6 +145,15 @@ public class SaasTypeModuleDO extends UuidIdentityEntityWithOperator {
		this.isMust = isMust;
	}
	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	@Transient
	public List<SaasTypeModuleDO> getChildren() {
		return children;

+ 8 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgUserDO.java

@ -1,7 +1,7 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -23,9 +23,9 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
	private String orgCode;
    /**
	 * 用户账号,base_user表里的username
	 * 用户账号,base_user表里的id
	 */
	private String userAccount;
	private String userId;
	@Column(name = "org_code")
@ -36,12 +36,12 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
        this.orgCode = orgCode;
    }
	@Column(name = "user_account")
    public String getUserAccount() {
        return userAccount;
	@Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    public void setUserId(String userId) {
        this.userId = userId;
    }

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/role/MenuDO.java

@ -36,6 +36,8 @@ public class MenuDO extends UuidIdentityEntityWithOperator {
	 * 排序
	 */
	private Integer sort;
	//菜单层级
	private Integer level;
	/**
	 * 父级ID
	 */
@ -145,6 +147,15 @@ public class MenuDO extends UuidIdentityEntityWithOperator {
		this.show = show;
	}
	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	@Transient
	public String getParentName() {
		return parentName;

+ 0 - 37
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java

@ -1,37 +0,0 @@
package com.yihu.jw.entity.base.saas;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Entity
@Table(name = "base_saas_user")
public class SaasUserDO extends UuidIdentityEntity {
    private String saasId;//租户ID
    private String userId;//用户账号
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 11 - 3
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -221,6 +221,7 @@ public class BaseRequestMapping {
     */
    public static class UserNotice extends Basic {
        public static final String PREFIX  = "/userNotice";
        public static final String COUNT  = "/count";
    }
    /**
@ -415,8 +416,14 @@ public class BaseRequestMapping {
    /**
     * 医生角色字典
     */
    public static class BaseDoctorRoleDict extends Basic {
        public static final String PREFIX  = "/baseDoctorRoleDict";
    public static class BaseDoctorRoleInfo extends Basic {
        public static final String PREFIX  = "/baseDoctorRoleInfo";
    }
/**
     * 医生模块角色关联表
     */
    public static class BaseModuleRole extends Basic {
        public static final String PREFIX  = "/baseModuleRole";
    }
 /**
@ -437,7 +444,7 @@ public class BaseRequestMapping {
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
        public static final String queryOneById  = "/queryOneById";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String queryCodeList  = "/queryCodeListBySaasId";
        public static final String queryOrgCodeAndNameListBySaasId  = "/queryOrgCodeAndNameListBySaasId";
    }
@ -484,6 +491,7 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseTeam";
        public static final String queryMemberList  = "/queryMemberList";
        public static final String queryOne  = "/getTeamById";
        public static final String getTeamTree  = "/getTeamTree";
    }

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

@ -36,6 +36,7 @@ public class HealthyHouseMapping {
            public static final String GETDICTENTRYBYDICTIDANDNAME = "/getDictEntryByDictIdAndName";
            public static final String DELETEBYDICTIDANDCODE = "/deleteByDictIdAndCode";
            public static final String ISEXISTSDICTENTRYBYDICTIDANDCODE = "/isExistsDictEntryByDictIdAndCode";
            public static final String GET_DICT_ENTRY_LIST_BY_DICT_ID = "/list/getSystemDictEntrysByList";
        }
        //设施

+ 20 - 7
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleDictVO.java

@ -8,38 +8,51 @@ import java.util.Date;
/**
 * 
 * 医生角色字典vo
 * 业务模块角色字典(给医生用的)vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年09月05日 Created
 * litaohong 	1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorRoleDictVO", description = "医生角色字典")
public class BaseDoctorRoleDictVO extends IntegerIdentityVO{
@ApiModel(value = "BaseDoctorRoleInfoVO", description = "业务模块角色字典(给医生用的)")
public class BaseDoctorRoleInfoVO extends IntegerIdentityVO{
    /**
	 * saasid,不同租户各自医生的业务模块角色信息独立
	 */
	@ApiModelProperty(value = "saasid,不同租户各自医生的业务模块角色信息独立", example = "模块1")
    private String saasid;
    /**
	 * 角色code
	 */
	@ApiModelProperty(value = "角色code", example = "")
	@ApiModelProperty(value = "角色code", example = "模块1")
    private String code;
    /**
	 * 角色名称:全科医生、专科医生、健康管理师、管理员等
	 */
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "")
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "模块1")
    private String name;
    /**
	 * 作废标识,1正常,0作废
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    private String del;
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
    public String getCode() {
        return code;
    }

+ 11 - 49
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleVO.java

@ -7,48 +7,31 @@ import io.swagger.annotations.ApiModelProperty;
/**
 * 
 * 医生角色关联信息vo
 * 医生与业务模块角色关联信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年10月19日 Created
 * litaohong 	1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorRoleVO", description = "医生角色关联信息")
@ApiModel(value = "BaseDoctorRoleVO", description = "医生与业务模块角色关联信息")
public class BaseDoctorRoleVO extends IntegerIdentityVO{
    /**
	 * 医生code
	 */
	@ApiModelProperty(value = "医生code", example = "456345tf45225654g")
	@ApiModelProperty(value = "医生code", example = "模块1")
    private String doctorCode;
    /**
	 * 医生业务模块角色code
	 * 医生角色id
	 */
	@ApiModelProperty(value = "医生业务模块角色code", example = "")
    private String roleModuleCode;
	@ApiModelProperty(value = "医生角色id", example = "模块1")
    private String roleCode;
    /**
	 * 医生业务模块角色名称
	 */
	@ApiModelProperty(value = "医生业务模块角色名称", example = "")
    private String name;
	/**
	 * 医生业务模块角色名称
	 */
	@ApiModelProperty(value = "医生业务模块角色说明", example = "")
    private String description;
    /**
	 * 作废标识,1正常,0作废
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "")
    private String del;
    public String getDoctorCode() {
        return doctorCode;
@ -57,33 +40,12 @@ public class BaseDoctorRoleVO extends IntegerIdentityVO{
        this.doctorCode = doctorCode;
    }
    public String getRoleModuleCode() {
        return roleModuleCode;
    }
    public void setRoleModuleCode(String roleModuleCode) {
        this.roleModuleCode = roleModuleCode;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getName() {
        return name;
    public String getRoleCode() {
        return roleCode;
    }
    public void setName(String name) {
        this.name = name;
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 51 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseModuleRoleVO.java

@ -0,0 +1,51 @@
package com.yihu.jw.restmodel.base.doctor;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 
 * 业务模块与业务模块角色关联信息vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseModuleRoleVO", description = "业务模块与业务模块角色关联信息")
public class BaseModuleRoleVO extends IntegerIdentityVO{
    /**
	 * 角色标识
	 */
	@ApiModelProperty(value = "角色标识", example = "模块1")
    private String roleCode;
    /**
	 * 业务模块id
	 */
	@ApiModelProperty(value = "业务模块id", example = "模块1")
    private String moduleId;
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/ModuleVO.java

@ -26,6 +26,8 @@ public class ModuleVO extends UuidIdentityVOWithOperator {
    private Integer type;
    @ApiModelProperty(value = "状态", example = "1有效,0失效")
    private Integer status;
    @ApiModelProperty(value = "层级", example = "0")
    private Integer level;
    @ApiModelProperty(value = "备注", example = "我是备注")
    private String remark;
    @ApiModelProperty(value = "节点信息(0-表示有子节点,1-表示没有子节点)", example = "1")
@ -124,4 +126,12 @@ public class ModuleVO extends UuidIdentityVOWithOperator {
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/SaasModuleVO.java

@ -26,6 +26,8 @@ public class SaasModuleVO extends UuidIdentityVOWithOperator {
	private String parentModuleId;
	@ApiModelProperty(value = "状态", example = "1有效,0失效")
	private Integer status;
	@ApiModelProperty(value = "层级", example = "0")
	private Integer level;
	@ApiModelProperty(value = "类型", example = "0通用,1医生端你,2居民端")
	private Integer type;
	@ApiModelProperty(value = "备注", example = "备注")
@ -134,4 +136,12 @@ public class SaasModuleVO extends UuidIdentityVOWithOperator {
	public void setChildren(List<SaasModuleVO> children) {
		this.children = children;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/SaasTypeModuleVO.java

@ -28,6 +28,8 @@ public class SaasTypeModuleVO extends UuidIdentityVOWithOperator {
	private Integer status;
	@ApiModelProperty(value = "类型", example = "0通用,1医生端你,2居民端")
	private Integer type;
	@ApiModelProperty(value = "层级", example = "0")
	private Integer level;
	@ApiModelProperty(value = "备注", example = "备注")
	private String remark;
	@ApiModelProperty(value = "0-表示有子节点,1-表示没有子节点", example = "1")
@ -144,4 +146,12 @@ public class SaasTypeModuleVO extends UuidIdentityVOWithOperator {
	public void setIsCheck(Integer isCheck) {
		this.isCheck = isCheck;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
}

+ 2 - 8
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/MenuVO.java

@ -23,6 +23,8 @@ public class MenuVO extends UuidIdentityVOWithOperator {
//    private String method;
    @ApiModelProperty(value = "排序", example = "1")
    private Integer sort;
    @ApiModelProperty(value = "层级", example = "0")
    private Integer level;
    @ApiModelProperty(value = "父级ID", example = "父级ID")
    private String parentId;
    @ApiModelProperty(value = "父级名称", example = "父级名称")
@ -117,12 +119,4 @@ public class MenuVO extends UuidIdentityVOWithOperator {
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    public Boolean getChecked() {
        return checked;
    }
    public void setChecked(Boolean checked) {
        this.checked = checked;
    }
}

+ 0 - 32
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java

@ -1,32 +0,0 @@
package com.yihu.jw.restmodel.base.saas;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@ApiModel(value = "SaasUserVO", description = "租户账号")
public class SaasUserVO extends UuidIdentityVO {
    private String saasId;//租户ID
    private String userId;//用户账号
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
}

+ 2 - 4
gateway/ag-basic/src/main/resources/application.yml

@ -42,15 +42,13 @@ zuul:
      serviceId: svr-iot
    svr-base:
      path: /base/**
      serviceId: svr-base
      serviceId: svr-base-lyx
    svr-authentication:
      path: /auth/**
      serviceId: svr-authentication
      serviceId: svr-authentication-lyx
    svr-healthy-house:
      path: /healthyHouse/**
      serviceId: svr-healthy-house
---
spring:
  profiles: jwdev

+ 1 - 1
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: ag-basic
    name: ag-basic-lyx
  cloud:
    config:
      failFast: true

+ 20 - 26
sql/init.sql

@ -99,10 +99,11 @@ CREATE TABLE `base_doctor` (
  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` (
-- 业务模块角色字典表(给医生用的)
drop table IF EXISTS `base_doctor_role_info`;
CREATE TABLE `base_doctor_role_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saasid` varchar(50) NOT NULL COMMENT 'saasid,不同租户各自医生的业务模块角色信息独立',
  `code` varchar(50) NOT NULL COMMENT '角色code',
  `name` varchar(50) NOT NULL COMMENT '角色名称:全科医生、专科医生、健康管理师、管理员等',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
@ -114,7 +115,8 @@ CREATE TABLE `base_doctor_role_dict` (
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_doctor_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生角色字典';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色字典(给医生用的)';
-- 医生角色关联表
drop table IF EXISTS `base_doctor_role`;
@ -122,10 +124,19 @@ CREATE TABLE `base_doctor_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,关联表',
  `doctor_code` varchar(50) NOT NULL COMMENT '医生code',
  `role_code` varchar(50) NOT NULL COMMENT '医生角色id',
  `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='医生角色关联信息';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生与业务模块角色关联信息';
-- 业务模块信息与角色关联表
drop table IF EXISTS `base_module_role`;
create table `base_module_role`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `role_code` varchar(100) DEFAULT NULL COMMENT '角色标识',
  `module_id` varchar(50) not null COMMENT '业务模块id',
  primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块与业务模块角色关联信息';
-- 医生执业表(一个医生可在多个医院供职,角色等)
drop table IF EXISTS `base_doctor_hospital`;
@ -142,6 +153,7 @@ CREATE TABLE `base_doctor_hospital` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生执业信息';
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色关联表';
-- 居民信息表
drop table IF EXISTS `base_patient`;
CREATE TABLE `base_patient` (
@ -695,7 +707,7 @@ CREATE TABLE `base_role_authority` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='角色权限';
-- 用户角色
Drop table IF EXISTS `base_user_role`;
Drop table IF EXISTS base_user_menu_role;
CREATE TABLE `base_user_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '用户ID',
@ -802,26 +814,6 @@ create table `base_role_menu`
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色';
drop table IF EXISTS `base_role_module`;
create table `base_role_module`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `code` varchar(100) DEFAULT NULL COMMENT '角色标识',
  `name` varchar(100) DEFAULT NULL COMMENT '角色名称',
  `module_id` varchar(50) not null COMMENT '业务模块id,多个用逗号分割',
  `del` varchar(1) not null COMMENT '状态,0失效,1有效',
  `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 `code` (`code`)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色';
-- 机构区域树形结构表
drop table IF EXISTS `org_tree`;
create table `org_tree`

File diff suppressed because it is too large
+ 0 - 43
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java


+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java

@ -30,6 +30,6 @@ public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDo
    @Query("select id from BaseDoctorHospitalDO where doctorCode = ?1")
    Set<Object> findIdListByOrgCodeAndDoctorCode(String doctorCode);
    @Query("select new BaseDoctorHospitalDO(orgCode,orgName,doctorDutyCode,doctorDutyName) from BaseDoctorHospitalDO where doctorCode = ?1")
    List<BaseDoctorHospitalDO> getOrgAndDutyByDoctorCode(String doctorCode);
    @Query(value = "select org_code as orgCode,org_name as orgName,doctor_duty_code as doctorDutyCode ,doctor_duty_name as doctorDutyName from base_doctor_hospital where doctor_code = ?1 GROUP BY orgCode ORDER BY orgName DESC",nativeQuery = true)
    List<Map<String,Object>> getOrgAndDutyByDoctorCode(String doctorCode);
}

+ 5 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java

@ -6,17 +6,17 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
 * 医生角色关联信息 数据库访问层
 * 医生与业务模块角色关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月19日 	Created
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
 * @since 1.
@ -26,5 +26,5 @@ public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctor
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    Set<Object> findIdListByDoctorCode(String doctorCode);
    List<BaseDoctorRoleDO> findByDoctorCodeAndDel(String doctorCode,String del);
}
    List<BaseDoctorRoleDO> findByDoctorCode(String doctorCode);
}

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

@ -1,28 +0,0 @@
package com.yihu.jw.base.dao.doctor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDictDO;
import java.util.Set;
/**
 * 
 * 医生角色字典 数据库访问层
 * 
 * @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>  {
    @Query("select id from BaseDoctorHospitalDO where doctorCode = ?1")
    Set<Object> findIdListByHospCodeAndDoctorCode(String doctorCode);
}

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

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 
 * 业务模块角色字典(给医生用的) 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorRoleInfoDao extends PagingAndSortingRepository<BaseDoctorRoleInfoDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleInfoDO>  {
}

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

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 
 * 业务模块与业务模块角色关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseModuleRoleDao extends PagingAndSortingRepository<BaseModuleRoleDO, Integer>, JpaSpecificationExecutor<BaseModuleRoleDO>  {
}

+ 5 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -38,6 +38,9 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
    @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);
   /* @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);*/
    @Query("select code as code,name as name from BaseOrgDO where del = 1")
    List<Map<String,Object>> findOrgListBySaasId();
}

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgSaasDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -22,4 +24,8 @@ import java.util.List;
public interface BaseOrgSaasDao extends PagingAndSortingRepository<BaseOrgSaasDO, String>, JpaSpecificationExecutor<BaseOrgSaasDO>  {
    List<BaseOrgSaasDO> findBySaasid(String saasId);
    @Modifying
    @Query("delete from BaseOrgSaasDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
}

+ 0 - 13
svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java

@ -1,13 +0,0 @@
package com.yihu.jw.base.dao.saas;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
public interface SaasUserDao extends PagingAndSortingRepository<SaasUserDO, String> {
}

+ 0 - 103
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleDictEndpoint.java

@ -1,103 +0,0 @@
package com.yihu.jw.base.endpoint.doctor;
import com.yihu.jw.base.service.doctor.BaseDoctorRoleDictService;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorRoleDictVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDictDO;
/**
 * 医生角色字典控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BaseDoctorRoleDict.PREFIX)
@Api(value = "医生角色字典管理", description = "医生角色字典管理服务接口", tags = {"wlyy基础服务 - 医生角色字典管理服务接口"})
public class BaseDoctorRoleDictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorRoleDictService baseDoctorRoleDictService;
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleDict.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BaseDoctorRoleDictVO> create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BaseDoctorRoleDictDO baseDoctorRoleDict = toEntity(jsonData, BaseDoctorRoleDictDO.class);
        baseDoctorRoleDict = baseDoctorRoleDictService.save(baseDoctorRoleDict);
        return success(baseDoctorRoleDict, BaseDoctorRoleDictVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleDict.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        baseDoctorRoleDictService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleDict.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorRoleDictVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BaseDoctorRoleDictDO baseDoctorRoleDict = toEntity(jsonData, BaseDoctorRoleDictDO.class);
        if (null == baseDoctorRoleDict.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        baseDoctorRoleDict = baseDoctorRoleDictService.save(baseDoctorRoleDict);
        return success(baseDoctorRoleDict, BaseDoctorRoleDictVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctorRoleDict.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<BaseDoctorRoleDictVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<BaseDoctorRoleDictDO> baseDoctorRoleDicts = baseDoctorRoleDictService.search(fields, filters, sorts, page, size);
        int count = (int) baseDoctorRoleDictService.getCount(filters);
        return success(baseDoctorRoleDicts, count, page, size, BaseDoctorRoleDictVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctorRoleDict.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<BaseDoctorRoleDictVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseDoctorRoleDictDO> baseDoctorRoleDicts = baseDoctorRoleDictService.search(fields, filters, sorts);
        return success(baseDoctorRoleDicts, BaseDoctorRoleDictVO.class);
    }
}

+ 5 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleEndpoint.java

@ -17,28 +17,27 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 医生角色关联信息控制器
* 医生与业务模块角色关联信息控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月19日 	Created
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.BaseDoctorRole.PREFIX)
@Api(value = "医生角色关联信息管理", description = "医生角色关联信息管理服务接口", tags = {"wlyy基础服务 - 医生角色关联信息管理服务接口"})
@Api(value = "医生与业务模块角色关联信息管理", description = "医生与业务模块角色关联信息管理服务接口", tags = {"wlyy基础服务 - 医生与业务模块角色关联信息管理服务接口"})
public class BaseDoctorRoleEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseDoctorRoleService baseDoctorRoleService;
@PostMapping(value = BaseRequestMapping.BaseDoctorRole.CREATE)
@PostMapping(value = BaseRequestMapping.BaseDoctorRole.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseDoctorRoleVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
@ -57,7 +56,7 @@ public ObjEnvelop<BaseDoctorRoleVO> create (
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRole.UPDATE)
    @PostMapping(value = BaseRequestMapping.BaseDoctorRole.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorRoleVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)

+ 104 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java

@ -0,0 +1,104 @@
package com.yihu.jw.base.endpoint.doctor;
import com.yihu.jw.base.service.doctor.BaseDoctorRoleInfoService;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorRoleInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 业务模块角色字典(给医生用的)控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.PREFIX)
@Api(value = "业务模块角色字典(给医生用的)管理", description = "业务模块角色字典(给医生用的)管理服务接口", tags = {"wlyy基础服务 - 业务模块角色字典(给医生用的)管理服务接口"})
public class BaseDoctorRoleInfoEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseDoctorRoleInfoService baseDoctorRoleInfoService;
@PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseDoctorRoleInfoVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BaseDoctorRoleInfoDO baseDoctorRoleInfo = toEntity(jsonData, BaseDoctorRoleInfoDO.class);
    baseDoctorRoleInfo = baseDoctorRoleInfoService.save(baseDoctorRoleInfo);
    return success(baseDoctorRoleInfo, BaseDoctorRoleInfoVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseDoctorRoleInfoService.delete(ids.split(","));
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorRoleInfoVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        BaseDoctorRoleInfoDO baseDoctorRoleInfo = toEntity(jsonData, BaseDoctorRoleInfoDO.class);
        if (null == baseDoctorRoleInfo.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseDoctorRoleInfo = baseDoctorRoleInfoService.save(baseDoctorRoleInfo);
        return success(baseDoctorRoleInfo, BaseDoctorRoleInfoVO.class);
        }
        @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseDoctorRoleInfoVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts, page, size);
                int count = (int)baseDoctorRoleInfoService.getCount(filters);
                return success(baseDoctorRoleInfos, count, page, size, BaseDoctorRoleInfoVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BaseDoctorRoleInfo.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseDoctorRoleInfoVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<BaseDoctorRoleInfoDO> baseDoctorRoleInfos = baseDoctorRoleInfoService.search(fields, filters, sorts);
                  return success(baseDoctorRoleInfos, BaseDoctorRoleInfoVO.class);
         }
 }

+ 104 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseModuleRoleEndpoint.java

@ -0,0 +1,104 @@
package com.yihu.jw.base.endpoint.doctor;
import com.yihu.jw.base.service.doctor.BaseModuleRoleService;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import com.yihu.jw.restmodel.base.doctor.BaseModuleRoleVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 业务模块与业务模块角色关联信息控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.BaseModuleRole.PREFIX)
@Api(value = "业务模块与业务模块角色关联信息管理", description = "业务模块与业务模块角色关联信息管理服务接口", tags = {"wlyy基础服务 - 业务模块与业务模块角色关联信息管理服务接口"})
public class BaseModuleRoleEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseModuleRoleService baseModuleRoleService;
@PostMapping(value = BaseRequestMapping.BaseModuleRole.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseModuleRoleVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BaseModuleRoleDO baseModuleRole = toEntity(jsonData, BaseModuleRoleDO.class);
    baseModuleRole = baseModuleRoleService.save(baseModuleRole);
    return success(baseModuleRole, BaseModuleRoleVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BaseModuleRole.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseModuleRoleService.delete(ids.split(","));
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseModuleRole.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseModuleRoleVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        BaseModuleRoleDO baseModuleRole = toEntity(jsonData, BaseModuleRoleDO.class);
        if (null == baseModuleRole.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseModuleRole = baseModuleRoleService.save(baseModuleRole);
        return success(baseModuleRole, BaseModuleRoleVO.class);
        }
        @GetMapping(value = BaseRequestMapping.BaseModuleRole.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseModuleRoleVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<BaseModuleRoleDO> baseModuleRoles = baseModuleRoleService.search(fields, filters, sorts, page, size);
                int count = (int)baseModuleRoleService.getCount(filters);
                return success(baseModuleRoles, count, page, size, BaseModuleRoleVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BaseModuleRole.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseModuleRoleVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<BaseModuleRoleDO> baseModuleRoles = baseModuleRoleService.search(fields, filters, sorts);
                  return success(baseModuleRoles, BaseModuleRoleVO.class);
         }
 }

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/module/ModuleEndpoint.java

@ -93,7 +93,7 @@ public class ModuleEndpoint extends EnvelopRestEndpoint {
        if(count > 1){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Module.NAME_IS_EXIST), ObjEnvelop.class);
        }
        module = moduleService.save(module);
        module = moduleService.updateModule(module);
        return success(module, ModuleVO.class);
    }

+ 11 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/notice/UserNoticeEndpoint.java

@ -54,4 +54,15 @@ public class UserNoticeEndpoint extends EnvelopRestEndpoint {
        return userNoticeService.queryPage(page, size, userId);
    }
    @GetMapping(value = BaseRequestMapping.UserNotice.COUNT)
    @ApiOperation(value = "根据用户id,判断该用户是否有未读消息")
    public ObjEnvelop<Long> countUserNotice() throws Exception {
        String userId = getUID();
        if(StringUtils.isBlank(userId)){
            return failed("用户信息获取失败!",ObjEnvelop.class);
        }
        Long lo=userNoticeService.countUnReadNotice(userId);
        return success("success",lo);
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -185,9 +185,9 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryCodeList)
    @ApiOperation(value = "查询机构列表")
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryOrgCodeAndNameListBySaasId)
    @ApiOperation(value = "查询机构代码和名称列表")
    public ListEnvelop queryOrgCodeAndNameList() throws Exception {
        return success(baseOrgService.findOrgCodeListBySaasId(""));
        return success(baseOrgService.findOrgListBySaasId(""));
    }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java

@ -107,7 +107,7 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
        if(count>1){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
        }
        menuDO = menuService.save(menuDO);
        menuDO = menuService.updateMenu(menuDO);
        return success(menuDO);
    }

+ 22 - 10
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java

@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.saas.SaasTypeDictDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.restmodel.base.module.ModuleVO;
import com.yihu.jw.restmodel.base.module.SaasModuleVO;
import com.yihu.jw.restmodel.base.saas.SaasVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -73,10 +74,10 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
            @RequestParam String jsonSaas) throws Exception {
        SaasDO saasDO = toEntity(jsonSaas, SaasDO.class);
        if(!ValidateUtil.isValidMobileNo(saasDO.getMobile())){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.MOBILE_IS_EXIST), Envelop.class);
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.PHONE_IS_NOT_FORMAT), Envelop.class);
        }
        if(!ValidateUtil.isValidEmail(saasDO.getEmail())){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_NOT_FORMAT), Envelop.class);
        }
        if (saasService.search("name=" + saasDO.getName()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST), Envelop.class);
@ -223,25 +224,36 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.Saas.FIND_MODULE_BY_SAASID)
    @ApiOperation(value = "获取租户的模块列表")
    public ListEnvelop<SaasModuleVO> findModuleBySaasId (
    public ListEnvelop<ModuleVO> findModuleBySaasId (
            @ApiParam(name = "saasId", value = "saasId")
            @RequestParam(value = "saasId", required = true) String saasId) throws Exception {
        String filters = "status="+ ModuleDO.Status.available.getValue()+";";
        if(StringUtils.isNotBlank(saasId)){
            filters = "saasId="+saasId;
            filters += "saasId="+saasId;
        }
        List<SaasModuleDO> modules = saasModuleService.search(null, filters, null);
        List<SaasModuleVO> moduleVOs = convertToModels(modules,new ArrayList<>(modules.size()),SaasModuleVO.class);
        Map<String,List<SaasModuleVO>> map = moduleVOs.stream().collect(Collectors.groupingBy(SaasModuleVO::getParentModuleId));
        moduleVOs.forEach(module->{
            List<SaasModuleVO> tmp = map.get(module.getId());
        List<ModuleVO> moduleVOList = new ArrayList<>(moduleVOs.size());
        //转化为module
        moduleVOs.forEach(one->{
            ModuleVO vo = new ModuleVO();
            vo.setId(one.getModuleId());
            vo.setParentId(one.getParentModuleId());
            vo.setIsMust(one.getIsMust());
            vo.setName(one.getName());
            moduleVOList.add(vo);
        });
        List<ModuleVO> moduleVOList2 = moduleVOList;
        Map<String,List<ModuleVO>> map = moduleVOList2.stream().collect(Collectors.groupingBy(ModuleVO::getParentId));
        moduleVOList2.forEach(module->{
            List<ModuleVO> tmp = map.get(module.getId());
            module.setChildren(tmp);
        });
        moduleVOs = moduleVOs.stream()
                .filter(module -> CommonContant.DEFAULT_PARENTID.equals(module.getParentModuleId()))
        moduleVOList2 = moduleVOList2.stream()
                .filter(module -> CommonContant.DEFAULT_PARENTID.equals(module.getParentId()))
                .collect(Collectors.toList());
        return success(moduleVOs);
        return success(moduleVOList2);
    }
    @PostMapping(value = BaseRequestMapping.Saas.AUDIT)

+ 11 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java

@ -130,4 +130,15 @@ public class BaseTeamEndpoint extends EnvelopRestEndpoint {
             return success(team.getJSONObject("msg"));
         }
         @GetMapping(value = BaseRequestMapping.BaseTeam.getTeamTree)
         @ApiOperation(value = "团队机构/科室/医生树形结构")
         public Envelop generateOneOrgDeptDoctorTree (
             @ApiParam(name = "jsonData", value = "json,包含团队机构,团队机构名称,已勾选的医生")
             @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
             JSONObject team = baseTeamService.generateOneOrgDeptDoctorTree(jsonData);
             if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(team.getString("msg"));
             }
             return success(team.getJSONArray("msg"));
         }
}

+ 19 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java

@ -4,13 +4,11 @@ import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
 * 医生职业信息服务service
@ -28,6 +26,9 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据机构标识和医生标识获取医生相关联的部门职务职称等
     *
@ -59,14 +60,24 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
    /**
     * 根据医生标识获取医生已经选择的机构和职务信息
     *
     * @param doctorCode
     * @return
     */
    List<BaseDoctorHospitalDO> getOrgAndDutyListByDoctorCode(String doctorCode){
        List<BaseDoctorHospitalDO> result = new ArrayList<>();
        if(StringUtils.isEmpty(doctorCode)) {
    List<Map<String, Object>> getOrgAndDutyListByDoctorCode(String doctorCode) {
        List<Map<String, Object>> result = new ArrayList<>();
        if (StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorHospitalDao.getOrgAndDutyByDoctorCode(doctorCode);
        String sql = "SELECT" +
                "  org_code         AS orgCode," +
                "  org_name         AS orgName," +
                "  doctor_duty_code AS doctorDutyCode," +
                "  doctor_duty_name AS doctorDutyName " +
                " FROM base_doctor_hospital" +
                " WHERE doctor_code = '{doctorCode}'" +
                " GROUP BY orgCode" +
                " ORDER BY doctorDutyName DESC";
        return jdbcTemplate.queryForList(sql.replace("{doctorCode}",doctorCode));
    }
}

+ 0 - 23
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleDictService.java

@ -1,23 +0,0 @@
package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDictDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDictDO;
/**
 * 
 * 医生角色字典服务service
 * 
 * @version
 *
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseDoctorRoleDictService extends BaseJpaService<BaseDoctorRoleDictDO, BaseDoctorRoleDictDao> {
}

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 
 * 业务模块角色字典(给医生用的)服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseDoctorRoleInfoService extends BaseJpaService<BaseDoctorRoleInfoDO, BaseDoctorRoleInfoDao> {
}

+ 13 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java

@ -3,25 +3,29 @@ package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 医生角色关联信息服务service
 *
 * @version <pre>
 * 
 * 医生与业务模块角色关联信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月19日 Created
 * litaohong    1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, BaseDoctorRoleDao> {
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
@ -45,11 +49,11 @@ public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, Base
     * @param doctorCode
     * @return
     */
    public List<BaseDoctorRoleDO> queryDoctorRoleList(String doctorCode,String del) {
    public List<BaseDoctorRoleDO> queryDoctorRoleList(String doctorCode) {
        List<BaseDoctorRoleDO> result = new ArrayList<>();
        if (StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorRoleDao.findByDoctorCodeAndDel(doctorCode,del);
        return baseDoctorRoleDao.findByDoctorCode(doctorCode);
    }
}

+ 105 - 73
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -106,8 +106,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        //医生基本信息
        List<BaseDoctorDO> doctors = this.findByField("id",doctorId);
        if(CollectionUtils.isEmpty(doctors)){
        BaseDoctorDO doctors = baseDoctorDao.findOne(doctorId);
        if(null == doctors){
            result.put("msg","doctor not exist for id:" + doctorId);
            result.put("response",ConstantUtils.FAIL);
            return result;
@ -123,7 +123,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result;
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("doctor",doctors.get(0));
        jsonObject.put("doctor",doctors);
        jsonObject.put("role",roleList);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",jsonObject);
@ -141,7 +141,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject result = new JSONObject();
        String orgCodeVale = null == orgCode ? "" : orgCode;
        String del = null == docStatus ? "" : docStatus;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : nameOrIdcard;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : "%" + nameOrIdcard + "%";
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String sql = "select" +
@ -163,7 +163,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "     doc.mobile,  " +
                "     concat(hos.org_name,'/',dept.name,'/',hos.doctor_duty_name) as org,  " +
                "     doc.job_title_name,  " +
                "     case doc.del when 0 then '无效' when 1 then '有效' end as status,  " +
                "     case doc.del when 0 then '已失效' when 1 then '生效中' end as status,  " +
                "      doc.create_time  " +
                "   from  " +
                "     base_doctor doc,  " +
@ -176,9 +176,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    hos.dept_code = dept.code  " +
                "    and  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}'  ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "      and  " +
                "    ((doc.name like '{name}'  or ''= '{name}' )  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) or (doc.name like '{name}'  or ''= '{name}' )  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "  ) tb  " +
                "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
        String finalSql = sql
@ -202,9 +200,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    hos.dept_code = dept.code " +
                "    and " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " +
                "      and " +
                "    ((doc.name like '{name}' or ''= '{name}')  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) ";
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) or (doc.name like '{name}' or ''= '{name}') and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " ;
        String finalCountSql = countSql
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
@ -234,7 +230,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role) || CollectionUtils.isEmpty(hospital)){
        if(null == doctor || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
@ -251,14 +247,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        this.save(baseDoctorDO);
        //组装医生角色关联关系
        //组装医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        try {
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorDO.setDel("1");
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
            }
        } catch (IOException e) {
@ -267,6 +263,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result.toJSONString();
        }
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        }
        // 组装医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
@ -305,7 +302,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role)){
        if(null == doctor){
            result.put("msg","parameter role of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
@ -318,8 +315,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        // 修改医生信息
        BaseDoctorDO baseDoctorDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            baseDoctorDO.setPassword(oldDoctor.getPassword());
        } catch (IOException e) {
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
@ -327,23 +327,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        this.save(baseDoctorDO);
        //修改医生角色关联关系
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
        try {
            for(Object object : hospital){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                if(roleIdList.contains(baseDoctorRoleDO.getId())){
                    roleIdList.remove(baseDoctorRoleDO.getId());
        //修改医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
            BaseDoctorRoleDO baseDoctorRoleDO = null;
            Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
            try {
                for(Object object : role){
                    baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                    if(roleIdList.contains(baseDoctorRoleDO.getId())){
                        roleIdList.remove(baseDoctorRoleDO.getId());
                    }
                    baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                    baseDoctorRoleService.save(baseDoctorRoleDO);
                }
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorRoleService.save(baseDoctorRoleDO);
            } catch (IOException e) {
                result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response",ConstantUtils.FAIL);
            }
            if(roleIdList.size() > 0){
                baseDoctorRoleService.delete(roleIdList.toArray());
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
        }
        baseDoctorHospitalService.delete(roleIdList.toArray());
        // 修改医生任职机构及职业信息,前端不修改就不做任何操作
         if(!CollectionUtils.isEmpty(hospital)){
@ -362,7 +367,9 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                 result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                 result.put("response",ConstantUtils.FAIL);
             }
             baseDoctorHospitalService.delete(hospitalIdList.toArray());
             if(hospitalIdList.size() > 0){
                 baseDoctorHospitalService.delete(hospitalIdList.toArray());
             }
         }
        result.put("response",ConstantUtils.SUCCESS);
@ -396,7 +403,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    }
    /**
     * 获取医生已选中的区县/机构列表,当有机构是被选中时,要标有checked=true的状态前端加载生成树形机构,
     * 获取医生已选中的区县/机构列表,当有机构是被选中时,要标有checked=true的状态,由前端加载生成树形机构,
     * @param doctorCode
     * @return
     */
@ -416,10 +423,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        Map<String,Map<String, Object>> orgCodeMap = new HashMap<>();
        list.forEach( one-> orgCodeMap.put(String.valueOf(one.get("code")),one));
        List<BaseDoctorHospitalDO> selectedList = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        for(BaseDoctorHospitalDO one : selectedList){
            if(orgCodeMap.containsKey(one.getOrgCode())){
                orgCodeMap.get(one.getOrgCode()).put("checked",true);
        List<Map<String,Object>> selectedList = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        for(Map<String,Object> one : selectedList){
            if(orgCodeMap.containsKey(one.get("orgCode"))){
                orgCodeMap.get(one.get("orgCode")).put("checked",true);
            }
        }
        result.put("response", ConstantUtils.SUCCESS);
@ -429,7 +436,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    /**
     * 获取医生已选中的机构/职务树形结构,当有机构是被选中时,要标有checked=true的状态
     * 获取医生已选中的机构/职务树形结构,当有机构是被选中时,要标有checked=true的状态,生成树形结构,前端直接获取
     * @param doctorCode
     * @return
     */
@ -440,26 +447,26 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        List<DictDoctorDutyDO> dutyDOList = dictDoctorDutyService.search(null);
        List<DictDoctorDutyDO> dutyDOList = dictDoctorDutyService.search(null,"-name");
        List<BaseDoctorHospitalDO> selectedDutylist = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        Set<Object> selectedDutySet = new HashSet<>();
        selectedDutylist.forEach( one -> selectedDutySet.add(one.getDoctorDutyCode()) );
        List<Map<String,Object>> selectedDutylist = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        Set<String> selectedDutySet = new HashSet<>();
        selectedDutylist.forEach( one -> selectedDutySet.add(String.valueOf(one.get("orgCode"))+one.get("doctorDutyCode")));
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(BaseDoctorHospitalDO one : selectedDutylist){
        for(Map<String,Object> one : selectedDutylist){
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(one.getOrgCode());
            orgTreeParent.setName(one.getOrgName());
            orgTreeParent.setCode(String.valueOf(one.get("orgCode")));
            orgTreeParent.setName(String.valueOf(one.get("orgName")));
            orgTreeList.add(orgTreeParent);
            for(DictDoctorDutyDO dictDoctorDutyDO :dutyDOList){
                OrgTree orgTreeChild = new OrgTree();
                orgTreeChild.setParentCode(one.getOrgCode());
                orgTreeChild.setParentCode(String.valueOf(one.get("orgCode")));
                orgTreeChild.setCode(dictDoctorDutyDO.getCode());
                orgTreeChild.setName(dictDoctorDutyDO.getName());
                if(selectedDutySet.contains(dictDoctorDutyDO.getCode())){
                if(selectedDutySet.contains(String.valueOf(one.get("orgCode"))+dictDoctorDutyDO.getCode())){
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                }
@ -467,12 +474,13 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", objectMapper.readValue(makeTree(orgTreeList),JSONArray.class));
        // 不同医院职务可以相同
        result.put("msg", objectMapper.readValue(makeTree(orgTreeList,true),JSONArray.class));
        return result;
    }
    /**
     * 获取医生已选中的机构/科室树形结构
     * 获取医生已选中的机构/科室树形结构,当有机构是被选中时,要标有checked=true的状态,生成树形结构,前端直接获取
     * @param doctorCode
     * @return
     */
@ -483,7 +491,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        String deptSql = "select" +
        //医生已选中的机构的里的科室列表
        String orgDeptSql = "SELECT" +
                "  org.code AS orgCode," +
                "  org.name     AS orgName," +
                "  dept.code    AS deptCode," +
                "  dept.name    AS deptName" +
                " FROM" +
                "  base_org org," +
                "  dict_hospital_dept dept" +
                " WHERE" +
                "  dept.org_code = org.code" +
                "  AND" +
                "  dept.org_code" +
                "  in (" +
                "    SELECT DISTINCT hos.org_code from" +
                "      base_doctor_hospital hos where hos.doctor_code = '" + doctorCode + "'" +
                "  ) ORDER BY dept.name";
        List<Map<String,Object>> deptList = jdbcTemplate.queryForList(orgDeptSql);
        //医生已选中的机构的里的所在科室
        String doctorSelectedDeptSql = "select" +
                "  hos.doctor_code ," +
                "  hos.org_code as orgCode," +
                "  org.name as orgName," +
@ -496,37 +525,39 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                " where" +
                "  hos.org_code = org.code" +
                "  and" +
                "  hos.org_code = dept.org_code";
        String doctorSelectedDeptSql = deptSql + " and  hos.dept_code = dept.code and hos.doctor_code = '{doctorCode}'";
                "  hos.org_code = dept.org_code" +
                " and  hos.dept_code = dept.code and hos.doctor_code = '" + doctorCode + "' " +
                "  ORDER BY dept.name";
        List<Map<String,Object>> selectedDeptlist = jdbcTemplate.queryForList(doctorSelectedDeptSql.replace("{doctorCode}",doctorCode));
        List<Map<String,Object>> deptList = jdbcTemplate.queryForList(deptSql);
        Set<String> selectedDeptCodeSet = new HashSet<>();
        selectedDeptlist.forEach( one -> selectedDeptCodeSet.add(String.valueOf(one.get("orgCode")) + String.valueOf(one.get("deptCode"))));
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(Map<String,Object> one : selectedDeptlist){
        selectedDeptlist.forEach(one -> {
            selectedDeptCodeSet.add(String.valueOf(one.get("orgCode")) + String.valueOf(one.get("deptCode")));
            //机构树
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(String.valueOf(one.get("orgCode")));
            orgTreeParent.setName(String.valueOf(one.get("orgName")));
            orgTreeList.add(orgTreeParent);
            for(Map<String,Object> dept :deptList){
                OrgTree orgTreeChild = new OrgTree();
                orgTreeChild.setParentCode(String.valueOf(dept.get("orgCode")));
                orgTreeChild.setCode(String.valueOf(dept.get("deptCode")));
                orgTreeChild.setName(String.valueOf(dept.get("deptName")));
                orgTreeList.add(orgTreeChild);
                if(selectedDeptCodeSet.contains(String.valueOf(dept.get("orgCode")) + dept.get("deptCode"))){
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                }
            //本身就是加载已经选中了的机构,所以机构状态为true
            orgTreeParent.setChecked(true);
        });
        //科室树
        for (Map<String, Object> dept : deptList) {
            OrgTree orgTreeChild = new OrgTree();
            orgTreeChild.setParentCode(String.valueOf(dept.get("orgCode")));
            orgTreeChild.setCode(String.valueOf(dept.get("deptCode")));
            orgTreeChild.setName(String.valueOf(dept.get("deptName")));
            orgTreeList.add(orgTreeChild);
            if (selectedDeptCodeSet.contains(String.valueOf(dept.get("orgCode")) + dept.get("deptCode"))) {
                orgTreeChild.setChecked(true);
            }
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList),JSONArray.class));
        //不同医院科室可以相同
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList,true),JSONArray.class));
        return result;
    }
@ -534,10 +565,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * 构建树形结构
     * @return
     */
    public String makeTree(List<OrgTree> orgTreeList ){
    public String makeTree(List<OrgTree> orgTreeList,boolean isAllowedRepeat){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes);
        SimpleTree tree = new SimpleTree(treeNodes,isAllowedRepeat);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
@ -592,6 +623,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            baseDoctorDO.setIsFamous(one.getIsFamous());
            baseDoctorDO.setExpertise(one.getExpertise());
            baseDoctorDO.setIntroduce(one.getBrief());
            baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
            if(!StringUtils.isEmpty(one.getJobTitleName())){
                String[] job = one.getJobTitleName().split(",");
                String jobCode = job[0];
@ -599,7 +631,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                baseDoctorDO.setJobTitleCode(jobTitleDO.getCode());
                baseDoctorDO.setJobTitleName(jobTitleDO.getName());
            }
//            baseDoctorDao.save(baseDoctorDO);
            baseDoctorDao.save(baseDoctorDO);
            if(!StringUtils.isEmpty(one.getHospitalInfo())){
                BaseOrgDO orgDO = null;
                DictHospitalDeptDO hospitalDeptDO = null;
@ -641,9 +673,9 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                        dictJobTitleDO = jobTitleDao.findByCode(roleCode);
                        baseDoctorRoleDO = new BaseDoctorRoleDO();
                        baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                        baseDoctorRoleDO.setRoleModuleCode(dictJobTitleDO.getCode());
                        baseDoctorRoleDO.setName(dictJobTitleDO.getName());
                        baseDoctorRoleDO.setDel("1");
//                        baseDoctorRoleDO.setRoleModuleCode(dictJobTitleDO.getCode());
//                        baseDoctorRoleDO.setName(dictJobTitleDO.getName());
//                        baseDoctorRoleDO.setDel("1");
                        baseDoctorRoleDOList.add(baseDoctorRoleDO);
                    }
                    baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseModuleRoleService.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseModuleRoleDao;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 
 * 业务模块与业务模块角色关联信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月25日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseModuleRoleService extends BaseJpaService<BaseModuleRoleDO, BaseModuleRoleDao> {
}

+ 13 - 13
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java

@ -60,7 +60,7 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
                    baseDoctorExcelDO.setHospitalInfo(replaceBlank(getCellCont(sheet, i, 5)));
                    baseDoctorExcelDO.setJobTitleName(replaceBlank(getCellCont(sheet, i, 6)));
                    baseDoctorExcelDO.setRoleInfo(replaceBlank(getCellCont(sheet, i, 7)));
                    baseDoctorExcelDO.setIsFamous(null == getCellCont(sheet, i, 8)?null:Integer.valueOf(replaceBlank(getCellCont(sheet, i, 7)).trim()));
                    baseDoctorExcelDO.setIsFamous(null == getCellCont(sheet, i, 8)?null:Integer.valueOf(replaceBlank(getCellCont(sheet, i, 8)).trim()));
                    baseDoctorExcelDO.setExpertise(replaceBlank(getCellCont(sheet, i, 9)));
                    baseDoctorExcelDO.setBrief(replaceBlank(getCellCont(sheet, i, 10)));
                    baseDoctorExcelDO.setExcelSeq(i);
@ -95,15 +95,15 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
                String orgCode = org[0];
                String deptCode = dept[0];
                String dutyCode = duty[0];
                if(!baseOrgDao.existsByCode(orgCode)){
                    return 0;
                }
                if(!deptDao.existsByCodeAndOrgCode(deptCode,orgCode)){
                    return 0;
                }
                if(!dutyDao.existsByCode(dutyCode)){
                    return 0;
                }
//                if(!baseOrgDao.existsByCode(orgCode)){
//                    return 0;
//                }
//                if(!deptDao.existsByCodeAndOrgCode(deptCode,orgCode)){
//                    return 0;
//                }
//                if(!dutyDao.existsByCode(dutyCode)){
//                    return 0;
//                }
            }
        }
        if(StringUtils.isNotEmpty(baseDoctorExcelDO.getRoleInfo())){
@ -111,9 +111,9 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
            for(String role:roles){
                String[] element = role.split(",");
                String roleCode = element[0];
                if(jobTitleDao.existsByCode(roleCode)){
                    return 0;
                }
//                if(jobTitleDao.existsByCode(roleCode)){
//                    return 0;
//                }
            }
        }
        return rs;

+ 55 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/ModuleService.java

@ -39,6 +39,47 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
    @Autowired
    private SaasDao saasDao;
    /**
     * 修改
     * @param moduleDO
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public ModuleDO updateModule(ModuleDO moduleDO){
        ModuleDO oldModule = moduleDao.findOne(moduleDO.getId());
        if(StringUtils.isBlank(moduleDO.getParentId())){
            moduleDO.setParentId(CommonContant.DEFAULT_PARENTID);
        }
        ModuleDO parentModule = null;
        //设置level
        if(CommonContant.DEFAULT_PARENTID.equals(moduleDO.getParentId())){
            moduleDO.setLevel(0);
        }else {
            parentModule = moduleDao.findOne(moduleDO.getParentId());
            moduleDO.setLevel(parentModule.getLevel()+1);
        }
        moduleDO.setDel(1);
        moduleDO.setIsEnd(1);
        moduleDao.save(moduleDO);
        //父节点设置非根节点
        if(!CommonContant.DEFAULT_PARENTID.equals(moduleDO.getParentId())){
            if(ModuleDO.End.no.getValue().equals(parentModule.getIsEnd())){
                parentModule.setIsEnd(ModuleDO.End.have.getValue());
                moduleDao.save(parentModule);
            }
        }
        //若新增某必选业务模块,则需为所有已创建的租户和租户类型添加此业务模块
        if(ModuleDO.Must.nonMust.getValue().equals(oldModule.getIsMust())&&
                ModuleDO.Must.must.getValue().equals(moduleDO.getIsMust())){
            addSubModule(moduleDO);
        }
        return moduleDO;
    }
    /**
     * 新增模块
     * @param moduleDO
@ -49,12 +90,21 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
        if(StringUtils.isBlank(moduleDO.getParentId())){
            moduleDO.setParentId(CommonContant.DEFAULT_PARENTID);
        }
        ModuleDO parentModule = null;
        //设置level
        if(CommonContant.DEFAULT_PARENTID.equals(moduleDO.getParentId())){
            moduleDO.setLevel(0);
        }else {
            parentModule = moduleDao.findOne(moduleDO.getParentId());
            moduleDO.setLevel(parentModule.getLevel()+1);
        }
        moduleDO.setDel(1);
        moduleDO.setIsEnd(1);
        moduleDao.save(moduleDO);
        //父节点设置非根节点
        if(!CommonContant.DEFAULT_PARENTID.equals(moduleDO.getParentId())){
            ModuleDO parentModule = moduleDao.findOne(moduleDO.getParentId());
            if(ModuleDO.End.no.getValue().equals(parentModule.getIsEnd())){
                parentModule.setIsEnd(ModuleDO.End.have.getValue());
                moduleDao.save(parentModule);
@ -100,6 +150,7 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
                saasTypeModuleDO.setSaasTypeId(saasTypeDictDO.getId());
                saasTypeModuleDO.setType(moduleDO.getType());
                saasTypeModuleDO.setUrl(moduleDO.getUrl());
                saasTypeModuleDO.setLevel(moduleDO.getLevel());
                saasTypeModuleDOList.add(saasTypeModuleDO);
                //父模块非必选
@ -119,6 +170,7 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
                        typeModuleDO.setSaasTypeId(saasTypeDictDO.getId());
                        typeModuleDO.setType(parentModule.getType());
                        typeModuleDO.setUrl(parentModule.getUrl());
                        typeModuleDO.setLevel(parentModule.getLevel());
                        saasTypeModuleDOList.add(typeModuleDO);
                    }
                }
@ -143,6 +195,7 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
                saasModuleDO.setSaasId(saasDO.getId());
                saasModuleDO.setType(moduleDO.getType());
                saasModuleDO.setUrl(moduleDO.getUrl());
                saasModuleDO.setLevel(moduleDO.getLevel());
                saasModuleDOList.add(saasModuleDO);
                //父模块非必选
@ -162,6 +215,7 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
                        saasModule.setSaasId(saasDO.getId());
                        saasModule.setType(parentModule.getType());
                        saasModule.setUrl(parentModule.getUrl());
                        saasModule.setLevel(parentModule.getLevel());
                        saasModuleDOList.add(saasModule);
                    }
                }

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/notice/UserNoticeService.java

@ -73,6 +73,24 @@ public class UserNoticeService extends BaseJpaService<UserNoticeDO, UserNoticeDa
        return PageEnvelop.getSuccessListWithPage("查找成功",list, page, size,count);
    }
    /**
     * 查找该用户是否存在未读公告
     * @param userId
     * @return
     */
    public Long countUnReadNotice(String userId){
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(*) count from base_notice n , base_user_notice u WHERE n.del = '1' ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(userId)){
            sqlCount.append(" and u.user_id='").append(userId).append("' ");
            args.add(userId);
        }
        sqlCount.append(" and u.notice_id = n.id and u.del = '1'");
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return count;
    }
}

+ 8 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -163,7 +163,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            //新增机构与管理员关联关系
            BaseOrgUserDO baseOrgUserDO = new BaseOrgUserDO();
            baseOrgUserDO.setOrgCode(baseOrgDO.getCode());
            baseOrgUserDO.setUserAccount(mobile);
            baseOrgUserDO.setUserId(mobile);
            baseOrgUserService.save(baseOrgUserDO);
            //新增用户(管理员)
@ -286,9 +286,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     */
    public List findOrgCodeListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
        /*if(StringUtils.isEmpty(saasId)){
            return result;
        }
        }*/
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
@ -298,11 +298,11 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @return
     */
    public List findOrgListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgDao.findOrgCodeBySaasId(saasId);
//        List result = new ArrayList();
//        if(StringUtils.isEmpty(saasId)){
//            return result;
//        }
        return baseOrgDao.findOrgListBySaasId();
    }

+ 9 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTree.java

@ -9,8 +9,8 @@ public class SimpleTree implements Tree{
    private HashMap<String, SimpleTreeNode> treeNodesMap = new HashMap<String, SimpleTreeNode>();
    private List<SimpleTreeNode> treeNodesList = new ArrayList<SimpleTreeNode>();
    public SimpleTree(List<TreeNode> list){
        initTreeNodeMap(list);
    public SimpleTree(List<TreeNode> list,boolean isAllowedRepeat){
        initTreeNodeMap(list,isAllowedRepeat);
        initTreeNodeList();
    }
@ -43,11 +43,16 @@ public class SimpleTree implements Tree{
        }
    }
    private void initTreeNodeMap(List<TreeNode> list){
    private void initTreeNodeMap(List<TreeNode> list,boolean isAllowedRepeat){
        SimpleTreeNode treeNode = null;
        for(TreeNode item : list){
            treeNode = new SimpleTreeNode(item);
            treeNodesMap.put(treeNode.getParentNodeId() + treeNode.getNodeId(), treeNode);
            if(isAllowedRepeat){
                treeNodesMap.put(treeNode.getParentNodeId() + treeNode.getNodeId(), treeNode);
            }else{
                treeNodesMap.put(treeNode.getNodeId(), treeNode);
            }
        }
        Iterator<SimpleTreeNode> iter = treeNodesMap.values().iterator();

+ 31 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java

@ -31,6 +31,29 @@ public class MenuService extends BaseJpaService<MenuDO, MenuDao> {
        menuDao.updateStatus(id,status);
    }
    /**
     * 修改菜单
     * @param menuDO
     * @return
     */
    public MenuDO updateMenu(MenuDO menuDO){
        if(StringUtils.isBlank(menuDO.getParentId())){
            menuDO.setParentId(CommonContant.DEFAULT_PARENTID);
            menuDO.setLevel(0);
        }
        //设置level
        if(CommonContant.DEFAULT_PARENTID.equals(menuDO.getParentId())){
            menuDO.setLevel(0);
        }else {
            MenuDO parentMemu = menuDao.findOne(menuDO.getParentId());
            menuDO.setLevel(parentMemu.getLevel()+1);
        }
        int sort = menuDao.countMenuByParentId(menuDO.getParentId())+1;
        menuDO.setSort(sort);
        menuDao.save(menuDO);
        return menuDO;
    }
    /**
     * 新增菜单
     * @param menuDO
@ -39,6 +62,14 @@ public class MenuService extends BaseJpaService<MenuDO, MenuDao> {
    public MenuDO addMenu(MenuDO menuDO){
        if(StringUtils.isBlank(menuDO.getParentId())){
            menuDO.setParentId(CommonContant.DEFAULT_PARENTID);
            menuDO.setLevel(0);
        }
        //设置level
        if(CommonContant.DEFAULT_PARENTID.equals(menuDO.getParentId())){
            menuDO.setLevel(0);
        }else {
            MenuDO parentMemu = menuDao.findOne(menuDO.getParentId());
            menuDO.setLevel(parentMemu.getLevel()+1);
        }
        int sort = menuDao.countMenuByParentId(menuDO.getParentId())+1;
        menuDO.setSort(sort);

+ 14 - 35
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -100,7 +100,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
    /**
     * 默认租户管理员角色code
     */
    private final String roleCode = "saasAdmin";
    private final String roleCode = "2";
    /**
     * 注册新增
@ -113,8 +113,8 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        saas.setStatus(SaasDO.Status.auditPassed);
        saas = saasDao.save(saas);
        List<BaseOrgDO> orgDOList = saas.getOrgList();
        List<BaseOrgSaasDO> baseOrgSaasDOs = new ArrayList<>(orgDOList.size());
        if(orgDOList!=null&&orgDOList.size()>0){
            List<BaseOrgSaasDO> baseOrgSaasDOs = new ArrayList<>(orgDOList.size());
            String saasId = saas.getId();
            orgDOList.forEach(org->{
                BaseOrgSaasDO baseOrgSaasDO = new BaseOrgSaasDO();
@ -122,8 +122,8 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
                baseOrgSaasDO.setSaasid(saasId);
                baseOrgSaasDOs.add(baseOrgSaasDO);
            });
            baseOrgSaasDao.save(baseOrgSaasDOs);
        }
        baseOrgSaasDao.save(baseOrgSaasDOs);
        //用户信息初始化
        UserDO userDO = new UserDO();
@ -131,6 +131,9 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        userDO.setMobile(saas.getMobile());
        userDO.setName(saas.getManagerName());
        userDO.setUsername(userDO.getEmail());
        userDO.setAk("access_key");
        userDO.setGender(UserDO.Gender.male);
        userDO.setLoginFailureCount(0);
        saasAudit(saas, userDO);
        send(saas);
@ -219,40 +222,18 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        userDO.setEmail(saas.getEmail());
        userDO.setMobile(saas.getMobile());
        userDO.setName(saas.getManagerName());
        baseOrgDao.deleteBySaasId(saasId);
        baseOrgSaasDao.deleteBySaasId(saasId);
        List<BaseOrgDO> orgDOList = saas.getOrgList();
        if(orgDOList!=null&&orgDOList.size()>0){
            List<BaseOrgSaasDO> baseOrgSaasDOs = new ArrayList<>(orgDOList.size());
            orgDOList.forEach(org->{
                BaseOrgDO orgDO = baseOrgDao.findByCodeAndSaasId(org.getCode(),defaultSaasId);
                org.setSaasid(saasId);
                org.setName(orgDO.getName());
                org.setCreateTime(new Date());
                org.setAddress(orgDO.getAddress());
                org.setAlias(orgDO.getAlias());
                org.setBrief(orgDO.getBrief());
                org.setCityCode(orgDO.getCityCode());
                org.setCityName(orgDO.getCityName());
                org.setDel(orgDO.getDel());
                org.setIntro(orgDO.getIntro());
                org.setLatitude(orgDO.getLatitude());
                org.setLegalperson(orgDO.getLegalperson());
                org.setLongitude(orgDO.getLongitude());
                org.setName(orgDO.getName());
                org.setOrgAdmin(orgDO.getOrgAdmin());
                org.setOrgUrl(orgDO.getOrgUrl());
                org.setPhoto(orgDO.getPhoto());
                org.setProvinceCode(orgDO.getProvinceCode());
                org.setProvinceName(orgDO.getProvinceName());
                org.setQrcode(orgDO.getQrcode());
                org.setSpell(orgDO.getSpell());
                org.setStreetCode(orgDO.getStreetCode());
                org.setStreetName(orgDO.getStreetName());
                org.setTownCode(orgDO.getTownCode());
                org.setTownName(orgDO.getTownName());
                org.setType(orgDO.getType());
                BaseOrgSaasDO baseOrgSaasDO = new BaseOrgSaasDO();
                baseOrgSaasDO.setOrgCode(org.getCode());
                baseOrgSaasDO.setSaasid(saasId);
                baseOrgSaasDOs.add(baseOrgSaasDO);
            });
            baseOrgSaasDao.save(baseOrgSaasDOs);
        }
        baseOrgDao.save(orgDOList);
        saasDao.save(oldSaas);
        userDao.save(userDO);
        return oldSaas;
@ -284,6 +265,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
            saasModuleDO.setStatus(moduleDO.getStatus());
            saasModuleDO.setType(moduleDO.getType());
            saasModuleDO.setUrl(moduleDO.getUrl());
            saasModuleDO.setLevel(moduleDO.getLevel());
        });
        saasDao.save(oldSaas);
        saasModuleDao.save(saasModuleDOList);
@ -358,8 +340,6 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
            user.setEnabled(true);
            user.setLocked(false);
            user.setSalt(randomString(5));
            //姓名
            user.setName(user.getEmail());
            //账号
            user.setUsername(user.getEmail());
            String password = user.getPassword();
@ -377,7 +357,6 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        }
        saas.setManager(user.getId());
        saas.setManagerName(user.getName());
        saas.setAppId(getCode());
        saas.setAppSecret(getCode());
        saas = saasDao.save(saas);

+ 0 - 16
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java

@ -1,16 +0,0 @@
package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasUserDao;
import com.yihu.jw.entity.base.saas.SaasUserDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 租户账号
 * @author yeshijie on 2018/10/16.
 */
@Service
public class SaasUserService extends BaseJpaService<SaasUserDO, SaasUserDao> {
}

+ 95 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -5,8 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
@ -51,6 +55,12 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorService baseDoctorService;
    @Autowired
    private DictHospitalDeptService dictHospitalDeptService;
    /**
     * 新增团队
     * @param jsonData
@ -186,4 +196,89 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        result.put("msg",teamInfo);
        return result;
    }
    /**
     * 生成 机构/科室/医生 树形结构
     */
    public JSONObject generateOneOrgDeptDoctorTree(String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject result = new JSONObject();
        String orgCode = jsonObject.getString("orgCode");
        String orgName = jsonObject.getString("orgName");
        if(StringUtils.isEmpty(orgCode) || StringUtils.isEmpty(orgName)){
            result.put("msg","parameter orgCode or orgName is not allowed to be null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        List<OrgTree> orgTreeList = new ArrayList<>();
        OrgTree orgTree = new OrgTree();
        orgTree.setParentCode("");
        orgTree.setCode(orgCode);
        orgTree.setName(orgName);
        orgTreeList.add(orgTree);
        //获取该机构下的科室列表
        List<DictHospitalDeptDO> deptList = dictHospitalDeptService.findDeptByOrgCode(orgCode);
        deptList.forEach(one -> {
            OrgTree deptTree = new OrgTree();
            deptTree.setParentCode(orgCode);
            deptTree.setCode(one.getCode());
            deptTree.setName(one.getName());
            orgTreeList.add(deptTree);
        });
        //获取该机构下的医生列表
        String sql = " SELECT " +
                "  hos.doctor_code AS doctorCode," +
                "  doc.name AS doctorName," +
                "  org.code  AS orgCode," +
                "  org.name     AS orgName," +
                "  dept.code    AS deptCode," +
                "  dept.name    AS deptName" +
                " FROM " +
                "  base_doctor_hospital hos," +
                "  dict_hospital_dept dept," +
                "  base_org org," +
                "  base_doctor doc" +
                " WHERE " +
                "  hos.doctor_code = doc.id AND" +
                "  hos.org_code = org.code AND" +
                "  hos.org_code = dept.org_code AND" +
                "  hos.dept_code = dept.code AND hos.org_code = '" + orgCode +"'";
        List<Map<String,Object>> doctorList = jdbcTemplate.queryForList(sql);
        Map<String,Map<String,Object>> deptDoctorMap = new HashMap<>();
        for(Map<String,Object> doctorMap : doctorList){
            String deptCode = String.valueOf(doctorMap.get("deptCode"));
            if(deptDoctorMap.containsKey(deptCode)){
                deptDoctorMap.get(deptCode).putAll(doctorMap);
            }else{
                deptDoctorMap.put(deptCode,doctorMap);
            }
        }
        // 循环科室医生,组装tree结构
        for(String key : deptDoctorMap.keySet()){
            OrgTree deptTree = new OrgTree();
            deptTree.setParentCode(orgCode);
            deptTree.setCode(String.valueOf(deptDoctorMap.get(key).get("deptCode")));
            deptTree.setName(String.valueOf(deptDoctorMap.get(key).get("deptName")));
            OrgTree doctorTree = new OrgTree();
            doctorTree.setParentCode(String.valueOf(deptDoctorMap.get(key).get("deptCode")));
            doctorTree.setCode(String.valueOf(deptDoctorMap.get(key).get("doctorCode")));
            doctorTree.setName(String.valueOf(deptDoctorMap.get(key).get("doctorName")));
            orgTreeList.add(deptTree);
            orgTreeList.add(doctorTree);
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",objectMapper.readValue(baseDoctorService.makeTree(orgTreeList,false),JSONArray.class));
        return result;
    }
}

+ 3 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/constant/UserConstant.java

@ -7,6 +7,9 @@ package com.yihu.jw.healthyhouse.constant;
public class UserConstant {
    public static final String UNAUTHORIZED = "0";
    public static final String AUTHORIZED = "1";
    //服务分类字典id
    public static final String FACILITIES_SERVER_DICT_ID = "7";
    public static final String DEFAULT_PARENTID = "0";
}

+ 19 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/dict/SystemDictEntryController.java

@ -1,6 +1,7 @@
package com.yihu.jw.healthyhouse.controller.dict;
import com.yihu.jw.healthyhouse.constant.UserConstant;
import com.yihu.jw.healthyhouse.model.dict.DictEntryKey;
import com.yihu.jw.healthyhouse.model.dict.SystemDict;
import com.yihu.jw.healthyhouse.model.dict.SystemDictEntry;
@ -17,6 +18,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author zdm
@ -131,11 +133,27 @@ public class SystemDictEntryController extends EnvelopRestEndpoint {
    @GetMapping(HealthyHouseMapping.HealthyHouse.SystemDictEntry.LIST)
    @ApiOperation(value = "根据dictId获取所有字典项")
    public ListEnvelop GetSystemDictEntryListByDictId(
    public ListEnvelop getSystemDictEntryListByDictId(
            @ApiParam(name = "dictId", value = "字典id")
            @RequestParam(value = "dictId") String dictId) throws Exception {
        List<SystemDictEntry> cardList = systemDictEntryService.getDictEntryCodeAndValueByDictId(dictId);
        return success(cardList);
    }
    @GetMapping(HealthyHouseMapping.HealthyHouse.SystemDictEntry.GET_DICT_ENTRY_LIST_BY_DICT_ID)
    @ApiOperation(value = "设施服务补充:根据dictId获取所有字典项-包含子类列表")
    public ListEnvelop getSystemDictEntrysByList(
            @ApiParam(name = "dictId", value = "字典id")
            @RequestParam(value = "dictId") String dictId) throws Exception {
        List<SystemDictEntry> cardList = systemDictEntryService.getSystemDictEntryListByDictId(dictId);
        // 根据父节点分组
        Map<String,List<SystemDictEntry>> map=cardList.stream().collect(Collectors.groupingBy(SystemDictEntry::getPcode));
        cardList.stream().forEach(systemDictEntry -> {
            List<SystemDictEntry> list=map.get(systemDictEntry.getCode());
            systemDictEntry.setSystemDictEntryChildrenList(list);
        });
        cardList=cardList.stream().filter(systemDictEntry-> UserConstant.DEFAULT_PARENTID.equals(systemDictEntry.getPcode())).collect(Collectors.toList());
        return success(cardList);
    }
}

+ 8 - 3
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesController.java

@ -1,9 +1,11 @@
package com.yihu.jw.healthyhouse.controller.facilities;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.healthyhouse.constant.UserConstant;
import com.yihu.jw.healthyhouse.model.facility.Facility;
import com.yihu.jw.healthyhouse.model.facility.FacilityServer;
import com.yihu.jw.healthyhouse.model.facility.FacilityServerRelation;
import com.yihu.jw.healthyhouse.service.dict.SystemDictEntryService;
import com.yihu.jw.healthyhouse.service.facility.FacilityServerRelationService;
import com.yihu.jw.healthyhouse.service.facility.FacilityServerService;
import com.yihu.jw.healthyhouse.service.facility.FacilityService;
@ -52,6 +54,8 @@ public class FacilitiesController extends EnvelopRestEndpoint {
    private FacilityServerService facilityServerService;
    @Autowired
    private FacilityServerRelationService facilityServerRelationService;
    @Autowired
    private SystemDictEntryService systemDictEntryService;
    @ApiOperation(value = "获取设施列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.Facilities.PAGE)
@ -333,7 +337,7 @@ public class FacilitiesController extends EnvelopRestEndpoint {
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "facilityCategory", value = "设施分类:1小屋、2步道、3餐厅", defaultValue = "1")
            @RequestParam(value = "facilityCategory", required = false) String facilityCategory,
            @ApiParam(name = "facilityServerType", value = "非必传参数:设施服务类型:dinner吃饭、measure测量、sports运动", defaultValue = "measure")
            @ApiParam(name = "facilityServerType", value = "非必传参数:设施服务类型(大类或小类):dinner就餐、measure测量、sports运动", defaultValue = "measure")
            @RequestParam(value = "facilityServerType", required = false) String facilityServerType,
            @ApiParam(name = "facilityServerCodes", value = "非必传参数:设施服务编码,可多个,用逗号隔开", defaultValue = "jkxwServer003,HFHS7C5B5")
            @RequestParam(value = "facilityServerCodes", required = false) String facilityServerCodes) throws Exception {
@ -346,8 +350,10 @@ public class FacilitiesController extends EnvelopRestEndpoint {
                facilityList = facilityService.getFacilityByFacilityCode(facilityCodeList);
            }
        } else if (StringUtils.isNotEmpty(facilityServerType)) {
            //查找最小服务分类
             List<String> list= systemDictEntryService.getMinDictEntryCodeByCode(UserConstant.FACILITIES_SERVER_DICT_ID, facilityServerType);
            //设施编码为空,设施服务类型不为空,按设施服务类型获取设施
            List<String> facilityCodeList = facilityService.getFacilityCodeByServerType(facilityServerType);
            List<String> facilityCodeList = facilityService.getFacilityCodeByServerTypeList(list.toArray(new String[list.size()]));
            if (null != facilityCodeList && facilityCodeList.size() > 0) {
                facilityList = facilityService.getFacilityByFacilityCode(facilityCodeList);
            }
@ -475,7 +481,6 @@ public class FacilitiesController extends EnvelopRestEndpoint {
            if (dataList.size() > 0) {
                //TODO 导入
                facilityService.batchInsertDemo(dataList);
                System.out.println(dataList);
                return success("导入成功!");
            }

+ 9 - 4
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesServerController.java

@ -20,6 +20,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -155,21 +156,25 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "app按照分类获取-设施服务列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.LIST_FACILITIESERVERS_BY_TYPE)
    public ObjEnvelop<Map> getFacilitiesServerByType() throws Exception {
        Map<String, List<FacilityServer>> map = new HashMap<>();
    public ListEnvelop<Map> getFacilitiesServerByType() throws Exception {
        List<Map> mapList=new ArrayList<>();
        Map<String, Object> map ;
        List<FacilityServer> facilityServerList;
        //获取系统字典-设施服务类型
        List<SystemDictEntry> systemDictEntryList = systemDictEntryService.getDictEntryCodeAndValueByDictId(SystemDictConstant.FACILITIE_SERVERS_TYPE_DICT_ID);
        List<SystemDictEntry> systemDictEntryList = systemDictEntryService.getDictEntryCodeAndValueByDictIdAndPcode(SystemDictConstant.FACILITIE_SERVERS_TYPE_DICT_ID);
        for (Object object : systemDictEntryList) {
            Object[] obj=(Object[])object;
            if(null!=obj[0]&&StringUtils.isNotEmpty(obj[0].toString()) ){
                map = new HashMap<>();
                String filters = "type=" + obj[0].toString();
                facilityServerList = facilityServerService.search("", filters, "");
                map.put("name",null==obj[1]?"":obj[1].toString());
                map.put(obj[0].toString(), facilityServerList);
                mapList.add(map);
            }
        }
        return success(map);
        return success("success",mapList);
    }

+ 2 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/dict/SystemDictEntryDao.java

@ -36,5 +36,7 @@ public interface SystemDictEntryDao extends JpaRepository<SystemDictEntry, DictE
    @Query("select max(entry.sort) from SystemDictEntry entry where entry.dictId = :dictId")
    Integer getNextEntrySN(@Param("dictId") String dictId);
    List<SystemDictEntry> findAllByDictId(String dictId);
}

+ 0 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java

@ -108,7 +108,6 @@ public class ActivatedInterceptor {
        }
        String userId = request.getHeader("userId");
        System.out.println(userId);
        if (userId == null) {
            response.setStatus(402);
            return joinPoint.proceed();

+ 0 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/listener/RedisKeyExpirationListener.java

@ -23,7 +23,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
//      super.onMessage(message, pattern);
        // 用户做自己的业务处理即可,注意message.toString()可以获取失效的key
        String expiredKey = message.toString();
        System.out.println(expiredKey);
    }
}

+ 11 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/dict/SystemDictEntry.java

@ -12,6 +12,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 *系统字典项。
@ -46,6 +47,7 @@ public class SystemDictEntry implements Serializable {
    protected String updateUser;
    //更新者
    protected String updateUserName;
    public List<SystemDictEntry> systemDictEntryChildrenList;
    public SystemDictEntry(){
    }
@ -172,4 +174,13 @@ public class SystemDictEntry implements Serializable {
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Transient
    public List<SystemDictEntry> getSystemDictEntryChildrenList() {
        return systemDictEntryChildrenList;
    }
    public void setSystemDictEntryChildrenList(List<SystemDictEntry> systemDictEntryChildrenList) {
        this.systemDictEntryChildrenList = systemDictEntryChildrenList;
    }
}

+ 44 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/dict/SystemDictEntryService.java

@ -1,5 +1,6 @@
package com.yihu.jw.healthyhouse.service.dict;
import com.yihu.jw.healthyhouse.constant.UserConstant;
import com.yihu.jw.healthyhouse.dao.dict.SystemDictEntryDao;
import com.yihu.jw.healthyhouse.model.dict.DictEntryKey;
import com.yihu.jw.healthyhouse.model.dict.SystemDictEntry;
@ -11,6 +12,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@ -87,9 +89,22 @@ public class SystemDictEntryService extends BaseJpaService<SystemDictEntry, Syst
     * 根据字典id获取字典项编码和值
     */
    public List getDictEntryCodeAndValueByDictId(String dict_id) {
        String sql = "SELECT code,value FROM system_dict_entries where dict_id=:dict_id";
        String pcode = UserConstant.DEFAULT_PARENTID;
        String sql = "SELECT code,value FROM system_dict_entries where dict_id=:dict_id AND pcode =:pcode";
        SQLQuery sqlQuery = currentSession().createSQLQuery(sql);
        sqlQuery.setParameter("dict_id", dict_id);
        sqlQuery.setParameter("pcode", pcode);
        return sqlQuery.list();
    }
    /**
     * 根据字典id获取字典项编码和值
     */
    public List getDictEntryCodeAndValueByDictIdAndPcode(String dict_id) {
        String pcode = UserConstant.DEFAULT_PARENTID;
        String sql = "SELECT code,value FROM system_dict_entries where dict_id=:dict_id  AND pcode !=:pcode ";
        SQLQuery sqlQuery = currentSession().createSQLQuery(sql);
        sqlQuery.setParameter("dict_id", dict_id);
        sqlQuery.setParameter("pcode", pcode);
        return sqlQuery.list();
    }
@ -106,4 +121,32 @@ public class SystemDictEntryService extends BaseJpaService<SystemDictEntry, Syst
        }
    }
    public List<SystemDictEntry> getSystemDictEntryListByDictId(String dictId){
        return  systemDictEntryDao.findAllByDictId(dictId);
    }
    /**
     * 获取字典项,获取最小字典项。
     *
     * @param dictId
     * @param code
     * @return
     */
    public List<String> getMinDictEntryCodeByCode(String dictId, String code) {
        List<String> list = new ArrayList<>();
        list.add(code);
        SystemDictEntry systemDictEntry = systemDictEntryDao.findOne(new DictEntryKey(code, dictId));
        if (null != systemDictEntry && systemDictEntry.getPcode().equals(UserConstant.DEFAULT_PARENTID)) {
            list.remove(code);
            String sql = "SELECT code FROM system_dict_entries where dict_id=:dict_id AND pcode=:pcode";
            SQLQuery sqlQuery = currentSession().createSQLQuery(sql);
            sqlQuery.setParameter("dict_id", dictId);
            sqlQuery.setParameter("pcode", code);
            list = sqlQuery.list();
        }
        return list;
    }
}

+ 12 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java

@ -378,9 +378,20 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
            Map<String,Double> location = (Map<String, Double>) result1.get("location");
            facility.setLatitude(location.get("lat"));
            facility.setLongitude(location.get("lng"));
            System.out.println(result);
//            System.out.println(result);
        }
    }
    /**
     * 根据服务类型获取设施
     */
    public List<String> getFacilityCodeByServerTypeList(String[] type) {
        Session s = currentSession();
        String hql = "SELECT  DISTINCT fsr.facilitie_code FROM  facility_server_relation fsr,facility_server fs WHERE fsr.service_code=fs.code and fs.type IN(:type)";
        Query query = s.createSQLQuery(hql);
        query.setParameter("type", type);
        return query.list();
    }
}

+ 1 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/MapUtil.java

@ -28,7 +28,7 @@ public class MapUtil {
    public static void main(String[] args) {
        double distance = getDistance(118.191839, 24.49555, 118.15639977090478000000, 24.48613312327105300000);
        System.out.println(distance);
//        System.out.println(distance);
    }
}