|
|
|
@ -2,17 +2,16 @@ package com.docus.server.collection.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
|
import com.docus.server.collection.config.UserSyncConfig;
|
|
|
|
|
import com.docus.server.collection.consts.PowerDeptConst;
|
|
|
|
|
import com.docus.server.collection.dto.DeptDto;
|
|
|
|
|
import com.docus.server.collection.dto.DeptModifyParam;
|
|
|
|
|
import com.docus.server.collection.dto.UserModifyParam;
|
|
|
|
|
import com.docus.server.collection.entity.PowerDept;
|
|
|
|
|
import com.docus.server.collection.entity.PowerUser;
|
|
|
|
|
import com.docus.server.collection.mapper.PowerDeptMapper;
|
|
|
|
|
import com.docus.server.collection.service.IPowerDeptService;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 科室服务实现
|
|
|
|
@ -28,26 +27,51 @@ public class PowerDeptServiceImpl implements IPowerDeptService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean register(DeptDto deptDto) {
|
|
|
|
|
PowerDept powerDept = powerDeptMapper.getDeptByDeptCode(deptDto.getDeptCode());
|
|
|
|
|
String deptCode = deptDto.getDeptCode();
|
|
|
|
|
PowerDept powerDept = null;
|
|
|
|
|
DeptModifyParam deptModifyParam = deptDto.transDeptAddParam();
|
|
|
|
|
if (Func.isEmpty(powerDept)) {
|
|
|
|
|
if (deptCode.startsWith(PowerDeptConst.WARD_DEPT_PREFIX)) {
|
|
|
|
|
powerDept = powerDeptMapper.getWardDeptByDeptCode(deptCode);
|
|
|
|
|
} else if (deptCode.startsWith(PowerDeptConst.MZ_DEPT_PREFIX)) {
|
|
|
|
|
powerDept = powerDeptMapper.getMzDeptByDeptCode(deptCode);
|
|
|
|
|
} else {
|
|
|
|
|
powerDept = powerDeptMapper.getDeptByDeptCode(deptCode);
|
|
|
|
|
}
|
|
|
|
|
if (Objects.isNull(powerDept)) {
|
|
|
|
|
long deptId = idService.getDateSeq();
|
|
|
|
|
deptModifyParam.setDeptId(deptId);
|
|
|
|
|
powerDeptMapper.addDept(deptModifyParam);
|
|
|
|
|
if (deptCode.startsWith(PowerDeptConst.WARD_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.addWardDept(deptModifyParam);
|
|
|
|
|
} else if (deptCode.startsWith(PowerDeptConst.MZ_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.addMzDept(deptModifyParam);
|
|
|
|
|
} else {
|
|
|
|
|
powerDeptMapper.addDept(deptModifyParam);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deptModifyParam.setDeptId(powerDept.getDeptId());
|
|
|
|
|
powerDeptMapper.updateDept(deptModifyParam);
|
|
|
|
|
|
|
|
|
|
if (deptCode.startsWith(PowerDeptConst.WARD_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.updateWardDept(deptModifyParam);
|
|
|
|
|
} else if (deptCode.startsWith(PowerDeptConst.MZ_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.updateMzDept(deptModifyParam);
|
|
|
|
|
} else {
|
|
|
|
|
powerDeptMapper.updateDept(deptModifyParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean delDeptByDeptCode(String deptCode) {
|
|
|
|
|
PowerDept powerDept = powerDeptMapper.getDeptByDeptCode(deptCode);
|
|
|
|
|
if (Func.isEmpty(powerDept)) {
|
|
|
|
|
return true;
|
|
|
|
|
public void delDeptByDeptCode(String deptCode) {
|
|
|
|
|
if (deptCode.startsWith(PowerDeptConst.WARD_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.delWardDeptByDeptCode(deptCode);
|
|
|
|
|
} else if (deptCode.startsWith(PowerDeptConst.MZ_DEPT_PREFIX)) {
|
|
|
|
|
powerDeptMapper.delMzDeptByDeptCode(deptCode);
|
|
|
|
|
} else {
|
|
|
|
|
powerDeptMapper.delDeptByDeptCode(deptCode);
|
|
|
|
|
}
|
|
|
|
|
powerDeptMapper.delDeptByDeptCode(deptCode);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|