ソースを参照

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

LiTaohong 6 年 前
コミット
807515c9dc
28 ファイル変更832 行追加147 行削除
  1. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  2. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/system/SystemDictEntryVO.java
  3. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictDoctorDutyDao.java
  4. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java
  5. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictJobTitleDao.java
  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. 35 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java
  9. 8 5
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/notice/UserNoticeEndpoint.java
  10. 6 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java
  11. 4 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java
  12. 38 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEndpoint.java
  13. 54 9
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/system/SystemDictEntryEndpoint.java
  14. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictDiseaseService.java
  15. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHealthProblemService.java
  16. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java
  17. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictIcd10Service.java
  18. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictJobTitleService.java
  19. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictMedicineService.java
  20. 101 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  21. 181 11
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDO.java
  22. 122 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java
  23. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  24. 29 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/tree/SimpleTree.java
  25. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  26. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictEntryService.java
  27. 178 66
      svr/svr-base/src/main/java/com/yihu/jw/base/service/system/SystemDictService.java
  28. 5 43
      svr/svr-base/src/main/resources/application.yml

+ 2 - 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";
    }
    /**
@ -393,6 +394,7 @@ public class BaseRequestMapping {
        public static final String docOrgDutyTreeInfo  = "/docOrgDutyTreeInfo";
        public static final String docOrgDeptTreeInfo  = "/docOrgDeptTreeInfo";
        public static final String getDoctorListByDept  = "/getDoctorListByDept";
        public static final String DOCTOR_INFO_IMPORT  = "/baseDoctorInfoImport";
    }

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

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

@ -18,4 +18,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface DictDoctorDutyDao extends PagingAndSortingRepository<DictDoctorDutyDO, Integer>, JpaSpecificationExecutor<DictDoctorDutyDO>  {
    boolean existsByCode(String code);
    DictDoctorDutyDO findByCode(String code);
}

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

@ -37,4 +37,8 @@ public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHosp
    Long countByCodeIn(String orgCode);
    boolean existsByCodeAndOrgCode(String code,String orgCode);
    DictHospitalDeptDO findByCode(String code);
}

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

@ -34,4 +34,8 @@ public interface DictJobTitleDao extends PagingAndSortingRepository<DictJobTitle
    List<DictJobTitleDO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
    DictJobTitleDO findByCode(String code);
    boolean existsByCode(String 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);
}

+ 35 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -1,10 +1,15 @@
package com.yihu.jw.base.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.base.endpoint.common.populationBatchImport.PopulationMsg;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDOReader;
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.exception.business.ManageException;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -16,12 +21,17 @@ 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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
/**
 * 医生基础信息控制器
@ -250,4 +260,29 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
        return success(jsonObject.getJSONArray("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctor.DOCTOR_INFO_IMPORT)
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础医生信息列表导入")
    public Envelop importData(
            @ApiParam(name = "file", value = "文件", required = true)
            @RequestPart(value = "file") MultipartFile file,
            HttpServletRequest request) throws IOException, ManageException {
        try {
            request.setCharacterEncoding("UTF-8");
            AExcelReader excelReader = new BaseDoctorExcelDOReader();
            excelReader.read(file);
            //验证未通过(暂无验证)
            List<BaseDoctorExcelDO> errorLs = excelReader.getErrorLs();
            List<BaseDoctorExcelDO> correctLs = excelReader.getCorrectLs();
            if(correctLs.size()>0){
                Map<String, Object> result = baseDoctorService.batchInsertDoctor(correctLs);
                result.put("errorLs", errorLs);
                return success("导入成功!", result);
            }
        }catch (Exception e){
            e.printStackTrace();
            return failed("导入异常,请检查导入文件格式" + e.getMessage());
        }
        return failed("导入失败");
    }
}

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

+ 101 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -4,9 +4,15 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.databind.ObjectMapper;
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;
@ -16,9 +22,13 @@ import com.yihu.jw.base.util.ConstantUtils;
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;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -61,6 +71,16 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private DictHospitalDeptDao deptDao;
    @Autowired
    private DictDoctorDutyDao dutyDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private DictJobTitleDao jobTitleDao;
    @Autowired
    private OrgTreeService orgTreeService;
@ -559,4 +579,85 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        result.put("msg",JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
    public Map<String, Object> batchInsertDoctor(List<BaseDoctorExcelDO> doctors) throws ManageException {
        Map<String, Object> result = new HashMap<>();
        //批量存储的集合
//        int correctCount = 0;
//        List<BaseDoctorExcelDO> corrects = new ArrayList<>();
        BaseDoctorDO baseDoctorDO;
        //批量存储
        for(BaseDoctorExcelDO one:doctors){
            baseDoctorDO = new BaseDoctorDO();
            baseDoctorDO.setName(one.getName());
            baseDoctorDO.setDel(one.getDel());
            baseDoctorDO.setSex(one.getSex());
            baseDoctorDO.setIdcard(one.getIdcard());
            baseDoctorDO.setMobile(one.getMobile());
            baseDoctorDO.setIsFamous(one.getIsFamous());
            baseDoctorDO.setExpertise(one.getExpertise());
            baseDoctorDO.setIntroduce(one.getBrief());
            if(!StringUtils.isEmpty(one.getJobTitleName())){
                String[] job = one.getJobTitleName().split(",");
                String jobCode = job[0];
                DictJobTitleDO jobTitleDO = jobTitleDao.findByCode(jobCode);
                baseDoctorDO.setJobTitleCode(jobTitleDO.getCode());
                baseDoctorDO.setJobTitleName(jobTitleDO.getName());
            }
//            baseDoctorDao.save(baseDoctorDO);
            if(!StringUtils.isEmpty(one.getHospitalInfo())){
                BaseOrgDO orgDO = null;
                DictHospitalDeptDO hospitalDeptDO = null;
                DictDoctorDutyDO doctorDutyDO = null;
                String[] hospitals = one.getHospitalInfo().split(";");
                List<BaseDoctorHospitalDO> doctorHospitalList = new ArrayList<>();
                for(String hospital:hospitals){
                    String[] element = hospital.split("/");
                    String[] org = element[0].split(",");//机构
                    String[] dept = element[1].split(",");//部门
                    String[] duty = element[2].split(",");//职务
                    String orgCode = org[0];
                    String deptCode = dept[0];
                    String dutyCode = duty[0];
                    orgDO =baseOrgDao.findByCode(orgCode);
                    hospitalDeptDO = deptDao.findByCode(deptCode);
                    doctorDutyDO = dutyDao.findByCode(dutyCode);
                    //医生执业信息实体
                    BaseDoctorHospitalDO doctorHospitalDO = new BaseDoctorHospitalDO();
                    doctorHospitalDO.setOrgCode(orgDO.getCode());
                    doctorHospitalDO.setOrgName(orgDO.getName());
                    doctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                    doctorHospitalDO.setDeptCode(hospitalDeptDO.getCode());
                    doctorHospitalDO.setDoctorDutyCode(doctorDutyDO.getCode());
                    doctorHospitalDO.setDoctorDutyName(doctorDutyDO.getName());
                    doctorHospitalDO.setDel("1");
                    doctorHospitalList.add(doctorHospitalDO);
                }
                doctorHospitalDao.save(doctorHospitalList);
                if(!StringUtils.isEmpty(one.getRoleInfo())){
                    BaseDoctorRoleDO baseDoctorRoleDO = null;
                    DictJobTitleDO dictJobTitleDO = null;
                    String[] roles = one.getRoleInfo().split(";");
                    List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
                    for(String role:roles){
                        String[] element = role.split(",");
                        String roleCode = element[0];
                        dictJobTitleDO = jobTitleDao.findByCode(roleCode);
                        baseDoctorRoleDO = new BaseDoctorRoleDO();
                        baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                        baseDoctorRoleDO.setRoleModuleCode(dictJobTitleDO.getCode());
                        baseDoctorRoleDO.setName(dictJobTitleDO.getName());
                        baseDoctorRoleDO.setDel("1");
                        baseDoctorRoleDOList.add(baseDoctorRoleDO);
                    }
                    baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
                }
            }
        }
        result.put("correctCount", doctors.size());
        return result;
    }
}

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

@ -15,7 +15,7 @@ import java.util.Map;
import java.util.Set;
/**
 *  基础人口信息列表-excel实体类
 *  医生信息列表-excel实体类
 * @author lith
 * Created at 2018/10/22.
 */
@ -25,34 +25,37 @@ public class BaseDoctorExcelDO extends ExcelUtil implements Validation {
    @Location(x=0)
    @ValidRepeat
    String name;
    String name;//姓名
    @Location(x=1)
    @ValidRepeat
    String del;
    String del;//状态(1生效,0失效)
    @Location(x=2)
    @ValidRepeat
    String sex;
    Integer sex;//性别(1男2女)
    @Location(x=3)
    @ValidRepeat
    String idcard;
    String idcard;//身份证号
    @Location(x=4)
    @ValidRepeat
    String mobile;
    String mobile;//联系方式
    @Location(x=5)
    @ValidRepeat
    String hospitalInfo;
    String hospitalInfo;//机构/部门/职务
    @Location(x=6)
    @ValidRepeat
    Integer roleInfo;
    String jobTitleName;//职称
    @Location(x=7)
    @ValidRepeat
    String isFamous;
    String roleInfo;//归属业务模块角色
    @Location(x=8)
    @ValidRepeat
    Integer expertise;
    Integer isFamous;//是否名医
    @Location(x=9)
    @ValidRepeat
    String brief;
    String expertise;//专长
    @Location(x=10)
    @ValidRepeat
    String brief;//简介
    private String  saasId;
    //租户创建时间
@ -79,4 +82,171 @@ public class BaseDoctorExcelDO extends ExcelUtil implements Validation {
        return rs;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getHospitalInfo() {
        return hospitalInfo;
    }
    public void setHospitalInfo(String hospitalInfo) {
        this.hospitalInfo = hospitalInfo;
    }
    public String getRoleInfo() {
        return roleInfo;
    }
    public void setRoleInfo(String roleInfo) {
        this.roleInfo = roleInfo;
    }
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
    public String getBrief() {
        return brief;
    }
    public void setBrief(String brief) {
        this.brief = brief;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
    public String getDistrictName() {
        return districtName;
    }
    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public int getYearNow() {
        return yearNow;
    }
    public void setYearNow(int yearNow) {
        this.yearNow = yearNow;
    }
    public String getJobTitleName() {
        return jobTitleName;
    }
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
}

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

@ -0,0 +1,122 @@
package com.yihu.jw.base.service.doctor.excelImport;
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.org.BaseOrgDao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
 * 医生信息列表-excel解析类
 * Created by 刘文彬 on 2018/10/24.
 */
public class BaseDoctorExcelDOReader extends AExcelReader {
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private DictHospitalDeptDao deptDao;
    @Autowired
    private DictDoctorDutyDao dutyDao;
    @Autowired
    private DictJobTitleDao jobTitleDao;
    @Override
    public void read(Workbook rwb) throws Exception {
        try{
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            BaseDoctorExcelDO baseDoctorExcelDO;
            getRepeat().put("name", new HashSet<>());
            getRepeat().put("del", new HashSet<>());
            getRepeat().put("sex", new HashSet<>());
            getRepeat().put("idcard", new HashSet<>());
            getRepeat().put("mobile", new HashSet<>());
            getRepeat().put("hospitalInfo", new HashSet<>());
            getRepeat().put("jobTitleName", new HashSet<>());
            getRepeat().put("roleInfo", new HashSet<>());
            getRepeat().put("isFamous", new HashSet<>());
            getRepeat().put("expertise", new HashSet<>());
            getRepeat().put("brief", new HashSet<>());
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    baseDoctorExcelDO = new BaseDoctorExcelDO();
                    baseDoctorExcelDO.setName(replaceBlank(getCellCont(sheet, i, 0)));
                    baseDoctorExcelDO.setDel(replaceBlank(getCellCont(sheet, i, 1)));
                    baseDoctorExcelDO.setSex(null == getCellCont(sheet, i, 2)?null:Integer.valueOf(replaceBlank(getCellCont(sheet, i, 2)).trim()));
                    baseDoctorExcelDO.setIdcard(replaceBlank(getCellCont(sheet, i, 3)));
                    baseDoctorExcelDO.setMobile(replaceBlank(getCellCont(sheet, i, 4)));
                    baseDoctorExcelDO.setHospitalInfo(replaceBlank(getCellCont(sheet, i, 5)));
                    baseDoctorExcelDO.setJobTitleName(replaceBlank(getCellCont(sheet, i, 6)));
                    baseDoctorExcelDO.setRoleInfo(replaceBlank(getCellCont(sheet, i, 7)));
                    baseDoctorExcelDO.setIsFamous(null == getCellCont(sheet, i, 8)?null:Integer.valueOf(replaceBlank(getCellCont(sheet, i, 7)).trim()));
                    baseDoctorExcelDO.setExpertise(replaceBlank(getCellCont(sheet, i, 9)));
                    baseDoctorExcelDO.setBrief(replaceBlank(getCellCont(sheet, i, 10)));
                    baseDoctorExcelDO.setExcelSeq(i);
                    int rs = baseDoctorExcelDO.validate(repeat);
                    if (rs == 0||validate(baseDoctorExcelDO)== 0) {
                        errorLs.add(baseDoctorExcelDO);
                    } else if (rs == 1) {
                        correctLs.add(baseDoctorExcelDO);
                    }
                }
                j++;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
    public int validate(BaseDoctorExcelDO baseDoctorExcelDO) {
        int rs = 1;
        if(StringUtils.isNotEmpty(baseDoctorExcelDO.getHospitalInfo())){
            String[] hospitals = baseDoctorExcelDO.getHospitalInfo().split(";");
            for(String hospital:hospitals){
                String[] element = hospital.split("/");
                String[] org = element[0].split(",");//机构
                String[] dept = element[1].split(",");//部门
                String[] duty = element[1].split(",");//职务
                String orgCode = org[0];
                String deptCode = dept[0];
                String dutyCode = duty[0];
                if(!baseOrgDao.existsByCode(orgCode)){
                    return 0;
                }
                if(!deptDao.existsByCodeAndOrgCode(deptCode,orgCode)){
                    return 0;
                }
                if(!dutyDao.existsByCode(dutyCode)){
                    return 0;
                }
            }
        }
        if(StringUtils.isNotEmpty(baseDoctorExcelDO.getRoleInfo())){
            String[] roles = baseDoctorExcelDO.getRoleInfo().split(";");
            for(String role:roles){
                String[] element = role.split(",");
                String roleCode = element[0];
                if(jobTitleDao.existsByCode(roleCode)){
                    return 0;
                }
            }
        }
        return rs;
    }
}

+ 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");

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

@ -14,6 +14,35 @@ 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){

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

+ 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/