人员字典二次分配自定义显示列:

parent 985ee9f6
......@@ -719,6 +719,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
_redistributionService.ClearInvalidValue(cleanDatas);
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
_redistributionService.RowsExpand(allot, dic, cleanDatas);
return new ApiResponse(ResponseType.OK, new { Head = request.Head, Body = cleanDatas, Dic = dic });
}
catch (PerformanceException ex)
......@@ -915,8 +916,10 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request)
// 返回信息
var (head, rows) = _redistributionService.RedistributionDetail((ComputeMode)request.ComputeMode, allot, second, workloadGroups);
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
_redistributionService.RowsExpand(allot, dic, rows);
return new ApiResponse(ResponseType.OK, new { Head = head, Body = rows, Dic = dic });
}
#endregion
......
......@@ -4096,6 +4096,11 @@
格式
</summary>
</member>
<member name="P:Performance.DtoModels.SecondColumnDictionary.Expand">
<summary>
true 扩展字段,通过配置额外展示
</summary>
</member>
<member name="P:Performance.DtoModels.SecondEmployeeDto.ComputeMode">
<summary>
计算方式:11 不计算 12 横向计算 13 纵向计算
......
......@@ -38,12 +38,16 @@ public class SecondColumnDictionary
/// 格式
/// </summary>
public bool IsNumber { get; set; }
/// <summary>
/// true 扩展字段,通过配置额外展示
/// </summary>
public bool Expand { get; set; }
public SecondColumnDictionary()
{
}
public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null, bool isNumber = true)
public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null, bool isNumber = true, bool expand = false)
{
Label = label;
Key = key;
......@@ -54,6 +58,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s
Color = color;
Width = width.HasValue ? width.ToString() : ((label ?? "").Length * 20 + 10).ToString();
IsNumber = isNumber;
Expand = expand;
}
}
}
......@@ -253,9 +253,7 @@ public IEnumerable<view_second_workload_result> GetSecondWorkload(int allotid, s
/// <summary>
/// 查询HIS提取数据,工作量字典
/// </summary>
/// <param name="allotid"></param>
/// <param name="unittype"></param>
/// <param name="accountingunit"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId)
{
......@@ -278,5 +276,27 @@ public IEnumerable<string> GetSecondWorkloadMaps(int hospitalId)
}
}
}
/// <summary>
/// 查询人员字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public IEnumerable<dynamic> QueryEmployee(int allotId)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string query = $@"SELECT * FROM view_employee WHERE AllotID = @allotId";
return connection.Query(query, new { allotId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
}
}
\ No newline at end of file
......@@ -178,7 +178,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
/*
此处数据需要额外注意,前端显示规则:通过isTrue=true显示,显示名称为label
*/
var alias = _cofaliasRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Route == "/second_entering") ?? new List<cof_alias>();
var alias = _cofaliasRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Route == "/second_entering" && t.States == 1) ?? new List<cof_alias>();
Func<string, string, string> getAlias = (name, def) =>
{
try
......@@ -226,6 +226,27 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitleCoefficient), "职称系数"), nameof(ag_bodysource.TitleCoefficient), false, 203, color: "title_color", isNumber: true));
maps.Add(new SecondColumnDictionary(getAlias(nameof(ag_bodysource.TitlePerformanceScore), "职称绩效得分"), nameof(ag_bodysource.TitlePerformanceScore), false, 204, color: "title_color", isNumber: true));
}
// 扩展字典
if (alias != null && alias.Any())
{
List<string> notCalculate = new List<string>
{
nameof(ag_bodysource.Post),
nameof(ag_bodysource.StaffCoefficient),
nameof(ag_bodysource.ActualAttendance),
nameof(ag_bodysource.JobTitle),
nameof(ag_bodysource.TitleCoefficient),
nameof(ag_bodysource.TitlePerformanceScore),
};
foreach (var item in alias)
{
if (!maps.Any(w => w.Key.Equals(item.Name, StringComparison.OrdinalIgnoreCase))
&& !notCalculate.Contains(item.Name))
{
maps.Add(new SecondColumnDictionary(item.Alias, item.Name, false, item.Sort, color: "title_color", isNumber: false, expand: true));
}
}
}
// 工作量
if (computeMode != ComputeMode.NotCalculate)
......@@ -288,6 +309,35 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
}
/// <summary>
/// 补充内容 扩展字段,通过配置额外展示
/// </summary>
/// <param name="allot"></param>
/// <param name="dic"></param>
/// <param name="rows"></param>
public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<Dictionary<string, object>> rows)
{
if (dic != null && dic.Any(w => w.Expand))
{
var employees = _perallotRepository.QueryEmployee(allot.ID);
foreach (var row in rows)
{
var number = row.GetString(nameof(ag_bodysource.WorkNumber));
Dictionary<string, object> pairs = new Dictionary<string, object>();
var emp = employees.FirstOrDefault(w => w.PersonnelNumber == number);
if (emp != null)
pairs = JsonHelper.Deserialize<Dictionary<string, object>>(JsonHelper.Serialize(emp));
foreach (var item in dic.Where(w => w.Expand))
{
var value = pairs.GetString(item.Key);
row.AddOrUpdate(item.Key, value);
}
}
}
}
/// <summary>
/// 加载已保存工作量数据,加载时区分:已提交和未提交
/// </summary>
/// <param name="allot"></param>
......@@ -782,7 +832,7 @@ private HandsonTableBase ComputeMode_Format2(per_allot allot, List<string> colHe
{
getAlias(nameof(ag_bodysource.WorkNumber), "工号"),
getAlias(nameof(ag_bodysource.Name), "姓名"),
getAlias(nameof(ag_bodysource.Post), "人员系数"),
getAlias(nameof(ag_bodysource.Post), "领取平均绩效"),
getAlias(nameof(ag_bodysource.StaffCoefficient), "人员系数"),
getAlias(nameof(ag_bodysource.ActualAttendance), "出勤"),
getAlias(nameof(ag_bodysource.JobTitle), "职称"),
......
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