Explorar el Código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
liuwenbin hace 6 años
padre
commit
dbd531f4e0
Se han modificado 31 ficheros con 640 adiciones y 223 borrados
  1. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  2. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  3. 33 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorRoleVO.java
  4. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/system/SystemDictEntryVO.java
  5. 26 6
      sql/init.sql
  6. 8 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java
  7. 10 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java
  8. 22 9
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java
  9. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorRoleEndpoint.java
  10. 8 5
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/notice/UserNoticeEndpoint.java
  11. 6 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java
  12. 4 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java
  13. 38 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java
  14. 54 9
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEntryEndpoint.java
  15. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictDiseaseService.java
  16. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHealthProblemService.java
  17. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java
  18. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java
  19. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictJobTitleService.java
  20. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictMedicineService.java
  21. 142 56
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  22. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  23. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java
  24. 30 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTree.java
  25. 13 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTreeNode.java
  26. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/TreeNode.java
  27. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  28. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictEntryService.java
  29. 178 66
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java
  30. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/util/JavaBeanUtils.java
  31. 5 43
      svr/svr-base/src/main/resources/application.yml

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

@ -60,7 +60,7 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
	    this.doctorDutyName = doctorDutyName;
    }
	@Column(name = "hosp_code")
	@Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
@ -68,7 +68,7 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
        this.orgCode = orgCode;
    }
	@Column(name = "hosp_name")
	@Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }

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

