行政后勤二次分配

parent 1a969928
...@@ -110,7 +110,7 @@ public ApiResponse SelfInfo() ...@@ -110,7 +110,7 @@ public ApiResponse SelfInfo()
user.Role = _roleService.GetUserRole(user.UserID); user.Role = _roleService.GetUserRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(user.UserID); user.Hospital = _hospitalService.GetUserHopital(user.UserID);
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole }; int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false; user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
return new ApiResponse(ResponseType.OK, user); return new ApiResponse(ResponseType.OK, user);
} }
...@@ -179,7 +179,7 @@ public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), ...@@ -179,7 +179,7 @@ public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"),
{ {
var userId = _claim.GetUserId(); var userId = _claim.GetUserId();
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole }; int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
var roles = _roleService.GetUserRole(userId); var roles = _roleService.GetUserRole(userId);
var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false; var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false;
......
...@@ -116,49 +116,49 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -116,49 +116,49 @@ public ApiResponse Import([FromForm] IFormCollection form)
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary> ///// <summary>
/// 查看科室绩效 ///// 查看科室绩效
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("departmentdetail")] //[Route("departmentdetail")]
[HttpPost] //[HttpPost]
public ApiResponse DepartmentDetail([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request) //public ApiResponse DepartmentDetail([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request)
{ //{
var userId = claimService.GetUserId(); // var userId = claimService.GetUserId();
var roles = roleService.GetUserRole(userId); // var roles = roleService.GetUserRole(userId);
var department = claimService.GetUserClaim(JwtClaimTypes.Department); // var department = claimService.GetUserClaim(JwtClaimTypes.Department);
var again = againAllotService.GetAgainallot(request.AgainAllotID); // var again = againAllotService.GetAgainallot(request.AgainAllotID);
if (again == null) // if (again == null)
return new ApiResponse(ResponseType.Fail, "当前二次绩效ID无效"); // return new ApiResponse(ResponseType.Fail, "当前二次绩效ID无效");
if (roles.First().Type == application.DirectorRole) // if (roles.First().Type == application.DirectorRole)
{ // {
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 1); // var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 1);
return new ApiResponse(ResponseType.OK, detail); // return new ApiResponse(ResponseType.OK, detail);
} // }
else if (roles.First().Type == application.NurseRole) // else if (roles.First().Type == application.NurseRole)
{ // {
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 2); // var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 2);
return new ApiResponse(ResponseType.OK, detail); // return new ApiResponse(ResponseType.OK, detail);
} // }
return new ApiResponse(ResponseType.Fail, "当前用户角色无法识别"); // return new ApiResponse(ResponseType.Fail, "当前用户角色无法识别");
} //}
/// <summary> ///// <summary>
/// 生成绩效 ///// 生成绩效
/// </summary> ///// </summary>
/// <param name="request"></param> ///// <param name="request"></param>
/// <returns></returns> ///// <returns></returns>
[Route("generate")] //[Route("generate")]
[HttpPost] //[HttpPost]
public ApiResponse Generate([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request) //public ApiResponse Generate([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request)
{ //{
var userId = claimService.GetUserId(); // var userId = claimService.GetUserId();
var department = claimService.GetUserClaim(JwtClaimTypes.Department); // var department = claimService.GetUserClaim(JwtClaimTypes.Department);
var result = againAllotService.Generate(request, userId, department); // var result = againAllotService.Generate(request, userId, department);
return new ApiResponse(ResponseType.OK); // return new ApiResponse(ResponseType.OK);
} //}
/// <summary> /// <summary>
/// 查看绩效详情 /// 查看绩效详情
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
"DirectorRole": "4", "DirectorRole": "4",
//特殊科室二次绩效管理员 //特殊科室二次绩效管理员
"SpecialRole": "9", "SpecialRole": "9",
//行政科室二次绩效管理员
"OfficeRole": "10",
//邮件指定接收人 //邮件指定接收人
"Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ], "Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ],
// 抽取结果Excel文件保存地址 // 抽取结果Excel文件保存地址
......
...@@ -115,20 +115,6 @@ ...@@ -115,20 +115,6 @@
<param name="form"></param> <param name="form"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AgainAllotController.DepartmentDetail(Performance.DtoModels.AgainAllotRequest)">
<summary>
查看科室绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Generate(Performance.DtoModels.AgainAllotRequest)">
<summary>
生成绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Detail(Performance.DtoModels.AgainAllotRequest)"> <member name="M:Performance.Api.Controllers.AgainAllotController.Detail(Performance.DtoModels.AgainAllotRequest)">
<summary> <summary>
查看绩效详情 查看绩效详情
......
...@@ -49,6 +49,11 @@ ...@@ -49,6 +49,11 @@
特殊科室二次绩效管理员 特殊科室二次绩效管理员
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.AppSettings.Application.OfficeRole">
<summary>
行政科室二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.Receiver"> <member name="P:Performance.DtoModels.AppSettings.Application.Receiver">
<summary> <summary>
邮件指定接收人 邮件指定接收人
......
...@@ -31,6 +31,10 @@ public class Application ...@@ -31,6 +31,10 @@ public class Application
/// </summary> /// </summary>
public int SpecialRole { get; set; } public int SpecialRole { get; set; }
/// <summary> /// <summary>
/// 行政科室二次绩效管理员
/// </summary>
public int OfficeRole { get; set; }
/// <summary>
/// 邮件指定接收人 /// 邮件指定接收人
/// </summary> /// </summary>
public string[] Receiver { get; set; } public string[] Receiver { get; set; }
......
...@@ -37,8 +37,8 @@ public enum UnitType ...@@ -37,8 +37,8 @@ public enum UnitType
行政高层 = 10, 行政高层 = 10,
[Description("行政中层")] [Description("行政中层")]
行政中层 = 11, 行政中层 = 11,
[Description("行政勤")] [Description("行政勤")]
行政 = 12, 行政 = 12,
} }
public enum SheetType public enum SheetType
......
...@@ -535,7 +535,7 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid) ...@@ -535,7 +535,7 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid)
if (!role.HasValue) if (!role.HasValue)
throw new PerformanceException("用户信息错误"); throw new PerformanceException("用户信息错误");
var roleTypes = new[] { options.Value.NurseRole, options.Value.DirectorRole, options.Value.SpecialRole }; var roleTypes = new[] { options.Value.NurseRole, options.Value.DirectorRole, options.Value.SpecialRole, options.Value.OfficeRole };
var reserveds = perforresreservedRepository.GetEntities(w => w.HospitalId == hospitalId && w.Year == year); var reserveds = perforresreservedRepository.GetEntities(w => w.HospitalId == hospitalId && w.Year == year);
...@@ -547,6 +547,8 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid) ...@@ -547,6 +547,8 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid)
reserveds = reserveds.Where(w => !string.IsNullOrEmpty(w.UnitType) && (w.UnitType.Contains(UnitType.医生组.ToString()) || w.UnitType.Contains(UnitType.医技组.ToString())) && w.AccountingUnit == user.Department)?.ToList(); reserveds = reserveds.Where(w => !string.IsNullOrEmpty(w.UnitType) && (w.UnitType.Contains(UnitType.医生组.ToString()) || w.UnitType.Contains(UnitType.医技组.ToString())) && w.AccountingUnit == user.Department)?.ToList();
else if (role.Value == options.Value.SpecialRole) else if (role.Value == options.Value.SpecialRole)
reserveds = reserveds.Where(w => !string.IsNullOrEmpty(w.UnitType) && w.UnitType.Contains(UnitType.特殊核算组.ToString()) && w.AccountingUnit == user.Department)?.ToList(); reserveds = reserveds.Where(w => !string.IsNullOrEmpty(w.UnitType) && w.UnitType.Contains(UnitType.特殊核算组.ToString()) && w.AccountingUnit == user.Department)?.ToList();
else if (role.Value == options.Value.OfficeRole)
reserveds = reserveds.Where(w => !string.IsNullOrEmpty(w.UnitType) && (w.UnitType.Contains(UnitType.行政中层.ToString()) || w.UnitType.Contains(UnitType.行政后勤.ToString())) && w.AccountingUnit == user.Department)?.ToList();
} }
return reserveds; return reserveds;
......
...@@ -272,7 +272,7 @@ public List<DeptResponse> GetOtherPerformance(int allotId) ...@@ -272,7 +272,7 @@ public List<DeptResponse> GetOtherPerformance(int allotId)
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetOfficePerformance(int allotId) public List<DeptResponse> GetOfficePerformance(int allotId)
{ {
var unitType = new List<int> { (int)UnitType.行政 }; var unitType = new List<int> { (int)UnitType.行政 };
var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId) var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId)
?.OrderBy(t => t.UnitType) ?.OrderBy(t => t.UnitType)
......
...@@ -302,9 +302,10 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId) ...@@ -302,9 +302,10 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
Dictionary<int, string[]> dict = new Dictionary<int, string[]> Dictionary<int, string[]> dict = new Dictionary<int, string[]>
{ {
{ application.DirectorRole, new string[]{ UnitType.医生组.ToString(), UnitType.医技组.ToString() } }, { application.DirectorRole, new string[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ application.NurseRole, new string[]{ UnitType.护理组.ToString() } }, { application.NurseRole, new string[]{ UnitType.护理组.ToString() } },
{ application.SpecialRole, new string[]{ UnitType.特殊核算组.ToString() } }, { application.SpecialRole, new string[]{ UnitType.特殊核算组.ToString() } },
{ application.OfficeRole, new string[]{ UnitType.行政中层.ToString(), UnitType.行政后勤.ToString()} },
}; };
if (dict.Keys.Contains(role.Type.Value)) if (dict.Keys.Contains(role.Type.Value))
......
...@@ -358,7 +358,8 @@ private bool IsMedical(int userId) ...@@ -358,7 +358,8 @@ private bool IsMedical(int userId)
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID); var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
if (role.Type == application.DirectorRole || role.Type == application.NurseRole) var roleTypes = new[] { application.NurseRole, application.DirectorRole, application.SpecialRole, application.OfficeRole };
if (role.Type.HasValue && roleTypes.Contains(role.Type.Value))
return true; return true;
else else
return false; return false;
......
...@@ -113,6 +113,8 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -113,6 +113,8 @@ public List<SecondListResponse> GetSecondList(int userId)
exp = exp.And(t => t.UnitType == UnitType.护理组.ToString()); exp = exp.And(t => t.UnitType == UnitType.护理组.ToString());
else if (role.Type == application.SpecialRole) else if (role.Type == application.SpecialRole)
exp = exp.And(t => t.UnitType == UnitType.特殊核算组.ToString()); exp = exp.And(t => t.UnitType == UnitType.特殊核算组.ToString());
else if (role.Type == application.OfficeRole)
exp = exp.And(t => t.UnitType == UnitType.行政后勤.ToString());
var secondList = perforAgsecondallotRepository.GetEntities(exp); var secondList = perforAgsecondallotRepository.GetEntities(exp);
//各科室绩效分配结果 //各科室绩效分配结果
...@@ -137,6 +139,8 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -137,6 +139,8 @@ public List<SecondListResponse> GetSecondList(int userId)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组); account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组);
else if (role.Type == application.SpecialRole) else if (role.Type == application.SpecialRole)
special = specialList?.FirstOrDefault(t => t.AllotID == item); special = specialList?.FirstOrDefault(t => t.AllotID == item);
else if (role.Type == application.OfficeRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.行政后勤);
if (account == null && special == null) continue; if (account == null && special == null) continue;
...@@ -798,11 +802,18 @@ public List<SecondTempResponse> GetTemp(int hospitalid, string department, int u ...@@ -798,11 +802,18 @@ public List<SecondTempResponse> GetTemp(int hospitalid, string department, int u
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID); var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
Dictionary<int, string[]> dic = new Dictionary<int, string[]>
{
{ application.DirectorRole, new[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ application.NurseRole, new[]{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString()} },
{ application.SpecialRole, new[]{ UnitType.特殊核算组.ToString() }},
{ application.OfficeRole, new[]{ UnitType.行政后勤.ToString() } },
};
Expression<Func<ag_usetemp, bool>> exp = t => t.HospitalId == hospitalid && t.Department == department; Expression<Func<ag_usetemp, bool>> exp = t => t.HospitalId == hospitalid && t.Department == department;
if (role.Type == application.DirectorRole) if (role.Type.HasValue && dic.ContainsKey(role.Type.Value))
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.UnitType)); exp = exp.And(t => dic[role.Type.Value].Contains(t.UnitType));
else if (role.Type == application.NurseRole)
exp = exp.And(t => t.UnitType == UnitType.护理组.ToString());
var useTemp = perforAgusetempRepository.GetEntity(exp); var useTemp = perforAgusetempRepository.GetEntity(exp);
var secondTemps = Mapper.Map<List<SecondTempResponse>>(temps); var secondTemps = Mapper.Map<List<SecondTempResponse>>(temps);
...@@ -1130,6 +1141,10 @@ public bool DeleteWorkType(WorkloadRequest request) ...@@ -1130,6 +1141,10 @@ public bool DeleteWorkType(WorkloadRequest request)
return (UnitType.医生组.ToString(), user.Department); return (UnitType.医生组.ToString(), user.Department);
else if (role.Type == application.NurseRole) else if (role.Type == application.NurseRole)
return (UnitType.护理组.ToString(), user.Department); return (UnitType.护理组.ToString(), user.Department);
if (role.Type == application.SpecialRole)
return (UnitType.特殊核算组.ToString(), user.Department);
if (role.Type == application.OfficeRole)
return (UnitType.行政后勤.ToString(), user.Department);
else else
return ("", user.Department); return ("", user.Department);
} }
...@@ -1174,11 +1189,17 @@ public bool AuditSubmit(ag_secondallot second, int userId) ...@@ -1174,11 +1189,17 @@ public bool AuditSubmit(ag_secondallot second, int userId)
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID); var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
Dictionary<int, string[]> dic = new Dictionary<int, string[]>
{
{ application.DirectorRole, new[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ application.NurseRole, new[]{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString()} },
{ application.SpecialRole, new[]{ UnitType.特殊核算组.ToString() }},
{ application.OfficeRole, new[]{ UnitType.行政后勤.ToString() } },
};
Expression<Func<ag_usetemp, bool>> exp = t => t.HospitalId == allot.HospitalId && t.Department == second.Department; Expression<Func<ag_usetemp, bool>> exp = t => t.HospitalId == allot.HospitalId && t.Department == second.Department;
if (role.Type == application.DirectorRole) if (role.Type.HasValue && dic.ContainsKey(role.Type.Value))
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.UnitType)); exp = exp.And(t => dic[role.Type.Value].Contains(t.UnitType));
else if (role.Type == application.NurseRole)
exp = exp.And(t => t.UnitType == UnitType.护理组.ToString());
var temp = perforAgusetempRepository.GetEntity(exp); var temp = perforAgusetempRepository.GetEntity(exp);
if (temp == null) if (temp == null)
...@@ -1538,6 +1559,7 @@ public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId) ...@@ -1538,6 +1559,7 @@ public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId)
{ {
{ application.DirectorRole, AccountUnitType.科主任.ToString() }, { application.DirectorRole, AccountUnitType.科主任.ToString() },
{ application.NurseRole, AccountUnitType.护士长.ToString() }, { application.NurseRole, AccountUnitType.护士长.ToString() },
{ application.OfficeRole, AccountUnitType.行政中层.ToString() },
}; };
if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>(); if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>();
......
...@@ -27,6 +27,8 @@ public class UserService : IAutoInjection ...@@ -27,6 +27,8 @@ public class UserService : IAutoInjection
private PerforPerallotRepository _perforPerallotRepository; private PerforPerallotRepository _perforPerallotRepository;
private PerforImaccountbasicRepository _imaccountbasicRepository; private PerforImaccountbasicRepository _imaccountbasicRepository;
private PerforImspecialunitRepository _imspecialunitRepository; private PerforImspecialunitRepository _imspecialunitRepository;
private PerforResaccountRepository _resaccountRepository;
private PerforPerallotRepository _perallotRepository;
private PerforPerdeptdicRepository _perdeptdicRepository; private PerforPerdeptdicRepository _perdeptdicRepository;
public UserService(IOptions<Application> application, public UserService(IOptions<Application> application,
PerforSmsRepository smsRepository, PerforSmsRepository smsRepository,
...@@ -39,6 +41,8 @@ public class UserService : IAutoInjection ...@@ -39,6 +41,8 @@ public class UserService : IAutoInjection
PerforPerallotRepository perforPerallotRepository, PerforPerallotRepository perforPerallotRepository,
PerforImaccountbasicRepository imaccountbasicRepository, PerforImaccountbasicRepository imaccountbasicRepository,
PerforImspecialunitRepository imspecialunitRepository, PerforImspecialunitRepository imspecialunitRepository,
PerforResaccountRepository resaccountRepository,
PerforPerallotRepository perallotRepository,
PerforPerdeptdicRepository perdeptdicRepository) PerforPerdeptdicRepository perdeptdicRepository)
{ {
this.application = application.Value; this.application = application.Value;
...@@ -52,6 +56,8 @@ public class UserService : IAutoInjection ...@@ -52,6 +56,8 @@ public class UserService : IAutoInjection
this._perforPerallotRepository = perforPerallotRepository; this._perforPerallotRepository = perforPerallotRepository;
this._imaccountbasicRepository = imaccountbasicRepository; this._imaccountbasicRepository = imaccountbasicRepository;
this._imspecialunitRepository = imspecialunitRepository; this._imspecialunitRepository = imspecialunitRepository;
this._resaccountRepository = resaccountRepository;
this._perallotRepository = perallotRepository;
this._perdeptdicRepository = perdeptdicRepository; this._perdeptdicRepository = perdeptdicRepository;
} }
...@@ -148,16 +154,15 @@ public ApiResponse Delete(int iD) ...@@ -148,16 +154,15 @@ public ApiResponse Delete(int iD)
/// <param name="request"></param> /// <param name="request"></param>
public UserResponse Insert(UserRequest request, int userid) public UserResponse Insert(UserRequest request, int userid)
{ {
var isAgainAdmin = new int[] { application.DirectorRole, application.NurseRole }.Contains(request.Role);
if (null != _userRepository.GetEntity(t => t.Login == request.Login && t.IsDelete == 1)) if (null != _userRepository.GetEntity(t => t.Login == request.Login && t.IsDelete == 1))
throw new PerformanceException("登录名重复"); throw new PerformanceException("登录名重复");
//if (null != _userRepository.GetEntity(t => t.Mobile == request.Mobile && t.IsDelete == 1)) //if (null != _userRepository.GetEntity(t => t.Mobile == request.Mobile && t.IsDelete == 1))
// throw new PerformanceException("手机号重复"); // throw new PerformanceException("手机号重复");
if (request.Role == 3 && string.IsNullOrEmpty(request.Department)) if (request.Role == 3 && string.IsNullOrEmpty(request.Department))
throw new PerformanceException("请选择科室"); throw new PerformanceException("请选择科室");
if (isAgainAdmin && request.HosIDArray.Length > 1) if (request.HosIDArray.Length > 1)
throw new PerformanceException("二次绩效管理员只支持单家医院"); throw new PerformanceException("二次绩效管理员只支持单家医院");
if (isAgainAdmin && string.IsNullOrEmpty(request.Department)) if (string.IsNullOrEmpty(request.Department))
throw new PerformanceException("二次绩效管理员科室不能为空"); throw new PerformanceException("二次绩效管理员科室不能为空");
var user = Mapper.Map<sys_user>(request); var user = Mapper.Map<sys_user>(request);
...@@ -326,7 +331,7 @@ public List<sys_role> RoleList(int userId) ...@@ -326,7 +331,7 @@ public List<sys_role> RoleList(int userId)
List<sys_role> result = new List<sys_role>() { role }; List<sys_role> result = new List<sys_role>() { role };
GetChildrenRole(roles, role.ID, result); GetChildrenRole(roles, role.ID, result);
return result?.Distinct().ToList(); return result?.OrderBy(w => w.Sort)?.Distinct().ToList();
} }
/// <summary> /// <summary>
...@@ -362,7 +367,24 @@ public List<TitleValue> Department(int hospitalId) ...@@ -362,7 +367,24 @@ public List<TitleValue> Department(int hospitalId)
var list = _perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId); var list = _perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (list == null || !list.Any()) return new List<TitleValue>(); if (list == null || !list.Any()) return new List<TitleValue>();
var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t); var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t).ToList();
// 补充行政科室
var states = new int[] { (int)AllotStates.Archive, (int)AllotStates.GenerateAccomplish };
var allots = _perallotRepository.GetEntities(w => w.HospitalId == hospitalId && states.Contains(w.States));
if (allots != null && allots.Any())
{
var allot = allots.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).FirstOrDefault();
if (allot != null)
{
var types = new int[] { (int)UnitType.行政中层, (int)UnitType.行政后勤 };
var accounts = _resaccountRepository.GetEntities(w => w.AllotID == allot.ID && w.UnitType.HasValue && types.Contains(w.UnitType.Value));
if (accounts != null && accounts.Any())
{
result.AddRange(accounts.Select(w => w.AccountingUnit));
}
}
}
return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList(); return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment