二次分配科室详情

parent ae1699bc
......@@ -5,7 +5,9 @@
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
......@@ -27,21 +29,27 @@ namespace Performance.Api.Controllers
public class AgainAllotController : Controller
{
private AgainAllotService againAllotService;
private ComputeService computeService;
private ClaimService claimService;
private AllotService allotService;
private IHostingEnvironment evn;
private ConfigService configService;
private Application application;
public AgainAllotController(AgainAllotService againAllotService,
ClaimService claimService,
AllotService allotService,
IHostingEnvironment evn,
ConfigService configService)
ConfigService configService,
ComputeService computeService,
IOptions<Application> options)
{
this.againAllotService = againAllotService;
this.claimService = claimService;
this.allotService = allotService;
this.evn = evn;
this.configService = configService;
this.computeService = computeService;
this.application = options.Value;
}
/// <summary>
......@@ -105,6 +113,31 @@ public ApiResponse Import([FromForm] IFormCollection form)
}
/// <summary>
/// 查看科室绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("departmentdetail")]
[HttpPost]
public ApiResponse DepartmentDetail([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request)
{
var user = claimService.At(request);
var again = againAllotService.GetAgainallot(request.AgainAllotID);
if (user.Role.First().RoleID == application.DirectorRole)
{
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, user.Department, 1);
return new ApiResponse(ResponseType.OK, detail);
}
else if (user.Role.First().RoleID == application.NurseRole)
{
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, user.Department, 2);
return new ApiResponse(ResponseType.OK, detail);
}
return new ApiResponse(ResponseType.Fail, "当前用户角色无法识别");
}
/// <summary>
/// 生成绩效
/// </summary>
/// <param name="request"></param>
......
......@@ -104,7 +104,7 @@ public ApiResponse<DeptDetailResponse> DeptDetail([FromBody]DeptDetailRequest re
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
DeptDetailResponse response = _computeService.GetDepartmentDetail(request);
DeptDetailResponse response = _computeService.GetDepartmentDetail(request.AllotId, request.AccountID, request.Type);
return new ApiResponse<DeptDetailResponse>(ResponseType.OK, response);
}
......
......@@ -110,17 +110,37 @@ public List<NurseResponse> GetNursePerformance(int allotId)
return nurse;
}
public DeptDetailResponse GetDepartmentDetail(int allotId, string department, int type)
{
if (type == 1)
{
var accountList = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == department);
if (accountList != null)
return GetDepartmentDetail(allotId, accountList.First().ID, type);
}
else if (type == 2)
{
var accountList = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == department);
if (accountList != null)
return GetDepartmentDetail(allotId, accountList.First().ID, type);
}
return null;
}
/// <summary>
/// 返回科室详情
/// </summary>
/// <param name="request"></param>
/// <param name="allotId"></param>
/// <param name="accountId"></param>
/// <param name="type"> 1 医生组 2 护理组</param>
/// <returns></returns>
public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int type)
{
var sheetList = _perforPerSheetRepository.GetEntities(t => t.AllotID == request.AllotId);
if (request.Type == 1)
var sheetList = _perforPerSheetRepository.GetEntities(t => t.AllotID == allotId);
if (type == 1)
{
var doctor = _perforResAccountdoctorRepository.GetEntity(t => t.AllotID == request.AllotId && t.ID == request.AccountID);
var doctor = _perforResAccountdoctorRepository.GetEntity(t => t.AllotID == allotId && t.ID == accountId);
DeptDetailResponse response = new DeptDetailResponse()
{
......@@ -145,9 +165,9 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
return response;
}
else if (request.Type == 2)
else if (type == 2)
{
var nurse = _perforResAccountnurseRepository.GetEntity(t => t.AllotID == request.AllotId && t.ID == request.AccountID);
var nurse = _perforResAccountnurseRepository.GetEntity(t => t.AllotID == allotId && t.ID == accountId);
DeptDetailResponse response = new DeptDetailResponse()
{
Pandect = Mapper.Map<PerDataAccount>(nurse),
......
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