BUG修复

parent 9340e303
......@@ -438,6 +438,11 @@
管理绩效发放系数
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeEmployee.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResult.AccountType">
<summary>
科室类别(例如 医技科室 临床科室 其他科室)
......@@ -583,6 +588,11 @@
效率绩效人数
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResult.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="T:Performance.DtoModels.UnitType">
<summary> 核算单元类型 </summary>
</member>
......@@ -1017,6 +1027,11 @@
岗位系数
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataEmployee.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataEmployee.ScoreAverageRate">
<summary>
考核得分率
......@@ -2876,6 +2891,16 @@
效率绩效人数
</summary>
</member>
<member name="P:Performance.DtoModels.ResComputeResponse.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="P:Performance.DtoModels.ResComputeResponse.OtherPerformance">
<summary>
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.RoleResponse.RoleName">
<summary>
角色名称
......
......@@ -2242,6 +2242,11 @@
其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.im_employee.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="P:Performance.EntityModels.im_employee.Punishment">
<summary>
医院奖罚
......@@ -4457,6 +4462,11 @@
其他绩效(来自人员名单)
</summary>
</member>
<member name="P:Performance.EntityModels.res_compute.NightWorkPerfor">
<summary>
夜班费
</summary>
</member>
<member name="P:Performance.EntityModels.res_compute.GiveFee">
<summary>
应发绩效(需计算)
......@@ -4727,6 +4737,11 @@
量化指标绩效分值
</summary>
</member>
<member name="P:Performance.EntityModels.res_specialunit.QuantitativeFee">
<summary>
量化指标绩效金额
</summary>
</member>
<member name="P:Performance.EntityModels.res_specialunit.ScoringAverage">
<summary>
考核得分率
......
......@@ -135,5 +135,10 @@ public class ComputeEmployee
/// 管理绩效发放系数
/// </summary>
public Nullable<decimal> Management { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
}
}
......@@ -168,5 +168,10 @@ public class ComputeResult
/// 效率绩效人数
/// </summary>
public Nullable<decimal> PermanentStaff { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
}
}
......@@ -97,6 +97,11 @@ public class PerDataClinicEmployee : IPerData
public Nullable<decimal> OthePerfor { get; set; }
///// <summary>
///// 夜班费
///// </summary>
//public Nullable<decimal> NightWorkPerfor { get; set; }
///// <summary>
///// 医院奖罚
///// </summary>
//public Nullable<decimal> Punishment { get; set; }
......
......@@ -62,6 +62,11 @@ public class PerDataEmployee : IPerData
//public Nullable<DateTime> WorkTime { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 考核得分率
/// </summary>
public Nullable<decimal> ScoreAverageRate { get; set; }
......
......@@ -167,5 +167,15 @@ public class ResComputeResponse
/// 效率绩效人数
/// </summary>
public Nullable<decimal> PermanentStaff { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public Nullable<decimal> OtherPerformance { get; set; }
}
}
......@@ -115,6 +115,11 @@ public class im_employee
/// 其他绩效
/// </summary>
public Nullable<decimal> OtherPerfor { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 医院奖罚
......
......@@ -7,25 +7,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("res_compute")]
public class res_compute
public class res_compute
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
/// sheet页id
/// </summary>
......@@ -40,12 +40,12 @@ public class res_compute
/// 核算单元类型(医技科室、临床科室等)
/// </summary>
public string AccountType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 绩效基数核算参考对象
/// </summary>
......@@ -65,137 +65,142 @@ public class res_compute
/// 人员姓名
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 职称
/// </summary>
public string JobTitle { get; set; }
/// <summary>
/// 工号
/// </summary>
public string JobNumber { get; set; }
/// <summary>
/// 绩效合计(来自科室经济测算表)
/// </summary>
public Nullable<decimal> PerforTotal { get; set; }
/// <summary>
/// 核算单元医生数量(来自科室经济测算表)
/// </summary>
public Nullable<decimal> Number { get; set; }
/// <summary>
/// 人均绩效(来自科室经济测算表)
/// </summary>
public Nullable<decimal> Avg { get; set; }
/// <summary>
/// 效率绩效(需计算)
/// </summary>
public Nullable<decimal> Efficiency { get; set; }
/// <summary>
/// 规模绩效(需计算)
/// </summary>
public Nullable<decimal> Scale { get; set; }
/// <summary>
/// 岗位系数
/// </summary>
public Nullable<decimal> PostCoefficient { get; set; }
/// <summary>
/// 发放系数(来自人员名单)
/// </summary>
public Nullable<decimal> Grant { get; set; }
/// <summary>
/// 应发管理绩效(需计算,科主任护士长独有)
/// </summary>
public Nullable<decimal> ShouldGiveFee { get; set; }
/// <summary>
/// 绩效合计(需计算)
/// </summary>
public Nullable<decimal> PerforSumFee { get; set; }
/// <summary>
/// 考核对分率(来自人员名单)
/// </summary>
public Nullable<decimal> ScoreAverageRate { get; set; }
/// <summary>
/// 医院奖罚(来自人员名单)
/// </summary>
public Nullable<decimal> Punishment { get; set; }
/// <summary>
/// 其他绩效(来自人员名单)
/// </summary>
public Nullable<decimal> OtherPerfor { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 应发绩效(需计算)
/// </summary>
public Nullable<decimal> GiveFee { get; set; }
/// <summary>
/// 出勤率(来自人员名单)
/// </summary>
public Nullable<decimal> Attendance { get; set; }
/// <summary>
/// 参加工作时间(来自人员名单)
/// </summary>
public Nullable<DateTime> WorkTime { get; set; }
/// <summary>
/// 绩效基础金额(计算)
/// </summary>
public Nullable<decimal> BaiscNormValue { get; set; }
/// <summary>
/// 年资系数(来自人员名单)
/// </summary>
public Nullable<decimal> WorkYear { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> Adjust { get; set; }
/// <summary>
/// 工作量绩效
/// </summary>
public Nullable<decimal> Workload { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 变更日志
/// </summary>
public string ChangeLog { get; set; }
/// <summary>
///
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 科主任/护士长人数
/// </summary>
public Nullable<decimal> ManagerNumber { get; set; }
/// <summary>
/// 核算单元人员数量
/// </summary>
public Nullable<decimal> MedicalNumber { get; set; }
/// <summary>
/// 效率绩效人数
/// </summary>
......
......@@ -62,6 +62,11 @@ public class res_specialunit
public Nullable<decimal> QuantitativeIndicatorsValue { get; set; }
/// <summary>
/// 量化指标绩效金额
/// </summary>
public Nullable<decimal> QuantitativeFee { get; set; }
/// <summary>
/// 考核得分率
/// </summary>
public Nullable<decimal> ScoringAverage { get; set; }
......
......@@ -170,6 +170,13 @@ public class ResultComputeService : IAutoInjection
var drugExtra = drugExtras?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
var materialsExtra = materialsExtras?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
headcount = group.Number;
if (!headcount.HasValue || headcount == 0)
headcount = 1;
//var xxx = item.Quantity * item.QuantitativeIndicatorsValue * headcount;
var res = new res_specialunit
{
AllotID = allot.ID,
......@@ -179,6 +186,7 @@ public class ResultComputeService : IAutoInjection
QuantitativeIndicators = item.QuantitativeIndicators,
Quantity = item.Quantity,
QuantitativeIndicatorsValue = item.QuantitativeIndicatorsValue,
QuantitativeFee = item.Quantity * item.QuantitativeIndicatorsValue * headcount,
ScoringAverage = dept?.ScoringAverage,
//OtherPerfor = dept?.OtherPerfor,
Punishment = (extra ?? 0),
......
......@@ -107,6 +107,7 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
};
var isShowManage = IsShowManage(allotId);
var apramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId);
if (pairs.Keys.Any(t => t == type))
{
......@@ -167,11 +168,12 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && pairs[type].Contains(t.UnitType));
if (computes == null || !computes.Any()) return new List<ResComputeResponse>();
data = Mapper.Map<List<ResComputeResponse>>(computes);
data.ForEach(t =>
{
t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd");
//t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd");
if (isShowManage == 2)
{
t.PerforSumFee = t.ShouldGiveFee;
......@@ -182,6 +184,9 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
t.RealGiveFee = t.GiveFee * (t.Adjust ?? 1m);
t.BaiscNormValue = t.RealGiveFee;
}
var aprAmount = apramounts?.Where(w => !(string.IsNullOrEmpty(w.DoctorName) && string.IsNullOrEmpty(w.PersonnelNumber)) && w.DoctorName?.Trim() == t.EmployeeName?.Trim() && w.PersonnelNumber?.Trim() == t.JobNumber?.Trim());
t.OtherPerformance = aprAmount?.Sum(w => w.Amount);
});
return data.Distinct().OrderByDescending(t => t.AccountingUnit).ToList();
}
......@@ -193,7 +198,12 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
data = Mapper.Map<List<ResComputeResponse>>(compute);
data = data.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList();
data.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd"));
data.ForEach(t =>
{
//t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd");
var aprAmount = apramounts?.Where(w => !(string.IsNullOrEmpty(w.DoctorName) && string.IsNullOrEmpty(w.PersonnelNumber)) && w.DoctorName?.Trim() == t.EmployeeName?.Trim() && w.PersonnelNumber?.Trim() == t.JobNumber?.Trim());
t.OtherPerformance = aprAmount?.Sum(w => w.Amount);
});
return data.Distinct().OrderByDescending(t => t.AccountingUnit).ToList();
}
}
......@@ -460,24 +470,32 @@ public List<ComputeResponse> AllCompute(int allotId, int isShowManage)
private List<ComputeResponse> GetAllotPerformance(int allotId, int isShowManage)
{
var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
var types = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
var types1 = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
var types2 = new List<string> { AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
// 一次绩效 获取特定人员绩效结果
var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit);
var apramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId);
return allot?.Select(t =>
{
var comp = new ComputeResponse("一次绩效", t.AccountingUnit, t.EmployeeName, t.JobNumber, t.JobTitle);
if (types.Contains(t.AccountType))
if (types1.Contains(t.AccountType))
comp.PerforManagementFee = (t.ShouldGiveFee ?? 0) + (t.OtherPerfor ?? 0) + (t.Punishment ?? 0);
else
comp.PerforManagementFee = t.RealGiveFee;
// 行政中层 行政高层 补充 夜班费
if (types2.Contains(t.AccountType))
{
comp.NightWorkPerfor = t.NightWorkPerfor;
}
// 仅显示管理绩效
if (isShowManage == 1)
comp.PerforSumFee = 0;
else
comp.PerforSumFee = t.Avg;
return comp;
}).ToList();
}
......@@ -521,24 +539,15 @@ private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> co
if (list == null || !list.Any())
return computes;
var source = new string[] { "一次绩效", "二次绩效" };
foreach (var item in list.Where(t => t.Amount.HasValue))
foreach (var emp in computes)
{
foreach (var s in source)
{
// 全空跳过
if (string.IsNullOrEmpty(item.PersonnelNumber) && string.IsNullOrEmpty(item.DoctorName))
continue;
// 优先工号和姓名全部匹配 其次是工号 最后是姓名
var emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber && t.EmployeeName == item.DoctorName);
if (emp == null)
emp = computes.FirstOrDefault(t => !string.IsNullOrEmpty(item.PersonnelNumber) && t.Source == s && t.JobNumber == item.PersonnelNumber);
if (emp == null)
emp = computes.FirstOrDefault(t => !string.IsNullOrEmpty(item.DoctorName) && t.Source == s && t.EmployeeName == item.DoctorName);
if (emp != null)
emp.OthePerfor += item.Amount;
}
var apramount = list.Where(t => emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim() && emp.EmployeeName?.Trim() == t.DoctorName?.Trim());
if (apramount == null)
apramount = list.Where(t => !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
if (apramount == null)
apramount = list.Where(t => !string.IsNullOrEmpty(t.DoctorName) && emp.EmployeeName?.Trim() == t.DoctorName?.Trim());
emp.OthePerfor = apramount?.Sum(w => w.Amount);
}
return computes;
}
......@@ -733,17 +742,17 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
else if (sheet.SheetType == (int)SheetType.AccountExtra)
{
sheettype = 5;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = doctor?.Extra ?? 0;
}
else if (sheet.SheetType == (int)SheetType.AccountDrugAssess)
{
sheettype = 6;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = doctor?.MedicineExtra ?? 0;
}
else if (sheet.SheetType == (int)SheetType.AccountMaterialsAssess)
{
sheettype = 7;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = doctor?.MaterialsExtra ?? 0;
}
var item = new DetailDtos
......@@ -916,6 +925,8 @@ public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
PerforTotal = special.FirstOrDefault()?.ResultsTotalFee,
Income = special.FirstOrDefault()?.ResultsTotalFee,
Extra = special.FirstOrDefault()?.Punishment ?? 0,
MedicineExtra = special.FirstOrDefault()?.MedicineExtra ?? 0,
MaterialsExtra = special.FirstOrDefault()?.MaterialsExtra ?? 0,
},
Detail = new List<DetailDtos>(),
};
......@@ -934,12 +945,11 @@ public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
ItemName = item.QuantitativeIndicators,
CellValue = item.Quantity,
Factor = item.QuantitativeIndicatorsValue,
ItemValue = Math.Round(item.Quantity * item.QuantitativeIndicatorsValue ?? 0, 2)
ItemValue = Math.Round(item.QuantitativeFee ?? 0, 2)
});
}
deptDetails.Detail.Add(detail);
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == second.AllotId);
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == second.AllotId);
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == second.AllotId && t.AccountingUnit == second.Department);
......@@ -966,17 +976,17 @@ public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
if (sheet.SheetType == (int)SheetType.AccountExtra)
{
sheettype = 5;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = special.FirstOrDefault()?.Punishment ?? 0;
}
else if (sheet.SheetType == (int)SheetType.AccountDrugAssess)
{
sheettype = 6;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = special.FirstOrDefault()?.MedicineExtra ?? 0;
}
else if (sheet.SheetType == (int)SheetType.AccountMaterialsAssess)
{
sheettype = 7;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
amount = special.FirstOrDefault()?.MaterialsExtra ?? 0;
}
var item = new DetailDtos
......
......@@ -488,6 +488,10 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, per_allot
baiscnorm = item.FitPeopleValue ?? baiscNormService.GetBaiscNorm(baiscnormList, perforType);
}
}
// 行政高层 行政中层 夜班费
if (AccountUnitType.行政高层.ToString() == involve || AccountUnitType.行政中层.ToString() == involve)
compute.NightWorkPerfor = item.NightWorkPerfor;
//添加参数计算
compute.BaiscNormValue = baiscnorm * (item.FitPeopleRatio ?? 0);
//绩效合计
......
......@@ -19,6 +19,7 @@ public class ExcelReadConfig
new ColumnInfo(nameof(PerDataEmployee.FitPeopleRatio), "绩效基数核算系数", true),
new ColumnInfo(nameof(PerDataEmployee.AccountType), "人员分类"),
new ColumnInfo(nameof(PerDataEmployee.PostCoefficient), "岗位系数", true),
new ColumnInfo(nameof(PerDataEmployee.NightWorkPerfor), "夜班费"),
new ColumnInfo(nameof(PerDataEmployee.ScoreAverageRate), "考核得分率", true),
new ColumnInfo(nameof(PerDataEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataEmployee.Adjust), "调节系数", true),
......@@ -43,6 +44,7 @@ public class ExcelReadConfig
new ColumnInfo(nameof(PerDataClinicEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataClinicEmployee.OtheManagementPerfor), "其他管理绩效"),
new ColumnInfo(nameof(PerDataClinicEmployee.OthePerfor), "其他绩效"),
//new ColumnInfo(nameof(PerDataClinicEmployee.NightWorkPerfor), "夜班费"),
new ColumnInfo(nameof(PerDataClinicEmployee.Adjust), "调节系数", true),
};
......
......@@ -103,7 +103,7 @@ public List<SecondListResponse> GetSecondList(int userId)
throw new NotImplementedException("人员未选择医院");
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospital.HospitalID && new List<int> { 6, 8 }.Contains(t.States));
if (allotList == null || allotList.Count == 0)
throw new NotImplementedException("该医院未生成绩效");
return new List<SecondListResponse>();
var allotListId = allotList.Select(t => t.ID).ToList();
Expression<Func<ag_secondallot, bool>> exp = t => allotListId.Contains(t.AllotId.Value) && t.Department == user.Department;
......@@ -323,7 +323,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
var result = new SecondResponse();
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue);
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue && !string.IsNullOrEmpty(t.ItemName));
//归档 或 等待审核、审核通过时,headItems不会随选择模板改动,带出已填写数据中的headItems
if (request.IsArchive == 1 || new List<int> { 2, 3 }.Contains(second.Status ?? 1))
{
......@@ -331,6 +331,8 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
throw new PerformanceException("提交时未添加数据。");
result = SubmittedData(fixatList, headItems);
// 补充 医院其他绩效
SupplementOtherPerfor(result, second.AllotId ?? -99);
}
else
{
......@@ -340,8 +342,13 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
if (fixatList != null && fixatList.Any())
{
result.BodyItems = GetBodyItems(fixatList, headItems);
// 补充 医院其他绩效
SupplementOtherPerfor(result, second.AllotId ?? -99);
if (fixatList.Where(t => t.RowNumber != -1) == null || !fixatList.Where(t => t.RowNumber != -1).Any())
result.BodyItems.AddRange(GetEmployees(second.AllotId.Value, userId, headItems)); //更换模板时,会自动保存顶部数据
{
//更换模板时,会自动保存顶部数据
result.BodyItems.AddRange(GetEmployees(second.AllotId.Value, userId, headItems));
}
}
else
{
......@@ -367,6 +374,31 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
BodyItems = result.BodyItems.OrderBy(t => t.RowNumber).ThenBy(t => t.Type).ThenBy(t => t.Sort).ToList(),
};
}
/// <summary>
/// 补充 医院其他绩效
/// </summary>
/// <param name="result"></param>
private void SupplementOtherPerfor(SecondResponse result, int allotId)
{
if (result?.BodyItems != null && result.BodyItems.Any())
{
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId);
foreach (var rownum in result.BodyItems.Where(w => w.RowNumber > -1).Select(w => w.RowNumber).Distinct())
{
var rowData = result.BodyItems.Where(w => w.RowNumber == rownum);
var personnelNumber = rowData.FirstOrDefault(w => w.FiledId == "PersonnelNumber")?.Value;
var fullName = rowData.FirstOrDefault(w => w.FiledId == "FullName")?.Value;
var amount = perapramounts
?.Where(w => w.DoctorName?.Trim() == fullName?.Trim() && w.PersonnelNumber?.Trim() == personnelNumber?.Trim())
?.Sum(w => w.Amount);
var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance");
if (otherPerfor != null)
otherPerfor.Value = amount?.ToString();
}
}
}
private List<BodyItem> GetEmployees(int allotId, int userId, List<HeadItem> heads, string empName = "", string jobNumber = "")
{
......@@ -651,13 +683,11 @@ public bool SaveValue(List<ag_fixatitem> request)
List<ag_fixatitem> update = new List<ag_fixatitem>(), insert = new List<ag_fixatitem>();
if (fixatitems != null && fixatitems.Any())
{
foreach (var item in request)
foreach (var item in request.Where(w => !string.IsNullOrEmpty(w.ItemName)))
{
if (fixatitems.Any(t => t.RowNumber == item.RowNumber && t.ItemName == item.ItemName))
var cellItem = fixatitems.FirstOrDefault(t => t.RowNumber == item.RowNumber && t.ItemName == item.ItemName);
if (cellItem != null)
{
var cellItem = fixatitems.FirstOrDefault(t => t.RowNumber == item.RowNumber && t.ItemName == item.ItemName);
if (cellItem == null)
continue;
cellItem.ItemValue = item.ItemValue;
cellItem.Sort = item.Sort;
cellItem.SourceType = item.SourceType;
......@@ -1347,35 +1377,46 @@ public List<BodyItem> GetBodyItems(List<HeadItem> headItems, int source, List<co
#region 二次绩效其他来源
public List<ag_othersource> OtherList(int secondId, int userId)
{
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == secondId);
if (second == null) throw new PerformanceException("二次绩效信息无效!");
var employees = personService.GetPersons(second.AllotId.Value, userId);
if (employees == null || !employees.Any()) return new List<ag_othersource>();
List<ag_othersource> result = null;
var otherSecondList = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (otherSecondList != null && otherSecondList.Any())
{
return otherSecondList.OrderBy(t => t.Id).ToList();
result = otherSecondList.OrderBy(t => t.Id).ToList();
}
else
{
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == secondId);
if (second == null) throw new PerformanceException("二次绩效信息无效!");
var employees = personService.GetPersons(second.AllotId.Value, userId);
if (employees == null || !employees.Any()) return new List<ag_othersource>();
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId);
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts
?.Where(w => w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.Amount);
return employees.Select(t => new ag_othersource
result = employees.Select(t => new ag_othersource
{
SecondId = secondId,
WorkNumber = t.PersonnelNumber,
Name = t.DoctorName,
Department = t.Department,
WorkPost = t.JobTitle,
ReservedRatio = t.ReservedRatio,
OtherPerformance = getAprAmount(t)
}).ToList();
}
// 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId);
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts
?.Where(w => w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.Amount);
foreach (var item in result)
{
var empl = employees.FirstOrDefault(w => w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim());
if (empl != null)
{
item.ReservedRatio = empl.ReservedRatio;
item.OtherPerformance = getAprAmount(empl);
}
}
return result;
}
public Dictionary<string, string> OtherListHeader(int secondId, decimal? amount)
......
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