Commit 05853650 by 李承祥

二次绩效接口调整:1.获取使用模板根据医院和科室 2. 获取二次绩效考核根据allotid和年月 3. 获取科室

parent 25ffb9af
......@@ -122,10 +122,11 @@ public ApiResponse SecondDetail([CustomizeValidator(RuleSet = "Refresh"), FromBo
/// 选择二次绩效模板
/// </summary>
/// <returns></returns>
[HttpGet("api/temp/list/{hospitalid}")]
public ApiResponse<List<SecondTempResponse>> Temp(int hospitalid)
[HttpPost]
[Route("api/temp/list")]
public ApiResponse<List<SecondTempResponse>> Temp([FromBody]AllotDeptRequest request)
{
var result = secondAllotService.GetTemp(hospitalid);
var result = secondAllotService.GetTemp(request.HospitalId, request.Department);
return new ApiResponse<List<SecondTempResponse>>(ResponseType.OK, result);
}
......@@ -229,12 +230,12 @@ public ApiResponse SubmitAudit(int secondid)
/// 二次绩效审核列表
/// </summary>
/// <returns></returns>
[HttpGet]
[HttpPost]
[Route("/api/second/audit/list")]
public ApiResponse<List<ag_secondallot>> AuditList()
public ApiResponse<List<ag_secondallot>> AuditList([FromBody]AllotDeptRequest request)
{
var userid = claimService.GetUserId();
var list = secondAllotService.AuditList(userid);
var list = secondAllotService.AuditList(userid, request.AllotId);
return new ApiResponse<List<ag_secondallot>>(ResponseType.OK, "审核列表", list);
}
......
......@@ -739,7 +739,13 @@
二次绩效
</summary>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.List">
<member name="M:Performance.Api.Controllers.SecondAllotController.List(Performance.DtoModels.SetDepartmentRequest)">
<summary>
二次绩效列表(没有需要初始化)
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.AuditList(Performance.DtoModels.AllotRequest)">
<summary>
二次绩效列表(没有需要初始化)
</summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class AllotDeptRequest
{
public int AllotId { get; set; }
public int HospitalId { get; set; }
public string Department { get; set; }
}
}
......@@ -311,12 +311,12 @@ public bool SaveCompute(List<ag_compute> request)
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<SecondTempResponse> GetTemp(int hospitalid)
public List<SecondTempResponse> GetTemp(int hospitalid, string department)
{
var temps = perforAgtempRepository.GetEntities();
if (temps != null && temps.Any())
{
var useTemp = perforAgusetempRepository.GetEntity(t => t.HospitalId == hospitalid);
var useTemp = perforAgusetempRepository.GetEntity(t => t.HospitalId == hospitalid && t.Department == department);
var secondTemps = Mapper.Map<List<SecondTempResponse>>(temps);
if (useTemp != null)
secondTemps.ForEach(t => t.IsSelected = t.Id == useTemp.UseTempId);
......@@ -544,16 +544,22 @@ public bool WorkloadDelete(int id)
/// </summary>
/// <param name="userId">用户ID</param>
/// <returns></returns>
public List<ag_secondallot> AuditList(int userId)
public List<ag_secondallot> AuditList(int userId, int allotId)
{
var hospital = perforUserhospitalRepository.GetEntities(t => t.UserID == userId);
var allotList = perforPerallotRepository.GetEntities(t => hospital.Select(h => h.HospitalID).Contains(t.HospitalId));
if (allotList != null && allotList.Count > 0)
{
var allotIds = allotList.Select(t => t.ID);
return perforAgsecondallotRepository.GetEntities(t => allotIds.Contains(t.AllotId.Value) && t.Status == 2);
}
return null;
//var hospital = perforUserhospitalRepository.GetEntities(t => t.UserID == userId);
//var allotList = perforPerallotRepository.GetEntities(t => hospital.Select(h => h.HospitalID).Contains(t.HospitalId));
//if (allotList != null && allotList.Count > 0)
//{
// var allotIds = allotList.Select(t => t.ID);
// return perforAgsecondallotRepository.GetEntities(t => allotIds.Contains(t.AllotId.Value) && t.Status == 2);
//}
//return null;
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null)
throw new PerformanceException("所选绩效不存在!");
var secondList = perforAgsecondallotRepository.GetEntities(t => t.AllotId == allot.ID && t.Year == allot.Year && t.Month == allot.Month && t.Status == 2);
return secondList;
}
/// <summary>
......
......@@ -25,6 +25,7 @@ public class UserService : IAutoInjection
private PerforUserroleRepository _userroleRepository;
private PerforImemployeeRepository _employeeRepository;
private PerforPerallotRepository _perforPerallotRepository;
private PerforImaccountbasicRepository _perforImaccountbasicRepository;
public UserService(IOptions<Application> application,
PerforSmsRepository smsRepository,
PerforUserRepository userRepository,
......@@ -33,7 +34,8 @@ public class UserService : IAutoInjection
PerforRoleRepository roleRepository,
PerforUserroleRepository userroleRepository,
PerforImemployeeRepository employeeRepository,
PerforPerallotRepository perforPerallotRepository)
PerforPerallotRepository perforPerallotRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository)
{
this.application = application.Value;
this._userRepository = userRepository;
......@@ -44,6 +46,7 @@ public class UserService : IAutoInjection
this._userroleRepository = userroleRepository;
this._employeeRepository = employeeRepository;
this._perforPerallotRepository = perforPerallotRepository;
this._perforImaccountbasicRepository = perforImaccountbasicRepository;
}
/// <summary>
......@@ -317,7 +320,7 @@ public List<sys_role> RoleList(int userId)
List<sys_role> result = new List<sys_role>() { role };
GetChildrenRole(roles, role.ID, result);
return result;
return result?.Distinct().ToList();
}
/// <summary>
......@@ -327,14 +330,23 @@ public List<sys_role> RoleList(int userId)
public List<TitleValue> Department(int hospitalID)
{
var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalID);
var result = new List<string>();
if (allotList != null)
{
var idList = allotList.Select(s => s.ID).ToList();
var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value));
if (department != null && department.Count > 0)
return department.Select(t => t.Department).Distinct().Select(t => new TitleValue { Title = t, Value = t }).OrderBy(t => t.Title).ToList();
//var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
//if (department != null && department.Count() > 0)
// result.AddRange(department);
var department = _perforImaccountbasicRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
if (department != null && department.Count() > 0)
result.AddRange(department);
if (result != null && result.Any())
{
result = result.Distinct().OrderBy(t => t).ToList();
}
}
return new List<TitleValue>();
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