| | |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | //先检查该医院该科室是否已经存在 |
| | | if (sysDepartment.getId() == null) { |
| | | Map<String, Object> checkDepartment=new HashMap<String,Object>(); |
| | | checkDepartment.put("page", 1); |
| | | checkDepartment.put("limit", 1); |
| | |
| | | if (sysDepartmentService.findList(checkDepartment).getData().size()>0) { |
| | | return ResultBody.failed().msg(String.format("该医院下已经存在科室 %s", sysDepartment.getDepartmentName())); |
| | | } |
| | | } |
| | | //先检查是否存在组织信息 |
| | | SysOrganization sysOrganization=new SysOrganization(); |
| | | if(sysDepartment.getOrgId()!=null){ |
| | | sysOrganization.setId(sysDepartment.getOrgId());} |
| | | else{ |
| | | sysOrganization.setId(sysDepartment.getOrgId()); |
| | | } else { |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | | //临时暂用其它字段承载数据 |
| | | sysOrganization.setOrgParentId(sysDepartment.getUpdateUserId()); |
| | | } |
| | | sysOrganization=sysOrganizationService.findByObject(sysOrganization); |
| | | if(sysOrganization==null) |
| | | { |
| | | if (sysOrganization == null) { |
| | | //创建一个组织 |
| | | sysOrganization=new SysOrganization(); |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | |
| | | sysOrganization.setOrgLevel(2); |
| | | //临时暂用其它字段承载数据 |
| | | sysOrganization.setOrgParentId(sysDepartment.getUpdateUserId()); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | | } |
| | | boolean org=sysOrganizationService.saveOrUpdate(sysOrganization); |