浏览代码

Merge branch 'dev' of LiTaohong/wlyy2.0 into dev

LiTaohong 6 年之前
父节点
当前提交
05f1398d55
共有 36 个文件被更改,包括 769 次插入577 次删除
  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. 8 8
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgUserDO.java
  6. 0 37
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasUserDO.java
  7. 10 3
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  8. 20 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleDictVO.java
  9. 11 49
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleVO.java
  10. 51 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseModuleRoleVO.java
  11. 0 32
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasUserVO.java
  12. 20 26
      sql/init.sql
  13. 0 43
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java
  14. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java
  15. 5 5
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java
  16. 0 28
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDictDao.java
  17. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleInfoDao.java
  18. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseModuleRoleDao.java
  19. 5 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  20. 0 13
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/saas/SaasUserDao.java
  21. 0 103
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleDictEndpoint.java
  22. 5 6
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleEndpoint.java
  23. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleInfoEndpoint.java
  24. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseModuleRoleEndpoint.java
  25. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  26. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java
  27. 19 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java
  28. 0 23
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleDictService.java
  29. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java
  30. 13 9
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java
  31. 103 72
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  32. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseModuleRoleService.java
  33. 8 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  34. 9 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTree.java
  35. 0 16
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasUserService.java
  36. 95 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.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
@Entity
@Table(name = "base_doctor")
@Table(name = "base_doctor")
@Where(clause = "del = 1")
public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
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;
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.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
/**
/**
 * 医生角色关联信息实体
 * 医生与业务模块角色关联信息实体
 * 
 * 
 * @author litaohong on  2018年10月19日
 * @author litaohong on  2018年10月25日
 *
 *
 */
 */
