Commit 08dabd96 by 钟博

修改核算数据和原始数据为handsonTable显示、修改其他显示的bug

parent 3a2e7a19
...@@ -452,6 +452,38 @@ public ApiResponse<per_apr_amount> GetEmployeeMessage([FromBody] per_apr_amount ...@@ -452,6 +452,38 @@ public ApiResponse<per_apr_amount> GetEmployeeMessage([FromBody] per_apr_amount
} }
/// <summary> /// <summary>
/// 获取其他绩效信息
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost("GetAprHands/{allotId}")]
public ApiResponse GetAprHands(int allotId)
{
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHands(allotId,claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 保存其他绩效信息
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveAprHands/{allotId}")]
[HttpPost]
public ApiResponse SaveAprHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
employeeService.SaveAprHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 绩效类型字典 /// 绩效类型字典
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
......
...@@ -37,6 +37,36 @@ public ApiResponse GetPersons(int allotId) ...@@ -37,6 +37,36 @@ public ApiResponse GetPersons(int allotId)
} }
/// <summary> /// <summary>
/// 获取员工记录
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("GetPersonsHands/{allotId}/hosp/{hospitalId}")]
[HttpPost]
public ApiResponse GetPersonsHands(int allotId,int hospitalId)
{
var list = personService.GetPersonHands(allotId,hospitalId, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 保存员工信息
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SavePersonHands/{allotId}/hosp/{HospitalId}")]
[HttpPost]
public ApiResponse SavePersonHands(int allotId,int HospitalId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
personService.SavePersonHands(allotId,HospitalId,request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 新增员工信息 /// 新增员工信息
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
......
...@@ -52,5 +52,18 @@ public ApiResponse SheetExport([FromBody]SheetExportRequest request) ...@@ -52,5 +52,18 @@ public ApiResponse SheetExport([FromBody]SheetExportRequest request)
return new ApiResponse(ResponseType.OK, exportData); return new ApiResponse(ResponseType.OK, exportData);
} }
/// <summary>
/// sheet 数据详情
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("SheetExportHands")]
[HttpPost]
public ApiResponse SheetExportHands([FromBody] SheetExportRequest request)
{
var exportData = _sheetSevice.SheetExportHands(request.SheetID);
return new ApiResponse(ResponseType.OK, exportData);
}
} }
} }
...@@ -23,7 +23,9 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi ...@@ -23,7 +23,9 @@ public HandsonTable(int sheetType, string[] cols, List<collect_permission> permi
public string[] ColHeaders { get; private set; } public string[] ColHeaders { get; private set; }
public List<Dictionary<string, string>> Data => _data; public List<Dictionary<string, string>> Data => _data;
public HandsonColumn[] Columns { get; private set; } public HandsonColumn[] Columns { get; private set; }
public List<NestedHeaders>[] NestHeaders { get;set; }
public string SheetName { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -133,7 +135,18 @@ public class NumericFormat ...@@ -133,7 +135,18 @@ public class NumericFormat
{ {
public string Pattern { get; set; } public string Pattern { get; set; }
} }
public class NestedHeaders
{
public NestedHeaders(string label, int colspan)
{
Label = label;
Colspan = colspan;
}
public string Label { get; set; }
public int Colspan { get; set; } = 1;
}
public class DefalutHandsonHeader public class DefalutHandsonHeader
{ {
public SheetType SheetType { get; set; } public SheetType SheetType { get; set; }
......
...@@ -392,7 +392,7 @@ public HandsonTable GetDrugtypeHands(int allotId) ...@@ -392,7 +392,7 @@ public HandsonTable GetDrugtypeHands(int allotId)
} }
} }
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId).OrderBy(c=>c.Charge); var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId)?.OrderBy(c=>c.Charge);
if (list == null) return handson; if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
...@@ -685,7 +685,7 @@ public HandsonTable GetDepttypeHands(int allotId) ...@@ -685,7 +685,7 @@ public HandsonTable GetDepttypeHands(int allotId)
Readnoly = 0 Readnoly = 0
}).ToList()); }).ToList());
var list = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId).OrderBy(c=>c.Charge); var list = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId)?.OrderBy(c=>c.Charge);
if (list == null) return handson; if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
......
...@@ -637,5 +637,154 @@ public List<TitleValue> GetPerforTypeDict(int allotId) ...@@ -637,5 +637,154 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
Value = t Value = t
}).ToList(); }).ToList();
} }
public HandsonTable GetAprHands(int allotId, int userId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, OrtherPerfDic.Select(c => c.Value).ToArray(), OrtherPerfDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (column.Data == "绩效类型")
{
column.Type = "autocomplete";
column.Source = new[] { "基础绩效", "管理绩效" };
column.Strict = false;
}
if (new[] { "状态", "备注" }.Contains(column.Data))
{
column.ReadOnly = true;
}
}
}
var list = GetAprList(allotId, userId);
if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in list)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in OrtherPerfDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
var status = cells.First(c => c.Name == "状态");
switch (status.Value)
{
case "1":
status.Value = "未提交";
break;
case "2":
status.Value = "等待审核";
break;
case "3":
status.Value = "审核通过";
break;
case "4":
status.Value = "驳回";
break;
}
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
public void SaveAprHands(int AllotId, SaveConfigData request)
{
var dicData = CreateDataRow(request, OrtherPerfDic);
List<per_apr_amount> empDics = new List<per_apr_amount>();
foreach (var dic in dicData)
{
if (dic.ContainsKey("Status"))
{
if (dic.ContainsValue("未提交"))
{
dic["Status"] = "1";
}
else if (dic.ContainsValue("等待审核"))
{
dic["Status"] = "2";
}
else if (dic.ContainsValue("审核通过"))
{
dic["Status"] = "3";
}
else
{
dic["Status"] = "4";
}
}
var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<per_apr_amount>(json);
if (!string.IsNullOrEmpty(data.DoctorName) || !string.IsNullOrEmpty(data.PersonnelNumber))
{
data.AllotId = AllotId;
data.CreateDate=Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
empDics.Add(data);
}
}
perapramountRepository.Execute("delete from per_apr_amount where AllotId = @AllotId", new { AllotId });
perapramountRepository.AddRange(empDics.ToArray());
}
private List<Dictionary<string, string>> CreateDataRow(SaveConfigData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
//baseData.Add(nameof(collect_data), HospitalId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveConfigData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
public static Dictionary<string, string> OrtherPerfDic { get; } = new Dictionary<string, string>
{
{ nameof(per_apr_amount.TypeInDepartment), "录入科室" },
{ nameof(per_apr_amount.AccountingUnit), "核算单元" },
{ nameof(per_apr_amount.PersonnelNumber), "人员工号" },
{ nameof(per_apr_amount.DoctorName), "姓名" },
{ nameof(per_apr_amount.PerforType), "绩效类型" },
{ nameof(per_apr_amount.Amount), "金额" },
{ nameof(per_apr_amount.Status), "状态" },
{ nameof(per_apr_amount.Remark), "备注" }
};
} }
} }
...@@ -334,13 +334,13 @@ public HandsonTable GetQueryItemHands(ModModuleRequest request) ...@@ -334,13 +334,13 @@ public HandsonTable GetQueryItemHands(ModModuleRequest request)
if (column.Data == "自动提取规则(无法提取的考核项请勿填写)") if (column.Data == "自动提取规则(无法提取的考核项请勿填写)")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
column.Source = scheme.Select(c => c.Title).ToArray(); column.Source = scheme?.Select(c => c.Title).ToArray();
column.Strict = false; column.Strict = false;
} }
} }
} }
var list = exitemRepository.GetEntities(t => t.ModuleId == request.ModuleId).OrderBy(c=>c.ItemName); var list = exitemRepository.GetEntities(t => t.ModuleId == request.ModuleId)?.OrderBy(c=>c.ItemName);
if (list == null) return handson; if (list == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
......
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