@ -140,6 +140,7 @@ public class BaseRequestMapping {
        public static final String ALL  = "/query_all";
        public static final String QUERY_BY_SAASID = "/queryBySaasId";
        public static final String QUERY_BY_TYPE  = "/query_by_type";
        public static final String CREATE_BY_TYPE = "/createByType";
    }
    /**

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

@ -27,10 +27,22 @@ public class BaseDoctorRoleVO extends IntegerIdentityVO{
    private String doctorCode;
    /**
	 * 医生角色code
	 * 医生业务模块角色code
	 */
	@ApiModelProperty(value = "医生角色id", example = "")
    private String roleCode;
	@ApiModelProperty(value = "医生业务模块角色code", example = "")
    private String roleModuleCode;
    /**
	 * 医生业务模块角色名称
	 */
	@ApiModelProperty(value = "医生业务模块角色名称", example = "")
    private String name;
	/**
	 * 医生业务模块角色名称
	 */
	@ApiModelProperty(value = "医生业务模块角色说明", example = "")
    private String description;
    /**
	 * 作废标识,1正常,0作废
@ -45,11 +57,11 @@ public class BaseDoctorRoleVO extends IntegerIdentityVO{
        this.doctorCode = doctorCode;
    }
    public String getRoleCode() {
        return roleCode;
    public String getRoleModuleCode() {
        return roleModuleCode;
    }
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    public void setRoleModuleCode(String roleModuleCode) {
        this.roleModuleCode = roleModuleCode;
    }
    public String getDel() {
@ -59,5 +71,19 @@ public class BaseDoctorRoleVO extends IntegerIdentityVO{
        this.del = del;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

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

@ -30,6 +30,8 @@ public class SystemDictEntryVO extends UuidIdentityVO {
	//备注
	@ApiModelProperty(value = "备注", example = "我是备注")
	private String remark;
	@ApiModelProperty(value = "所属租户id", example = "1")
	private String saasId;
	public String getDictCode() {
		return dictCode;
@ -78,4 +80,12 @@ public class SystemDictEntryVO extends UuidIdentityVO {
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getSaasId() {
		return saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
}

+ 26 - 6
sql/init.sql

@ -781,6 +781,26 @@ create table `base_message_type`
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息类型字典';
-- 功能菜单角色表
drop table IF EXISTS `base_role_menu`;
create table `base_role_menu`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长,字典型',
  `saasid` varchar(50) DEFAULT NULL COMMENT 'saasid,每个租户',
  `code` varchar(100) DEFAULT NULL COMMENT '角色标识',
  `name` varchar(100) DEFAULT NULL COMMENT '角色名称',
  `module_id` varchar(50) not null COMMENT '业务模块id,多个用逗号分割',
  `del` varchar(1) not null COMMENT '状态,0失效,1有效',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  primary key (id),
  key `code` (`code`)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='业务模块角色';
-- 业务模块角色表
drop table IF EXISTS `base_role_module`;
@ -791,12 +811,12 @@ create table `base_role_module`
  `name` varchar(100) DEFAULT NULL COMMENT '角色名称',
  `module_id` varchar(50) not null COMMENT '业务模块id,多个用逗号分割',
  `del` varchar(1) not null COMMENT '状态,0失效,1有效',
  `create_user` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建人名',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_user` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '修改人名',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  `create_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  primary key (id),
  key `code` (`code`)
)

+ 8 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictDao.java

@ -4,8 +4,10 @@ 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.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@ -19,8 +21,12 @@ public interface SystemDictDao extends PagingAndSortingRepository<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);
    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);
    List<Map<String, Object>> findCodeAndName(Pageable pageable);
    @Modifying
    @Query("delete from SystemDictDO  where code=?1")
    void deleteByCode(String code);
}

+ 10 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/system/SystemDictEntryDao.java

@ -2,7 +2,11 @@ package com.yihu.jw.base.dao.system;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -14,5 +18,10 @@ public interface SystemDictEntryDao extends PagingAndSortingRepository<SystemDic
    List<SystemDictEntryDO> findBySaasId(String saasId);
    List<SystemDictEntryDO> findByDictCodeAndCodeAndSaasId(String dictCode,String code,String saasId);
    List<SystemDictEntryDO> findByDictCodeAndCodeAndSaasId(String dictCode, String code, String saasId);
    @Modifying
    @Transactional
    @Query("delete from SystemDictEntryDO  where dictCode=?1")
    void deleteByDictCode(String dictCode);
}

+ 22 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -137,7 +137,7 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
        return success(jsonObject.getJSONObject("msg"));
    }
    /**
@ -198,11 +198,16 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.getOrgListByTown)
    @ApiOperation(value = "根据区域获取机构列表")
    public Envelop enableOrDisableDoctor(
    public Envelop getOrgListByTown(
            @ApiParam(name = "doctorCode", value = "townCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @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));
        JSONObject jsonObject = baseDoctorService.getOrgListByTownAndDoctorCode(doctorCode,townCode);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getJSONArray("msg"));
    }
    /**
@ -213,11 +218,15 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.docOrgDutyTreeInfo)
    @ApiOperation(value = "获取医生所属机构树形结构数据")
    @ApiOperation(value = "获取医生 机构/职务 树形结构数据")
    public Envelop getOrgDutyTree(
            @ApiParam(name = "doctorCode", value = "doctorCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode) throws Exception {
        return success(baseDoctorService.getDoctorDutyTree(doctorCode));
        JSONObject jsonObject = baseDoctorService.getDoctorDutyTree(doctorCode);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.get("msg"));
    }
    /**
@ -228,11 +237,15 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
     * @throws Exception
     */
    @GetMapping(value = BaseRequestMapping.BaseDoctor.docOrgDeptTreeInfo)
    @ApiOperation(value = "获取医生所属机构树形结构数据")
    @ApiOperation(value = "获取医生 机构/科室 树形结构数据")
    public Envelop getOrgDeptTree(
            @ApiParam(name = "doctorCode", value = "doctorCode")
            @RequestParam(value = "doctorCode", required = true) String doctorCode) throws Exception {
        return success(baseDoctorService.getDoctorDeptTree(doctorCode));
        JSONObject jsonObject = baseDoctorService.getDoctorDeptTree(doctorCode);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getJSONArray("msg"));
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctor.getDoctorListByDept)
@ -244,7 +257,7 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
        return success(jsonObject.getJSONArray("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctor.DOCTOR_INFO_IMPORT)

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

@ -38,7 +38,7 @@ public class BaseDoctorRoleEndpoint extends EnvelopRestEndpoint {
@Autowired
private BaseDoctorRoleService baseDoctorRoleService;
@PostMapping(value = BaseRequestMapping.BaseDoctorRole.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@PostMapping(value = BaseRequestMapping.BaseDoctorRole.CREATE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseDoctorRoleVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
@ -57,7 +57,7 @@ public ObjEnvelop<BaseDoctorRoleVO> create (
    return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctorRole.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BaseDoctorRole.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorRoleVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)

+ 8 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/notice/UserNoticeEndpoint.java

@ -11,6 +11,7 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -40,15 +41,17 @@ public class UserNoticeEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseRequestMapping.Module.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<UserNoticeVO> page (
            @ApiParam(name = "userId", value = "用户id")
            @RequestParam(value = "userId", required = true) String userId,
    @ApiOperation(value = "获取分页") 
    public PageEnvelop<UserNoticeVO> page(
            @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 {
        return userNoticeService.queryPage(page,size,userId);
        String userId = getUID();
        if(StringUtils.isBlank(userId)){
            return failed("用户信息获取失败!",PageEnvelop.class);
        }
        return userNoticeService.queryPage(page, size, userId);
    }
}

+ 6 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java

@ -70,10 +70,10 @@ public class RegisterEndpoint extends EnvelopRestEndpoint {
        SaasDO saasDO = toEntity(jsonSaas, SaasDO.class);
        if(!ValidateUtil.isValidMobileNo(saasDO.getMobile())){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.MOBILE_IS_EXIST), Envelop.class);
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.PHONE_IS_NOT_FORMAT), Envelop.class);
        }
        if(!ValidateUtil.isValidEmail(saasDO.getEmail())){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_NOT_FORMAT), Envelop.class);
        }
        String redisKey = redisPrefix + saasDO.getEmail();
@ -147,6 +147,10 @@ public class RegisterEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "邮件发送")
    public Envelop send(@ApiParam(name = "email", value = "邮箱地址", required = true)
                         @RequestParam String email) throws Exception {
        if(!ValidateUtil.isValidEmail(email)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_NOT_FORMAT), Envelop.class);
        }
        //建立邮件消息
        SimpleMailMessage mainMessage = new SimpleMailMessage();
        //发送者

+ 4 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java

@ -267,7 +267,10 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
        userDO.setUsername(userDO.getEmail());
        //初始化租户信息
        saasService.save(saasDO);
        saasDO = saasService.saasAudit(saasDO, userDO);
        //审核通过,初始化用户信息
        if("auditPassed".equals(status.name())){
            saasDO = saasService.saasAudit(saasDO, userDO);
        }
        return send(saasDO);
    }

+ 38 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java

@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -31,13 +32,18 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SystemDictService systemDictService;
    @Value("${configDefault.saasId}")
    private String saasId;
    @PostMapping(value = BaseRequestMapping.SystemDict.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        systemDictService.delete(ids.split(","));
            @ApiParam(name = "dictId", value = "字典id", required = true)
            @RequestParam(value = "dictId") String dictId,
            @ApiParam(name = "dictType", value = "字典类型")
            @RequestParam(value = "dictType", required = true) String dictType) throws Exception{
        systemDictService.deleteDictByType(dictId,dictType);
        return success("删除成功");
    }
@ -47,6 +53,9 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        SystemDictDO systemDictDO = toEntity(jsonData, SystemDictDO.class);
        if(StringUtils.isBlank(systemDictDO.getSaasId())){
            systemDictDO.setSaasId(saasId);
        }
        if (null == systemDictDO.getCode()) {
            return failed("ID不能为空", Envelop.class);
        }