@Entity
@Entity
@Table(name = "base_doctor_role")
@Table(name = "base_doctor_role")
public class BaseDoctorRoleDO extends IntegerIdentityEntityWithOperator {
public class BaseDoctorRoleDO extends IntegerIdentityEntity {
    /**
    /**
	 * saasid
	 */
	private String saasid;
	/**
	 * 医生code
	 * 医生code
	 */
	 */
	private String doctorCode;
	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() {
    public String getDoctorCode() {
        return doctorCode;
        return doctorCode;
    }
    }
@ -64,38 +35,14 @@ public class BaseDoctorRoleDO extends IntegerIdentityEntityWithOperator {
        this.doctorCode = doctorCode;
        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
@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
	 * 角色code
@ -33,6 +38,14 @@ public class BaseDoctorRoleDictDO extends IntegerIdentityEntity {
	private String del;
	private String del;
	@Column(name = "saasid")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
	@Column(name = "code")
	@Column(name = "code")
    public String getCode() {
    public String getCode() {
        return code;
        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;
    }
}

+ 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;
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
@ -23,9 +23,9 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
	private String orgCode;
	private String orgCode;
    /**
    /**
	 * 用户账号,base_user表里的username
	 * 用户账号,base_user表里的id
	 */
	 */
	private String userAccount;
	private String userId;
	@Column(name = "org_code")
	@Column(name = "org_code")
@ -36,12 +36,12 @@ public class BaseOrgUserDO extends IntegerIdentityEntity {
        this.orgCode = orgCode;
        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;
    }
    }

+ 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;
    }
}

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

@ -411,8 +411,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";
    }
    }
 /**
 /**
@ -433,7 +439,7 @@ public class BaseRequestMapping {
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
        public static final String queryOneById  = "/queryOneById";
        public static final String queryOneById  = "/queryOneById";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String queryCodeList  = "/queryCodeListBySaasId";
        public static final String queryOrgCodeAndNameListBySaasId  = "/queryOrgCodeAndNameListBySaasId";
    }
    }
@ -480,6 +486,7 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseTeam";
        public static final String PREFIX  = "/baseTeam";
        public static final String queryMemberList  = "/queryMemberList";
        public static final String queryMemberList  = "/queryMemberList";
        public static final String queryOne  = "/getTeamById";
        public static final String queryOne  = "/getTeamById";
        public static final String getTeamTree  = "/getTeamTree";
    }
    }

+ 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 
 * @version 
 * <pre>
 * <pre>
 * Author	Version		Date		Changes
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年09月05日 Created
 * litaohong 	1.0  2018年10月25日 Created
 *
 *
 * </pre>
 * </pre>
 * @since 1.
 * @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
	 * 角色code
	 */
	 */
	@ApiModelProperty(value = "角色code", example = "")
	@ApiModelProperty(value = "角色code", example = "模块1")
    private String code;
    private String code;
    /**
    /**
	 * 角色名称:全科医生、专科医生、健康管理师、管理员等
	 * 角色名称:全科医生、专科医生、健康管理师、管理员等
	 */
	 */
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "")
	@ApiModelProperty(value = "角色名称:全科医生、专科医生、健康管理师、管理员等", example = "模块1")
    private String name;
    private String name;
    /**
    /**
	 * 作废标识,1正常,0作废
	 * 作废标识,1正常,0作废
	 */
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "模块1")
    private String del;
    private String del;
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
    public String getCode() {
    public String getCode() {
        return code;
        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 
 * @version 
 * <pre>
 * <pre>
 * Author	Version		Date		Changes
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年10月19日 Created
 * litaohong 	1.0  2018年10月25日 Created
 *
 *
 * </pre>
 * </pre>
 * @since 1.
 * @since 1.
 */
 */
@ApiModel(value = "BaseDoctorRoleVO", description = "医生角色关联信息")
@ApiModel(value = "BaseDoctorRoleVO", description = "医生与业务模块角色关联信息")
public class BaseDoctorRoleVO extends IntegerIdentityVO{
public class BaseDoctorRoleVO extends IntegerIdentityVO{
    /**
    /**
	 * 医生code
	 * 医生code
	 */
	 */
	@ApiModelProperty(value = "医生code", example = "456345tf45225654g")
	@ApiModelProperty(value = "医生code", example = "模块1")
    private String doctorCode;
    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() {
    public String getDoctorCode() {
        return doctorCode;
        return doctorCode;
@ -57,33 +40,12 @@ public class BaseDoctorRoleVO extends IntegerIdentityVO{
        this.doctorCode = doctorCode;
        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;
    }
}

+ 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;
    }
}

+ 20 - 26
sql/init.sql

@ -99,10 +99,11 @@ CREATE TABLE `base_doctor` (
  UNIQUE KEY `idx_id` (`id`)
  UNIQUE KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生基本信息';
) 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,自增长,字典型',
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saasid` varchar(50) NOT NULL COMMENT 'saasid,不同租户各自医生的业务模块角色信息独立',
  `code` varchar(50) NOT NULL COMMENT '角色code',
  `code` varchar(50) NOT NULL COMMENT '角色code',
  `name` varchar(50) NOT NULL COMMENT '角色名称:全科医生、专科医生、健康管理师、管理员等',
  `name` varchar(50) NOT NULL COMMENT '角色名称:全科医生、专科医生、健康管理师、管理员等',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `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 '修改时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_doctor_code` (`code`)
  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`;
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,自增长,关联表',
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,关联表',
  `doctor_code` varchar(50) NOT NULL COMMENT '医生code',
  `doctor_code` varchar(50) NOT NULL COMMENT '医生code',
  `role_code` varchar(50) NOT NULL COMMENT '医生角色id',
  `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`)
  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`;
drop table IF EXISTS `base_doctor_hospital`;
@ -142,6 +153,7 @@ CREATE TABLE `base_doctor_hospital` (
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生执业信息';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生执业信息';
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色关联表';
-- 居民信息表
-- 居民信息表
drop table IF EXISTS `base_patient`;
drop table IF EXISTS `base_patient`;
CREATE TABLE `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='角色权限';
) 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` (
CREATE TABLE `base_user_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '用户ID',
  `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='业务模块角色';
  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`;
drop table IF EXISTS `org_tree`;
create table `org_tree`
create table `org_tree`

文件差异内容过多而无法显示
+ 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")
    @Query("select id from BaseDoctorHospitalDO where doctorCode = ?1")
    Set<Object> findIdListByOrgCodeAndDoctorCode(String doctorCode);
    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 org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Set;
/**
/**
 * 
 * 
 * 医生角色关联信息 数据库访问层
 * 医生与业务模块角色关联信息 数据库访问层
 * 
 * 
 * @version 
 * @version 
 * <pre>
 * <pre>
 * Author	Version		Date		Changes
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月19日 	Created
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 *
 * </pre>
 * </pre>
 * @since 1.
 * @since 1.
@ -26,5 +26,5 @@ public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctor
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    Set<Object> findIdListByDoctorCode(String doctorCode);
    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")
    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
    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();
}
}

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

+ 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
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryCodeList)
    @ApiOperation(value = "查询机构列表")
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryOrgCodeAndNameListBySaasId)
    @ApiOperation(value = "查询机构代码和名称列表")
    public ListEnvelop queryOrgCodeAndNameList() throws Exception {
    public ListEnvelop queryOrgCodeAndNameList() throws Exception {
        return success(baseOrgService.findOrgCodeListBySaasId(""));
        return success(baseOrgService.findOrgListBySaasId(""));
    }
    }
}
}

+ 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"));
             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 com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
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
 * 医生职业信息服务service
@ -28,6 +26,9 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
    @Autowired
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
    /**
     * 根据机构标识和医生标识获取医生相关联的部门职务职称等
     * 根据机构标识和医生标识获取医生相关联的部门职务职称等
     *
     *
@ -59,14 +60,24 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
    /**
    /**
     * 根据医生标识获取医生已经选择的机构和职务信息
     * 根据医生标识获取医生已经选择的机构和职务信息
     *
     * @param doctorCode
     * @param doctorCode
     * @return
     * @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 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.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月19日 Created
 * litaohong    1.0  2018年10月25日 Created
 *
 *
 * </pre>
 * </pre>
 * @since 1.
 * @since 1.
 */
 */
@Service
@Service
public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, BaseDoctorRoleDao> {
public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, BaseDoctorRoleDao> {
    @Autowired
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    private BaseDoctorRoleDao baseDoctorRoleDao;
@ -45,11 +49,11 @@ public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, Base
     * @param doctorCode
     * @param doctorCode
     * @return
     * @return
     */
     */
    public List<BaseDoctorRoleDO> queryDoctorRoleList(String doctorCode,String del) {
    public List<BaseDoctorRoleDO> queryDoctorRoleList(String doctorCode) {
        List<BaseDoctorRoleDO> result = new ArrayList<>();
        List<BaseDoctorRoleDO> result = new ArrayList<>();
        if (StringUtils.isEmpty(doctorCode)) {
        if (StringUtils.isEmpty(doctorCode)) {
            return result;
            return result;
        }
        }
        return baseDoctorRoleDao.findByDoctorCodeAndDel(doctorCode,del);
        return baseDoctorRoleDao.findByDoctorCode(doctorCode);
    }
    }
}
}

+ 103 - 72
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("msg","doctor not exist for id:" + doctorId);
            result.put("response",ConstantUtils.FAIL);
            result.put("response",ConstantUtils.FAIL);
            return result;
            return result;
@ -123,7 +123,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result;
            return result;
        }
        }
        JSONObject jsonObject = new JSONObject();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("doctor",doctors.get(0));
        jsonObject.put("doctor",doctors);
        jsonObject.put("role",roleList);
        jsonObject.put("role",roleList);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",jsonObject);
        result.put("msg",jsonObject);
@ -141,7 +141,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        String orgCodeVale = null == orgCode ? "" : orgCode;
        String orgCodeVale = null == orgCode ? "" : orgCode;
        String del = null == docStatus ? "" : docStatus;
        String del = null == docStatus ? "" : docStatus;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : nameOrIdcard;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : "%" + nameOrIdcard + "%";
        int start = 0 == page ? page++ : (page - 1) * size;
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        int end = 0 == size ? 15 : page * size;
        String sql = "select" +
        String sql = "select" +
@ -163,7 +163,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "     doc.mobile,  " +
                "     doc.mobile,  " +
                "     concat(hos.org_name,'/',dept.name,'/',hos.doctor_duty_name) as org,  " +
                "     concat(hos.org_name,'/',dept.name,'/',hos.doctor_duty_name) as org,  " +
                "     doc.job_title_name,  " +
                "     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  " +
                "      doc.create_time  " +
                "   from  " +
                "   from  " +
                "     base_doctor doc,  " +
                "     base_doctor doc,  " +
@ -176,9 +176,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    and " +
                "    hos.dept_code = dept.code  " +
                "    hos.dept_code = dept.code  " +
                "    and  " +
                "    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  " +
                "  ) tb  " +
                "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
                "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
        String finalSql = sql
        String finalSql = sql
@ -202,9 +200,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "    and " +
                "    and " +
                "    hos.dept_code = dept.code " +
                "    hos.dept_code = dept.code " +
                "    and " +
                "    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
        String finalCountSql = countSql
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
@ -234,7 +230,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        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("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
            return result.toJSONString();
@ -251,14 +247,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        this.save(baseDoctorDO);
        this.save(baseDoctorDO);
        //组装医生角色关联关系
        //组装医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        try {
        try {
            for(Object object : role){
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorDO.setDel("1");
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
            }
            }
        } catch (IOException e) {
        } catch (IOException e) {
@ -267,6 +263,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result.toJSONString();
            return result.toJSONString();
        }
        }
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        }
        // 组装医生任职机构及职业信息
        // 组装医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
@ -305,7 +302,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        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("msg","parameter role of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
            return result.toJSONString();
@ -318,8 +315,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        }
        // 修改医生信息
        // 修改医生信息
        BaseDoctorDO baseDoctorDO = null;
        BaseDoctorDO baseDoctorDO = null;
        try {
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            baseDoctorDO.setPassword(oldDoctor.getPassword());
        } catch (IOException e) {
        } catch (IOException e) {
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            result.put("response",ConstantUtils.FAIL);
@ -327,23 +327,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        }
        this.save(baseDoctorDO);
        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)){
         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("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                 result.put("response",ConstantUtils.FAIL);
                 result.put("response",ConstantUtils.FAIL);
             }
             }
             baseDoctorHospitalService.delete(hospitalIdList.toArray());
             if(hospitalIdList.size() > 0){
                 baseDoctorHospitalService.delete(hospitalIdList.toArray());
             }
         }
         }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("response",ConstantUtils.SUCCESS);
@ -396,7 +403,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    }
    }
    /**
    /**
     * 获取医生已选中的区县/机构列表,当有机构是被选中时,要标有checked=true的状态前端加载生成树形机构,
     * 获取医生已选中的区县/机构列表,当有机构是被选中时,要标有checked=true的状态,由前端加载生成树形机构,
     * @param doctorCode
     * @param doctorCode
     * @return
     * @return
     */
     */
@ -416,10 +423,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        }
        Map<String,Map<String, Object>> orgCodeMap = new HashMap<>();
        Map<String,Map<String, Object>> orgCodeMap = new HashMap<>();
        list.forEach( one-> orgCodeMap.put(String.valueOf(one.get("code")),one));
        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);
        result.put("response", ConstantUtils.SUCCESS);
@ -429,7 +436,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    /**
    /**
     * 获取医生已选中的机构/职务树形结构,当有机构是被选中时,要标有checked=true的状态
     * 获取医生已选中的机构/职务树形结构,当有机构是被选中时,要标有checked=true的状态,生成树形结构,前端直接获取
     * @param doctorCode
     * @param doctorCode
     * @return
     * @return
     */
     */
@ -440,26 +447,26 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("response", ConstantUtils.FAIL);
            result.put("response", ConstantUtils.FAIL);
            return result;
            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<>();
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(BaseDoctorHospitalDO one : selectedDutylist){
        for(Map<String,Object> one : selectedDutylist){
            OrgTree orgTreeParent = new OrgTree();
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            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);
            orgTreeList.add(orgTreeParent);
            for(DictDoctorDutyDO dictDoctorDutyDO :dutyDOList){
            for(DictDoctorDutyDO dictDoctorDutyDO :dutyDOList){
                OrgTree orgTreeChild = new OrgTree();
                OrgTree orgTreeChild = new OrgTree();
                orgTreeChild.setParentCode(one.getOrgCode());
                orgTreeChild.setParentCode(String.valueOf(one.get("orgCode")));
                orgTreeChild.setCode(dictDoctorDutyDO.getCode());
                orgTreeChild.setCode(dictDoctorDutyDO.getCode());
                orgTreeChild.setName(dictDoctorDutyDO.getName());
                orgTreeChild.setName(dictDoctorDutyDO.getName());
                if(selectedDutySet.contains(dictDoctorDutyDO.getCode())){
                if(selectedDutySet.contains(String.valueOf(one.get("orgCode"))+dictDoctorDutyDO.getCode())){
                    orgTreeParent.setChecked(true);
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                    orgTreeChild.setChecked(true);
                }
                }
@ -467,12 +474,13 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }
            }
        }
        }
        result.put("response", ConstantUtils.SUCCESS);
        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;
        return result;
    }
    }
    /**
    /**
     * 获取医生已选中的机构/科室树形结构
     * 获取医生已选中的机构/科室树形结构,当有机构是被选中时,要标有checked=true的状态,生成树形结构,前端直接获取
     * @param doctorCode
     * @param doctorCode
     * @return
     * @return
     */
     */
@ -483,7 +491,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("response", ConstantUtils.FAIL);
            result.put("response", ConstantUtils.FAIL);
            return result;
            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.doctor_code ," +
                "  hos.org_code as orgCode," +
                "  hos.org_code as orgCode," +
                "  org.name as orgName," +
                "  org.name as orgName," +
@ -496,37 +525,39 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                " where" +
                " where" +
                "  hos.org_code = org.code" +
                "  hos.org_code = org.code" +
                "  and" +
                "  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>> selectedDeptlist = jdbcTemplate.queryForList(doctorSelectedDeptSql.replace("{doctorCode}",doctorCode));
        List<Map<String,Object>> deptList = jdbcTemplate.queryForList(deptSql);
        Set<String> selectedDeptCodeSet = new HashSet<>();
        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<>();
        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();
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(String.valueOf(one.get("orgCode")));
            orgTreeParent.setCode(String.valueOf(one.get("orgCode")));
            orgTreeParent.setName(String.valueOf(one.get("orgName")));
            orgTreeParent.setName(String.valueOf(one.get("orgName")));
            orgTreeList.add(orgTreeParent);
            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("response", ConstantUtils.SUCCESS);
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList),JSONArray.class));
        //不同医院科室可以相同
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList,true),JSONArray.class));
        return result;
        return result;
    }
    }
@ -534,10 +565,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * 构建树形结构
     * 构建树形结构
     * @return
     * @return
     */
     */
    public String makeTree(List<OrgTree> orgTreeList ){
    public String makeTree(List<OrgTree> orgTreeList,boolean isAllowedRepeat){
        List<TreeNode> treeNodes = new ArrayList<>();
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeList);
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes);
        SimpleTree tree = new SimpleTree(treeNodes,isAllowedRepeat);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("parent");
@ -641,9 +672,9 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                        dictJobTitleDO = jobTitleDao.findByCode(roleCode);
                        dictJobTitleDO = jobTitleDao.findByCode(roleCode);
                        baseDoctorRoleDO = new BaseDoctorRoleDO();
                        baseDoctorRoleDO = new BaseDoctorRoleDO();
                        baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                        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);
                        baseDoctorRoleDOList.add(baseDoctorRoleDO);
                    }
                    }
                    baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
                    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> {
}

+ 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 baseOrgUserDO = new BaseOrgUserDO();
            baseOrgUserDO.setOrgCode(baseOrgDO.getCode());
            baseOrgUserDO.setOrgCode(baseOrgDO.getCode());
            baseOrgUserDO.setUserAccount(mobile);
            baseOrgUserDO.setUserId(mobile);
            baseOrgUserService.save(baseOrgUserDO);
            baseOrgUserService.save(baseOrgUserDO);
            //新增用户(管理员)
            //新增用户(管理员)
@ -286,9 +286,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     */
     */
    public List findOrgCodeListBySaasId(String saasId){
    public List findOrgCodeListBySaasId(String saasId){
        List result = new ArrayList();
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
        /*if(StringUtils.isEmpty(saasId)){
            return result;
            return result;
        }
        }*/
        return baseOrgDao.findOrgCodeBySaasId(saasId);
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
    }
@ -298,11 +298,11 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     * @return
     * @return
     */
     */
    public List findOrgListBySaasId(String saasId){
    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 HashMap<String, SimpleTreeNode> treeNodesMap = new HashMap<String, SimpleTreeNode>();
    private List<SimpleTreeNode> treeNodesList = new ArrayList<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();
        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;
        SimpleTreeNode treeNode = null;
        for(TreeNode item : list){
        for(TreeNode item : list){
            treeNode = new SimpleTreeNode(item);
            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();
        Iterator<SimpleTreeNode> iter = treeNodesMap.values().iterator();

+ 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.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
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.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
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.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
@ -51,6 +55,12 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorService baseDoctorService;
    @Autowired
    private DictHospitalDeptService dictHospitalDeptService;
    /**
    /**
     * 新增团队
     * 新增团队
     * @param jsonData
     * @param jsonData
@ -186,4 +196,89 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        result.put("msg",teamInfo);
        result.put("msg",teamInfo);
        return result;
        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;
    }
}
}