行政科室测算

parent a1c512cc
......@@ -111,6 +111,22 @@ public ApiResponse<List<DeptResponse>> GetOther([FromBody] ComputerRequest reque
}
/// <summary>
/// 行政科室绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getofficedata")]
[HttpPost]
public ApiResponse<List<DeptResponse>> GetOffice([FromBody] ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetOfficePerformance(request.AllotId);
return new ApiResponse<List<DeptResponse>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 返回院领导、中层、工勤组绩效
/// </summary>
/// <param name="request"></param>
......
......@@ -319,6 +319,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetOffice(Performance.DtoModels.ComputerRequest)">
<summary>
行政科室绩效列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetAdminPerformance(Performance.DtoModels.ComputerRequest)">
<summary>
返回院领导、中层、工勤组绩效
......
......@@ -148,9 +148,9 @@ public AutoMapperConfigs()
//CreateMap<PerDataAccountNurse, res_accountnurse>();
//CreateMap<res_accountdoctor, PerDataAccountBaisc>();
CreateMap<res_account, PerDataAccountBaisc>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => ((UnitType)src.UnitType).ToString()));
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType.HasValue ? ((UnitType)src.UnitType).ToString() : ""));
CreateMap<PerDataAccountBaisc, res_account>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value));
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => string.IsNullOrEmpty(src.UnitType) ? -1 : EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value));
//CreateMap<PerDataAccountBaisc, res_accountnurse>();
//CreateMap<res_accountdoctor, ComputeSource>();
......
......@@ -27,6 +27,7 @@ public class ProcessComputService : IAutoInjection
private PerforCofdrugtypeRepository perforCofdrugtypeRepository;
private PerforCofworkitemRepository perforCofworkitemRepository;
private PerforCofcmiRepository perforCofcmiRepository;
private readonly PerforRescomputeRepository perforRescomputeRepository;
private readonly LogManageService logManageService;
private readonly GuaranteeService guaranteeService;
......@@ -41,6 +42,7 @@ public class ProcessComputService : IAutoInjection
PerforCofdrugtypeRepository perforCofdrugtypeRepository,
PerforCofworkitemRepository perforCofworkitemRepository,
PerforCofcmiRepository perforCofcmiRepository,
PerforRescomputeRepository perforRescomputeRepository,
LogManageService logManageService,
GuaranteeService guaranteeService)
{
......@@ -55,6 +57,7 @@ public class ProcessComputService : IAutoInjection
this.perforCofdrugtypeRepository = perforCofdrugtypeRepository;
this.perforCofworkitemRepository = perforCofworkitemRepository;
this.perforCofcmiRepository = perforCofcmiRepository;
this.perforRescomputeRepository = perforRescomputeRepository;
this.logManageService = logManageService;
this.guaranteeService = guaranteeService;
}
......@@ -285,7 +288,7 @@ public void Save(List<PerSheet> perSheets, int allotId)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
dept.MedicineFactor = workDoctor?.MedicineFactor;
dept.ScoringAverage = dept.ScoringAverage == 0m ? 1 : dept.ScoringAverage;
dept.ScoringAverage = dept.ScoringAverage == 0m ? 0 : dept.ScoringAverage;
dept.AdjustFactor = dept.AdjustFactor == 0m ? 1 : dept.AdjustFactor;
dept.Income = econDoctor?.CellValue ?? 0;
dept.WorkloadFee = workDoctor?.CellValue ?? 0;
......@@ -306,6 +309,70 @@ public void Save(List<PerSheet> perSheets, int allotId)
}
/// <summary>
/// 计算行政科室绩效
/// </summary>
/// <param name="allot"></param>
/// <param name="excel"></param>
/// <param name="extras"></param>
/// <param name="drugExtras"></param>
/// <param name="materialsExtras"></param>
public void ComputeOffice(per_allot allot, PerExcel excel, IEnumerable<AccountUnitTotal> extras,
IEnumerable<AccountUnitTotal> drugExtras, IEnumerable<AccountUnitTotal> materialsExtras)
{
//取出科室
var accountList = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic)?.PerData?.Select(t => (PerDataAccountBaisc)t);
List<string> involves = new List<string>
{
AccountUnitType.行政高层.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政工勤.ToString()
};
var empolyeeList = perforRescomputeRepository.GetEntities(w => w.AllotID == allot.ID && involves.Contains(w.AccountType));
if (empolyeeList == null || empolyeeList.Count() == 0) return;
List<PerDataAccountBaisc> perDatas = new List<PerDataAccountBaisc>();
// 取出科室
var dataList = empolyeeList.Select(w => new { w.AccountType, w.AccountingUnit }).Distinct();
foreach (var account in dataList)
{
var resAccount = accountList.FirstOrDefault(t => t.UnitType == account.AccountType && t.AccountingUnit == account.AccountingUnit);
var empolyees = empolyeeList.Where(w => w.AccountingUnit == account.AccountingUnit && w.AccountType == account.AccountType);
if (!empolyees.Any()) continue;
//科室奖罚汇总结果
var extra = extras.FirstOrDefault(w => w.UnitType == account.AccountType.ToString() && w.AccountingUnit == resAccount.AccountingUnit)?.TotelValue;
var drugExtra = drugExtras.FirstOrDefault(w => w.UnitType == account.AccountType.ToString() && w.AccountingUnit == resAccount.AccountingUnit)?.TotelValue;
var materialsExtra = materialsExtras.FirstOrDefault(w => w.UnitType == account.AccountType.ToString() && w.AccountingUnit == resAccount.AccountingUnit)?.TotelValue;
var dept = new PerDataAccountBaisc();
dept.AccountingUnit = account.AccountingUnit;
//dept.UnitType = account.AccountType;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
dept.AdjustFactor = resAccount?.AdjustFactor == null ? 1 : resAccount.AdjustFactor;
dept.Income = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.Extra = (extra ?? 0);
dept.MedicineExtra = (drugExtra ?? 0);
dept.MaterialsExtra = (materialsExtra ?? 0);
dept.PerforFee = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.PerforTotal = Math.Round((dept.PerforFee + (dept?.OtherPerfor1 ?? 0)) ?? 0);
dept.RealGiveFee = Math.Round(((dept.PerforTotal * dept.ScoringAverage + dept.MedicineExtra + dept.MaterialsExtra + dept.OtherPerfor2 + (extra ?? 0)) * dept.AdjustFactor) ?? 0);
dept.Avg = dept.ManagerNumber + dept.Number == 0 ? 0 : dept.PerforTotal / (dept.ManagerNumber + dept.Number);
perDatas.Add(dept);
}
List<res_account> addList = new List<res_account>();
foreach (var data in perDatas)
{
var imdata = Mapper.Map<res_account>(data);
imdata.AllotID = allot.ID;
addList.Add(imdata);
}
perforResaccountRepository.AddRange(addList.ToArray());
}
/// <summary>
/// 获取科室奖罚汇总结果
/// </summary>
/// <param name="excel"></param>
......
......@@ -375,6 +375,9 @@ public void Generate(per_allot allot, string mail)
logManageService.WriteMsg("正在生成绩效", "计算最终绩效数据", 1, allot.ID, "ReceiveMessage", true);
var baiscnormList = resultComputeService.Compute(allot, excel, sheetLast, employeeExtra);
// 计算行政科室绩效
processComputService.ComputeOffice(allot, excel, accountExtras, drugExtras, materialsExtras);
// 计算特殊科室
logManageService.WriteMsg("正在生成绩效", "计算最终特殊科室绩效数据", 1, allot.ID, "ReceiveMessage", true);
resultComputeService.SpecialUnitCompute(excel, allot, sheetLast, baiscnormList, accountExtras, drugExtras, materialsExtras, employeeExtra);
......
......@@ -253,6 +253,21 @@ public List<DeptResponse> GetOtherPerformance(int allotId)
}
/// <summary>
/// 返回行政科室绩效列表
/// </summary>
/// <param name="allotId">绩效ID</param>
/// <returns></returns>
public List<DeptResponse> GetOfficePerformance(int allotId)
{
var list = perforResaccountRepository.GetEntities(t => t.UnitType == -1 && t.AllotID == allotId)
?.OrderBy(t => t.UnitType)
.ThenByDescending(t => t.AccountingUnit);
List<DeptResponse> other = Mapper.Map<List<DeptResponse>>(list);
other?.ForEach(t => t.UnitName = ((UnitType)t.UnitType).ToString());
return other;
}
/// <summary>
/// 返回院领导、中层、工勤组绩效
/// </summary>
/// <param name="allotId">绩效ID</param>
......
......@@ -19,6 +19,7 @@ public class ComputeDirector : IAutoInjection
private readonly PerforCofdirectorRepository perforCofdirectorRepository;
private readonly PerforCofworkyearRepository perforCofworkyearRepository;
private readonly PerforResaccountRepository perforResaccountRepository;
private readonly PerforRescomputeRepository perforRescomputeRepository;
private readonly BudgetService budgetService;
//private readonly PerforResaccountdoctorRepository perforResAccountdoctorRepository;
......@@ -26,12 +27,14 @@ public class ComputeDirector : IAutoInjection
PerforCofdirectorRepository perforCofdirectorRepository,
PerforCofworkyearRepository perforCofworkyearRepository,
PerforResaccountRepository perforResaccountRepository,
PerforRescomputeRepository perforRescomputeRepository,
BudgetService budgetService)
{
this.baiscNormService = baiscNormService;
this.perforCofdirectorRepository = perforCofdirectorRepository;
this.perforCofworkyearRepository = perforCofworkyearRepository;
this.perforResaccountRepository = perforResaccountRepository;
this.perforRescomputeRepository = perforRescomputeRepository;
this.budgetService = budgetService;
}
......@@ -321,7 +324,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<PerS
unitType = unit.FirstOrDefault(t => t.UnitType.ToString() == empolyee.UnitType)?.NewUnitType;
}
var resAccount = dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == empolyee.UnitType && t.AccountingUnit == empolyee.AccountingUnit) ?? dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == unitType && t.AccountingUnit == empolyee.AccountingUnit);
var resAccount = dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == empolyee.UnitType && t.AccountingUnit == empolyee.AccountingUnit)
?? dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == unitType && t.AccountingUnit == empolyee.AccountingUnit);
if (resAccount == null && empolyees.Count() > 1)
{
// 如果没有找到科室,则找相同用户的其他核算单元类型
......@@ -475,6 +479,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, per_allot
}
//添加参数计算
compute.BaiscNormValue = baiscnorm * (item.FitPeopleRatio ?? 0);
//绩效合计
compute.PerforTotal = compute.BaiscNormValue * compute.PostCoefficient * compute.Attendance;
//应发绩效
compute.GiveFee = compute.BaiscNormValue * compute.PostCoefficient * compute.Attendance + compute.Punishment;
......
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