Przeglądaj źródła

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

LiTaohong 6 lat temu
rodzic
commit
06308fb91c
65 zmienionych plików z 2252 dodań i 409 usunięć
  1. 54 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictDoctorDutyDO.java
  2. 23 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  3. 32 39
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  4. 57 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDO.java
  5. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  6. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgSaasDO.java
  7. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgUserDO.java
  8. 27 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  9. 26 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  10. 58 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictDoctorDutyVO.java
  11. 0 26
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorHospitalVO.java
  12. 63 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleVO.java
  13. 27 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java
  14. 51 10
      sql/init.sql
  15. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictDoctorDutyDao.java
  16. 6 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHealthProblemDao.java
  17. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java
  18. 4 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java
  19. 4 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictJobTitleDao.java
  20. 36 12
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java
  21. 13 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java
  22. 26 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java
  23. 7 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDictDao.java
  24. 6 22
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  25. 25 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgSaasDao.java
  26. 25 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgUserDao.java
  27. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java
  28. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java
  29. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java
  30. 10 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java
  31. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java
  32. 5 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java
  33. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDoctorDutyEndpoint.java
  34. 95 27
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java
  35. 104 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleEndpoint.java
  36. 68 28
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  37. 1 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  38. 10 6
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java
  39. 79 66
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java
  40. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java
  41. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/enums/SystemDictEnum.java
  42. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictDoctorDutyService.java
  43. 7 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHealthProblemService.java
  44. 6 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java
  45. 5 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java
  46. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictJobTitleService.java
  47. 54 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java
  48. 42 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java
  49. 321 51
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  50. 82 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDO.java
  51. 39 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgSaasService.java
  52. 135 47
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  53. 35 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgUserService.java
  54. 30 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java
  55. 12 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java
  56. 14 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java
  57. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java
  58. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictEntryService.java
  59. 75 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java
  60. 38 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamMemberService.java
  61. 108 22
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  62. 19 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  63. 8 7
      svr/svr-base/src/main/java/com/yihu/jw/base/util/JavaBeanUtils.java
  64. 7 2
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/RowKeyUtils.java
  65. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 54 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictDoctorDutyDO.java

@ -0,0 +1,54 @@
package com.yihu.jw.entity.base.dict;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医生职务字典实体
 * 
 * @author litaohong on  2018年10月19日
 *
 */
@Entity
@Table(name = "dict_doctor_duty")
public class DictDoctorDutyDO extends IntegerIdentityEntity {
    /**
	 * 职务标识
	 */
	private String code;
    /**
	 * 职务名称(院长/科室主任等等)
	 */
	private String name;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
	@Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

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

@ -153,6 +153,16 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
	 */
	private String openid;
	/**
	 * 职称代码
	 */
	private String jobTitleCode;
	/**
	 * 职称名称
	 */
	private String jobTitleName;
    /**
	 * 作废标识,1正常,0作废
	 */
@ -374,6 +384,19 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
        this.del = del;
    }
    public String getJobTitleCode() {
        return jobTitleCode;
    }
    public void setJobTitleCode(String jobTitleCode) {
        this.jobTitleCode = jobTitleCode;
    }
    public String getJobTitleName() {
        return jobTitleName;
    }
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
}

+ 32 - 39
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java

@ -33,16 +33,6 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
     */
	private String doctorCode;
    /**
	 * 医生角色标识
	 */
	private String roleCode;
    /**
	 * 医院角色名称
	 */
	private String roleName;
    /**
	 * 职称代码
	 */
@ -58,18 +48,29 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
     */
    private String deptCode;
    /**
     * 职务代码
     */
    private String doctorDutyCode;
    /**
     * 职务名称
     */
    private String doctorDutyName;
    /**
	 * 作废标识,1正常,0作废
	 */
	private String del;
    /**
	 * 
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
	public BaseDoctorHospitalDO(){}
	public BaseDoctorHospitalDO(String hospCode,String hospName,String doctorDutyCode,String doctorDutyName){
	    this.hospCode = hospCode;
	    this.hospName = hospName;
	    this.doctorDutyCode = doctorDutyCode;
	    this.doctorDutyName = doctorDutyName;
    }
	@Column(name = "hosp_code")
    public String getHospCode() {
@ -96,22 +97,6 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
        this.doctorCode = doctorCode;
    }
    @Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
	@Column(name = "role_name")
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
	@Column(name = "job_title_code")
    public String getJobTitleCode() {
        return jobTitleCode;
@ -136,14 +121,6 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
        this.del = del;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getDeptCode() {
        return deptCode;
    }
@ -151,4 +128,20 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
    public String getDoctorDutyCode() {
        return doctorDutyCode;
    }
    public void setDoctorDutyCode(String doctorDutyCode) {
        this.doctorDutyCode = doctorDutyCode;
    }
    public String getDoctorDutyName() {
        return doctorDutyName;
    }
    public void setDoctorDutyName(String doctorDutyName) {
        this.doctorDutyName = doctorDutyName;
    }
}

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorRoleDO.java

@ -0,0 +1,57 @@
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月19日
 *
 */
@Entity
@Table(name = "base_doctor_role")
public class BaseDoctorRoleDO extends IntegerIdentityEntity {
    /**
	 * 医生code
	 */
	private String doctorCode;
    /**
	 * 医生角色code
	 */
	private String roleCode;
    /**
	 * 作废标识,1正常,0作废
	 */
	private String del;
	@Column(name = "doctor_code")
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
	@Column(name = "role_code")
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -17,6 +17,8 @@ import java.util.Date;
@Table(name = "base_org")
public class BaseOrgDO extends UuidIdentityEntityWithOperator {
    /**
	 * saas化配置
	 */

+ 49 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgSaasDO.java

@ -0,0 +1,49 @@
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;
/**
* 机构与Saas关联信息实体
*
* @author litaohong on  2018年10月20日
*
*/
@Entity
@Table(name = "base_org_saas")
public class BaseOrgSaasDO extends IntegerIdentityEntity {
    /**
	 * saas化配置
	 */
	private String saasid;
    /**
	 * 机构标识
	 */
	private String orgCode;
	@Column(name = "saasid")
    public String getSaasid() {
        return saasid;
    }
    public void setSaasid(String saasid) {
        this.saasid = saasid;
    }
	@Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
}

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

@ -0,0 +1,49 @@
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;
/**
* 机构与机构管理员关联信息实体
*
* @author litaohong on  2018年10月20日
*
*/
@Entity
@Table(name = "base_org_user")
public class BaseOrgUserDO extends IntegerIdentityEntity {
    /**
	 * 机构标识,base_org里的code
	 */
	private String orgCode;
    /**
	 * 用户账号,base_user表里的username
	 */
	private String userAccount;
	@Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
	@Column(name = "user_account")
    public String getUserAccount() {
        return userAccount;
    }
    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    }
}

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

@ -145,6 +145,16 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
     */
    private String liveTownName;
    /**
     * 居住街道代码
     */
    private String liveStreetCode;
    /**
     * 居住街道名称
     */
    private String liveStreetName;
    /**
     * 居住居委会代码
     */
@ -608,4 +618,21 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
    @Column(name = "live_street_code")
    public String getLiveStreetCode() {
        return liveStreetCode;
    }
    public void setLiveStreetCode(String liveStreetCode) {
        this.liveStreetCode = liveStreetCode;
    }
    @Column(name = "live_street_name")
    public String getLiveStreetName() {
        return liveStreetName;
    }
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
}

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

@ -386,8 +386,12 @@ public class BaseRequestMapping {
    public static class BaseDoctor extends Basic {
        public static final String PREFIX  = "/baseDoctor";
        public static final String DOCINFO  = "/docInfo";
        public static final String getOrgListByTown  = "/getOrgListByTown";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String docFullInfo  = "/docFullInfo";
        public static final String docOrgTreeInfo  = "/docOrgTreeInfo";
        public static final String docOrgDutyTreeInfo  = "/docOrgDutyTreeInfo";
        public static final String docOrgDeptTreeInfo  = "/docOrgDeptTreeInfo";
        public static final String getDoctorListByDept  = "/getDoctorListByDept";
    }
@ -406,6 +410,13 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseDoctorRoleDict";
    }
 /**
     * 医生角色关联关系
     */
    public static class BaseDoctorRole extends Basic {
        public static final String PREFIX  = "/baseDoctorRole";
    }
    /**
     * 机构信息
@ -415,6 +426,9 @@ public class BaseRequestMapping {
        public static final String baseInfoList  = "/baseInfoList";
        public static final String check_code  = "/check_code";
        public static final String getOrgAreaTree  = "/getOrgAreaTree";
        public static final String queryOneById  = "/queryOneById";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String queryCodeList  = "/queryCodeListBySaasId";
    }
@ -459,6 +473,8 @@ public class BaseRequestMapping {
     */
    public static class BaseTeam extends Basic {
        public static final String PREFIX  = "/baseTeam";
        public static final String queryMemberList  = "/queryMemberList";
        public static final String queryOne  = "/getTeamById";
    }
@ -526,13 +542,21 @@ public class BaseRequestMapping {
    /**
     * 职称字典
     * 医生职称字典
     */
    public static class DictJobTitle extends Basic {
        public static final String PREFIX  = "/dictJobTitle";
    }
    /**
     * 医生职务字典
     */
    public static class DictDoctorDuty extends Basic {
        public static final String PREFIX  = "/dictDoctorDuty";
    }
    /**
     * 药品字典
     */

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

@ -0,0 +1,58 @@
package com.yihu.jw.restmodel.base.dict;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * 
 * 医生职务字典vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  2018年10月19日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "DictDoctorDutyVO", description = "医生职务字典")
