Commit 18c76996 by 李承祥

二次绩效,首次录入自动带出上个月姓名岗位等数据

parent 3aaa548d
...@@ -18,6 +18,8 @@ public class HeadItem ...@@ -18,6 +18,8 @@ public class HeadItem
public int Type { get; set; } public int Type { get; set; }
public decimal FactorValue { get; set; } public decimal FactorValue { get; set; }
public int SourceType { get; set; } public int SourceType { get; set; }
/// <summary> 1 带出历史数据 2不带出 </summary>
public Nullable<int> IsBring { get; set; }
} }
public class BodyItem : HeadItem public class BodyItem : HeadItem
......
...@@ -19,7 +19,7 @@ public class ag_fixatitem ...@@ -19,7 +19,7 @@ public class ag_fixatitem
/// ///
/// </summary> /// </summary>
[Key] [Key]
public int Id { get; set; } public int ID { get; set; }
/// <summary> /// <summary>
/// ///
......
...@@ -50,5 +50,10 @@ public class ag_tempitem ...@@ -50,5 +50,10 @@ public class ag_tempitem
/// 1 自动带出 2 计算得出 /// 1 自动带出 2 计算得出
/// </summary> /// </summary>
public Nullable<int> SourceType { get; set; } public Nullable<int> SourceType { get; set; }
/// <summary>
/// 1 带出历史数据 2不带出
/// </summary>
public Nullable<int> IsBring { get; set; }
} }
} }
...@@ -170,18 +170,9 @@ public bool UseTemp(UseTempRequest request) ...@@ -170,18 +170,9 @@ public bool UseTemp(UseTempRequest request)
result = perforAgusetempRepository.Update(entity); result = perforAgusetempRepository.Update(entity);
if (result) if (result)
{ {
//获取固定模板列 //获取固定模板列 + 工作量列
var tempItem = perforAgtempitemRepository.GetEntities(t => t.TempId == request.TempId); var headItems = GetHeadItems(request.TempId, request.HospitalId, request.Department, request.UnitType);
var headItems = Mapper.Map<List<HeadItem>>(tempItem) ?? new List<HeadItem>();
//获取工作量列头
var workItem = perforAgworkloadRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Department == request.Department && t.UnitType == request.UnitType);
if (workItem != null && workItem.Count > 0)
{
var workDtos = Mapper.Map<List<HeadItem>>(workItem);
workDtos.ForEach(t => { t.Type = 3; });
headItems.AddRange(workDtos);
}
List<ag_fixatitem> list = new List<ag_fixatitem>(); List<ag_fixatitem> list = new List<ag_fixatitem>();
var addList = new List<ag_fixatitem>(); var addList = new List<ag_fixatitem>();
...@@ -475,17 +466,46 @@ public SecondResponse GetSecondDetail(UseTempRequest request) ...@@ -475,17 +466,46 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
{ {
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId); var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
var config = perforCofagainRepository.GetEntities(t => t.AllotID == second.AllotId && t.Department == request.Department) ?? new List<cof_again>(); var config = perforCofagainRepository.GetEntities(t => t.AllotID == second.AllotId && t.Department == request.Department) ?? new List<cof_again>();
config.Add(new cof_again { TypeName = "绩效合计(考核后)", Value = second.RealGiveFee });
#region 补充顶部数据
config.Add(new cof_again { TypeName = "绩效合计(考核后)", Value = second.RealGiveFee });
result.BodyItems.AddRange(GetBodyItems(headItems.Where(t => t.Type == 1).ToList(), 1, configs: config)); result.BodyItems.AddRange(GetBodyItems(headItems.Where(t => t.Type == 1).ToList(), 1, configs: config));
result.BodyItems.FirstOrDefault(t => t.FiledName == "发放月份").Value = $"{second.Year}{second.Month}月"; result.BodyItems.FirstOrDefault(t => t.FiledName == "发放月份").Value = $"{second.Year}{second.Month}月";
#endregion
#region 补充需要带出的数据
headItems = headItems.Where(t => t.IsBring == 1).ToList();
if (headItems != null && headItems.Count > 0)
{
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == request.HospitalId);
var secondIdList = perforAgsecondallotRepository.GetEntities(t => allotList.Select(a => a.ID).Contains(t.AllotId.Value)).OrderBy(t => t.Year).ThenBy(t => t.Month).Select(t => t.Id).ToList();
var index = secondIdList.IndexOf(request.SecondId);
if (index != 0)
fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == secondIdList.ElementAt(index - 1) && t.RowNumber.HasValue);
fixatList = fixatList.Where(t => headItems.Select(h => h.FiledName).Contains(t.ItemName)).ToList();
if (fixatList != null && fixatList.Count > 0)
{
var rows = fixatList.Select(t => t.RowNumber.Value).Distinct();
foreach (var row in rows)
{
var header = row == -1 ? headItems.Where(t => t.Type == 1).ToList() : headItems.Where(t => t.Type != 1).ToList();
result.BodyItems.AddRange(GetBodyItems(header, 2, fixatitems: fixatList, row: row));
}
}
}
#endregion
} }
return result; return new SecondResponse
{
HeadItems = result.HeadItems.OrderBy(t => t.Type).ThenBy(t => t.Sort).ThenBy(t => t.FiledName).ToList(),
BodyItems = result.BodyItems.OrderBy(t => t.RowNumber).ThenBy(t => t.Type).ThenBy(t => t.Sort).ToList(),
};
} }
/// <summary> /// <summary>
/// /// 获取 列
/// </summary> /// </summary>
/// <param name="tempId">模板Id</param> /// <param name="tempId">模板Id</param>
/// <param name="hospitalId">医院Id</param> /// <param name="hospitalId">医院Id</param>
...@@ -524,7 +544,7 @@ public List<BodyItem> GetBodyItems(List<HeadItem> headItems, int source, List<co ...@@ -524,7 +544,7 @@ public List<BodyItem> GetBodyItems(List<HeadItem> headItems, int source, List<co
{ {
var bodyItem = new BodyItem var bodyItem = new BodyItem
{ {
RowNumber = -1, RowNumber = source == 1 ? -1 : row.Value,
FiledId = item.FiledId, FiledId = item.FiledId,
FiledName = item.FiledName, FiledName = item.FiledName,
FactorValue = item.FactorValue, FactorValue = item.FactorValue,
......
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