|
@ -92,64 +92,10 @@ public class RoleService extends BaseJpaService<DoctorRole, DoctorRoleDao> {
|
|
|
if (roleList != null && roleList.size() > 0) {
|
|
|
//遍历角色
|
|
|
for (DoctorRole role : roleList) {
|
|
|
if(role.getCode().length()!=6&&role.getCode().length()!=10){
|
|
|
continue;
|
|
|
}
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put("code", role.getCode());
|
|
|
map.put("name", role.getName());
|
|
|
|
|
|
//获取区域权限
|
|
|
String areaString = "";
|
|
|
List<DoctorRoleRealm> areaList = doctorRoleRealmDao.findByRoleCode(role.getCode());
|
|
|
if (areaList != null && areaList.size() > 0) {
|
|
|
//获取最大权限区域
|
|
|
List<String> areas = new ArrayList<>();
|
|
|
List<String> orgs = new ArrayList<>();
|
|
|
for (DoctorRoleRealm areaItem : areaList) {
|
|
|
String currentArea = areaItem.getAreaCode();
|
|
|
int currentLength = currentArea.length();
|
|
|
|
|
|
if (currentLength == 6) //区域
|
|
|
{
|
|
|
areas.add(currentArea);
|
|
|
} else { //机构
|
|
|
orgs.add(currentArea);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//区域权限重复校验
|
|
|
for (int i = areas.size() - 1; i >= 0; i--) {
|
|
|
String currentArea = areas.get(i);
|
|
|
for (int j = 0; j < areas.size() - i - 1; j++) {
|
|
|
String shortArea = getShortArea(areas.get(j));
|
|
|
if (currentArea.startsWith(shortArea)) //包含则移除
|
|
|
{
|
|
|
areas.remove(i);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//机构权限重复校验
|
|
|
for (int m = orgs.size() - 1; m >= 0; m--) {
|
|
|
String currentOrg = orgs.get(m);
|
|
|
for (int n = 0; n < areas.size() - m - 1; n++) {
|
|
|
String shortArea = getShortArea(areas.get(n));
|
|
|
if (currentOrg.startsWith(shortArea)) //包含则移除
|
|
|
{
|
|
|
orgs.remove(m);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (String item : areas) {
|
|
|
areaString += item + ",";
|
|
|
}
|
|
|
for (String item : orgs) {
|
|
|
areaString += item + ",";
|
|
|
}
|
|
|
areaString = areaString.substring(0, areaString.length() - 1);
|
|
|
}
|
|
|
map.put("areas", areaString);
|
|
|
map.put("areas", "");
|
|
|
map.put("level",roleConverse(role.getCode())+"");
|
|
|
map.put("isManage", "1");
|
|
|
if(resultLevel==roleConverse(role.getCode())){
|