public class DictDoctorDutyVO extends IntegerIdentityVO{
    /**
	 * 职务标识
	 */
	@ApiModelProperty(value = "职务标识", example = "模块1")
    private String code;
    /**
	 * 职务名称(院长/科室主任等等)
	 */
	@ApiModelProperty(value = "职务名称(院长/科室主任等等)", example = "模块1")
    private String name;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

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

@ -34,18 +34,6 @@ public class BaseDoctorHospitalVO extends IntegerIdentityVO{
	@ApiModelProperty(value = "医院名称", example = "厦门市中医院")
    private String hospName;
    /**
	 * 医生角色标识
	 */
	@ApiModelProperty(value = "医生角色标识", example = "专科医生")
    private String roleCode;
    /**
	 * 医院角色名称
	 */
	@ApiModelProperty(value = "医生角色名称", example = "")
    private String roleName;
    /**
	 * 职称代码
	 */
@ -98,20 +86,6 @@ public class BaseDoctorHospitalVO extends IntegerIdentityVO{
        this.hospName = hospName;
    }
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
    public String getJobTitleCode() {
        return jobTitleCode;
    }

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

@ -0,0 +1,63 @@
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月19日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "BaseDoctorRoleVO", description = "医生角色关联信息")
public class BaseDoctorRoleVO extends IntegerIdentityVO{
    /**
	 * 医生code
	 */
	@ApiModelProperty(value = "医生code", example = "456345tf45225654g")
    private String doctorCode;
    /**
	 * 医生角色code
	 */
	@ApiModelProperty(value = "医生角色id", example = "")
    private String roleCode;
    /**
	 * 作废标识,1正常,0作废
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "")
    private String del;
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getRoleCode() {
        return roleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -174,6 +174,17 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "居住区县名称", example = "参考区县名称")
    private String liveTownName;
    /**
     * 居住街道代码
     */
    @ApiModelProperty(value = "居住街道代码", example = "参考居住街道代码")
    private String liveStreetCode;
    /**
     * 居住街道名称
     */
    @ApiModelProperty(value = "居住街道名称", example = "参考居住街道名称")
    private String liveStreetName;
    /**
     * 居委会代码
     */
@ -624,4 +635,20 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
    public String getLiveStreetCode() {
        return liveStreetCode;
    }
    public void setLiveStreetCode(String liveStreetCode) {
        this.liveStreetCode = liveStreetCode;
    }
    public String getLiveStreetName() {
        return liveStreetName;
    }
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
}

+ 51 - 10
sql/init.sql

@ -37,11 +37,31 @@ CREATE TABLE `base_org` (
  KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构信息(医院)';
-- 机构Saas关联表
drop table IF EXISTS `base_org_saas`;
CREATE TABLE `base_org_saas` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT 'id,自增长',
  `saasid` varchar(50) NOT NULL COMMENT 'saas化配置',
  `org_code` varchar(50) NOT NULL COMMENT '机构标识',
  PRIMARY KEY (`id`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构与Saas关联信息';
-- 机构管理员关联表
drop table IF EXISTS `base_org_user`;
CREATE TABLE `base_org_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT 'id,自增长',
  `org_code` varchar(50) NOT NULL COMMENT '机构标识,base_org里的code',
  `user_account` varchar(50) NOT NULL COMMENT '用户账号,base_user表里的username',
  PRIMARY KEY (`id`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构与机构管理员关联信息';
-- 医生信息表
drop table IF EXISTS `base_doctor`;
CREATE TABLE `base_doctor` (
  `id` varchar(50) NOT NULL COMMENT 'uuid,uuid唯一标识',
  `org_id` varchar(100) DEFAULT NULL COMMENT '机构id',
  `org_code` varchar(100) DEFAULT NULL COMMENT '机构id',
  `password` varchar(50) NOT NULL COMMENT '密码',
  `salt` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
@ -61,7 +81,7 @@ CREATE TABLE `base_doctor` (
  `town_name` varchar(50) DEFAULT NULL COMMENT '区县名称',
  `street_code` varchar(50) DEFAULT NULL COMMENT '街道代码',
  `street_name` varchar(50) DEFAULT NULL COMMENT '街道名称',
  `iscertified` varchar(1) NOT NULL DEFAULT '0' COMMENT '资格是否认证通过,1是,0否',
  `iscertified` varchar(1) DEFAULT NULL DEFAULT '0' COMMENT '资格是否认证通过,1是,0否',
  `is_famous` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否是名医,1是,0否',
  `is_password_prompt` char(1) DEFAULT NULL COMMENT '是否提示设置密码  1 提示过 0未提示',
  `spell` varchar(10) DEFAULT NULL COMMENT '名称拼音首字母',
@ -98,23 +118,23 @@ CREATE TABLE `base_doctor_role_dict` (
-- 医生角色关联表
drop table IF EXISTS `base_doctor_role`;
/*CREATE TABLE `base_doctor_role` (
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',
  `doctor_id` varchar(50) NOT NULL COMMENT '医生code',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生角色关联信息';
*/
-- 医生执业表(一个医生可在多个医院供职,角色等)
drop table IF EXISTS `base_doctor_hospital`;
CREATE TABLE `base_doctor_hospital` (
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `hosp_code` varchar(50) NOT NULL COMMENT '医院标识',
  `hosp_name` varchar(50) NOT NULL COMMENT '医院名称',
  `role_code` varchar(50) NOT NULL COMMENT '医生角色标识',
  `role_name` varchar(50) NOT NULL COMMENT '医院角色名称',
  `doctor_duty_code` varchar(50) NOT NULL COMMENT '医生职务标识',
  `doctor_duty_name` varchar(50) NOT NULL COMMENT '医院职务名称',
  `job_title_code` varchar(50) NOT NULL COMMENT '职称代码',
  `job_title_name` varchar(50) NOT NULL COMMENT '职称名称',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
@ -145,8 +165,16 @@ CREATE TABLE `base_patient` (
  `town_name` varchar(50) DEFAULT NULL COMMENT '区县名称',
  `street_code` varchar(50) DEFAULT NULL COMMENT '街道代码',
  `street_name` varchar(50) DEFAULT NULL COMMENT '街道名称',
  `committee_code` varchar(50) DEFAULT NULL COMMENT '居委会代码',
  `committee_name` varchar(50) DEFAULT NULL COMMENT '居委会名称',
  `live_province_code` varchar(50) DEFAULT NULL COMMENT '居住省代码',
  `live_province_name` varchar(50) DEFAULT NULL COMMENT '居住省名称',
  `live_city_code` varchar(50) DEFAULT NULL COMMENT '居住市代码',
  `live_city_name` varchar(50) DEFAULT NULL COMMENT '居住市名称',
  `live_town_code` varchar(50) DEFAULT NULL COMMENT '居住区县代码',
  `live_town_name` varchar(50) DEFAULT NULL COMMENT '居住区县名称',
  `live_street_code` varchar(50) DEFAULT NULL COMMENT '居住街道代码',
  `live_street_name` varchar(50) DEFAULT NULL COMMENT '居住街道名称',
  `committee_code` varchar(50) DEFAULT NULL COMMENT '居住居委会代码',
  `committee_name` varchar(50) DEFAULT NULL COMMENT '居住居委会名称',
  `disease` varchar(100) DEFAULT NULL COMMENT '疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病',
  `disease_condition` varchar(100) DEFAULT NULL COMMENT '病情:0绿标,1黄标,2红标,3重点关注,',
  `points` varchar(100) DEFAULT NULL COMMENT '总积分',
@ -305,19 +333,31 @@ CREATE TABLE `base_committee` (
-- 行政区划数据  5个表 ---end----
-- 医生职称字典表
drop table IF EXISTS `dict_job_title`;
create table `dict_job_title`(
`id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
`saas_id` varchar(100) DEFAULT NULL COMMENT 'saas配置id,null标识公共字典',
`code` varchar(50) default NULL COMMENT '职称标识',
`name` varchar(20) default NULL COMMENT '职称名',
`name` varchar(20) default NULL COMMENT '职称名(主任医师/副主任医师)',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
 KEY `idx_job_title_code` (`code`),
primary key (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='职称字典';
-- 医生职务字典表
drop table IF EXISTS `dict_doctor_duty`;
create table `dict_doctor_duty`(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `code` varchar(50) default NULL COMMENT '职务标识',
  `name` varchar(20) default NULL COMMENT '职务名称(院长/科室主任等等)',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  KEY `idx_job_title_code` (`code`),
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生职务字典';
-- 机构药品分发
drop table IF EXISTS `dict_medicine_distribute_org`;
CREATE TABLE `dict_medicine_distribute_org` (

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

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

+ 6 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHealthProblemDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -26,11 +27,13 @@ import java.util.Map;
 */
public interface DictHealthProblemDao extends PagingAndSortingRepository<DictHealthProblemDO, Integer>, JpaSpecificationExecutor<DictHealthProblemDO>  {
    @Query("select code as code,name as name from DictHealthProblemDO where saasId = :saasId")
    List<DictHealthProblemDO> findCodeAndNameBySaasId(@Param("saasId") String saasId);
    @Query("select code as code,name as name from DictHealthProblemDO where saasId = ?1")
    List<Map<String,Object>> findCodeAndNameBySaasId(String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictHealthProblemDO")
    List<Map<String,Object>> findCodeAndName();
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictHealthProblemDO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java

@ -34,4 +34,7 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    List<DictHospitalDeptDO> findByOrgCode(String orgCode);
    List<DictHospitalDeptDO> findByOrgCodeIn(String orgCode);
    Long countByCodeIn(String orgCode);
}

+ 4 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictIcd10Dao.java

@ -24,11 +24,13 @@ import java.util.Map;
 */
public interface DictIcd10Dao extends PagingAndSortingRepository<DictIcd10DO, Integer>, JpaSpecificationExecutor<DictIcd10DO>  {
    @Query("select code as code,name as name from DictIcd10DO where code = ?1")
    List<Map<String,Object>> findCodeAndNameSa(String saasId,Pageable pageable);
    @Query("select code as code,name as name from DictIcd10DO where saasId = ?1")
    List<Map<String,Object>> findCodeAndNameSaasId(String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictIcd10DO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictIcd10DO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
}

+ 4 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictJobTitleDao.java

@ -25,11 +25,13 @@ import java.util.Map;
 */
public interface DictJobTitleDao extends PagingAndSortingRepository<DictJobTitleDO, Integer>, JpaSpecificationExecutor<DictJobTitleDO>  {
    @Query("select code as code,name as name from DictJobTitleDO where saasId = :saasId")
    List<Map<String,Object>> findCodeAndNameBySaasId(@Param("saasId") String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictJobTitleDO where saasId = ?1")
    List<Map<String,Object>> findCodeAndNameBySaasId(String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictJobTitleDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictJobTitleDO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
}

Plik diff jest za duży
+ 36 - 12
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java


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

@ -1,10 +1,16 @@
package com.yihu.jw.base.dao.doctor;
import org.springframework.beans.factory.annotation.Autowired;
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.BaseDoctorHospitalDO;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
 * 医生职业信息 数据库访问层
@ -19,4 +25,11 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 */
public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDoctorHospitalDO, Integer>, JpaSpecificationExecutor<BaseDoctorHospitalDO>  {
    List<BaseDoctorHospitalDO> findByHospCodeAndDoctorCode(String hospCode,String doctorCode);
    @Query("select id from BaseDoctorHospitalDO where doctorCode = ?1")
    Set<Object> findIdListByHospCodeAndDoctorCode(String doctorCode);
    @Query("select new BaseDoctorHospitalDO(hospCode,hospName,doctorDutyCode,doctorDutyName) from BaseDoctorHospitalDO where doctorCode = ?1")
    List<BaseDoctorHospitalDO> getOrgAndDutyByDoctorCode(String doctorCode);
}

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

@ -0,0 +1,26 @@
package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Set;
/**
 * 
 * 医生角色关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月19日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctorRoleDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDO>  {
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    Set<Object> findIdListByDoctorCode(String doctorCode);
}

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

@ -1,10 +1,13 @@
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;
/**
 * 
 * 医生角色字典 数据库访问层
@ -18,4 +21,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDictDO;
 * @since 1.
 */
public interface BaseDoctorRoleDictDao extends PagingAndSortingRepository<BaseDoctorRoleDictDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDictDO>  {
    @Query("select id from BaseDoctorHospitalDO where doctorCode = ?1")
    Set<Object> findIdListByHospCodeAndDoctorCode(String doctorCode);
}

+ 6 - 22
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -24,36 +24,20 @@ import java.util.Map;
 */
public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String>, JpaSpecificationExecutor<BaseOrgDO>  {
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where code like ?1")
    List<Map<String,Object>> findByCode(String code,Pageable pageable);
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where code like ?1 and del = ?2")
    List<Map<String,Object>> findByCodeAndDel(String code, String del,Pageable pageable);
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where name like ?1")
    List<Map<String,Object>> findByName(String name,Pageable pageable);
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where name like ?1 and del = ?2")
    List<Map<String,Object>> findByNameAndDel(String name, String del,Pageable pageable);
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where del = ?1")
    List<Map<String,Object>> findBaseInfoByDel(String del, Pageable pageable);
    @Query("select new BaseOrgDO(provinceCode,provinceName,cityCode,cityName,townCode,townName,code,name) from BaseOrgDO")
    List<BaseOrgDO> findOrgByArea();
    @Query(value="select b.* from base_org b where b.code= ?1 and b.saasid= ?2 limit 1",nativeQuery = true)
    BaseOrgDO findByCodeAndSaasId(String code,String saasId);
    boolean existsByCode(String code);
    BaseOrgDO findByCode(String code);
    @Modifying
    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
    @Query("select id from BaseOrgDO where saasid = ?1")
    @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);
}

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

@ -0,0 +1,25 @@
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.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 
 * 机构与Saas关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月20日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseOrgSaasDao extends PagingAndSortingRepository<BaseOrgSaasDO, String>, JpaSpecificationExecutor<BaseOrgSaasDO>  {
    List<BaseOrgSaasDO> findBySaasid(String saasId);
}

+ 25 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgUserDao.java

@ -0,0 +1,25 @@
package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 
 * 机构与机构管理员关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月20日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseOrgUserDao extends PagingAndSortingRepository<BaseOrgUserDO, String>, JpaSpecificationExecutor<BaseOrgUserDO>  {
    List<BaseOrgUserDO> findAllByOrgCode(String orgCode);
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java

@ -36,4 +36,7 @@ public interface OrgTreeDao extends PagingAndSortingRepository<OrgTree, Integer>
    OrgTree findByCode(String code);
    boolean existsByCode(String code);
    @Query("select tree.code as code,tree.name as name from OrgTree tree where parentCode = ?1 and level = 3")
    List<Map<String,Object>> findOrgListByParentCode(String parent);
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java

@ -20,13 +20,13 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    BasePatientDO findByIdAndDel(String id,String del);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    List<Map<String,Object>> findByIdcard(String idcard, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
}

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java

@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * Created by Trick on 2018/8/31.
@ -15,5 +16,5 @@ public interface PatientMedicareCardDao extends PagingAndSortingRepository<Patie
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);
    @Query("select id from PatientMedicareCardDO where patientCode = ?1")
    List<Object> findIdListByPatientCode(String patientCode);
    Set<Object> findIdListByPatientCode(String patientCode);
}

+ 10 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java

@ -1,10 +1,14 @@
package com.yihu.jw.base.dao.system;
import com.yihu.jw.entity.base.system.SystemDictDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * Dao - 系统字典
@ -13,4 +17,10 @@ import java.util.List;
public interface SystemDictDao extends PagingAndSortingRepository<SystemDictDO, String>, JpaSpecificationExecutor<SystemDictDO> {
    List<SystemDictDO> findBySaasId(String saasId);
    @Query("select code as code,name as name from SystemDictDO where saasId = :saasId")
    List<Map<String,Object>> findCodeAndNameBySaasId(@Param("saasId") String saasId, Pageable pageable);
    @Query("select code as code,name as name from SystemDictDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
}

+ 2 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java

@ -13,4 +13,6 @@ import java.util.List;
public interface SystemDictEntryDao extends PagingAndSortingRepository<SystemDictEntryDO, String>, JpaSpecificationExecutor<SystemDictEntryDO> {
    List<SystemDictEntryDO> findBySaasId(String saasId);
    List<SystemDictEntryDO> findByDictCodeAndCodeAndSaasId(String dictCode,String code,String saasId);
}

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
@ -26,4 +27,8 @@ public interface BaseTeamMemberDao extends PagingAndSortingRepository<BaseTeamMe
    @Query("select doc.name,doc.idcard,doc.id from BaseDoctorDO doc where doc.id in (select team.doctorCode from BaseTeamMemberDO team where team.orgCode = ?1 and team.teamCode = ?2)")
    List<Map<String,Object>> getTeamMemberList();
    @Query("select id from BaseTeamMemberDO where teamCode = ?1")
    Set<Object> findIdListByTeamCode(String teamCode);
    List<BaseTeamMemberDO> findByTeamCode(String teamCode);
}

+ 104 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDoctorDutyEndpoint.java

@ -0,0 +1,104 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.restmodel.base.dict.DictDoctorDutyVO;
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月19日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.DictDoctorDuty.PREFIX)
@Api(value = "医生职务字典管理", description = "医生职务字典管理服务接口", tags = {"wlyy基础服务 - 医生职务字典管理服务接口"})
public class DictDoctorDutyEndpoint extends EnvelopRestEndpoint {
@Autowired
private DictDoctorDutyService dictDoctorDutyService;
@PostMapping(value = BaseRequestMapping.DictDoctorDuty.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<DictDoctorDutyVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    DictDoctorDutyDO dictDoctorDuty = toEntity(jsonData, DictDoctorDutyDO.class);
    dictDoctorDuty = dictDoctorDutyService.save(dictDoctorDuty);
    return success(dictDoctorDuty, DictDoctorDutyVO.class);
    }
    @PostMapping(value = BaseRequestMapping.DictDoctorDuty.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    dictDoctorDutyService.delete(ids.split(","));
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.DictDoctorDuty.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<DictDoctorDutyVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        DictDoctorDutyDO dictDoctorDuty = toEntity(jsonData, DictDoctorDutyDO.class);
        if (null == dictDoctorDuty.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        dictDoctorDuty = dictDoctorDutyService.save(dictDoctorDuty);
        return success(dictDoctorDuty, DictDoctorDutyVO.class);
        }
        @GetMapping(value = BaseRequestMapping.DictDoctorDuty.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<DictDoctorDutyVO> 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<DictDoctorDutyDO> dictDoctorDutys = dictDoctorDutyService.search(fields, filters, sorts, page, size);
                int count = (int)dictDoctorDutyService.getCount(filters);
                return success(dictDoctorDutys, count, page, size, DictDoctorDutyVO.class);
         }
         @GetMapping(value = BaseRequestMapping.DictDoctorDuty.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<DictDoctorDutyVO> 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<DictDoctorDutyDO> dictDoctorDutys = dictDoctorDutyService.search(fields, filters, sorts);
                  return success(dictDoctorDutys, DictDoctorDutyVO.class);
         }
 }

+ 95 - 27
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -2,11 +2,12 @@ package com.yihu.jw.base.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
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;
@ -40,6 +41,9 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorService baseDoctorService;
    @Autowired
    private OrgTreeService orgTreeService;
    @PostMapping(value = BaseRequestMapping.BaseDoctor.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "新增医生")
    public Envelop create(
@ -64,16 +68,16 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctor.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorVO> update(
    @ApiOperation(value = "更新医生")
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        BaseDoctorDO baseDoctor = toEntity(jsonData, BaseDoctorDO.class);
        if (null == baseDoctor.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        String str = baseDoctorService.updateDoctor(jsonData);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        baseDoctor = baseDoctorService.save(baseDoctor);
        return success(baseDoctor, BaseDoctorVO.class);
        return success(jsonObject.getString("response"));
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctor.PAGE)
@ -109,6 +113,7 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    /**
     * 单个医生信息(基本信息 + 医院执业信息)
     *
     * @param orgId
     * @param doctorId
     * @return
@ -121,10 +126,33 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgId", required = true) String orgId,
            @ApiParam(name = "doctorId", value = "医生id")
            @RequestParam(value = "doctorId", required = true) String doctorId) throws Exception {
        Map<String,Object> map = baseDoctorService.getDoctorInfo(orgId, doctorId);
        Map<String, Object> map = baseDoctorService.getOneDoctorInfo(orgId, doctorId);
        return success(map.toString());
    }
    /**
     * 生效或失效单个医生
     *
     * @param doctorCode
     * @param del
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseDoctor.enableOrDis)
    @ApiOperation(value = "生效或失效单个医生")
    public Envelop enableOrDisableDoctor(
            @ApiParam(name = "doctorCode", value = "医生标识")
            @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @ApiParam(name = "del", value = "生效或失效标识")
            @RequestParam(value = "del", required = true) String del) throws Exception {
        String str = baseDoctorService.enableOrDisableDoctor(doctorCode, del);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    /*
     * 医生信息(基本信息 + 医院执业信息)列表
     * @param name
@ -136,37 +164,77 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
     */
    @PostMapping(value = BaseRequestMapping.BaseDoctor.docFullInfo)
    @ApiOperation(value = "获取医生基础信息列表")
    public Envelop getDoctorFullInfolist(
            @ApiParam(name = "name", value = "医生姓名")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "idcard", value = "医生身份证号")
            @RequestParam(value = "idcard", required = false) String idcard,
            @ApiParam(name = "orgCode", value = "医院代码")
    public PageEnvelop getDoctorFullInfolist(
            @ApiParam(name = "nameOrIdcard", value = "医生姓名或医生身份证号")
            @RequestParam(value = "nameOrIdcard", required = false) String nameOrIdcard,
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "doctorStatus", value = "医生是否生效")
            @RequestParam(value = "doctorStatus", required = false) String doctorStatus,
            @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<Map<String,Object>> map = baseDoctorService.getDoctorFullInfo(name, idcard,orgCode,doctorStatus);
        return success(map.toString());
        JSONObject result = baseDoctorService.queryDoctorListFullInfo(nameOrIdcard,orgCode, doctorStatus,page,size);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
   /* *//**
     * 获取医生 所属机构/部门/职称/职务 树形结构数据
    /**
     * 获取医生新增时选择的机构列表
     *
     * @param townCode
     * @return
     * @throws Exception
     *//*
    @PostMapping(value = BaseRequestMapping.BaseDoctor.docOrgTreeInfo)
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.getOrgListByTown)
    @ApiOperation(value = "根据区域获取机构列表")
    public Envelop enableOrDisableDoctor(
            @ApiParam(name = "townCode", value = "townCode")
            @RequestParam(value = "townCode", required = true) String townCode) throws Exception {
        List<Map<String, Object>> result = orgTreeService.findOrgListByParentCode(townCode);
        return success(JavaBeanUtils.getInstance().mapListJson(result));
    }
    /**
     * 获取医生 机构/职务 树形结构数据
     *
     * @param doctorCode
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.docOrgDutyTreeInfo)
    @ApiOperation(value = "获取医生所属机构树形结构数据")
    public Envelop getOrgDutyTree(
            @ApiParam(name = "doctorCode", value = "doctorCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode) throws Exception {
        return success(baseDoctorService.getDoctorDutyTree(doctorCode));
    }
    /**
     * 获取医生 机构/科室 树形结构数据
     *
     * @param doctorCode
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.docOrgDeptTreeInfo)
    @ApiOperation(value = "获取医生所属机构树形结构数据")
    public Envelop getDoctorOrgTree() throws Exception {
        String data = baseDoctorService.getOrgTree();
        return success(data);
    public Envelop getOrgDeptTree(
            @ApiParam(name = "doctorCode", value = "doctorCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode) throws Exception {
        return success(baseDoctorService.getDoctorDeptTree(doctorCode));
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctor.getDoctorListByDept)
    @ApiOperation(value = "获取某一科室下的医生列表")
    public Envelop getDoctorListByDept(
            @ApiParam(name = "deptCode", value = "科室代码", required = true)
            @RequestParam String deptCode) throws Exception {
        JSONObject jsonObject = baseDoctorService.getDoctorListByDept(deptCode);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
*/
}

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

@ -0,0 +1,104 @@
package com.yihu.jw.base.endpoint.doctor;
import com.yihu.jw.base.service.doctor.BaseDoctorRoleService;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorRoleVO;
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月19日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.BaseDoctorRole.PREFIX)
@Api(value = "医生角色关联信息管理", description = "医生角色关联信息管理服务接口", tags = {"wlyy基础服务 - 医生角色关联信息管理服务接口"})
public class BaseDoctorRoleEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseDoctorRoleService baseDoctorRoleService;
@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)
    @RequestBody String jsonData) throws Exception {
    BaseDoctorRoleDO baseDoctorRole = toEntity(jsonData, BaseDoctorRoleDO.class);
    baseDoctorRole = baseDoctorRoleService.save(baseDoctorRole);
    return success(baseDoctorRole, BaseDoctorRoleVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRole.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseDoctorRoleService.delete(ids.split(","));
    return success("删除成功");
    }
    @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)
        @RequestBody String jsonData) throws Exception {
        BaseDoctorRoleDO baseDoctorRole = toEntity(jsonData, BaseDoctorRoleDO.class);
        if (null == baseDoctorRole.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseDoctorRole = baseDoctorRoleService.save(baseDoctorRole);
        return success(baseDoctorRole, BaseDoctorRoleVO.class);
        }
        @GetMapping(value = BaseRequestMapping.BaseDoctorRole.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseDoctorRoleVO> 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<BaseDoctorRoleDO> baseDoctorRoles = baseDoctorRoleService.search(fields, filters, sorts, page, size);
                int count = (int)baseDoctorRoleService.getCount(filters);
                return success(baseDoctorRoles, count, page, size, BaseDoctorRoleVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BaseDoctorRole.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseDoctorRoleVO> 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<BaseDoctorRoleDO> baseDoctorRoles = baseDoctorRoleService.search(fields, filters, sorts);
                  return success(baseDoctorRoles, BaseDoctorRoleVO.class);
         }
 }

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

@ -7,7 +7,6 @@ import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
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;
@ -15,12 +14,10 @@ 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.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * 机构信息控制器
@ -40,10 +37,10 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseOrgService baseOrgService;
    @PostMapping(value = BaseRequestMapping.BaseOrg.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BaseOrg.CREATE )
    @ApiOperation(value = "创建")
    public Envelop create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        BaseOrgDO baseOrg = toEntity(jsonObject.getJSONObject("org").toJSONString(), BaseOrgDO.class);
@ -63,17 +60,18 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseOrg.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BaseOrg.UPDATE )
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseOrgVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        BaseOrgDO baseOrg = toEntity(jsonData, BaseOrgDO.class);
        if (null == baseOrg.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        BaseOrgDO baseOrg = toEntity(jsonObject.getJSONObject("org").toJSONString(), BaseOrgDO.class);
        String  msg = baseOrgService.createOrUpdateOrg(baseOrg,jsonObject.getJSONObject("admin"));
        if(StringUtils.endsWithIgnoreCase(msg, ConstantUtils.SUCCESS)){
            return success(msg);
        }
        baseOrg = baseOrgService.save(baseOrg);
        return success(baseOrg, BaseOrgVO.class);
        return failed(msg);
    }
    @GetMapping(value = BaseRequestMapping.BaseOrg.PAGE)
@ -118,36 +116,78 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
           return success(baseOrgService.getOrgAreaTree(saasId));
       }
    }
    @GetMapping(value = BaseRequestMapping.BaseOrg.queryOneById)
    @ApiOperation(value = "根据机构id查询机构")
    public Envelop queryOne (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        JSONObject result = baseOrgService.queryOneById(id);
        if(StringUtils.endsWithIgnoreCase(ConstantUtils.FAIL,result.getString("response"))){
            return failed(result.getString("msg"));
        }
      return success(result.get("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseOrg.baseInfoList)
    @ApiOperation(value = "获取机构基础信息列表")
    public ListEnvelop queryBaseOrgInfolist(
            @ApiParam(name = "orgCode", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "orgName", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "orgName", required = false) String orgName,
            @ApiParam(name = "orgStatus", value = "排序,规则参见说明文档")
    public PageEnvelop queryBaseOrgInfolist(
            @ApiParam(name = "codeOrName", value = "机构名称或机构代码")
            @RequestParam(value = "codeOrName", required = false) String codeOrName,
            @ApiParam(name = "orgStatus", value = "机构状态")
            @RequestParam(value = "orgStatus", required = false) String orgStatus,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "0")
            @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,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<Map<String, Object>> list = baseOrgService.queryOrgBaseInfoList(orgCode, orgName, orgStatus,page,size,sorts);
        return success(list);
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = baseOrgService.queryOrgBaseInfoList(codeOrName, orgStatus,page,size);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
    @GetMapping(value = BaseRequestMapping.BaseOrg.check_code)
    @ApiOperation(value = "检查代码是否可用(message=1代表可用,message=0代表不可用)")
    @ApiOperation(value = "检查代码是否可用(message=available代表可用,message=inavailable代表不可用)")
    public Envelop checkCode (
            @ApiParam(name = "code", value = "机构代码", required = true)
            @RequestParam(value = "code", required = false) String code) throws Exception {
        if (baseOrgService.existCode(code)) {
            return success("1");
            return success("inavailable");
        } else {
            return success("0");
            return success("available");
        }
    }
    /**
     * 生效或失效某个机构
     *
     * @param id
     * @param status
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseOrg.enableOrDis)
    @ApiOperation(value = "生效或失效某个机构")
    public Envelop enableOrDisableOrg(
            @ApiParam(name = "id", value = "医生标识")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "生效或失效标识")
            @RequestParam(value = "status", required = true) String status) throws Exception {
        String str = baseOrgService.enableOrDisableOrg(id, status);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    /**
     * 查询机构列表
     *
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseOrg.queryCodeList)
    @ApiOperation(value = "查询机构列表")
    public ListEnvelop queryOrgCodeAndNameList() throws Exception {
        return success(baseOrgService.findOrgCodeListBySaasId(""));
    }
}

+ 1 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -5,7 +5,6 @@ import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
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;
@ -14,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -78,7 +76,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        String result = basePatientService.getPatientInfo(id);
        String result = basePatientService.getPatientById(id);
        return success(result);
    }

+ 10 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.endpoint.system;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.system.SystemDictService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.system.SystemDictDO;
@ -55,9 +56,9 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseRequestMapping.SystemDict.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<SystemDictVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
    public Envelop page(
            @ApiParam(name = "dictType", value = "字典类型")
            @RequestParam(value = "dictType", required = true) String dictType,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
@ -66,9 +67,12 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<SystemDictDO> systemDictDOS = systemDictService.search(fields, filters, sorts, page, size);
        int count = (int) systemDictService.getCount(filters);
        return success(systemDictDOS, count, page, size, SystemDictVO.class);
       JSONObject result =  systemDictService.queryDictPageByType("1",dictType,filters,sorts,page,size);
       if(StringUtils.equalsIgnoreCase(ConstantUtils.FAIL,result.getString("response"))){
           return failed(result.getString("msg"));
       }
        return success(result.getJSONArray("msg"), result.getInteger("count"), page, size);
    }
    @GetMapping(value = BaseRequestMapping.SystemDict.LIST)

+ 79 - 66
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.endpoint.team;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.team.BaseTeamService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.team.BaseTeamDO;
@ -21,100 +22,112 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* 团队信息控制器
*
* @version
* <pre>
 * 团队信息控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
* @since 1.
*/
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BaseTeam.PREFIX)
@Api(value = "团队信息管理", description = "团队信息管理服务接口", tags = {"wlyy基础服务 - 团队信息管理服务接口"})
public class BaseTeamEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseTeamService baseTeamService;
    @Autowired
    private BaseTeamService baseTeamService;
@PostMapping(value = BaseRequestMapping.BaseTeam.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public Envelop create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestParam String jsonData) throws Exception {
    String msg = baseTeamService.createTeam(jsonData);
    if(StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
        return success(msg);
    }
    return failed(msg);
    @PostMapping(value = BaseRequestMapping.BaseTeam.CREATE)
    @ApiOperation(value = "创建团队")
    public Envelop create(
            @ApiParam(name = " jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        String msg = baseTeamService.createTeam(jsonData);
        if (StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS, msg)) {
            return success(msg);
        }
        return failed(msg);
    }
    @PostMapping(value = BaseRequestMapping.BaseTeam.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    baseTeamService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        baseTeamService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseTeam.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseTeamVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestParam String jsonData) throws Exception {
        BaseTeamDO baseTeam = toEntity(jsonData, BaseTeamDO.class);
        if (null == baseTeam.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        baseTeam = baseTeamService.save(baseTeam);
        return success(baseTeam, BaseTeamVO.class);
    @PostMapping(value = BaseRequestMapping.BaseTeam.UPDATE)
    @ApiOperation(value = "更新团队")
    public Envelop update(
            @ApiParam(name = " jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject = baseTeamService.updateTeam(jsonData);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
        @GetMapping(value = BaseRequestMapping.BaseTeam.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BaseTeamVO> 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 {
                @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<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts, page, size);
                int count = (int)baseTeamService.getCount(filters);
                return success(baseTeams, count, page, size, BaseTeamVO.class);
         }
            int count = (int) baseTeamService.getCount(filters);
            return success(baseTeams, count, page, size, BaseTeamVO.class);
        }
         @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BaseTeamVO> 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<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts);
                  return success(baseTeams, BaseTeamVO.class);
         }
        @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
        @ApiOperation(value = "获取列表")
        public ListEnvelop<BaseTeamVO> 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<BaseTeamDO> baseTeams = baseTeamService.search(fields, filters, sorts);
            return success(baseTeams, BaseTeamVO.class);
        }
       /*  @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
         @GetMapping(value = BaseRequestMapping.BaseTeam.queryMemberList)
         @ApiOperation(value = "查看团队成员列表")
         public Envelop getTeamMemberList (
             @ApiParam(name = "orgCode", value = "返回的字段,为空返回全部字段")
             @ApiParam(name = "orgCode", value = "机构标识")
             @RequestParam(value = "orgCode", required = true) String orgCode,
             @ApiParam(name = "teamCode", value = "过滤器,为空检索所有条件")
             @ApiParam(name = "teamCode", value = "团队标识")
             @RequestParam(value = "teamCode", required = true) String teamCode) throws Exception {
             List<BaseTeamDO> baseTeams = baseTeamService.getTeamMemberList(orgCode, teamCode);
                  return success(baseTeams, BaseTeamVO.class);
         }*/
             JSONObject baseTeams = baseTeamService.getTeamMemberList(orgCode, teamCode);
             if (baseTeams.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(baseTeams.getString("msg"));
             }
            return success(baseTeams.getJSONArray("msg"));
         }
         @GetMapping(value = BaseRequestMapping.BaseTeam.queryOne)
         @ApiOperation(value = "查询某一个团队")
         public Envelop getTeamById (
             @ApiParam(name = "teamCode", value = "根据团队标识查询某一个团队信息")
             @RequestParam(value = "teamCode", required = true) String teamId) throws Exception {
             JSONObject team = baseTeamService.getTeamById(teamId);
             if (team.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                 return failed(team.getString("msg"));
             }
             return success(team.getJSONObject("msg"));
         }
 }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java

@ -36,7 +36,7 @@ public class UserEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        UserDO userDO = toEntity(jsonData, UserDO.class);
        userDO = userService.register(userDO);
        userDO = userService.registerWithIdcard(userDO);
        return success(userDO, UserVO.class);
    }

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/enums/SystemDictEnum.java

@ -8,5 +8,5 @@ import org.apache.commons.lang3.StringUtils;
 * @project jw2.0
 */
public enum SystemDictEnum {
    Icd10Dict, HospitalDeptDict, JobTitleDict, HealthProblemDict, DiseaseDict, MedicineDict;
    Icd10Dict, HospitalDeptDict, JobTitleDict, HealthProblemDict, DiseaseDict, MedicineDict,SystemDict;
}

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictDoctorDutyService.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.service.dict;
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 
 * 医生职务字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月19日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class DictDoctorDutyService extends BaseJpaService<DictDoctorDutyDO, DictDoctorDutyDao> {
}

+ 7 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHealthProblemService.java

@ -32,7 +32,7 @@ import java.util.Map;
public class DictHealthProblemService extends BaseJpaService<DictHealthProblemDO, DictHealthProblemDao> {
    @Autowired
    private DictJobTitleDao dictJobTitleDao;
    private DictHealthProblemDao dictHealthProblemDao;
    /**
     * 查询某一租户下的健康问题字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     * @param saasId
@ -41,11 +41,15 @@ public class DictHealthProblemService extends BaseJpaService<DictHealthProblemDO
    public JSONObject queryAll(String saasId, Pageable pageable){
        JSONObject jsonObject = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        long count = 0;
        if(StringUtils.isEmpty(saasId)){
            list = dictJobTitleDao.findCodeAndName(pageable);
            list = dictHealthProblemDao.findCodeAndName(pageable);
            count = dictHealthProblemDao.count();
        }else{
            list = dictJobTitleDao.findCodeAndNameBySaasId(saasId,pageable);
            list = dictHealthProblemDao.findCodeAndNameBySaasId(saasId,pageable);
            count = dictHealthProblemDao.countBySaasId(saasId);
        }
        jsonObject.put("count",count);
        jsonObject.put(SystemDictEnum.HealthProblemDict.toString(),list);
        return jsonObject;
    }

+ 6 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java

@ -3,11 +3,9 @@ package com.yihu.jw.base.service.dict;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,12 +48,16 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
    public JSONObject queryAll(String saasId, Pageable pageable) throws Exception{
        JSONObject jsonObject = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        long count = 0;
        if(StringUtils.isEmpty(saasId)){
            list = dictHospitalDeptDao.findCodeAndName(pageable);
            count = dictHospitalDeptDao.count();
        }else{
            List orgCodeList = baseOrgService.findOrgCodeBySaasId(saasId);
            List orgCodeList = baseOrgService.findOrgCodeListBySaasId(saasId);
            list = dictHospitalDeptDao.findByOrgCodeIn(objectMapper.writeValueAsString(orgCodeList),pageable);
            count = dictHospitalDeptDao.countByCodeIn(saasId);
        }
        jsonObject.put("count",count);
        jsonObject.put(SystemDictEnum.HospitalDeptDict.toString(),list);
        return jsonObject;
    }
@ -71,7 +73,7 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
            list = (List<DictHospitalDeptDO>)dictHospitalDeptDao.findAll();
            return list;
        }
        List orgCodeList = baseOrgService.findOrgCodeBySaasId(saasId);
        List orgCodeList = baseOrgService.findOrgCodeListBySaasId(saasId);
        try {
            list = dictHospitalDeptDao.findByOrgCodeIn(objectMapper.writeValueAsString(orgCodeList));
        } catch (JsonProcessingException e) {

+ 5 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java

@ -40,11 +40,15 @@ public class DictIcd10Service extends BaseJpaService<DictIcd10DO, DictIcd10Dao>
    public JSONObject queryAll(String saasId, Pageable pageable){
        JSONObject jsonObject = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        long count = 0;
        if(!StringUtils.isEmpty(saasId)){
           list = dictIcd10Dao.findCodeAndName(pageable);
           count = dictIcd10Dao.count();
        }else{
           list = dictIcd10Dao.findCodeAndNameSa(saasId,pageable);
           list = dictIcd10Dao.findCodeAndNameSaasId(saasId,pageable);
            count = dictIcd10Dao.countBySaasId(saasId);
        }
        jsonObject.put("count",count);
        jsonObject.put(SystemDictEnum.Icd10Dict.toString(),list);
        return jsonObject;
    }

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictJobTitleService.java

@ -38,12 +38,16 @@ public class DictJobTitleService extends BaseJpaService<DictJobTitleDO, DictJobT
     */
    public JSONObject queryAll(String saasId, Pageable pageable){
        JSONObject jsonObject = new JSONObject();
        long count = 0;
        List<Map<String,Object>> list = new ArrayList<>();
        if(StringUtils.isEmpty(saasId)){
            list = dictJobTitleDao.findCodeAndName(pageable);
            count = dictJobTitleDao.count();
        }else{
            list = dictJobTitleDao.findCodeAndNameBySaasId(saasId,pageable);
            count = dictJobTitleDao.countBySaasId(saasId);
        }
        jsonObject.put("count",count);
        jsonObject.put(SystemDictEnum.JobTitleDict.toString(),list);
        return jsonObject;
    }

+ 54 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java

@ -2,15 +2,20 @@ package com.yihu.jw.base.service.doctor;
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.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;
/**
 * 
 * 医生职业信息服务service
 * 
 * @version 
 * <pre>
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
@ -19,4 +24,49 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 */
@Service
public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospitalDO, BaseDoctorHospitalDao> {
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
     * 根据机构标识和医生标识获取医生相关联的部门职务职称等
     *
     * @param hospCode
     * @param doctorCode
     * @return
     */
    List<BaseDoctorHospitalDO> getDoctorHospitalListInfo(String hospCode, String doctorCode) {
        List<BaseDoctorHospitalDO> result = new ArrayList<>();
        if (StringUtils.isEmpty(hospCode) || StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorHospitalDao.findByHospCodeAndDoctorCode(hospCode, doctorCode);
    }
    /**
     * 根据医院标识和医生标识获取医生相关关联的部门职务职称Id列表
     *
     * @param doctorCode
     * @return
     */
    Set<Object> findDocHospIdList(String doctorCode) {
        Set<Object> result = new HashSet<>();
        if (StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorHospitalDao.findIdListByHospCodeAndDoctorCode(doctorCode);
    }
    /**
     * 根据医生标识获取医生已经选择的机构和职务信息
     * @param doctorCode
     * @return
     */
    List<BaseDoctorHospitalDO> getOrgAndDutyListByDoctorCode(String doctorCode){
        List<BaseDoctorHospitalDO> result = new ArrayList<>();
        if(StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorHospitalDao.getOrgAndDutyByDoctorCode(doctorCode);
    }
}

+ 42 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java

@ -0,0 +1,42 @@
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 java.util.HashSet;
import java.util.Set;
/**
 * 医生角色关联信息服务service
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月19日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseDoctorRoleService extends BaseJpaService<BaseDoctorRoleDO, BaseDoctorRoleDao> {
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    /**
     * 根据医生标识获取医生相关联的角色Id列表
     *
     * @param doctorCode
     * @return
     */
    public Set<Object> findRoleIdList(String doctorCode) {
        Set<Object> result = new HashSet<>();
        if (StringUtils.isEmpty(doctorCode)) {
            return result;
        }
        return baseDoctorRoleDao.findIdListByDoctorCode(doctorCode);
    }
}

+ 321 - 51
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.service.doctor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -12,8 +13,7 @@ import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -24,10 +24,8 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.regex.Pattern;
/**
 * 
@ -45,16 +43,16 @@ import java.util.Map;
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
    @Autowired
    private BaseDoctorHospitalService baseDoctorHospitalService;
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorRoleDictService baseDoctorRoleDictService;
    private BaseDoctorHospitalService baseDoctorHospitalService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private BaseDoctorRoleService baseDoctorRoleService;
    @Autowired
    private OrgTreeService orgTreeService;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
@ -66,7 +64,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * @param doctorId 医生id
     * @return
     */
    public Map<String,Object> getDoctorInfo(String orgId, String doctorId) throws Exception{
    public Map<String,Object> getOneDoctorInfo(String orgId, String doctorId) throws Exception{
        Map<String,Object> resultMap = new HashMap<>();
        if(StringUtils.isEmpty(orgId) || StringUtils.isEmpty(doctorId)){
@ -94,40 +92,82 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    /**
     * 获取医生信息(包括医生任职的医院相关信息)
     * @param name
     * @param idcard
     * @param nameOrIdcard
     * @param orgCode
     * @param docStatus
     * @return
     */
    public List<Map<String,Object>> getDoctorFullInfo(String name,String idcard,String orgCode,String docStatus){
        List<Map<String,Object>> result = new ArrayList<>();
        StringBuilder sql = new StringBuilder();
        sql.append("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hosp_name as hosptialName,dept.name as deptName,hos.role_name as roleName,hos.job_title_name jobTitleName from base_doctor doc,base_doctor_hospital hos,dict_hospital_dept dept where doc.id = hos.doctor_code and hos.dept_code = dept.code and hos.del = 1");
        if(StringUtils.isEmpty(name) && StringUtils.isEmpty(idcard) && StringUtils.isEmpty(orgCode) && StringUtils.isEmpty(docStatus)){
           result = jdbcTemplate.queryForList(sql.toString());
        }else if(StringUtils.isEmpty(name) || StringUtils.isEmpty(idcard)){
            if (!StringUtils.isEmpty(name)) {
                sql.append(" and doc.name = '").append(idcard).append("'");
            }else{
                sql.append(" and doc.idcard = '").append(name).append("'");
            }
            if(StringUtils.isEmpty(orgCode) && !StringUtils.isEmpty(docStatus)){
                sql.append(" and doc.del = '").append(docStatus).append("'");
            }else if(!StringUtils.isEmpty(orgCode) && StringUtils.isEmpty(docStatus)){
                sql.append(" and hos.hosp_code = '").append(orgCode).append("'");
            }else{
                sql.append(" and hos.hosp_code = '").append(orgCode).append("'");
                sql.append(" and doc.del = '").append(docStatus).append("'");
            }
            result = jdbcTemplate.queryForList(sql.toString());
        }else if(StringUtils.isEmpty(orgCode)){
            sql.append(" and doc.hosp_code = '").append(orgCode).append("'");
            result = jdbcTemplate.queryForList(sql.toString());
        }else{
            sql.append(" and doc.del = '").append(docStatus).append("'");
            result = jdbcTemplate.queryForList(sql.toString());
        }
    public JSONObject queryDoctorListFullInfo(String nameOrIdcard, String orgCode, String docStatus, int page, int size) throws Exception {
        JSONObject result = new JSONObject();
        String orgCodeVale = null == orgCode ? "" : orgCode;
        String del = null == docStatus ? "" : docStatus;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : nameOrIdcard;
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String sql = "select" +
                "  tb.id as id," +
                "  tb.name as name," +
                "  tb.idcard as idcard,  " +
                "  tb.sex as sex,  " +
                "  tb.mobile as mobile,  " +
                "  GROUP_CONCAT(tb.org SEPARATOR ',') as orgInfo,  " +
                "  tb.status as status " +
                "from  " +
                "  (  " +
                "    select  " +
                "     doc.id,  " +
                "     doc.name,  " +
                "     doc.idcard,  " +
                "     case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,  " +
                "     doc.mobile,  " +
                "     concat(hos.hosp_name,'/',dept.name,'/',hos.doctor_duty_name,'/',hos.job_title_name) as org,  " +
                "     case doc.del when 0 then '无效' when 1 then '有效' end as status,  " +
                "      doc.create_time  " +
                "   from  " +
                "     base_doctor doc,  " +
                "     base_doctor_hospital hos,  " +
                "     dict_hospital_dept dept  " +
                "  where  " +
                "    doc.id = hos.doctor_code  " +
                "    and  " +
                "    hos.dept_code = dept.code  " +
                "    and  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}'  ) and (hos.hosp_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "      or  " +
                "    ((doc.name like '{name}'  or ''= '{name}' )  and (hos.hosp_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
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
                .replace("{orgCode}",orgCodeVale)
                .replace("{docStatus}",del)
                .replace("{start}",String.valueOf(start))
                .replace("{end}",String.valueOf(end));
        String countSql = " select " +
                "     count(DISTINCT (doc.id)) as count " +
                "   from " +
                "     base_doctor doc, " +
                "     base_doctor_hospital hos, " +
                "     dict_hospital_dept dept " +
                "  where " +
                "    doc.id = hos.doctor_code " +
                "    and " +
                "    hos.dept_code = dept.code " +
                "    and " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) and (hos.hosp_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " +
                "      or " +
                "    ((doc.name like '{name}' or ''= '{name}')  and (hos.hosp_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) ";
        String finalCountSql = countSql
                .replace("{idcard}",nameOrIdcardValue)
                .replace("{name}",nameOrIdcardValue)
                .replace("{orgCode}",orgCodeVale)
                .replace("{docStatus}",del);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
        int count = jdbcTemplate.queryForObject(finalCountSql,Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
@ -146,14 +186,15 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONObject hospital = jsonObject.getJSONObject("hospital");
        if(null == doctor || null == hospital){
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role) || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        //组装医生信息
        BaseDoctorDO baseDoctorDO = null;
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
        } catch (IOException e) {
@ -161,34 +202,263 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
           result.put("response",ConstantUtils.FAIL);
           return result.toJSONString();
        }
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        this.save(baseDoctorDO);
        //组装医生角色关联关系
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        try {
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        // 组装医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
        try {
            baseDoctorHospitalDO = objectMapper.readValue(hospital.toJSONString(),BaseDoctorHospitalDO.class);
            baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
            for(Object object : hospital){
                baseDoctorHospitalDO = objectMapper.readValue(object.toString(),BaseDoctorHospitalDO.class);
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                hospitalDOList.add(baseDoctorHospitalDO);
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorHospitalService.save(baseDoctorHospitalDO);
        baseDoctorHospitalService.batchInsert(hospitalDOList);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseDoctorDO);
        return result.toJSONString();
    }
    /**
     * 修改医生
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String updateDoctor(String jsonData){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role) || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        //判断医生id是否存在
        if(StringUtils.isEmpty(doctor.getString("id"))){
            result.put("msg","parameter id for doctor is null when update doctor");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        // 修改医生信息
        BaseDoctorDO baseDoctorDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
        } catch (IOException e) {
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        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());
                }
                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);
        }
        baseDoctorHospitalService.delete(roleIdList.toArray());
        // 修改医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        Set<Object> hospitalIdList = baseDoctorHospitalService.findDocHospIdList(baseDoctorDO.getId());
        try {
            for(Object object : hospital){
                baseDoctorHospitalDO = objectMapper.readValue(object.toString(),BaseDoctorHospitalDO.class);
                if(hospitalIdList.contains(baseDoctorHospitalDO.getId())){
                    hospitalIdList.remove(baseDoctorHospitalDO.getId());
                }
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorHospitalService.save(baseDoctorHospitalDO);
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
        }
        baseDoctorHospitalService.delete(hospitalIdList.toArray());
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseDoctorDO);
        return result.toJSONString();
    }
    /**
     * 生效或失效单个医生
     * @param doctorCode
     * @param del
     * @return
     */
    public String enableOrDisableDoctor(String doctorCode,String del){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(doctorCode) || StringUtils.isEmpty(del)){
            result.put("msg","parameter doctorCode or del is null");
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctorCode);
        if( null == baseDoctorDO ){
            result.put("msg","doctor not exist for id:" + doctorCode);
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorDO.setDel(del);
        this.save(baseDoctorDO);
        result.put("response",ConstantUtils.SUCCESS);
        return result.toJSONString();
    }
    /**
     * 获取医生已选中的机构/职务树形结构
     * @param doctorCode
     * @return
     */
    public String getDoctorDutyTree(String doctorCode){
        if(StringUtils.isEmpty(doctorCode)){
            return "";
        }
        List<BaseDoctorHospitalDO> list = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(BaseDoctorHospitalDO one : list){
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(one.getHospCode());
            orgTreeParent.setName(one.getHospName());
            orgTreeList.add(orgTreeParent);
            OrgTree orgTreeChild = new OrgTree();
            orgTreeChild.setParentCode(one.getHospCode());
            orgTreeChild.setCode(one.getDoctorDutyCode());
            orgTreeChild.setName(one.getDoctorDutyName());
            orgTreeList.add(orgTreeChild);
        }
        return getOrgTree(orgTreeList);
    }
    /**
     * 构建区域树形结构()
     * @Param level 参考OrgTree的Level枚举类型
     * 获取医生已选中的机构/科室树形结构
     * @param doctorCode
     * @return
     */
    public String getOrgTree(OrgTree.Level level){
    public String getDoctorDeptTree(String doctorCode){
        if(StringUtils.isEmpty(doctorCode)){
            return "";
        }
        String sql = "select" +
                "  hos.doctor_code ," +
                "  hos.hosp_code as parentCode," +
                "  org.name as parentName," +
                "  hos.dept_code as childCode," +
                "  dept.name as childName" +
                " from" +
                "  base_doctor_hospital hos," +
                "  base_org org," +
                "  dict_hospital_dept dept" +
                " where" +
                "  hos.hosp_code = org.code" +
                "  and" +
                "  hos.hosp_code = dept.org_code" +
                "  and" +
                "  hos.dept_code = dept.code" +
                "  and doctor_code = '{doctorCode}'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.replace("{doctorCode}",doctorCode));
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(Map<String,Object> one : list){
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(String.valueOf(one.get("parentCode")));
            orgTreeParent.setName(String.valueOf(one.get("parentName")));
            orgTreeList.add(orgTreeParent);
            OrgTree orgTreeChild = new OrgTree();
            orgTreeChild.setParentCode(String.valueOf(one.get("parentCode")));
            orgTreeChild.setCode(String.valueOf(one.get("childCode")));
            orgTreeChild.setName(String.valueOf(one.get("childName")));
            orgTreeList.add(orgTreeChild);
        }
        return getOrgTree(orgTreeList);
    }
    /**
     * 构建树形结构
     * @return
     */
    public String getOrgTree(List<OrgTree> orgTreeList ){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeService.findListByLevel(level.getLevelValue()));
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        filter.getExcludes().add("parentNodeId");
        filter.getExcludes().add("orderNum");
        filter.getExcludes().add("level");
        return JSONObject.toJSONString(treeNode, filter);
    }
    /**
     * 获取某一科室下的医生列表
     * @param deptCode
     * @return
     */
    public JSONObject getDoctorListByDept(String deptCode) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(deptCode)){
            result.put("msg","parameter deptCode is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        String sql = "select " +
                "  DISTINCT hos.doctor_code as doctorCode, " +
                "  doc.name as name, " +
                "  hos.dept_code as deptCode " +
                " from " +
                "  base_doctor_hospital hos, " +
                "  base_doctor doc " +
                " where " +
                "  hos.doctor_code = doc.id" +
                " and hos.dept_code = '" + deptCode + "'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
}

+ 82 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDO.java

@ -0,0 +1,82 @@
package com.yihu.jw.base.service.doctor.excelImport;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.excel.ExcelUtil;
import com.yihu.jw.util.excel.Validation;
import com.yihu.jw.util.excel.annotation.Location;
import com.yihu.jw.util.excel.annotation.Row;
import com.yihu.jw.util.excel.annotation.Title;
import com.yihu.jw.util.excel.annotation.ValidRepeat;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
 *  基础人口信息列表-excel实体类
 * @author lith
 * Created at 2018/10/22.
 */
@Row(start = 1)
@Title(names= "{'姓名', '状态(1生效,0失效)','性别(1男2女)', '身份证号', '联系方式', '机构/部门/职务', '职称','归属业务模块角色','是否名医','专长','简介'}")
public class BaseDoctorExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String name;
    @Location(x=1)
    @ValidRepeat
    String del;
    @Location(x=2)
    @ValidRepeat
    String sex;
    @Location(x=3)
    @ValidRepeat
    String idcard;
    @Location(x=4)
    @ValidRepeat
    String mobile;
    @Location(x=5)
    @ValidRepeat
    String hospitalInfo;
    @Location(x=6)
    @ValidRepeat
    Integer roleInfo;
    @Location(x=7)
    @ValidRepeat
    String isFamous;
    @Location(x=8)
    @ValidRepeat
    Integer expertise;
    @Location(x=9)
    @ValidRepeat
    String brief;
    private String  saasId;
    //租户创建时间
    private Date saasCreateTime;
    //所属省代码
    private String  provinceCode;
    //省份名称
    private String  provinceName;
    //城市编码
    private String  cityCode;
    //城市名称
    private String  cityName;
    //所属区代码
    private String  districtCode;
    //区名
    private String  districtName;
    //慢病人数
    private Integer ncdNum;
    int yearNow = DateUtil.getNowYear();
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
        return rs;
    }
}

+ 39 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgSaasService.java

@ -0,0 +1,39 @@
package com.yihu.jw.base.service.org;
import com.yihu.jw.base.dao.org.BaseOrgSaasDao;
import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
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 javax.xml.ws.Action;
import java.util.ArrayList;
import java.util.List;
/**
 * 
 * 机构与Saas关联信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月20日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseOrgSaasService extends BaseJpaService<BaseOrgSaasDO, BaseOrgSaasDao> {
    @Autowired
    private BaseOrgSaasDao baseOrgSaasDao;
    public List<BaseOrgSaasDO>  findBySaasid(String saasId){
        List<BaseOrgSaasDO> result =  new ArrayList<>();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgSaasDao.findBySaasid(saasId);
    }
}

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

@ -2,6 +2,8 @@ package com.yihu.jw.base.service.org;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
@ -9,7 +11,8 @@ import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.service.user.UserRoleService;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.user.UserRoleDO;
import com.yihu.mysql.query.BaseJpaService;
@ -17,11 +20,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 
@ -49,36 +51,81 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    private UserRoleService userRoleService;
    @Autowired
    private  BaseOrgUserService baseOrgUserService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 机构基础信息列表
     * @param orgCode
     * @param orgName
     * @param codeOrName
     * @param orgStatus
     * @return
     */
    public List<Map<String,Object>> queryOrgBaseInfoList(String orgCode,String orgName,String orgStatus,int page,int size,String sorts){
        List<Map<String,Object>> result = new ArrayList<>();
        if(StringUtils.endsWithIgnoreCase("1",orgStatus)){
            if(!StringUtils.isEmpty(orgCode) ){
                result = baseOrgDao.findByCodeAndDel(orgCode,orgStatus,createPage(page,size,sorts));
            }else if(!StringUtils.isEmpty(orgCode)){
                result = baseOrgDao.findByNameAndDel(orgName,orgStatus,createPage(page,size,sorts));
            }else{
                result = baseOrgDao.findBaseInfoByDel(orgStatus,createPage(page,size,sorts));
            }
        }else{
            if(!StringUtils.isEmpty(orgCode) ){
                result = baseOrgDao.findByCode(orgCode,createPage(page,size,sorts));
            }else if(!StringUtils.isEmpty(orgCode)){
                result = baseOrgDao.findByName(orgName,createPage(page,size,sorts));
            }else{
                result = baseOrgDao.findBaseInfo(createPage(page,size,sorts));
            }
    public JSONObject queryOrgBaseInfoList(String codeOrName,String orgStatus,int page,int size) throws Exception {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String codeOrNameValue = null == codeOrName ? "" : codeOrName;
        String sql = "select id,code,name,case del when 1 then '有效' else '失效' end as status,concat(province_name,city_name,town_name,address) as address " +
                " from base_org " +
                " where " +
                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " or " +
                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " and" +
                " (del = '{orgStatus}' or ''='{orgStatus}')" +
                "  order by create_time desc limit {start},{end}";
        String finalSql = sql
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus).replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT count(id)" +
                " FROM base_org " +
                " WHERE " +
                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " OR " +
                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " AND" +
                " (del = '{orgStatus}' OR ''='{orgStatus}')";
        String finalCountSql = countSql
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(finalSql);
        Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
    /**
     * 根据id查询机构,只查询机构的信息
     * @param id
     * @return
     */
    public JSONObject queryOneById(String id) throws JsonProcessingException {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(id)){
            result.put("msg","org not exist for id:"+id);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        BaseOrgDO baseOrgDO = baseOrgDao.findOne(id);
        if(null == baseOrgDO){
            return null;
        }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseOrgDO);
        return result;
    }
@ -89,36 +136,45 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
     */
    public String createOrUpdateOrg(BaseOrgDO baseOrgDO,JSONObject orgAdminJson){
        UserDO userDO = null;
        String mobile = orgAdminJson.getString("mobile");
        String adminName = orgAdminJson.getString("orgAdmin");
        if(StringUtils.isEmpty(mobile)){
            return "paramter for admin is null";
        }
        //id为空表示新增
        if(StringUtils.isEmpty(baseOrgDO.getId())){
            String mobile = orgAdminJson.getString("mobile");
            String adminName = orgAdminJson.getString("orgAdmin");
            if(StringUtils.isEmpty(mobile)){
                return "paramter for admin is null";
            }
            baseOrgDO.setOrgAdmin(adminName);
            baseOrgDao.save(baseOrgDO);
            //新增机构与管理员关联关系
            BaseOrgUserDO baseOrgUserDO = new BaseOrgUserDO();
            baseOrgUserDO.setOrgCode(baseOrgDO.getCode());
            baseOrgUserDO.setUserAccount(mobile);
            baseOrgUserService.save(baseOrgUserDO);
            //新增用户(管理员)
            userDO = new UserDO();
            userDO.setUsername(adminName);
            userDO.setUsername(mobile);
            userDO.setName(adminName);
            userDO.setMobile(mobile);
            userService.register(userDO);
            userService.registerWithMobile(userDO);
            // 新增用户角色关联关系
            UserRoleDO userRoleDO = new UserRoleDO();
            userRoleDO.setRoleId("");
            userRoleDO.setUserId("");
            userRoleDO.setUserId(userDO.getId());
            userRoleService.save(userRoleDO);
            //新增机构与区域的树形结构关系
            orgTreeService.addOrgTreeNode(baseOrgDO);
        }else{
            String adminId = orgAdminJson.getString("id");
            if(StringUtils.isEmpty(adminId)){
                return "paramter id for admin is null when update";
            }
            BaseOrgDO oldBaseOrgDO = baseOrgDao.findOne(baseOrgDO.getId());
            if(null == oldBaseOrgDO){
                return "no exist this org";
            }
            baseOrgDao.save(baseOrgDO);
            if(!baseOrgDO.getCode().equalsIgnoreCase(oldBaseOrgDO.getCode()) || !baseOrgDO.getName().equalsIgnoreCase(oldBaseOrgDO.getName())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.org.getLevelValue());
            }
            if(!baseOrgDO.getTownCode().equalsIgnoreCase(oldBaseOrgDO.getTownCode())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.town.getLevelValue());
            }
@ -128,14 +184,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            if(!baseOrgDO.getProvinceCode().equalsIgnoreCase(oldBaseOrgDO.getProvinceCode())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.province.getLevelValue());
            }
            userDO = userService.findById(adminId);
            //没有修改就不保存
            if(StringUtils.endsWithIgnoreCase(adminName,userDO.getUsername()) && StringUtils.endsWithIgnoreCase(mobile,userDO.getMobile())){
                return ConstantUtils.SUCCESS;
            }
            userDO.setUsername(adminName);
            userDO.setMobile(mobile);
            userService.save(userDO);
            baseOrgDao.save(baseOrgDO);
        }
        return ConstantUtils.SUCCESS;
    }
@ -153,6 +202,30 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        return baseOrgDao.existsByCode(code);
    }
    /**
     * 生效或失效单个机构
     * @param id
     * @param del
     * @return
     */
    public String enableOrDisableOrg(String id,String del){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(id) || StringUtils.isEmpty(del)){
            result.put("msg","parameter id or del is null");
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        BaseOrgDO baseOrgDO = baseOrgDao.findOne(id);
        if( null == baseOrgDO ){
            result.put("msg","org not exist for id:" + id);
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseOrgDO.setDel(del);
        this.save(baseOrgDO);
        result.put("response",ConstantUtils.SUCCESS);
        return result.toJSONString();
    }
    /**
     * 构建机构区域树形结构
     * @return
@ -193,15 +266,30 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    }
    /**
     * 查找某一saasId下的所有机构code
     * 查找某一saasId下的有效的机构code
     * @param saasId
     * @return
     */
    public List findOrgCodeBySaasId(String saasId){
    public List findOrgCodeListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
     /**
     * 查找某一saasId下的有效的机构列表,新增团队时选择归属机构时用到
     * @param saasId
     * @return
     */
    public List findOrgListBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
}

+ 35 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgUserService.java

@ -0,0 +1,35 @@
package com.yihu.jw.base.service.org;
import com.yihu.jw.base.dao.org.BaseOrgUserDao;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
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 java.util.ArrayList;
import java.util.List;
/**
 * 
 * 机构与机构管理员关联信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月20日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class BaseOrgUserService extends BaseJpaService<BaseOrgUserDO, BaseOrgUserDao> {
    @Autowired
    private BaseOrgUserDao baseOrgUserDao;
    public List<BaseOrgUserDO> findAllByOrgCode(String orgCode){
        List<BaseOrgUserDO> result = new ArrayList<>();
        return StringUtils.isEmpty(orgCode) ? result : baseOrgUserDao.findAllByOrgCode(orgCode);
    }
}

+ 30 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java

@ -9,11 +9,14 @@ import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.rm.base.BaseRequestMapping;
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.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * 
@ -37,6 +40,7 @@ public class OrgTreeService extends BaseJpaService<OrgTree, OrgTreeDao> {
     * 添加机构和区域的关系
     * @param baseOrgDO
     */
    @Transactional(rollbackFor = Exception.class)
    public void addOrgTreeNode(BaseOrgDO baseOrgDO){
        List<OrgTree> treeNodes = new ArrayList<>();
        if(!orgTreeDao.existsByCode(baseOrgDO.getCode())){
@ -79,8 +83,19 @@ public class OrgTreeService extends BaseJpaService<OrgTree, OrgTreeDao> {
     * @param oldBaseOrgDO
     * @param newBaseOrgDO
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateOrgTreeNode(BaseOrgDO oldBaseOrgDO,BaseOrgDO newBaseOrgDO,int level){
        if( level == OrgTree.Level.town.getLevelValue() ){
        if( level == OrgTree.Level.org.getLevelValue() ){
            OrgTree orgTree = orgTreeDao.findByCode(oldBaseOrgDO.getCode());
            if(null == orgTree){
                return;
            }
            orgTree.setCode(newBaseOrgDO.getCode());
            orgTree.setName(newBaseOrgDO.getName());
            this.save(orgTree);
            addOrgTreeNode(newBaseOrgDO);
        }
        else if( level == OrgTree.Level.town.getLevelValue() ){
            OrgTree orgTree = orgTreeDao.findByCodeAndParentCode(oldBaseOrgDO.getCode(),oldBaseOrgDO.getTownCode());
            if(null == orgTree){
                return;
@ -152,4 +167,18 @@ public class OrgTreeService extends BaseJpaService<OrgTree, OrgTreeDao> {
        }
        return orgTreeDao.findByLevelLessThanEqual(level);
    }
    /**
     * 根据区下面的机构列表
     *
     * @param townCode
     * @return
     */
    public List<Map<String, Object>> findOrgListByParentCode(String townCode) {
        List<Map<String, Object>> result = new ArrayList<>();
        if (StringUtils.isEmpty(townCode)) {
            return result;
        }
        return orgTreeDao.findOrgListByParentCode(townCode);
    }
}

+ 12 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java

@ -44,12 +44,13 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 居民id
     * @param patientId
     * @return
     */
    public String getPatientInfo(String patientId) throws Exception{
    public String getPatientById(String patientId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(patientId)){
            result.put("result","parameter patientId is null");
@ -65,7 +66,6 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
        result.put("medicareCard",cards);
        return result.toJSONString();
    }
    /**
     * 获取用户基础信息,参数为空查全部
     * @param nameOrIdcard
@ -138,16 +138,20 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        // 保存修改的居民信息
        this.save(basePatientDO);
        // 一条一条修改居民相关的卡的信息
        for (Object obj: patientMedicareCards){
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(),PatientMedicareCardDO.class);
        Set<Object> cardIdList = patientMedicardCardService.findIdListByPatientCode(basePatientDO.getId());
        // 有些卡可能是新增或修改的,一条一条修改居民相关的卡的信息
        for (Object obj : patientMedicareCards) {
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(), PatientMedicareCardDO.class);
            card.setPatientCode(basePatientDO.getId());
            if(StringUtils.isEmpty(basePatientDO.getId())){
                return ConstantUtils.FAIL;
            if(cardIdList.contains(card.getId())){
                cardIdList.remove(card.getId());
            }
            patientMedicardCardService.save(card);
        }
        // 有些卡可能是删除的
        if(cardIdList.size() > 0){
            patientMedicardCardService.delete(cardIdList.toArray());
        }
        return ConstantUtils.SUCCESS;
    }
}

+ 14 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java

@ -8,7 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 
@ -41,6 +43,17 @@ public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCa
        return patientMedicareCardDao.findByPatientCode(patientCode);
    }
    /**
     * 根据居民标识获取关联卡id列表
     * @param patientCode
     * @return
     */
    public Set<Object> findIdListByPatientCode(String patientCode){
        Set<Object> result = new HashSet<>();
        if(StringUtils.isEmpty(patientCode)){
            return result;
        }
        return patientMedicareCardDao.findIdListByPatientCode(patientCode);
    }
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java

@ -40,12 +40,12 @@ public class SaasBusinessCardService extends BaseJpaService<SaasBusinessCardDO,
        /*Map<String, Object> card = new HashMap<>();
        if (type == SaasBusinessCardDO.Type.doctor) {
            //模拟加载医生数据
            Map<String, Object> source = doctorService.getDoctorInfo(orgId, sourceId);
            Map<String, Object> source = doctorService.getOneDoctorInfo(orgId, sourceId);
            saasBusinessCardDO.forEach(item -> card.put(item.getField(), source.get(item.getField())));
            return card;
        } else if (type == SaasBusinessCardDO.Type.patient) {
            //模拟加载居民数据
            Map<String, Object> source = basePatientService.getPatientInfo(sourceId);
            Map<String, Object> source = basePatientService.getPatientById(sourceId);
            saasBusinessCardDO.forEach(item -> card.put(item.getField(), source.get(item.getField())));
            return card;
        }

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictEntryService.java

@ -3,6 +3,7 @@ package com.yihu.jw.base.service.system;
import com.yihu.jw.base.dao.system.SystemDictEntryDao;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -12,4 +13,7 @@ import org.springframework.stereotype.Service;
@Service
public class SystemDictEntryService extends BaseJpaService<SystemDictEntryDO, SystemDictEntryDao> {
    @Autowired
    private SystemDictEntryDao systemDictEntryDao;
}

+ 75 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java

@ -12,12 +12,14 @@ import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Service - 系统字典
@ -26,6 +28,9 @@ import java.util.List;
@Service
public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDao> {
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private DictIcd10Service dictIcd10Service;
@ -121,11 +126,30 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictDiseaseService.queryAll("", createPage(page,size,sorts));
        }else{
            jsonObject = this.queryAll("", createPage(page,size,sorts));
        }
        jsonArray.add(jsonObject);
        return jsonArray;
    }
    /**
     * 查询某一租户下的医院科室字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     * @param saasId
     * @return
     */
    public JSONObject queryAll(String saasId, Pageable pageable) throws Exception{
        JSONObject jsonObject = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        if(StringUtils.isEmpty(saasId)){
            list = systemDictDao.findCodeAndName(pageable);
        }else{
            list = systemDictDao.findCodeAndNameBySaasId(saasId,pageable);
        }
        jsonObject.put(SystemDictEnum.SystemDict.toString(),list);
        return jsonObject;
    }
    /**
     * 新增字典,包括字典项值
     * "obj": {
@ -178,4 +202,55 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        return ConstantUtils.SUCCESS;
    }
    /**
     * 查询字典分页信息
     * @param type
     * @param userId
     * @param filters
     * @param sorts
     * @param page
     * @param size
     * @return
     */
    public JSONObject queryDictPageByType( String userId,String type,String filters,String sorts,int page,int size) throws ParseException {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(type) || StringUtils.isEmpty(userId)) {
            result.put("msg","parameter dictType or userId is null");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        List list = new ArrayList();
        long count = 0;
        if (SystemDictEnum.Icd10Dict == SystemDictEnum.valueOf(type)) {
            list = dictIcd10Service.search(null,filters,sorts,page,size);
            count = dictIcd10Service.getCount(filters);
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
            list = dictHospitalDeptService.search(null,filters,sorts,page,size);
            count = dictHospitalDeptService.getCount(filters);
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            list = dictJobTitleService.search(null,filters,sorts,page,size);
            count = dictJobTitleService.getCount(filters);
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            list = dictHealthProblemService.search(null,filters,sorts,page,size);
            count = dictHealthProblemService.getCount(filters);
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            list = dictMedicineService.search(null,filters,sorts,page,size);
            count = dictMedicineService.getCount(filters);
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            list = dictDiseaseService.search(null,filters,sorts,page,size);
            count = dictDiseaseService.getCount(filters);
        }else{
            list = this.search(null,filters,sorts,page,size);
            count = this.getCount(filters);
        }
        result.put("response",ConstantUtils.SUCCESS);
        result.put("count",count);
        result.put("msg",list);
        return result;
    }
}

+ 38 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamMemberService.java

@ -1,10 +1,19 @@
package com.yihu.jw.base.service.team;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
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 com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 
 * 团队成员服务service
@ -19,4 +28,33 @@ import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
 */
@Service
public class BaseTeamMemberService extends BaseJpaService<BaseTeamMemberDO, BaseTeamMemberDao> {
    @Autowired
    private BaseTeamMemberDao baseTeamMemberDao;
    /**
     * 根据团队标识获取团队成员Id列表
     *
     * @param teamCode
     * @return
     */
    public Set<Object> findMemberIdList(String teamCode) {
        Set<Object> result = new HashSet<>();
        if (StringUtils.isEmpty(teamCode)) {
            return result;
        }
        return baseTeamMemberDao.findIdListByTeamCode(teamCode);
    }
    /**
     * 根据团队标识获取居民团队成员列表
     * @param teamCode
     * @return
     */
    public List<BaseTeamMemberDO> findMembersByTeamCode(String teamCode){
        List<BaseTeamMemberDO> result = new ArrayList<>();
        if(org.apache.commons.lang.StringUtils.isEmpty(teamCode)){
            return result;
        }
        return baseTeamMemberDao.findByTeamCode(teamCode);
    }
}

+ 108 - 22
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -6,19 +6,23 @@ 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.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
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 com.yihu.jw.entity.base.team.BaseTeamDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 
@ -47,6 +51,13 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 新增团队
     * @param jsonData
     * @return
     * @throws Exception
     */
    @Transactional(rollbackFor = Exception.class)
    public String createTeam(String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject teamJSONObject = jsonObject.getJSONObject("team");
@ -55,49 +66,124 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
            return ConstantUtils.FAIL;
        }
        BaseTeamDO baseTeamDO = objectMapper.readValue(teamJSONObject.toJSONString(),BaseTeamDO.class);
        this.save(baseTeamDO);
        List<BaseTeamMemberDO> memberList = new ArrayList<>();
        teamMemberArray.forEach((teamMember)->{
            try {
                BaseTeamMemberDO baseTeamMemberDO = objectMapper.readValue(teamMember.toString(),BaseTeamMemberDO.class);
                baseTeamMemberDO.setTeamCode(baseTeamDO.getId());
                memberList.add(baseTeamMemberDO);
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
        this.save(baseTeamDO);
        baseTeamMemberService.batchInsert(memberList);
        return ConstantUtils.SUCCESS;
    }
    /**
     * 获取团队机构列表
     * 修改团队
     * @param jsonData
     * @return
     */
    public List<Map<String,Object>> getTeamOrgList(){
        List<Map<String,Object>> result = new ArrayList<>();
        result = baseTeamDao.getTeamOrgList();
    @Transactional(rollbackFor = Exception.class)
    public JSONObject updateTeam(String jsonData){
        JSONObject result = new JSONObject();
        if(org.springframework.util.StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject team = jsonObject.getJSONObject("team");
        JSONArray teamMembers = jsonObject.getJSONArray("teamMember");
        if(null == team || CollectionUtils.isEmpty(teamMembers)){
            result.put("msg","parameter team or teamMember of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //判断团队id是否存在
        if(org.springframework.util.StringUtils.isEmpty(team.getString("id"))){
            result.put("msg","parameter id for team is null when update team");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        // 修改团队信息
        BaseTeamDO baseTeamDO = null;
        try {
            baseTeamDO = objectMapper.readValue(team.toJSONString(),BaseTeamDO.class);
        } catch (IOException e) {
            result.put("msg","convert team jsonObject to BaseTeamDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        this.save(baseTeamDO);
        //修改团队成员信息
        BaseTeamMemberDO baseTeamMemberDO = null;
        Set<Object> roleIdList = baseTeamMemberService.findMemberIdList(baseTeamDO.getId());
        try {
            for(Object object : teamMembers){
                baseTeamMemberDO = objectMapper.readValue(object.toString(),BaseTeamMemberDO.class);
                if(roleIdList.contains(baseTeamMemberDO.getId())){
                    roleIdList.remove(baseTeamMemberDO.getId());
                }
                baseTeamMemberService.save(baseTeamMemberDO);
            }
        } catch (IOException e) {
            result.put("msg","convert teamMember jsonObject to BaseTeamMemberDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
        }
        baseTeamMemberService.delete(roleIdList.toArray());
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseTeamDO);
        return result;
    }
    /**
     * 查看团队成员
     * 查看团队成员 (姓名,身份证)
     * @param orgCode
     * @param teamCode
     * @return
     */
    public String getTeamMemberList(String orgCode,String teamCode){
        List<Map<String,Object>> result = new ArrayList<>();
        if( StringUtils.isEmpty(orgCode) || StringUtils.isEmpty(orgCode) ){
            return null;
    public JSONObject getTeamMemberList(String orgCode,String teamCode) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(orgCode) || StringUtils.isEmpty(teamCode)){
            result.put("msg","parameter orgCode or orgCode is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONArray list = new JSONArray();
        result = baseTeamMemberDao.getTeamMemberList();
        for(Map<String,Object> map : result){
            JSONObject jsonObject = JSONObject.parseObject(map.toString());
            list.add(jsonObject);
        }
        return list.toJSONString();
        List<Map<String,Object>> list = baseTeamMemberDao.getTeamMemberList();
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
    /**
     * 团队id
     * @param teamId
     * @return
     */
    public JSONObject getTeamById(String teamId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(teamId)){
            result.put("msg","parameter teamCode is null");
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        List<BaseTeamDO> teamDOList = this.findByField("id",teamId);
        if(CollectionUtils.isEmpty(teamDOList)){
            result.put("msg","not exist team for id:"+ teamId);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        List<BaseTeamMemberDO> members = baseTeamMemberService.findMembersByTeamCode(teamId);
        result.put("response",ConstantUtils.SUCCESS);
        JSONObject teamInfo = new JSONObject();
        teamInfo.put("team",teamDOList.get(0));
        teamInfo.put("teamMember",members);
        result.put("msg",teamInfo);
        return result;
    }
}

+ 19 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -22,7 +22,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
    @Autowired
    private UserDao userDao;
    public UserDO register(UserDO userDO) {
    public UserDO registerWithIdcard(UserDO userDO) {
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
        userDO.setLocked(false);
@ -35,6 +35,24 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        return userDao.save(userDO);
    }
    /**
     * 手机号作为账号,初始密码为手机号后6位
     * @param userDO
     * @return
     */
    public UserDO registerWithMobile(UserDO userDO) {
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
        userDO.setLocked(false);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password =  userDO.getMobile().substring(0, 5);
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
    }
    /**
     * 根据用户手机号查找(手机号为登录账号)

+ 8 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/util/JavaBeanUtils.java

@ -34,13 +34,15 @@ public class JavaBeanUtils {
                if (javaBeanUtils == null) {
                    javaBeanUtils = new JavaBeanUtils();
                }
                if (objectMapper == null) {
                    objectMapper = new ObjectMapper();
                }
            }
        }
        return javaBeanUtils;
    }
    @Autowired
    private ObjectMapper objectMapper;
    private static ObjectMapper objectMapper = null;
    /**
     * 将一个 Map 对象转化为一个 JavaBean
     *
@ -244,16 +246,15 @@ public class JavaBeanUtils {
     * map转为json
     * @return
     */
    public String mapListJson(List<Map<String, Object>> mapList) throws Exception {
    public JSONArray mapListJson(List<Map<String, Object>> mapList) throws Exception {
        JSONArray jsonArray = new JSONArray();
        if (CollectionUtils.isEmpty(mapList)) {
            return "paramter is null";
            return jsonArray;
        }
        List<Map<String, Object>> result = new ArrayList<>();
        JSONArray jsonArray = new JSONArray();
        for(Map<String, Object> map : mapList){
            JSONObject jsonObject = JSONObject.parseObject(objectMapper.writeValueAsString(map));
            jsonArray.add(jsonObject);
        }
        return jsonArray.toJSONString();
        return jsonArray;
    }
}

+ 7 - 2
svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/RowKeyUtils.java

@ -1,6 +1,8 @@
package com.yihu.iot.datainput.util;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.bouncycastle.jcajce.provider.symmetric.DES;
import org.springframework.util.Base64Utils;
import org.springframework.util.DigestUtils;
@ -15,19 +17,21 @@ import java.io.UnsupportedEncodingException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Date;
public class RowKeyUtils {
    private static EncryptUtil encryptUtil = EncryptUtil.getInstance();
    public static String makeRowKey(String accessToken,String deviceSn,String extCode,long measureTime) throws Exception {
    public static String  makeRowKey(String accessToken,String deviceSn,String extCode,long measureTime) throws Exception {
        StringBuilder sb = new StringBuilder();
        sb.append(accessToken+",");
        sb.append(deviceSn+",");
        sb.append(extCode+",");
        sb.append(measureTime);
        return encryptUtil.encode(sb.toString());
        return Base64Utils.encodeToString(sb.toString().getBytes()).toString();
    }
    /**
@ -97,4 +101,5 @@ public class RowKeyUtils {
            return new String(pasByte, "UTF-8");
        }
    }
}

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-iot-lith
    name: svr-iot
  cloud:
    config:
      failFast: true