代码搬迁位置

parent 4e2343b8
......@@ -6,9 +6,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -145,6 +145,11 @@ public ApiResponse Import([FromForm] IFormCollection form)
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 绩效生成
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("generate")]
[HttpPost]
public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]AllotRequest request)
......@@ -156,50 +161,5 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
BackgroundJob.Enqueue(() => _perExcelService.Execute(allot));
return new ApiResponse(ResponseType.OK);
}
[Route("getcompute")]
[HttpPost]
public ApiResponse<List<res_compute>> GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _perExcelService.GetCompute(request.AllotId, request.Type);
return new ApiResponse<List<res_compute>>(ResponseType.OK, "ok", list);
}
[Route("getspecial")]
[HttpPost]
public ApiResponse<List<res_specialunit>> GetSpecial([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _perExcelService.GetSpecial(request.AllotId);
return new ApiResponse<List<res_specialunit>>(ResponseType.OK, "ok", list);
}
[Route("getdoctordata")]
[HttpPost]
public ApiResponse<List<DoctorResponse>> GetDoctor([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _perExcelService.GetDoctorPerformance(request.AllotId);
return new ApiResponse<List<DoctorResponse>>(ResponseType.OK, "ok", list);
}
[Route("getnursedata")]
[HttpPost]
public ApiResponse<List<NurseResponse>> GetNurse([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _perExcelService.GetNursePerformance(request.AllotId);
return new ApiResponse<List<NurseResponse>>(ResponseType.OK, "ok", list);
}
}
}
......@@ -5,6 +5,7 @@
using Newtonsoft.Json.Linq;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
using System;
......@@ -26,6 +27,75 @@ public class ComputeController : Controller
_computeService = computeService;
}
/// <summary>
/// 获取绩效发放列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getcompute")]
[HttpPost]
public ApiResponse<List<res_compute>> GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetCompute(request.AllotId, request.Type);
return new ApiResponse<List<res_compute>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 特殊科室发放列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getspecial")]
[HttpPost]
public ApiResponse<List<res_specialunit>> GetSpecial([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetSpecial(request.AllotId);
return new ApiResponse<List<res_specialunit>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 医生组科室绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getdoctordata")]
[HttpPost]
public ApiResponse<List<DoctorResponse>> GetDoctor([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetDoctorPerformance(request.AllotId);
return new ApiResponse<List<DoctorResponse>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 护理组科室绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getnursedata")]
[HttpPost]
public ApiResponse<List<NurseResponse>> GetNurse([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetNursePerformance(request.AllotId);
return new ApiResponse<List<NurseResponse>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 科室绩效详情
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("deptdetail")]
[HttpPost]
public ApiResponse<DeptDetailResponse> DeptDetail([FromBody]DeptDetailRequest request)
......
using AutoMapper;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository;
using System;
using System.Collections.Generic;
......@@ -14,15 +16,82 @@ public class ComputeService : IAutoInjection
private PerforResAccountnurseRepository _perforResAccountnurseRepository;
private PerforPerSheetRepository _perforPerSheetRepository;
private PerforImDataRepository _perforImDataRepository;
private PerforRescomputeRepository _perforRescomputeRepository;
private PerforResspecialunitRepository _perforResspecialunitRepository;
public ComputeService(PerforResAccountdoctorRepository perforResAccountdoctorRepository,
PerforResAccountnurseRepository perforResAccountnurseRepository,
PerforPerSheetRepository perforPerSheetRepository,
PerforImDataRepository perforImDataRepository)
PerforImDataRepository perforImDataRepository,
PerforRescomputeRepository perforRescomputeRepository,
PerforResspecialunitRepository perforResspecialunitRepository)
{
_perforResAccountdoctorRepository = perforResAccountdoctorRepository;
_perforResAccountnurseRepository = perforResAccountnurseRepository;
_perforPerSheetRepository = perforPerSheetRepository;
_perforImDataRepository = perforImDataRepository;
_perforRescomputeRepository = perforRescomputeRepository;
_perforResspecialunitRepository = perforResspecialunitRepository;
}
public List<res_compute> GetCompute(int allotId, int type)
{
var list = new List<res_compute>();
Dictionary<int, List<PerformanceType>> keyValues = new Dictionary<int, List<PerformanceType>>
{
{ 1,new List<PerformanceType>{ PerformanceType.ReferenceDirector } },
{ 2,new List<PerformanceType>{ PerformanceType.ReferenceDirectorAvg } },
{ 3,new List<PerformanceType>{ PerformanceType.ReferenceNurseAvg95, PerformanceType.ReferenceHeadNurse, PerformanceType.Null } },
{ 5,new List<PerformanceType>{ PerformanceType.Director, PerformanceType.DeputyDirector } },
{ 6,new List<PerformanceType>{ PerformanceType.Nurse } }
};
if (keyValues.ContainsKey(type))
{
var conList = keyValues[type].Select(t => EnumHelper.GetDescription(t));
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && conList.Contains(t.FitPeople));
}
else if (type == 99)
{
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
}
else
{
throw new PerformanceException("参数错误,type无效");
}
return Mapper.Map<List<res_compute>>(list);
}
public List<res_specialunit> GetSpecial(int allotId)
{
var list = _perforResspecialunitRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<res_specialunit>>(list);
}
public List<DoctorResponse> GetDoctorPerformance(int allotId)
{
var list = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId);
List<DoctorResponse> doctor = Mapper.Map<List<DoctorResponse>>(list);
if (doctor != null)
{
foreach (var item in doctor)
{
item.UnitName = "医生组";
}
}
return Mapper.Map<List<DoctorResponse>>(doctor);
}
public List<NurseResponse> GetNursePerformance(int allotId)
{
var list = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId);
List<NurseResponse> nurse = Mapper.Map<List<NurseResponse>>(list);
if (nurse != null)
{
foreach (var item in nurse)
{
item.UnitName = "护士组";
}
}
return Mapper.Map<List<NurseResponse>>(nurse);
}
/// <summary>
......
......@@ -522,66 +522,5 @@ public List<res_baiscnorm> Compute(per_allot allot, PerExcel excel, res_baiscnor
return baiscnormList;
}
public List<res_compute> GetCompute(int allotId, int type)
{
var list = new List<res_compute>();
Dictionary<int, List<PerformanceType>> keyValues = new Dictionary<int, List<PerformanceType>>
{
{ 1,new List<PerformanceType>{ PerformanceType.ReferenceDirector } },
{ 2,new List<PerformanceType>{ PerformanceType.ReferenceDirectorAvg } },
{ 3,new List<PerformanceType>{ PerformanceType.ReferenceNurseAvg95, PerformanceType.ReferenceHeadNurse, PerformanceType.Null } },
{ 5,new List<PerformanceType>{ PerformanceType.Director, PerformanceType.DeputyDirector } },
{ 6,new List<PerformanceType>{ PerformanceType.Nurse } }
};
if (keyValues.ContainsKey(type))
{
var conList = keyValues[type].Select(t => EnumHelper.GetDescription(t));
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && conList.Contains(t.FitPeople));
}
else if (type == 99)
{
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
}
else
{
throw new PerformanceException("参数错误,type无效");
}
return Mapper.Map<List<res_compute>>(list);
}
public List<res_specialunit> GetSpecial(int allotId)
{
var list = _perforResspecialunitRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<res_specialunit>>(list);
}
public List<DoctorResponse> GetDoctorPerformance(int allotId)
{
var list = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId);
List<DoctorResponse> doctor = Mapper.Map<List<DoctorResponse>>(list);
if (doctor != null)
{
foreach (var item in doctor)
{
item.UnitName = "医生组";
}
}
return Mapper.Map<List<DoctorResponse>>(doctor);
}
public List<NurseResponse> GetNursePerformance(int allotId)
{
var list = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId);
List<NurseResponse> nurse = Mapper.Map<List<NurseResponse>>(list);
if (nurse != null)
{
foreach (var item in nurse)
{
item.UnitName = "护士组";
}
}
return Mapper.Map<List<NurseResponse>>(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