@ -67,7 +76,11 @@ 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 {
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
            filters = "saasId=" + saasId + ";" + filters;
        }
       JSONObject result =  systemDictService.queryDictPageByType("1",dictType,filters,sorts,page,size);
       if(StringUtils.equalsIgnoreCase(ConstantUtils.FAIL,result.getString("response"))){
           return failed(result.getString("msg"));
@ -84,6 +97,11 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
            filters = "saasId=" + saasId + ";" + filters;
        }
        List<SystemDictDO> systemDictDOS = systemDictService.search(fields, filters, sorts);
        return success(systemDictDOS, SystemDictVO.class);
    }
@ -94,6 +112,7 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "jsonData", value = "json数据,系统字典及其值")
            @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        String message = systemDictService.createSystemDict(jsonData);
        if (StringUtils.equalsIgnoreCase(message, ConstantUtils.SUCCESS)) {
            return success(message);
        }
@ -137,4 +156,19 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
        JSONArray list = systemDictService.getDistListByType(type, userId, sorts, page, size);
        return success(list);
    }
    @PostMapping(value = BaseRequestMapping.SystemDict.CREATE_BY_TYPE)
    @ApiOperation(value = "根据不同的类型创建字典")
    public Envelop createAndUpdate(
            @ApiParam(name = "dictType", value = "字典类型", required = true)
            @RequestParam(value = "dictType") String dictType,
            @ApiParam(name = "jsonData", value = "字典Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {
        JSONObject result =  systemDictService.createDictByType(dictType,jsonData);
        if(StringUtils.equalsIgnoreCase(ConstantUtils.FAIL,result.getString("response"))){
            return failed(result.getString("msg"));
        }
        return success(result.getJSONArray("msg"));
    }
}

+ 54 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEntryEndpoint.java

@ -9,11 +9,13 @@ 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 com.yihu.utils.pinyin.PinyinUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -30,18 +32,31 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
    
    @Autowired
    private SystemDictEntryService systemDictEntryService;
    @Value("${configDefault.saasId}")
    private String saasId;
    @PostMapping(value = BaseRequestMapping.SystemDict.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.SystemDictEntry.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<SystemDictEntryVO> create (
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {
        SystemDictEntryDO systemDictEntryDO = toEntity(jsonData, SystemDictEntryDO.class);
        if(StringUtils.isBlank(systemDictEntryDO.getDictCode())){
            return failed("字典编码不能为空!",ObjEnvelop.class);
        }if(StringUtils.isBlank(systemDictEntryDO.getCode())){
            return failed("字典项编码不能为空!",ObjEnvelop.class);
        }
        if(StringUtils.isBlank(systemDictEntryDO.getSaasId())){
            systemDictEntryDO.setSaasId(saasId);
        }
        if(StringUtils.isNotBlank(systemDictEntryDO.getValue())){
            systemDictEntryDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictEntryDO.getValue(), true));
        }
        systemDictEntryDO = systemDictEntryService.save(systemDictEntryDO);
        return success(systemDictEntryDO, SystemDictEntryVO.class);
    }
    @PostMapping(value = BaseRequestMapping.SystemDict.DELETE)
    @PostMapping(value = BaseRequestMapping.SystemDictEntry.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
@ -50,15 +65,26 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.SystemDict.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.SystemDictEntry.UPDATE)
    @ApiOperation(value = "更新")
    public Envelop update (
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam(value = "jsonData") String jsonData) throws Exception {
        SystemDictEntryDO systemDictEntryDO = toEntity(jsonData, SystemDictEntryDO.class);
        if (null == systemDictEntryDO.getId()) {
            return failed("ID不能为空", Envelop.class);
        }
        if(StringUtils.isBlank(systemDictEntryDO.getDictCode())){
            return failed("字典编码不能为空!",ObjEnvelop.class);
        }if(StringUtils.isBlank(systemDictEntryDO.getCode())){
            return failed("字典项编码不能为空!",ObjEnvelop.class);
        }
        if(StringUtils.isBlank(systemDictEntryDO.getSaasId())){
            systemDictEntryDO.setSaasId(saasId);
        }
        if(StringUtils.isNotBlank(systemDictEntryDO.getValue())){
            systemDictEntryDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictEntryDO.getValue(), true));
        }
        systemDictEntryDO = systemDictEntryService.save(systemDictEntryDO);
        return success(systemDictEntryDO, SystemDictEntryVO.class);
    }
@ -89,7 +115,7 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
        return success(systemDictEntryDOS, count, page, size, SystemDictEntryVO.class);
    }
    @GetMapping(value = BaseRequestMapping.SystemDict.PAGE)
    @GetMapping(value = BaseRequestMapping.SystemDictEntry.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<SystemDictEntryVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -102,12 +128,17 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
            filters = "saasId=" + saasId + ";" + filters;
        }
        List<SystemDictEntryDO> systemDictEntryDOS = systemDictEntryService.search(fields, filters, sorts, page, size);
        int count = (int)systemDictEntryService.getCount(filters);
        return success(systemDictEntryDOS, count, page, size, SystemDictEntryVO.class);
    }
    @GetMapping(value = BaseRequestMapping.SystemDict.LIST)
    @GetMapping(value = BaseRequestMapping.SystemDictEntry.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<SystemDictEntryVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -116,7 +147,21 @@ public class SystemDictEntryEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if (StringUtils.isBlank(filters)) {
            filters = "saasId=" + saasId+";";
        } else {
            filters = "saasId=" + saasId + ";" + filters;
        }
        List<SystemDictEntryDO> systemDictEntryDOS = systemDictEntryService.search(fields, filters, sorts);
        return success(systemDictEntryDOS, SystemDictEntryVO.class);
    }
    @GetMapping(value = BaseRequestMapping.SystemDictEntry.FINDBYID)
    @ApiOperation(value = "根据id获取详情")
    public ObjEnvelop<SystemDictEntryVO> getSystemDictEntryById(
            @ApiParam(name = "dictEntryId", value = "字典项id")
            @RequestParam(value = "dictEntryId", required = true) String dictEntryId) throws Exception {
        SystemDictEntryDO systemDictEntryDO = systemDictEntryService.findById(dictEntryId);
        return success(systemDictEntryDO, SystemDictEntryVO.class);
    }
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictDiseaseService.java

@ -48,4 +48,7 @@ public class DictDiseaseService extends BaseJpaService<DictDiseaseDO, DictDiseas
        jsonObject.put(SystemDictEnum.DiseaseDict.toString(),list);
        return jsonObject;
    }
    public void deleteById(Integer id){
        dictDiseaseDao.delete(id);
    }
}

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

@ -54,4 +54,8 @@ public class DictHealthProblemService extends BaseJpaService<DictHealthProblemDO
        return jsonObject;
    }
    public void deleteById(Integer id){
        dictHealthProblemDao.delete(id);
    }
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java

@ -94,4 +94,5 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
       }
       return dictHospitalDeptDao.findByOrgCode(orgCode);
    }
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java

@ -52,5 +52,8 @@ public class DictIcd10Service extends BaseJpaService<DictIcd10DO, DictIcd10Dao>
        jsonObject.put(SystemDictEnum.Icd10Dict.toString(),list);
        return jsonObject;
    }
    public void deleteById(Integer id){
        dictIcd10Dao.delete(id);
    }
}

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

@ -52,4 +52,8 @@ public class DictJobTitleService extends BaseJpaService<DictJobTitleDO, DictJobT
        return jsonObject;
    }
    public void deleteById(Integer id){
        dictJobTitleDao.delete(id);
    }
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictMedicineService.java

@ -47,4 +47,7 @@ public class DictMedicineService extends BaseJpaService<DictMedicineDO, DictMedi
        jsonObject.put(SystemDictEnum.DiseaseDict.toString(),list);
        return jsonObject;
    }
    public void deleteById(Integer id){
        dictMedicineDao.delete(id);
    }
}

