返回字典修改

parent 65b03bc5
......@@ -641,7 +641,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
// 重算顶部医院其他绩效
_redistributionService.OverviewCalculate_OtherPerformance(request.Head, cleanDatas);
var dic = _redistributionService.GetTableHeaderDictionary(loads);
var dic = _redistributionService.GetTableHeaderDictionary(second, loads);
return new ApiResponse(ResponseType.OK, new { Head = request.Head, Body = cleanDatas, Dic = dic });
}
......
......@@ -6,17 +6,19 @@ public class SecondColumnDictionary
public string Key { get; set; }
public bool IsTrue { get; set; }
public int Sort { get; set; }
public string Site { get; set; }
public SecondColumnDictionary()
{
}
public SecondColumnDictionary(string label, string key, bool isTrue, int sort)
public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table")
{
Label = label;
Key = key;
IsTrue = isTrue;
Sort = sort;
Site = site;
}
}
}
......@@ -122,96 +122,37 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, OverrideMode
}
}
#region 结构案例
//var colHeaders = new List<string> { "工号", "姓名", "核算单元", "主管", "人员系数", "出勤", "职称", "职称系数", "A班", "P班", "N班", "考核得分", "A班", "P班", "N班", "考核得分", "单项奖励A", "单项奖励B", "夜班绩效", };
//var columns = new List<HandsonColumn>
//{
// new HandsonColumn("WorkNumber"),
// new HandsonColumn("Name"),
// new HandsonColumn("Department"),
// new HandsonColumn("Post"),
// new HandsonColumn("StaffCoefficient"),
// new HandsonColumn("ActualAttendance"),
// new HandsonColumn("JobTitle"),
// new HandsonColumn("TitleCoefficient"),
// new HandsonColumn("Workload_Default_84"),
// new HandsonColumn("Workload_Default_85"),
// new HandsonColumn("Workload_Default_86"),
// new HandsonColumn("AssessmentScore_Default"),
// new HandsonColumn("Workload_101_84"),
// new HandsonColumn("Workload_101_85"),
// new HandsonColumn("Workload_101_86"),
// new HandsonColumn("AssessmentScore_101"),
// new HandsonColumn("SingleAwards_125"),
// new HandsonColumn("SingleAwards_126"),
// new HandsonColumn("SingleAwards_127"),
// new HandsonColumn("NightWorkPerformance"),
//};
//var data = new List<Dictionary<string, string>>
//{
// new Dictionary<string, string>
// {
// { "WorkNumber", "0575" },
// { "Name", "甘永玫" },
// { "Department", "肿瘤科三区" },
// { "Post", "是" },
// { "StaffCoefficient", "1.0000" },
// { "ActualAttendance", "30.0000" },
// { "JobTitle", "主管护师" },
// { "TitleCoefficient", "1.3000" },
// { "Workload_Default_84", "1" },
// { "Workload_Default_85", "2" },
// { "Workload_Default_86", "3" },
// { "AssessmentScore_Default", "100" },
// { "Workload_101_84", "1" },
// { "Workload_101_85", "2" },
// { "Workload_101_86", "3" },
// { "AssessmentScore_101", "99" },
// { "SingleAwards_125", "100" },
// { "SingleAwards_126", "200" },
// { "SingleAwards_127", "300" },
// },
//};
//handson.ColHeaders = colHeaders;
//handson.Columns = columns;
//handson.Data = data;
#endregion
var head = LoadHead(computeMode, allot, second);
var dic = GetTableHeaderDictionary(loads);
var dic = GetTableHeaderDictionary(second, loads);
return new SecondDetailDto { Head = head, Body = handson, Dic = dic };
}
public List<SecondColumnDictionary> GetTableHeaderDictionary(List<TitleValue<string, decimal?>> loads)
public List<SecondColumnDictionary> GetTableHeaderDictionary(ag_secondallot second, List<TitleValue<string, decimal?>> loads)
{
var maps = new List<SecondColumnDictionary>()
{
new SecondColumnDictionary("人员工号","worknumber",true,100 ),
new SecondColumnDictionary("姓名","name",true,100 ),
new SecondColumnDictionary("核算单元","department",true,100 ),
new SecondColumnDictionary("主管","post",true,100 ),
new SecondColumnDictionary("人员工号",nameof(ag_bodysource.WorkNumber),true,100 ),
new SecondColumnDictionary("姓名",nameof(ag_bodysource.Name),true,100 ),
new SecondColumnDictionary("科室",nameof(ag_bodysource.Department),true,100 ),
new SecondColumnDictionary("岗位",nameof(ag_bodysource.Post),true,100 ),
new SecondColumnDictionary("人员系数","staffcoefficient", true, 200 ),
new SecondColumnDictionary("出勤","actualattendance",true,201 ),
new SecondColumnDictionary("职称","jobtitle",true,202 ),
new SecondColumnDictionary( "职称系数","titlecoefficient", true, 203 ),
new SecondColumnDictionary("职称绩效","titleperformance", true, 299 ),
new SecondColumnDictionary("人员系数",nameof(ag_bodysource.StaffCoefficient),true,200 ),
new SecondColumnDictionary("出勤",nameof(ag_bodysource.ActualAttendance),true,201 ),
new SecondColumnDictionary("职称",nameof(ag_bodysource.JobTitle),true,202 ),
new SecondColumnDictionary("职称系数",nameof(ag_bodysource.TitleCoefficient),true,203 ),
new SecondColumnDictionary("职称绩效",nameof(ag_bodysource.TitlePerformance),true,299 ),
new SecondColumnDictionary("工作量绩效工资","workperformance", true, 399 ),
new SecondColumnDictionary( "单项奖励","deptreward", true, 499),
new SecondColumnDictionary("工作量绩效工资",nameof(ag_bodysource.WorkPerformance),true,399 ),
new SecondColumnDictionary("单项奖励小计",nameof(ag_bodysource.DeptReward),true,499 ),
new SecondColumnDictionary("可分配绩效","distperformance", true, 500 ),
new SecondColumnDictionary("医院其他绩效","otherperformance", true, 501 ),
new SecondColumnDictionary( "夜班工作量绩效","nightworkperformance", true, 502 ),
new SecondColumnDictionary("可分配绩效",nameof(ag_bodysource.DistPerformance),true,500 ),
new SecondColumnDictionary("医院其他绩效",nameof(ag_bodysource.OtherPerformance),true,501 ),
new SecondColumnDictionary("夜班工作量绩效",nameof(ag_bodysource.NightWorkPerformance),true,502 ),
new SecondColumnDictionary("预留比例","reservedratio", true, 601 ),
new SecondColumnDictionary("预留金额","reservedamount", true, 602 ),
new SecondColumnDictionary("预留比例",nameof(ag_bodysource.ReservedRatio),true,601 ),
new SecondColumnDictionary("预留金额",nameof(ag_bodysource.ReservedAmount),true,602 ),
new SecondColumnDictionary("实发绩效工资金额","realamount", true, 700 ),
new SecondColumnDictionary("实发绩效工资金额",nameof(ag_bodysource.RealAmount),true,700 ),
};
// 工作量
......@@ -227,6 +168,17 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(List<TitleValue<str
maps.Add(new SecondColumnDictionary(item.Value, item.Title, false, ++sort));
}
// 多工作量加载
var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == second.Id);
if (headDynamic != null && headDynamic.Any())
{
foreach (var item in headDynamic.Where(w => w.FieldId.StartsWithIgnoreCase("Workload_Ratio_")).OrderBy(t => t.Id))
{
maps.Add(new SecondColumnDictionary(item.FieldName, item.FieldId, true, 1, "Top"));
}
}
return maps.OrderBy(w => w.Sort).ToList();
}
......@@ -371,26 +323,6 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second
return LoadEmployeeByDictionary(second, employees, numbers);
}
//var data = new List<Dictionary<string, object>>();
//foreach (var item in loadDatas)
//{
// data.Add(new Dictionary<string, object>
// {
// { nameof(ag_bodysource.SecondId), item.SecondId },
// { nameof(ag_bodysource.Department), item.Department },
// { nameof(ag_bodysource.WorkNumber), item.WorkNumber },
// { nameof(ag_bodysource.Name), item.Name },
// { nameof(ag_bodysource.JobTitle), item.JobTitle },
// { nameof(ag_bodysource.ReservedRatio), item.ReservedRatio },
// { nameof(ag_bodysource.Post), item.Post },
// // 设置默认值
// { nameof(ag_bodysource.StaffCoefficient), item.StaffCoefficient ?? 1 },
// { nameof(ag_bodysource.ActualAttendance), item.ActualAttendance ?? DateTime.DaysInMonth(allot.Year, allot.Month) },
// { nameof(ag_bodysource.TitleCoefficient), item.TitleCoefficient ?? 1 },
// });
//}
//return data;
}
List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_employee> employees, List<string> numbers)
......@@ -418,92 +350,6 @@ List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_emp
private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondallot second)
{
//List<ag_bodysource> bodysources = new List<ag_bodysource>();
//// 上次二次分配分三种情况,1.其他来源 2.单工作量 3.多工作量
//var prevSecondAllot = _secondAllotDetails.GetPreviousSecondAllot(allot.HospitalId, second);
//var status = new int[] { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit };
//if (prevSecondAllot != null && status.Contains(prevSecondAllot.Status ?? (int)SecondAllotStatus.Uncommitted))
//{
// if (prevSecondAllot.Status == 6)
// {
// var prevDatas = _agothersourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id);
// if (prevDatas != null)
// {
// foreach (var pre in prevDatas)
// {
// var existEmp = dicEmployees.FirstOrDefault(w => w.PersonnelNumber?.Trim() == pre.WorkNumber?.Trim());
// if (existEmp != null)
// continue;
// bodysources.Add(new ag_bodysource
// {
// SecondId = second.Id,
// Department = existEmp.AccountingUnit,
// WorkNumber = existEmp.PersonnelNumber,
// Name = existEmp.DoctorName,
// JobTitle = existEmp.JobTitle,
// ReservedRatio = existEmp.ReservedRatio,
// Post = "否",
// });
// }
// }
// }
// else if (prevSecondAllot.Status == 7 || prevSecondAllot.Status == 8)
// {
// var prevDatas = _agfixatitemRepository
// .GetEntities(w => w.SecondId == prevSecondAllot.Id && w.RowNumber.HasValue && w.RowNumber > -1 && w.Type == (int)TempColumnType.TableFixedColumns);
// if (prevDatas != null)
// {
// foreach (var row in prevDatas.GroupBy(w => w.RowNumber.Value))
// {
// var personnelNumber = row.FirstOrDefault(w => w.ItemName == "人员工号")?.ItemValue;
// if (string.IsNullOrEmpty(personnelNumber))
// continue;
// var existEmp = dicEmployees.FirstOrDefault(w => w.PersonnelNumber?.Trim() == personnelNumber?.Trim());
// if (existEmp != null)
// continue;
// bodysources.Add(new ag_bodysource
// {
// SecondId = second.Id,
// Department = existEmp.AccountingUnit,
// WorkNumber = existEmp.PersonnelNumber,
// Name = existEmp.DoctorName,
// JobTitle = existEmp.JobTitle,
// ReservedRatio = existEmp.ReservedRatio,
// Post = "否",
// });
// }
// }
// }
// else if (prevSecondAllot.Status == 9 || prevSecondAllot.Status == 10)
// {
// var prevDatas = _agbodysourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id);
// if (prevDatas != null)
// {
// foreach (var pre in prevDatas)
// {
// var existEmp = dicEmployees.FirstOrDefault(w => w.PersonnelNumber?.Trim() == pre.WorkNumber?.Trim());
// if (existEmp != null)
// continue;
// bodysources.Add(new ag_bodysource
// {
// SecondId = second.Id,
// Department = existEmp.AccountingUnit,
// WorkNumber = existEmp.PersonnelNumber,
// Name = existEmp.DoctorName,
// JobTitle = existEmp.JobTitle,
// ReservedRatio = existEmp.ReservedRatio,
// Post = "否",
// });
// }
// }
// }
//}
//return bodysources;
List<string> numbers = new List<string>();
// 上次二次分配分三种情况,1.其他来源 2.单工作量 3.多工作量
var prevSecondAllot = _secondAllotDetails.GetPreviousSecondAllot(allot.HospitalId, second);
......@@ -544,23 +390,6 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall
private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_employee> dicEmployees)
{
//if (dicEmployees == null)
// return new List<ag_bodysource>();
//var employees = dicEmployees
// .Where(w => w.UnitType == second.UnitType && w.AccountingUnit == second.Department)
// .Select(emp => new ag_bodysource
// {
// SecondId = second.Id,
// Department = emp.AccountingUnit,
// WorkNumber = emp.PersonnelNumber,
// Name = emp.DoctorName,
// JobTitle = emp.JobTitle,
// ReservedRatio = emp.ReservedRatio,
// Post = "否",
// }).ToList();
//return employees;
var employees = dicEmployees
?.Where(w => w.UnitType == second.UnitType && w.AccountingUnit == second.Department)
.Select(emp => emp.PersonnelNumber?.Trim())
......@@ -570,33 +399,6 @@ private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_
private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
{
//List<ag_bodysource> bodysources = new List<ag_bodysource>();
//if (dicEmployees == null)
// return bodysources;
//var employees = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == second.AllotId && w.AccountingUnit == second.Department);
//if (employees != null)
//{
// foreach (var emp in employees)
// {
// var existEmp = dicEmployees.FirstOrDefault(w => w.PersonnelNumber?.Trim() == emp.PersonnelNumber?.Trim());
// if (existEmp != null)
// continue;
// bodysources.Add(new ag_bodysource
// {
// SecondId = second.Id,
// Department = existEmp.AccountingUnit,
// WorkNumber = existEmp.PersonnelNumber,
// Name = existEmp.DoctorName,
// JobTitle = existEmp.JobTitle,
// ReservedRatio = existEmp.ReservedRatio,
// Post = "否",
// });
// }
//}
//return bodysources;
List<string> numbers = new List<string>();
var employees = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == second.AllotId && w.AccountingUnit == second.Department);
......
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