新增返回不公示绩效

parent df5a481b
......@@ -305,6 +305,7 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request)
AdjustLaterOtherFee = t.Sum(s => s.AdjustLaterOtherFee),
ShouldGiveFee = t.Sum(s => s.ShouldGiveFee),
OthePerfor = t.Sum(s => s.OthePerfor),
HideOtherPerfor = t.Sum(s => s.HideOtherPerfor),
NightWorkPerfor = t.Sum(s => s.NightWorkPerfor),
RealGiveFee = t.Sum(s => s.RealGiveFee),
ReservedRatio = t.Sum(s => s.ReservedRatio),
......
......@@ -2900,6 +2900,11 @@
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.HideOtherPerfor">
<summary>
不公示其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.NightWorkPerfor">
<summary>
夜班费
......@@ -3186,7 +3191,12 @@
</member>
<member name="P:Performance.DtoModels.DeptResponse.AprPerforAmount">
<summary>
其他绩效
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.DeptResponse.HideAprOtherPerforAmount">
<summary>
不公示其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.DirectorResponse.TypeName">
......
......@@ -7444,6 +7444,11 @@
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.PersonnelNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.Amount">
<summary>
医院其他绩效
......
......@@ -65,6 +65,11 @@ public ComputeResponse(string source, string accountingUnit, string employeeName
public Nullable<decimal> OthePerfor { get; set; }
/// <summary>
/// 不公示其他绩效
/// </summary>
public Nullable<decimal> HideOtherPerfor { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
......
......@@ -174,8 +174,12 @@ public class DeptResponse
public Nullable<decimal> AssessLaterManagementFee { get; set; }
/// <summary>
/// 其他绩效
/// 医院其他绩效
/// </summary>
public Nullable<decimal> AprPerforAmount { get; set; }
/// <summary>
/// 不公示其他绩效
/// </summary>
public Nullable<decimal> HideAprOtherPerforAmount { get; set; }
}
}
......@@ -13,6 +13,17 @@ public class view_per_apr_amount : per_apr_amount
}
public class view_per_total_amount
{
public view_per_total_amount() { }
public view_per_total_amount(string unitType, string accountingUnit, string personnelNumber, decimal amount, bool use = false)
{
UnitType = unitType;
AccountingUnit = accountingUnit;
PersonnelNumber = personnelNumber;
Amount = amount;
Use = use;
}
/// <summary>
/// 核算单元组别
/// </summary>
......@@ -21,6 +32,9 @@ public class view_per_total_amount
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 医院其他绩效
......
......@@ -493,6 +493,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
}
});
#region 临床科室
// 临床科室
var accounts = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && clinicalTypesInt.Contains(t.UnitType.Value)) ?? new List<res_account>();
var clinicalResult = accounts.Select(t => new DeptResponse
......@@ -517,6 +518,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
});
result.AddRange(clinicalResult);
#endregion
#region 特殊核算组科室
// 特殊核算组科室
var specialunits = _perforResspecialunitRepository.GetEntities(t => t.AllotID == allotId) ?? new List<res_specialunit>();
......@@ -541,7 +545,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
RealGiveFee = t.Max(w => w.RealGiveFee),
}).Distinct();
result.AddRange(specialResult);
#endregion
#region 需要二次分配的行政科室
// 需要二次分配的行政科室
var needSecond = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是") ?? new List<res_account>();
var needSecondResult = needSecond.Select(t => new DeptResponse
......@@ -566,7 +572,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
});
result.AddRange(needSecondResult);
#endregion
#region 不需要二次分配的行政科室
// 不需要二次分配的行政科室
var officeTypes = new List<string> { "行政工勤", "行政高层", "行政中层" };
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && officeTypes.Contains(t.AccountType) && t.NeedSecondAllot == "否") ?? new List<res_compute>();
......@@ -591,32 +599,43 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
RealGiveFee = t.Sum(w => w.RealGiveFee),
}); ;
result.AddRange(officeResult);
#endregion
#region 医院其他绩效 && 不公示其他绩效
// 获取各科室 医院其他绩效
var fullAmounts = GetTotalAmount(allotId); ;
var otherPerformances = fullAmounts
var otherPerformances = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount
{
AccountingUnit = t.Key.AccountingUnit,
UnitType = t.Key.UnitType == "行政后勤" ? "行政工勤" : t.Key.UnitType,
Amount = t.Sum(s => s.Amount) ?? 0,
Use = false
}).ToList();
.Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0));
var hideOtherPerformances = _hideRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0));
// 医院其他绩效、科主任护士长管理绩效、合并实发
// 医院其他绩效 / 不公示其他绩效、科主任护士长管理绩效、合并实发
foreach (var item in result)
{
item.AprPerforAmount = 0;
item.HideAprOtherPerforAmount = 0;
// 医院其他绩效
var other = otherPerformances?.FirstOrDefault(w => w.AccountingUnit == item.AccountingUnit && w.UnitType == item.UnitName);
if (other != null)
{
other.Use = true;
item.AprPerforAmount = other?.Amount ?? 0;
}
// 不公示其他绩效
var hideOther = hideOtherPerformances?.FirstOrDefault(w => w.AccountingUnit == item.AccountingUnit && w.UnitType == item.UnitName);
if (hideOther != null)
{
hideOther.Use = true;
item.HideAprOtherPerforAmount = hideOther?.Amount ?? 0;
}
item.AssessLaterManagementFee = item.AssessLaterManagementFee ?? 0;
item.RealGiveFee = (item.RealGiveFee ?? 0) + item.AssessLaterManagementFee + item.AprPerforAmount;
item.RealGiveFee = (item.RealGiveFee ?? 0) + item.AssessLaterManagementFee + item.AprPerforAmount + item.HideAprOtherPerforAmount;
}
// 医院其他绩效匹配不上补充
var otherResult = otherPerformances
?.Where(w => w.Use == false)
......@@ -638,10 +657,38 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
AdjustFactor = 1,
AdjustLaterOtherFee = 0,
AprPerforAmount = t.Amount,
HideAprOtherPerforAmount = 0,
RealGiveFee = t.Amount,
}); ;
result.AddRange(otherResult);
// 不公示其他绩效匹配不上补充
var hideOtherResult = hideOtherPerformances
?.Where(w => w.Use == false)
.Select(t => new DeptResponse
{
UnitName = "不公示其他绩效",
AccountingUnit = t.AccountingUnit,
Department = t.AccountingUnit,
PerforFee = 0,
WorkloadFee = 0,
AssessBeforeOtherFee = 0,
PerforTotal = 0,
ScoringAverage = 1,
Extra = 0,
MedicineExtra = 0,
MaterialsExtra = 0,
AssessLaterOtherFee = 0,
AssessLaterPerforTotal = 0,
AdjustFactor = 1,
AdjustLaterOtherFee = 0,
AprPerforAmount = 0,
HideAprOtherPerforAmount = t.Amount,
RealGiveFee = t.Amount,
}); ;
result.AddRange(hideOtherResult);
#endregion
var enumItems = EnumHelper.GetItems<AccountUnitType>();
result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value)/*.ThenBy(t => t.AccountingUnit)*/.ToList();
return result;
......@@ -751,8 +798,8 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
{
// 人员字典
var employees = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
// 获取医院其他绩效汇总结果
var fullAmounts = GetTotalAmount(allotId);
//// 获取医院其他绩效汇总结果
//var fullAmounts = GetTotalAmount(allotId);
// 获取一次绩效结果
var one = GetAllotPerformance(allotId, hospitalId, isShowManage);
// 获取二次绩效结果
......@@ -764,23 +811,24 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
if (two != null)
response.AddRange(two);
// 其他绩效汇总
var totalAmounts = fullAmounts
// 医院其他绩效汇总
var totalAmounts = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount
{
AccountingUnit = w.Key.AccountingUnit,
UnitType = w.Key.UnitType,
PersonnelNumber = w.Key.PersonnelNumber,
Amount = w.Sum(t => t.Amount) ?? 0,
Use = false,
})?.ToList();
.Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0))
?.ToList();
// 医院其他绩效汇总
var totalAmounts_hide = _hideRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0))
?.ToList();
// 补充医院其他绩效
AddAprAmount(response, totalAmounts);
AddAprAmount(response, totalAmounts, totalAmounts_hide);
// 补充一次二次分配不存在,但医院其他绩效的人员信息
var notMatchs = totalAmounts
var notMatchs1 = totalAmounts
?.Where(w => w.Use == false)
.Select(other =>
{
......@@ -791,8 +839,23 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
bc.RealGiveFee = other.Amount;
return bc;
});
if (notMatchs != null)
response.AddRange(notMatchs);
if (notMatchs1 != null)
response.AddRange(notMatchs1);
// 补充一次二次分配不存在,但不公示其他绩效的人员信息
var notMatchs2 = totalAmounts_hide
?.Where(w => w.Use == false)
.Select(other =>
{
per_employee employee = employees?.FirstOrDefault(t => t.UnitType == other.UnitType && t.AccountingUnit == other.AccountingUnit && t.PersonnelNumber == other.PersonnelNumber);
var bc = new ComputeResponse("不公示其他绩效", other.AccountingUnit, employee?.DoctorName ?? "", other.PersonnelNumber, employee?.JobTitle ?? "");
bc.UnitType = other.UnitType;
bc.HideOtherPerfor = other.Amount;
bc.RealGiveFee = other.Amount;
return bc;
});
if (notMatchs2 != null)
response.AddRange(notMatchs2);
// 预留比例
if (response != null)
......@@ -817,9 +880,10 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
}
item.OthePerfor = Math.Round((item.OthePerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.HideOtherPerfor = Math.Round((item.HideOtherPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.NightWorkPerfor = Math.Round((item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round(real + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round(real + (item.OthePerfor ?? 0) + (item.HideOtherPerfor ?? 0) + (item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ReservedRatio = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
......@@ -835,30 +899,30 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
}
}
}
response.RemoveAll(w => w.PerforSumFee == 0 && w.PerforManagementFee == 0 && w.ShouldGiveFee == 0 && w.OthePerfor == 0 && w.RealGiveFee == 0);
response.RemoveAll(w => w.PerforSumFee == 0 && w.PerforManagementFee == 0 && w.ShouldGiveFee == 0 && w.OthePerfor == 0 && w.HideOtherPerfor == 0 && w.RealGiveFee == 0);
return response?.OrderByDescending(t => t.UnitType).ThenBy(t => t.AccountingUnit).ToList();
}
/// <summary>
/// 合并医院其他绩效、不公示其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
private List<view_per_apr_amount> GetTotalAmount(int allotId)
{
var fullAmounts1 = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
///// <summary>
///// 合并医院其他绩效、不公示其他绩效
///// </summary>
///// <param name="allotId"></param>
///// <returns></returns>
//private List<view_per_apr_amount> GetTotalAmount(int allotId)
//{
// var fullAmounts1 = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
var fullAmounts2 = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
// var fullAmounts2 = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
var fullAmounts = new List<view_per_apr_amount>();
// var fullAmounts = new List<view_per_apr_amount>();
if (fullAmounts1 != null && fullAmounts1.Any())
fullAmounts.AddRange(fullAmounts1);
if (fullAmounts2 != null && fullAmounts2.Any())
fullAmounts.AddRange(fullAmounts2);
// if (fullAmounts1 != null && fullAmounts1.Any())
// fullAmounts.AddRange(fullAmounts1);
// if (fullAmounts2 != null && fullAmounts2.Any())
// fullAmounts.AddRange(fullAmounts2);
return fullAmounts;
}
// return fullAmounts;
//}
/// <summary>
/// 获取一次次绩效结果
......@@ -962,18 +1026,26 @@ private List<ComputeResponse> GetSecondPerformance(int allotId)
/// <summary>
/// 添加额外绩效金额(基础绩效、其他绩效等)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
public void AddAprAmount(List<ComputeResponse> computes, List<view_per_total_amount> totalAmounts)
/// <param name="totalAmounts">医院其他绩效</param>
/// <param name="totalAmounts_hide">不公示其他绩效</param>
public void AddAprAmount(List<ComputeResponse> computes, List<view_per_total_amount> totalAmounts, List<view_per_total_amount> totalAmounts_hide)
{
foreach (var item in computes?.Where(w => !string.IsNullOrEmpty(w.JobNumber)).GroupBy(w => new { w.UnitType, w.AccountingUnit, w.JobNumber }))
{
var apramount = totalAmounts?.FirstOrDefault(t => t.UnitType == item.Key.UnitType && t.AccountingUnit == item.Key.AccountingUnit && item.Key.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
var apramount1 = totalAmounts?.FirstOrDefault(t => t.UnitType == item.Key.UnitType && t.AccountingUnit == item.Key.AccountingUnit && item.Key.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// 如果医院其他绩效 已经被使用,则不再多次带出,防止单个人多次出现造成金额叠加
if (apramount1 != null)
{
item.First().OthePerfor = apramount1.Amount;
apramount1.Use = true;
}
var apramount2 = totalAmounts_hide?.FirstOrDefault(t => t.UnitType == item.Key.UnitType && t.AccountingUnit == item.Key.AccountingUnit && item.Key.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// 如果医院其他绩效 已经被使用,则不再多次带出,防止单个人多次出现造成金额叠加
if (apramount != null)
if (apramount2 != null)
{
item.First().OthePerfor = apramount.Amount;
apramount.Use = true;
item.First().HideOtherPerfor = apramount2.Amount;
apramount2.Use = true;
}
}
}
......
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