Commit 9da16caa by ruyun.zhang@suvalue.com

Merge branch 'feature/new_report' into dev

parents ba95946d be83b464
...@@ -59,6 +59,19 @@ public ApiResponse List([FromBody]AllotRequest request) ...@@ -59,6 +59,19 @@ public ApiResponse List([FromBody]AllotRequest request)
} }
/// <summary> /// <summary>
/// 生成成功或归档绩效记录
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("list/success")]
[HttpPost]
public ApiResponse Success([FromBody]AllotRequest request)
{
List<AllotResponse> allots = _allotService.GetSuccAllotList(request.HospitalId);
return new ApiResponse(ResponseType.OK, allots);
}
/// <summary>
/// 新增绩效 /// 新增绩效
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
......
...@@ -15,9 +15,11 @@ namespace Performance.Api.Controllers ...@@ -15,9 +15,11 @@ namespace Performance.Api.Controllers
public class EmployeeController : Controller public class EmployeeController : Controller
{ {
private EmployeeService employeeService; private EmployeeService employeeService;
public EmployeeController(EmployeeService employeeService) private ClaimService claim;
public EmployeeController(EmployeeService employeeService, ClaimService claim)
{ {
this.employeeService = employeeService; this.employeeService = employeeService;
this.claim = claim;
} }
/// <summary> /// <summary>
...@@ -29,7 +31,7 @@ public EmployeeController(EmployeeService employeeService) ...@@ -29,7 +31,7 @@ public EmployeeController(EmployeeService employeeService)
[HttpPost] [HttpPost]
public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), FromBody]EmployeeRequest request) public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), FromBody]EmployeeRequest request)
{ {
var employee = employeeService.GetEmployeeList(request.AllotID.Value); var employee = employeeService.GetEmployeeList(request.AllotID, claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
} }
...@@ -82,10 +84,10 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Empl ...@@ -82,10 +84,10 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Empl
[HttpPost] [HttpPost]
public ApiResponse GetEmployeeClinicList([CustomizeValidator(RuleSet = "Select"), FromBody]im_employee_clinic request) public ApiResponse GetEmployeeClinicList([CustomizeValidator(RuleSet = "Select"), FromBody]im_employee_clinic request)
{ {
if ((request.AllotID ?? 0) == 0) //if ((request.AllotID ?? 0) == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); // return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetEmployeeClinicList(request.AllotID.Value); var employee = employeeService.GetEmployeeClinicList(request.AllotID, claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
} }
......
...@@ -115,7 +115,7 @@ public EmployeeRequestValidator() ...@@ -115,7 +115,7 @@ public EmployeeRequestValidator()
}; };
RuleSet("Select", () => RuleSet("Select", () =>
{ {
RuleFor(x => x.AllotID).NotNull().GreaterThan(0); //RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
}); });
RuleSet("Insert", () => RuleSet("Insert", () =>
......
...@@ -109,6 +109,31 @@ public List<AllotResponse> GetAllotList(int? hospitalId) ...@@ -109,6 +109,31 @@ public List<AllotResponse> GetAllotList(int? hospitalId)
} }
/// <summary> /// <summary>
/// 生成成功或归档绩效记录
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
public List<AllotResponse> GetSuccAllotList(int? hospitalId)
{
if (!hospitalId.HasValue || hospitalId.Value <= 0)
throw new PerformanceException("hospitalId无效");
var allotList = _allotRepository.GetEntities(t => t.HospitalId == hospitalId
&& new List<int> { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed }.Contains(t.States));
allotList = allotList == null ? allotList : allotList.OrderByDescending(t => t.ID).ToList();
var isconfig = perforHospitalconfigRepository.GetEntity(t => t.HospitalId == hospitalId) == null ? false : true;
var reuslt = Mapper.Map<List<AllotResponse>>(allotList);
reuslt?.ForEach(t =>
{
t.IsDown = !string.IsNullOrEmpty(t.ExtractPath);
if (!string.IsNullOrEmpty(t.ExtractPath))
t.ExtractPath = t.ExtractPath.Replace(options.Value.AbsolutePath, options.Value.HttpPath).Replace("\\", "/");
t.HasConfig = isconfig ? 3 : 0;
});
return reuslt;
}
/// <summary>
/// 新增 /// 新增
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -216,7 +241,7 @@ public void UpdateAllotStates(int allotId, int states, string remark) ...@@ -216,7 +241,7 @@ public void UpdateAllotStates(int allotId, int states, string remark)
{ {
_allotRepository.UpdateAllotStates(allotId, states, remark); _allotRepository.UpdateAllotStates(allotId, states, remark);
} }
/// <summary> /// <summary>
/// 生成绩效 /// 生成绩效
/// </summary> /// </summary>
......
...@@ -19,15 +19,21 @@ public class EmployeeService : IAutoInjection ...@@ -19,15 +19,21 @@ public class EmployeeService : IAutoInjection
private PerforPersheetRepository perforPersheetRepository; private PerforPersheetRepository perforPersheetRepository;
private PerforPerallotRepository perforPerallotRepository; private PerforPerallotRepository perforPerallotRepository;
private PerforImemployeeclinicRepository perforImemployeeclinicRepository; private PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private PerforUserhospitalRepository perforUserhospitalRepository;
private PerforPerallotRepository perallotRepository;
public EmployeeService(PerforImemployeeRepository perforImemployeeRepository, public EmployeeService(PerforImemployeeRepository perforImemployeeRepository,
PerforPersheetRepository perforPersheetRepository, PerforPersheetRepository perforPersheetRepository,
PerforPerallotRepository perforPerallotRepository, PerforPerallotRepository perforPerallotRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository) PerforImemployeeclinicRepository perforImemployeeclinicRepository,
PerforUserhospitalRepository perforUserhospitalRepository,
PerforPerallotRepository perallotRepository)
{ {
this.perforImemployeeRepository = perforImemployeeRepository; this.perforImemployeeRepository = perforImemployeeRepository;
this.perforPersheetRepository = perforPersheetRepository; this.perforPersheetRepository = perforPersheetRepository;
this.perforPerallotRepository = perforPerallotRepository; this.perforPerallotRepository = perforPerallotRepository;
this.perforImemployeeclinicRepository = perforImemployeeclinicRepository; this.perforImemployeeclinicRepository = perforImemployeeclinicRepository;
this.perforUserhospitalRepository = perforUserhospitalRepository;
this.perallotRepository = perallotRepository;
} }
#region 行政人员 #region 行政人员
...@@ -50,8 +56,21 @@ public im_employee GetEmployee(EmployeeRequest request) ...@@ -50,8 +56,21 @@ public im_employee GetEmployee(EmployeeRequest request)
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public List<im_employee> GetEmployeeList(int allotId) public List<im_employee> GetEmployeeList(int? allotId, int userId)
{ {
if (allotId == null || allotId == 0)
{
var userHospital = perforUserhospitalRepository.GetEntity(t => t.UserID == userId);
if (userHospital == null)
throw new PerformanceException("用户未绑定医院!");
var allotList = perallotRepository.GetEntities(t => t.HospitalId == userHospital.HospitalID
&& new List<int> { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed }.Contains(t.States));
if (allotList != null && allotList.Any())
{
allotId = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).First().ID;
}
}
var employee = perforImemployeeRepository.GetEntities(t => t.AllotID == allotId); var employee = perforImemployeeRepository.GetEntities(t => t.AllotID == allotId);
return employee?.OrderBy(t => t.RowNumber).ToList(); return employee?.OrderBy(t => t.RowNumber).ToList();
} }
...@@ -136,8 +155,21 @@ public bool Delete(EmployeeRequest request) ...@@ -136,8 +155,21 @@ public bool Delete(EmployeeRequest request)
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public List<im_employee_clinic> GetEmployeeClinicList(int allotId) public List<im_employee_clinic> GetEmployeeClinicList(int? allotId, int userId)
{ {
if (allotId == null || allotId == 0)
{
var userHospital = perforUserhospitalRepository.GetEntity(t => t.UserID == userId);
if (userHospital == null)
throw new PerformanceException("用户未绑定医院!");
var allotList = perallotRepository.GetEntities(t => t.HospitalId == userHospital.HospitalID
&& new List<int> { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed }.Contains(t.States));
if (allotList != null && allotList.Any())
{
allotId = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).First().ID;
}
}
var employee = perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId); var employee = perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId);
return employee?.OrderBy(t => t.RowNumber).ToList(); return employee?.OrderBy(t => t.RowNumber).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