+ 142 - 56
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -8,10 +8,13 @@ import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorDao;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
@ -20,6 +23,8 @@ import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
@ -34,6 +39,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
/**
@ -76,6 +82,15 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private DictJobTitleDao jobTitleDao;
    @Autowired
    private OrgTreeService orgTreeService;
    @Autowired
    private DictDoctorDutyService dictDoctorDutyService;
    @Autowired
    private DictHospitalDeptService dictHospitalDeptService;
    /**
     * 获取医生信息
@ -157,10 +172,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "  where  " +
                "    doc.id = hos.doctor_code  " +
                "    and  " +
                "    hos.org_code = dept.org_code " +
                "    and " +
                "    hos.dept_code = dept.code  " +
                "    and  " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}'  ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "      or  " +
                "      and  " +
                "    ((doc.name like '{name}'  or ''= '{name}' )  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}'))  " +
                "  ) tb  " +
                "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
@ -181,10 +198,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "  where " +
                "    doc.id = hos.doctor_code " +
                "    and " +
                "    hos.org_code = dept.org_code " +
                "    and " +
                "    hos.dept_code = dept.code " +
                "    and " +
                "    ((doc.idcard like '{idcard}' or ''= '{idcard}' ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " +
                "      or " +
                "      and " +
                "    ((doc.name like '{name}' or ''= '{name}')  and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) ";
        String finalCountSql = countSql
                .replace("{idcard}",nameOrIdcardValue)
@ -239,6 +258,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorDO.setDel("1");
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
            }
        } catch (IOException e) {
@ -285,8 +305,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(role) || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
        if(null == doctor || CollectionUtils.isEmpty(role)){
            result.put("msg","parameter role of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
@ -325,23 +345,26 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        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());
        // 修改医生任职机构及职业信息,前端不修改就不做任何操作
         if(!CollectionUtils.isEmpty(hospital)){
             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();
@ -373,30 +396,79 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    }
    /**
     * 获取医生已选中的机构/职务树形结构
     * 获取医生已选中的区县/机构列表,当有机构是被选中时,要标有checked=true的状态前端加载生成树形机构,
     * @param doctorCode
     * @return
     */
    public String getDoctorDutyTree(String doctorCode){
    public JSONObject getOrgListByTownAndDoctorCode(String doctorCode,String townCode) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(townCode)){
            result.put("msg","townCode is not allowed to be null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        List<Map<String, Object>> list = new ArrayList<>();
        list  = orgTreeService.findOrgListByParentCode(townCode);
        if(StringUtils.isEmpty(doctorCode)){
            return "";
            result.put("response", ConstantUtils.SUCCESS);
            result.put("msg",list);
            return result;
        }
        Map<String,Map<String, Object>> orgCodeMap = new HashMap<>();
        list.forEach( one-> orgCodeMap.put(String.valueOf(one.get("code")),one));
        List<BaseDoctorHospitalDO> selectedList = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        for(BaseDoctorHospitalDO one : selectedList){
            if(orgCodeMap.containsKey(one.getOrgCode())){
                orgCodeMap.get(one.getOrgCode()).put("checked",true);
            }
        }
        List<BaseDoctorHospitalDO> list = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",JavaBeanUtils.getInstance().mapListJson(orgCodeMap.values()));
        return result;
    }
    /**
     * 获取医生已选中的机构/职务树形结构,当有机构是被选中时,要标有checked=true的状态
     * @param doctorCode
     * @return
     */
    public JSONObject getDoctorDutyTree(String doctorCode) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(doctorCode)){
            result.put("msg","doctorCode is not allowed to be null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        List<DictDoctorDutyDO> dutyDOList = dictDoctorDutyService.search(null);
        List<BaseDoctorHospitalDO> selectedDutylist = baseDoctorHospitalService.getOrgAndDutyListByDoctorCode(doctorCode);
        Set<Object> selectedDutySet = new HashSet<>();
        selectedDutylist.forEach( one -> selectedDutySet.add(one.getDoctorDutyCode()) );
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(BaseDoctorHospitalDO one : list){
        for(BaseDoctorHospitalDO one : selectedDutylist){
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(one.getOrgCode());
            orgTreeParent.setName(one.getOrgName());
            orgTreeList.add(orgTreeParent);
            OrgTree orgTreeChild = new OrgTree();
            orgTreeChild.setParentCode(one.getOrgCode());
            orgTreeChild.setCode(one.getDoctorDutyCode());
            orgTreeChild.setName(one.getDoctorDutyName());
            orgTreeList.add(orgTreeChild);
            for(DictDoctorDutyDO dictDoctorDutyDO :dutyDOList){
                OrgTree orgTreeChild = new OrgTree();
                orgTreeChild.setParentCode(one.getOrgCode());
                orgTreeChild.setCode(dictDoctorDutyDO.getCode());
                orgTreeChild.setName(dictDoctorDutyDO.getName());
                if(selectedDutySet.contains(dictDoctorDutyDO.getCode())){
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                }
                orgTreeList.add(orgTreeChild);
            }
        }
        return getOrgTree(orgTreeList);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", objectMapper.readValue(makeTree(orgTreeList),JSONArray.class));
        return result;
    }
    /**
@ -404,50 +476,65 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * @param doctorCode
     * @return
     */
    public String getDoctorDeptTree(String doctorCode){
    public JSONObject getDoctorDeptTree(String doctorCode) throws Exception {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(doctorCode)){
            return "";
            result.put("msg","doctorCode is not allowed to be null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        String sql = "select" +
        String deptSql = "select" +
                "  hos.doctor_code ," +
                "  hos.hosp_code as parentCode," +
                "  org.name as parentName," +
                "  hos.dept_code as childCode," +
                "  dept.name as childName" +
                "  hos.org_code as orgCode," +
                "  org.name as orgName," +
                "  dept.code as deptCode," +
                "  dept.name as deptName" +
                " 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" +
                "  hos.org_code = org.code" +
                "  and" +
                "  hos.dept_code = dept.code" +
                "  and doctor_code = '{doctorCode}'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.replace("{doctorCode}",doctorCode));
                "  hos.org_code = dept.org_code";
        String doctorSelectedDeptSql = deptSql + " and  hos.dept_code = dept.code and hos.doctor_code = '{doctorCode}'";
        List<Map<String,Object>> selectedDeptlist = jdbcTemplate.queryForList(doctorSelectedDeptSql.replace("{doctorCode}",doctorCode));
        List<Map<String,Object>> deptList = jdbcTemplate.queryForList(deptSql);
        Set<String> selectedDeptCodeSet = new HashSet<>();
        selectedDeptlist.forEach( one -> selectedDeptCodeSet.add(String.valueOf(one.get("orgCode")) + String.valueOf(one.get("deptCode"))));
        List<OrgTree> orgTreeList = new ArrayList<>();
        for(Map<String,Object> one : list){
        for(Map<String,Object> one : selectedDeptlist){
            OrgTree orgTreeParent = new OrgTree();
            orgTreeParent.setParentCode("");
            orgTreeParent.setCode(String.valueOf(one.get("parentCode")));
            orgTreeParent.setName(String.valueOf(one.get("parentName")));
            orgTreeParent.setCode(String.valueOf(one.get("orgCode")));
            orgTreeParent.setName(String.valueOf(one.get("orgName")));
            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);
            for(Map<String,Object> dept :deptList){
                OrgTree orgTreeChild = new OrgTree();
                orgTreeChild.setParentCode(String.valueOf(dept.get("orgCode")));
                orgTreeChild.setCode(String.valueOf(dept.get("deptCode")));
                orgTreeChild.setName(String.valueOf(dept.get("deptName")));
                orgTreeList.add(orgTreeChild);
                if(selectedDeptCodeSet.contains(String.valueOf(dept.get("orgCode")) + dept.get("deptCode"))){
                    orgTreeParent.setChecked(true);
                    orgTreeChild.setChecked(true);
                }
            }
        }
        return getOrgTree(orgTreeList);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg",objectMapper.readValue(makeTree(orgTreeList),JSONArray.class));
        return result;
    }
    /**
     * 构建树形结构
     * @return
     */
    public String getOrgTree(List<OrgTree> orgTreeList ){
    public String makeTree(List<OrgTree> orgTreeList ){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeList);
        SimpleTree tree = new SimpleTree(treeNodes);
@ -455,7 +542,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        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);

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

@ -248,7 +248,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeService.findListByLevel(OrgTree.Level.org.getLevelValue()));
        SimpleTree tree = new SimpleTree(treeNodes);
        SimpleTree tree = new SimpleTree(treeNodes,"");
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
@ -267,7 +267,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(OrgTree.class)));
        SimpleTree tree = new SimpleTree(treeNodes);
        SimpleTree tree = new SimpleTree(treeNodes,"");
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "org_tree")
@ -16,6 +17,8 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
    //当前树节点所在层级,例如省在第一级,用0表示
    private Integer level;
    private boolean checked;
    public enum Level{
        province(0),
        city(1),
@ -63,6 +66,11 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        return null;
    }
    @Override
    public boolean extractChecked() {
        return this.checked;
    }
    @Column(name = "code", nullable = false)
    public String getCode() {
        return code;
@ -99,4 +107,12 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        this.level = level;
    }
    @Transient
    public boolean isChecked() {
        return checked;
    }
    public void setChecked(boolean checked) {
        this.checked = checked;
    }
}

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

@ -14,11 +14,40 @@ public class SimpleTree implements Tree{
        initTreeNodeList();
    }
    public SimpleTree(List<TreeNode> list,String isOrg){
        initOrgTreeNodeMap(list);
        initTreeNodeList();
    }
    private void initOrgTreeNodeMap(List<TreeNode> list){
        SimpleTreeNode treeNode = null;
        for(TreeNode item : list){
            treeNode = new SimpleTreeNode(item);
//            treeNodesMap.put(treeNode.getParentNodeId() + treeNode.getNodeId(), treeNode);
            treeNodesMap.put( treeNode.getNodeId(), treeNode);
        }
        Iterator<SimpleTreeNode> iter = treeNodesMap.values().iterator();
        SimpleTreeNode parentTreeNode = null;
        while(iter.hasNext()){
            treeNode = iter.next();
            if(treeNode.getParentNodeId() == null || treeNode.getParentNodeId() == ""){
                continue;
            }
            parentTreeNode = treeNodesMap.get(treeNode.getParentNodeId());
            if(parentTreeNode != null){
                treeNode.setParent(parentTreeNode);
                parentTreeNode.addChild(treeNode);
            }
        }
    }
    private void initTreeNodeMap(List<TreeNode> list){
        SimpleTreeNode treeNode = null;
        for(TreeNode item : list){
            treeNode = new SimpleTreeNode(item);
            treeNodesMap.put(treeNode.getNodeId(), treeNode);
            treeNodesMap.put(treeNode.getParentNodeId() + treeNode.getNodeId(), treeNode);
        }
        Iterator<SimpleTreeNode> iter = treeNodesMap.values().iterator();

+ 13 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTreeNode.java

@ -21,9 +21,12 @@ public class SimpleTreeNode {
    //节点所在的层级
    @JSONField(ordinal=5)
    private int level;
    //节点是否被选中
    @JSONField(ordinal=6)
    private boolean checked;
    private SimpleTreeNode parent;
    //当前节点的二子节点
    @JSONField(ordinal=6)
    @JSONField(ordinal=7)
    private List<SimpleTreeNode> children = new ArrayList<>();
    //当前节点的子孙节点
    private List<SimpleTreeNode> allChildren = new ArrayList<>();
@ -32,7 +35,7 @@ public class SimpleTreeNode {
        this.nodeId = obj.extractNodeId();
        this.nodeName = obj.extractNodeName();
        this.parentNodeId = obj.extractNodeParentId();
//        this.orderNum = obj.extractOrderNum();
        this.checked = obj.extractChecked();
    }
    public void addChild(SimpleTreeNode treeNode){
        this.children.add(treeNode);
@ -83,6 +86,14 @@ public class SimpleTreeNode {
        this.orderNum = orderNum;
    }
    public boolean isChecked() {
        return checked;
    }
    public void setChecked(boolean checked) {
        this.checked = checked;
    }
    public List<SimpleTreeNode> getAllChildren() {
        if(this.allChildren.isEmpty()){
            for(SimpleTreeNode treeNode : this.children){

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/TreeNode.java

@ -5,4 +5,5 @@ public interface TreeNode {
    String extractNodeName();
    String extractNodeParentId();
    Integer extractOrderNum();
    boolean extractChecked();
}

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

@ -353,7 +353,6 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        //判断该用户是否已经存在
        UserDO userDO= userDao.findByUsername(saas.getEmail());
        userDO.setRoleCode(roleCode);
        if (null == userDO) {
            //初始化租户管理员
            user.setEnabled(true);
@ -370,6 +369,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
            }
            user.setPassword(MD5.md5Hex(password + "{" + user.getSalt() + "}"));
            user.setSaasId(saas.getId());
            user.setRoleCode(roleCode);
            user = userDao.save(user);
        } else {
            userDO.setSaasId(saas.getId());

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

@ -5,6 +5,7 @@ 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;
import org.springframework.transaction.annotation.Transactional;
/**
 * Service - 系统字典项
@ -16,4 +17,11 @@ public class SystemDictEntryService extends BaseJpaService<SystemDictEntryDO, Sy
    @Autowired
    private SystemDictEntryDao systemDictEntryDao;
    public SystemDictEntryDO findById(String id) {
        return systemDictEntryDao.findOne(id);
    }
    public void deleteByDictCode(String dictCode) {
        systemDictEntryDao.deleteByDictCode(dictCode);
    }
}

+ 178 - 66
svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java

@ -7,11 +7,14 @@ import com.yihu.jw.base.dao.system.SystemDictDao;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.dict.*;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.dict.*;
import com.yihu.jw.entity.base.system.SystemDictDO;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.pinyin.PinyinUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -55,6 +58,9 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
    @Autowired
    private ObjectMapper objectMapper;
    @Value("${configDefault.saasId}")
    private String saasId;
    @Override
    public long getCount(String filters) throws ParseException {
        return super.getCount(filters);
@ -62,28 +68,29 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
    /**
     * 根据字典类型获取系统所有相关字典,
     *
     * @param saasId
     * @return
     */
    public JSONArray getDistListBySaasId(String type, String saasId,String name, String sorts, int page, int size) throws Exception {
    public JSONArray getDistListBySaasId(String type, String saasId, String name, String sorts, int page, int size) throws Exception {
        JSONArray jsonArray = new JSONArray();
        JSONObject jsonObject = new JSONObject();
        if (SystemDictEnum.Icd10Dict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictIcd10Service.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictIcd10Service.queryAll(saasId, createPage(page, size, sorts));
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictHospitalDeptService.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictHospitalDeptService.queryAll(saasId, createPage(page, size, sorts));
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictJobTitleService.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictJobTitleService.queryAll(saasId, createPage(page, size, sorts));
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictHealthProblemService.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictHealthProblemService.queryAll(saasId, createPage(page, size, sorts));
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictMedicineService.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictMedicineService.queryAll(saasId, createPage(page, size, sorts));
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictDiseaseService.queryAll(saasId, createPage(page,size,sorts));
            jsonObject = dictDiseaseService.queryAll(saasId, createPage(page, size, sorts));
        }
        jsonArray.add(jsonObject);
        return jsonArray;
@ -91,15 +98,18 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
    /**
     * 获取系统所有相关字典,
     *
     * @param userId
     * @return
     */
    public JSONArray getAllDistList(String userId){
    public JSONArray getAllDistList(String userId) {
        JSONArray jsonArray = new JSONArray();
        return jsonArray;
    }
    /**
     * 根据字典类型获取系统所有相关字典,
     *
     * @param userId
     * @return
     */
@ -111,23 +121,23 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
        JSONArray jsonArray = new JSONArray();
        JSONObject jsonObject = new JSONObject();
        if (SystemDictEnum.Icd10Dict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictIcd10Service.queryAll(userId, createPage(page,size,sorts));
            jsonObject = dictIcd10Service.queryAll(userId, createPage(page, size, sorts));
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictHospitalDeptService.queryAll("", createPage(page,size,sorts));
            jsonObject = dictHospitalDeptService.queryAll("", createPage(page, size, sorts));
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictJobTitleService.queryAll("", createPage(page,size,sorts));
            jsonObject = dictJobTitleService.queryAll("", createPage(page, size, sorts));
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictHealthProblemService.queryAll("", createPage(page,size,sorts));
            jsonObject = dictHealthProblemService.queryAll("", createPage(page, size, sorts));
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictMedicineService.queryAll("", createPage(page,size,sorts));
            jsonObject = dictMedicineService.queryAll("", createPage(page, size, sorts));
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            jsonObject = dictDiseaseService.queryAll("", createPage(page,size,sorts));
        }else{
            jsonObject = this.queryAll("", createPage(page,size,sorts));
            jsonObject = dictDiseaseService.queryAll("", createPage(page, size, sorts));
        } else {
            jsonObject = this.queryAll("", createPage(page, size, sorts));
        }
        jsonArray.add(jsonObject);
        return jsonArray;
@ -135,66 +145,68 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
    /**
     * 查询某一租户下的医院科室字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     *
     * @param saasId
     * @return
     */
    public JSONObject queryAll(String saasId, Pageable pageable) throws Exception{
    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<Map<String, Object>> list = new ArrayList<>();
        if (StringUtils.isEmpty(saasId)) {
            list = systemDictDao.findCodeAndName(pageable);
        }else{
            list = systemDictDao.findCodeAndNameBySaasId(saasId,pageable);
        } else {
            list = systemDictDao.findCodeAndNameBySaasId(saasId, pageable);
        }
        jsonObject.put(SystemDictEnum.SystemDict.toString(),list);
        jsonObject.put(SystemDictEnum.SystemDict.toString(), list);
        return jsonObject;
    }
    /**
     * 新增字典,包括字典项值
     * "obj": {
     "      dict:
                {
                code": "SYSTEM_SETTING",
     "          name": "系统设置",
     "          pyCode": "XTSZ",
     "          saasId": "string",
     "          type": "basic"
            }
            valueArr:[
                {
                dictCode:"SYSTEM_SETTING",
                code:"SYSTEM_SETTING_0",
                pyCode:"",
                value:"",
                sort:"",
                remark:"",
                 },{
                ....
                  }
            ]
     }
     *
     * "      dict:
     * {
     * code": "SYSTEM_SETTING",
     * "          name": "系统设置",
     * "          pyCode": "XTSZ",
     * "          saasId": "string",
     * "          type": "basic"
     * }
     * valueArr:[
     * {
     * dictCode:"SYSTEM_SETTING",
     * code:"SYSTEM_SETTING_0",
     * pyCode:"",
     * value:"",
     * sort:"",
     * remark:"",
     * },{
     * ....
     * }
     * ]
     * }
     */
    @Transactional(rollbackFor = Exception.class)
    public String createSystemDict(String jsonData) throws Exception{
        if(StringUtils.isEmpty(jsonData)){
    public String createSystemDict(String jsonData) throws Exception {
        if (StringUtils.isEmpty(jsonData)) {
            return "none params(jsonData)";
        }
        JSONObject jsonParam = JSONObject.parseObject(jsonData);
        if(null == jsonParam.get("dict")){
        if (null == jsonParam.get("dict")) {
            return "no dict element in " + jsonData;
        }
        JSONObject dictJson = (JSONObject)jsonParam.get("dict");
        SystemDictDO systemDictDO = objectMapper.readValue(dictJson.toString(),SystemDictDO.class);
        if(StringUtils.isEmpty(systemDictDO.getCode()) || StringUtils.isEmpty(systemDictDO.getName())){
        JSONObject dictJson = (JSONObject) jsonParam.get("dict");
        SystemDictDO systemDictDO = objectMapper.readValue(dictJson.toString(), SystemDictDO.class);
        if (StringUtils.isBlank(systemDictDO.getSaasId())) {
            systemDictDO.setSaasId(saasId);
        }
        if (StringUtils.isEmpty(systemDictDO.getCode()) || StringUtils.isEmpty(systemDictDO.getName())) {
            return "code or name of dict is required";
        }
        List<SystemDictEntryDO> systemDictEntryDOList = new ArrayList<>();
        JSONArray dictValueArr = jsonParam.getJSONArray("valueArr");
        dictValueArr.forEach((oneObj)->systemDictEntryDOList.add((SystemDictEntryDO)oneObj));
        dictValueArr.forEach((oneObj) -> systemDictEntryDOList.add((SystemDictEntryDO) oneObj));
        save(systemDictDO);
@ -205,6 +217,7 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
    /**
     * 查询字典分页信息
     *
     * @param type
     * @param userId
     * @param filters
@ -213,44 +226,143 @@ public class SystemDictService extends BaseJpaService<SystemDictDO, SystemDictDa
     * @param size
     * @return
     */
    public JSONObject queryDictPageByType( String userId,String type,String filters,String sorts,int page,int size) throws ParseException {
    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);
            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);
            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);
            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);
            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);
            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);
            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);
            list = dictDiseaseService.search(null, filters, sorts, page, size);
            count = dictDiseaseService.getCount(filters);
        }else{
            list = this.search(null,filters,sorts,page,size);
        } 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);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("count", count);
        result.put("msg", list);
        return result;
    }
    /**
     * 查询字典分页信息
     *
     * @param type
     * @param json
     * @return
     */
    public JSONObject createDictByType(String type, String json) throws Exception {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(json) || StringUtils.isEmpty(json)) {
            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)) {
            DictIcd10DO dictIcd10DO = objectMapper.readValue(json, DictIcd10DO.class);
            dictIcd10DO.setSaasId(saasId);
            dictIcd10Service.save(dictIcd10DO);
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
            //科室只与机构有关。
            DictHospitalDeptDO dictHospitalDeptDO = objectMapper.readValue(json, DictHospitalDeptDO.class);
            dictHospitalDeptService.save(dictHospitalDeptDO);
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            DictJobTitleDO dictJobTitleDO = objectMapper.readValue(json, DictJobTitleDO.class);
            dictJobTitleDO.setSaasId(saasId);
            dictJobTitleService.save(dictJobTitleDO);
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            DictHealthProblemDO dictHealthProblemDO = objectMapper.readValue(json, DictHealthProblemDO.class);
            dictHealthProblemDO.setSaasId(saasId);
            dictHealthProblemService.save(dictHealthProblemDO);
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            DictMedicineDO dictMedicineDO = objectMapper.readValue(json, DictMedicineDO.class);
            dictMedicineDO.setSaasId(saasId);
            dictMedicineService.save(dictMedicineDO);
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            DictDiseaseDO dictDiseaseDO = objectMapper.readValue(json, DictDiseaseDO.class);
            dictDiseaseDO.setSaasId(saasId);
            dictDiseaseService.save(dictDiseaseDO);
        } else {
            SystemDictDO systemDictDO = objectMapper.readValue(json, SystemDictDO.class);
            if (StringUtils.isBlank(systemDictDO.getCode())) {
                systemDictDO.setCode(getCode());
            }
            if (StringUtils.isNotBlank(systemDictDO.getName())) {
                systemDictDO.setPyCode(PinyinUtil.getPinYinHeadChar(systemDictDO.getName(), true));
            }
            systemDictDO.setType(SystemDictDO.Type.basic);
            systemDictDO.setSaasId(saasId);
            this.save(systemDictDO);
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("count", count);
        result.put("msg", list);
        return result;
    }
    @Transactional(rollbackFor = Exception.class)
    public JSONObject deleteDictByType(String dictId, String type) throws ParseException {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(type) || StringUtils.isEmpty(dictId)) {
            result.put("msg", "parameter dictType or dictId is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        if (SystemDictEnum.Icd10Dict == SystemDictEnum.valueOf(type)) {
            dictIcd10Service.deleteById(Integer.valueOf(dictId));
        } else if (SystemDictEnum.HospitalDeptDict == SystemDictEnum.valueOf(type)) {
//            暂时不维护
//            dictHospitalDeptService.delete(dictId);
        } else if (SystemDictEnum.JobTitleDict == SystemDictEnum.valueOf(type)) {
            dictJobTitleService.deleteById(Integer.valueOf(dictId));
        } else if (SystemDictEnum.HealthProblemDict == SystemDictEnum.valueOf(type)) {
            dictHealthProblemService.deleteById(Integer.valueOf(dictId));
        } else if (SystemDictEnum.MedicineDict == SystemDictEnum.valueOf(type)) {
            dictMedicineService.deleteById(Integer.valueOf(dictId));
        } else if (SystemDictEnum.DiseaseDict == SystemDictEnum.valueOf(type)) {
            dictDiseaseService.deleteById(Integer.valueOf(dictId));
        } else {
            systemDictEntryService.deleteByDictCode(dictId);
            this.deleteByCode(dictId);
        }
        result.put("response", ConstantUtils.SUCCESS);
        return result;
    }
    public void deleteByCode(String code) {
        systemDictDao.deleteByCode(code);
    }
}

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

@ -246,12 +246,12 @@ public class JavaBeanUtils {
     * map转为json
     * @return
     */
    public JSONArray mapListJson(List<Map<String, Object>> mapList) throws Exception {
    public JSONArray mapListJson(Collection mapList) throws Exception {
        JSONArray jsonArray = new JSONArray();
        if (CollectionUtils.isEmpty(mapList)) {
            return jsonArray;
        }
        for(Map<String, Object> map : mapList){
        for(Object map : mapList){
            JSONObject jsonObject = JSONObject.parseObject(objectMapper.writeValueAsString(map));
            jsonArray.add(jsonObject);
        }

+ 5 - 43
svr/svr-base/src/main/resources/application.yml

@ -41,6 +41,11 @@ spring:
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
es:
  index:
    servicePackLog: base_service_package_log
@ -88,12 +93,6 @@ spring:
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
  mail:
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
@ -122,24 +121,6 @@ spring:
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  mail:
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
#  mail:
    default-encoding: UTF-8
#端口
    port: 25
#协议
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
@ -165,24 +146,5 @@ spring:
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  mail:
    host: smtp.163.com
#发送者的邮箱账号
    username: i_jiankang@163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
#  mail:
    default-encoding: UTF-8
#端口
    port: 25
#协议
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/