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>();
......
...@@ -569,6 +569,8 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId) ...@@ -569,6 +569,8 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
return new string[] { }; return new string[] { };
} }
#region HandsTable
public HandsonTable GetDepartmentHands(int hospitalId) public HandsonTable GetDepartmentHands(int hospitalId)
{ {
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, DeptDic.Select(c => c.Value).ToArray(), DeptDic.Select(t => new collect_permission HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, DeptDic.Select(c => c.Value).ToArray(), DeptDic.Select(t => new collect_permission
...@@ -614,42 +616,95 @@ public HandsonTable GetDepartmentHands(int hospitalId) ...@@ -614,42 +616,95 @@ public HandsonTable GetDepartmentHands(int hospitalId)
} }
} }
var getDept = GetDepartments(hospitalId).OrderBy(c=>c.Department); var getDept = GetDepartments(hospitalId).OrderBy(c => c.Department);
var rowDatas = DeptHandsonRowData(getDept); var rowDatas = DeptHandsonRowData(getDept);
handson.SetRowData(rowDatas, rowDatas != null); handson.SetRowData(rowDatas, rowDatas != null);
return handson; return handson;
} }
private List<HandsonRowData> DeptHandsonRowData(IEnumerable<DeptdicResponse> getDept) public HandsonTable GetPersonHands(int allotId, int hospitalId,int userId)
{ {
if (getDept == null) return null; HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, PersonDic.Select(c => c.Value).ToArray(), PersonDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (column.Data == "核算单元")
{
column.Type = "autocomplete";
column.Source = deptdics?.Select(t => t.Department).Distinct().ToArray();
}
if (column.Data == "科室名称")
{
column.Type = "autocomplete";
column.Source = deptdics?
.Where(t => !new string[] {UnitType.行政后勤.ToString(), UnitType.特殊核算组.ToString()}.Contains(t.UnitType))
.Select(t => t.AccountingUnit).Distinct().ToArray();
}
if (column.Data == "人员类别")
{
column.Type = "autocomplete";
column.Source = deptdics?
.Where(t => !new string[] { UnitType.专家组.ToString() }.Contains(t.UnitType))
.Select(t => t.UnitType).Distinct().ToArray();
}
}
}
var list = peremployeeRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId==hospitalId)?.OrderBy(c=>c.AccountingUnit);
if (list==null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0; int i = 0;
foreach (var item in getDept) foreach (var item in list)
{ {
DeptdicResponse tempDept = new DeptdicResponse() var json = JsonHelper.Serialize(item);
{ Department = item.Department, HISDeptName = item.HISDeptName, HospitalId = item.HospitalId }; var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var temp = JsonHelper.Serialize(tempDept); var cells = (from conf in PersonDic
var tempDic = JsonHelper.Deserialize<Dictionary<string, Object>>(temp); join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
tempDic.Add(nameof(item.InpatNurseAccounting), item.InpatNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatDoctorAccounting), item.InpatDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatTechnicAccounting), item.InpatTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutNurseAccounting), item.OutNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutTechnicAccounting), item.OutTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutDoctorAccounting), item.OutDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.LogisticsAccounting), item.LogisticsAccounting.AccountingUnit); ;
tempDic.Add(nameof(item.SpecialAccounting), item.SpecialAccounting.AccountingUnit);
var cells = (from conf in DeptDic
join fst in tempDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList(); select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++;
} }
handson.SetRowData(rowDatas, rowDatas != null);
return rowDatas; return handson;
}
public void SavePersonHands(int AllotId,int HospitalId, SaveConfigData request)
{
var dicData = CreateDataRow(AllotId, request, PersonDic);
List<per_employee> empDics = new List<per_employee>();
foreach (var dic in dicData)
{
var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<per_employee>(json);
if (!string.IsNullOrEmpty(data.Department) || !string.IsNullOrEmpty(data.AccountingUnit))
{
data.HospitalId = HospitalId;
data.AllotId = AllotId;
data.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:dd"));
empDics.Add(data);
}
}
peremployeeRepository.Execute("delete from per_employee where AllotId = @AllotId", new { AllotId });
peremployeeRepository.AddRange(empDics.ToArray());
} }
public void SaveDeptDicHands(int HospitalId, SaveConfigData request) public void SaveDeptDicHands(int HospitalId, SaveConfigData request)
...@@ -662,17 +717,48 @@ public void SaveDeptDicHands(int HospitalId, SaveConfigData request) ...@@ -662,17 +717,48 @@ public void SaveDeptDicHands(int HospitalId, SaveConfigData request)
var json = JsonHelper.Serialize(dic); var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<DeptdicHands>(json); var data = JsonHelper.Deserialize<DeptdicHands>(json);
if (!string.IsNullOrEmpty(data.Department)|| !string.IsNullOrEmpty(data.HISDeptName)) if (!string.IsNullOrEmpty(data.Department) || !string.IsNullOrEmpty(data.HISDeptName))
{ {
DeptDicList(HospitalId, deptDics, data); DeptDicList(HospitalId, deptDics, data);
} }
} }
perdeptdicRepository.Execute("delete from per_dept_dic where HospitalId = @HospitalId", new { HospitalId }); perdeptdicRepository.Execute("delete from per_dept_dic where HospitalId = @HospitalId", new { HospitalId });
perdeptdicRepository.AddRange(deptDics.ToArray()); perdeptdicRepository.AddRange(deptDics.ToArray());
} }
private List<HandsonRowData> DeptHandsonRowData(IEnumerable<DeptdicResponse> getDept)
{
if (getDept == null) return null;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in getDept)
{
DeptdicResponse tempDept = new DeptdicResponse()
{ Department = item.Department, HISDeptName = item.HISDeptName, HospitalId = item.HospitalId };
var temp = JsonHelper.Serialize(tempDept);
var tempDic = JsonHelper.Deserialize<Dictionary<string, Object>>(temp);
tempDic.Add(nameof(item.InpatNurseAccounting), item.InpatNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatDoctorAccounting), item.InpatDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatTechnicAccounting), item.InpatTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutNurseAccounting), item.OutNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutTechnicAccounting), item.OutTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutDoctorAccounting), item.OutDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.LogisticsAccounting), item.LogisticsAccounting.AccountingUnit); ;
tempDic.Add(nameof(item.SpecialAccounting), item.SpecialAccounting.AccountingUnit);
var cells = (from conf in DeptDic
join fst in tempDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
}
return rowDatas;
}
private List<Dictionary<string, string>> CreateDataRow(int HospitalId, SaveConfigData request, Dictionary<string, string> config) private List<Dictionary<string, string>> CreateDataRow(int HospitalId, SaveConfigData request, Dictionary<string, string> config)
{ {
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>(); List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
...@@ -713,7 +799,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -713,7 +799,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
if (data.InpatDoctorAccounting != "" || data.InpatNurseAccounting != "" || data.InpatTechnicAccounting != "") if (data.InpatDoctorAccounting != "" || data.InpatNurseAccounting != "" || data.InpatTechnicAccounting != "")
{ {
if (data.InpatDoctorAccounting != "") if (data.InpatDoctorAccounting != "")
{ {
per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime }; per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime };
...@@ -743,7 +829,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -743,7 +829,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
if (data.OutDoctorAccounting != "" || data.OutNurseAccounting != "" || data.OutTechnicAccounting != "") if (data.OutDoctorAccounting != "" || data.OutNurseAccounting != "" || data.OutTechnicAccounting != "")
{ {
if (data.OutDoctorAccounting != "") if (data.OutDoctorAccounting != "")
{ {
per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime }; per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime };
...@@ -768,17 +854,17 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -768,17 +854,17 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
} }
#endregion #endregion
if (data.LogisticsAccounting != "") if (data.LogisticsAccounting != "")
{ {
per_dept_dic deptDic = new per_dept_dic() per_dept_dic deptDic = new per_dept_dic()
{ {
HospitalId = HospitalId, HospitalId = HospitalId,
Department = data.Department, Department = data.Department,
HISDeptName = data.HISDeptName, HISDeptName = data.HISDeptName,
CreateTime = nowTime, CreateTime = nowTime,
AccountingUnit=data.LogisticsAccounting, AccountingUnit = data.LogisticsAccounting,
UnitType = "行政后勤" UnitType = "行政后勤"
}; };
deptDics.Add(deptDic); deptDics.Add(deptDic);
...@@ -798,8 +884,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -798,8 +884,7 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
deptDics.Add(deptDic); deptDics.Add(deptDic);
} }
} }
private static Dictionary<string, string> DeptDic { get; } = new Dictionary<string, string>
public static Dictionary<string, string> DeptDic { get; } = new Dictionary<string, string>
{ {
{ nameof(DeptdicResponse.Department), "标准科室" }, { nameof(DeptdicResponse.Department), "标准科室" },
{ nameof(DeptdicResponse.HISDeptName), "系统科室" }, { nameof(DeptdicResponse.HISDeptName), "系统科室" },
...@@ -812,5 +897,26 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -812,5 +897,26 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
{ nameof(DeptdicResponse.LogisticsAccounting), "行政后勤" }, { nameof(DeptdicResponse.LogisticsAccounting), "行政后勤" },
{ nameof(DeptdicResponse.SpecialAccounting), "特殊核算组" } { nameof(DeptdicResponse.SpecialAccounting), "特殊核算组" }
}; };
private static Dictionary<string, string> PersonDic { get; } = new Dictionary<string, string>
{
{nameof(per_employee.AccountingUnit), "核算单元"},
{nameof(per_employee.Department), "科室名称"},
{nameof(per_employee.DoctorName), "姓名"},
{nameof(per_employee.PersonnelNumber), "员工工号"},
{nameof(per_employee.JobCategory), "正式/临聘"},
{nameof(per_employee.Duty), "职务"},
{nameof(per_employee.JobTitle), "职称"},
{nameof(per_employee.UnitType), "人员类别"},
{nameof(per_employee.AttendanceDay), "出勤天数"},
{nameof(per_employee.EfficiencyNumber), "效率绩效人数"},
{nameof(per_employee.WorkTime), "参加工作时间"},
{nameof(per_employee.BirthDate), "出生年月"},
{nameof(per_employee.Age), "年龄"},
{nameof(per_employee.PermanentStaff), "核算单元人员数量"},
{nameof(per_employee.Remark), "备注"},
};
#endregion
} }
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Newtonsoft.Json.Linq;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -362,7 +363,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response) ...@@ -362,7 +363,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response)
if (list != null && list.Count() > 0) if (list != null && list.Count() > 0)
{ {
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal // Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal
List<(string, Func<res_account, object>, int, int, bool, bool)> pairs = List<(string, Func<res_account, object>, int, int, bool, bool)> AccountDic =
new List<(string, Func<res_account, object>, int, int, bool, bool)> new List<(string, Func<res_account, object>, int, int, bool, bool)>
{ {
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false), ("核算单元", (t) => t.AccountingUnit, 1, 1, false, false),
...@@ -386,7 +387,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response) ...@@ -386,7 +387,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response)
}; };
var row = new Row(0); var row = new Row(0);
int index = 1; int index = 1;
foreach (var item in pairs) foreach (var item in AccountDic)
{ {
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6)); row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6));
index += 1; index += 1;
...@@ -398,7 +399,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response) ...@@ -398,7 +399,7 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response)
var account = list.ElementAt(i); var account = list.ElementAt(i);
var rowbody = new Row(i); var rowbody = new Row(i);
index = 1; index = 1;
foreach (var item in pairs) foreach (var item in AccountDic)
{ {
rowbody.Data.Add(new Cell(index, item.Item2.Invoke(account), item.Item3, item.Item4, item.Item5, item.Item6, id: account.ID)); rowbody.Data.Add(new Cell(index, item.Item2.Invoke(account), item.Item3, item.Item4, item.Item5, item.Item6, id: account.ID));
index += 1; index += 1;
...@@ -642,5 +643,705 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis ...@@ -642,5 +643,705 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis
} }
return response; return response;
} }
#region Hands
public HandsonTable SheetExportHands(int sheetID)
{
var sheet = _perforImSheetRepository.GetEntity(t => t.ID == sheetID);
if (sheet == null)
throw new PerformanceException("参数sheetid无效");
HandsonTable handson = null;
if (sheet.SheetType == (int)SheetType.Employee)
{
handson = EmployeeHands(sheetID);
}
else if (sheet.SheetType == (int)SheetType.ClinicEmployee)
{
handson = ClinicEmployeeHands(sheetID);
}
else if (sheet.SheetType == (int)SheetType.LogisticsEmployee)
{
handson = LogisticsEmployeeHands(sheetID);
}
else if (sheet.SheetType == (int)SheetType.SpecialUnit)
{
handson = SpecialUnitHands(sheetID);
}
else if (sheet.SheetType == (int)SheetType.ComputeDoctorAccount)
{
handson = AccountDoctorHands(sheetID);
}
else if (sheet.SheetType == (int)SheetType.ComputeNurseAccount)
{
handson = AccountNurseHands(sheetID);
}
else
{
handson = CommonHands(sheetID);
}
handson.SheetName = sheet.SheetName;
return handson;
}
private HandsonTable EmployeeHands(int sheetId)
{
var pairs = PerSheetHeader.employeeHeaders;
Dictionary<string, string> empDic = new Dictionary<string, string>();
foreach (var item in pairs)
{
empDic.Add(item.Rest.Item1, item.Item1);
}
var handson = new HandsonTable((int)SheetType.Unidentifiable, empDic.Select(c => c.Value).ToArray(), empDic.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)
{
column.ReadOnly = true;
if (new[] { "考核得分率", "出勤率", "调节系数" }.Contains(column.Data))
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat() { Pattern = "0,00.00%" };
column.Strict = false;
}
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in empDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[] { nesteds };
var employeeList = _perforImEmployeeRepository.GetEntities(t => t.SheetID == sheetId)?
.OrderByDescending(t => t.AccountType)
.ThenBy(t => t.AccountingUnit);
if (employeeList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in employeeList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in empDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable ClinicEmployeeHands(int sheetId)
{
var pairs = PerSheetHeader.employeeClinicHeaders;
Dictionary<string, string> clinicEmpDic = new Dictionary<string, string>();
foreach (var item in pairs)
{
clinicEmpDic.Add(item.Rest.Item1, item.Item1);
}
var handson = new HandsonTable((int)SheetType.Unidentifiable, clinicEmpDic.Select(c => c.Value).ToArray(), clinicEmpDic.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)
{
column.ReadOnly = true;
if (new[] { "效率绩效系数", "规模绩效系数", "管理绩效发放系数", "考核得分率", "出勤率", "调节系数" }.Contains(column.Data))
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat() { Pattern = "0,00.00%" };
column.Strict = false;
}
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in clinicEmpDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[] { nesteds };
var clinicList = _perforImemployeeclinicRepository.GetEntities(t => t.SheetID == sheetId)?
.OrderByDescending(t => t.UnitType)
.ThenBy(t => t.AccountingUnit);
if (clinicList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in clinicList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in clinicEmpDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable LogisticsEmployeeHands(int sheetId)
{
var pairs = PerSheetHeader.employeeLogisticsHeaders;
Dictionary<string, string> logEmpDic = new Dictionary<string, string>();
foreach (var item in pairs)
{
logEmpDic.Add(item.Rest.Item1, item.Item1);
}
var handson = new HandsonTable((int)SheetType.Unidentifiable, logEmpDic.Select(c => c.Value).ToArray(), logEmpDic.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)
{
column.ReadOnly = true;
if (column.Data == "出勤率")
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat() { Pattern = "0,00.00%" };
column.Strict = false;
}
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in logEmpDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[] { nesteds };
var logisticsList = _perforImemployeelogisticsRepository.GetEntities(t => t.SheetID == sheetId)?
.OrderByDescending(t => t.AccountType)
.ThenBy(t => t.AccountingUnit);
if (logisticsList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in logisticsList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in logEmpDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable SpecialUnitHands(int sheetId)
{
var pairs = PerSheetHeader.specialUnitHeaders;
Dictionary<string, string> specialUnitDic = new Dictionary<string, string>();
foreach (var item in pairs)
{
specialUnitDic.Add(item.Rest.Item1, item.Item1);
}
var handson = new HandsonTable((int)SheetType.Unidentifiable, specialUnitDic.Select(c => c.Value).ToArray(), specialUnitDic.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)
{
column.ReadOnly = true;
if (new[] { "考核得分率", "出勤率", "调节系数" }.Contains(column.Data))
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat() { Pattern = "0,00.00%" };
column.Strict = false;
}
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in specialUnitDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[] { nesteds };
var specialList = _perforImspecialunitRepository.GetEntities(t => t.SheetID == sheetId)?
.OrderByDescending(t => t.AccountingUnit);
if (specialList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in specialList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in specialUnitDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable AccountDoctorHands(int sheetId)
{
var handson = new HandsonTable((int)SheetType.Unidentifiable, AccountDic.Select(c => c.Value).ToArray(), AccountDic.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)
{
column.ReadOnly = true;
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in AccountDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[]{nesteds};
var accountList = _perforResaccountRepository.GetEntities(t => t.UnitType != (int)UnitType.护理组 && t.SheetID == sheetId)?.OrderByDescending(t => t.AccountingUnit);
if (accountList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in accountList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in AccountDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable AccountNurseHands(int sheetId)
{
var handson = new HandsonTable((int)SheetType.Unidentifiable, AccountDic.Select(c => c.Value).ToArray(), AccountDic.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)
{
column.ReadOnly = true;
}
}
List<NestedHeaders> nesteds = new List<NestedHeaders>();
foreach (var item in AccountDic)
{
NestedHeaders nested = new NestedHeaders(item.Value, 1);
nesteds.Add(nested);
}
handson.NestHeaders = new[] { nesteds };
var accountNurseList = _perforResaccountRepository.GetEntities(t => t.UnitType == (int)UnitType.护理组 && t.SheetID == sheetId)?.OrderByDescending(t => t.AccountingUnit);
if (accountNurseList == null) return handson;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in accountNurseList)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in AccountDic
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private HandsonTable CommonHands(int sheetId)
{
var headList = _perforImHeaderRepository.GetEntities(t => t.SheetID == sheetId)?.OrderBy(t => t.PointCell).ToList();
var dataList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetId)?.OrderByDescending(t => t.AccountingUnit).ToList();
var sheet = _perforImSheetRepository.GetEntity(t => t.ID == sheetId);
Dictionary<int, string> clinicEmpDic = new Dictionary<int, string>();
foreach (var item in headList)
{
clinicEmpDic.Add(item.ID, item.CellValue);
}
var handson = new HandsonTable((int)SheetType.Unidentifiable, clinicEmpDic.Select(c => c.Value).ToArray(), clinicEmpDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
//添加系数值
#region 添加系数值
int merge = 4;
if (sheet.SheetType == (int)SheetType.Income && !headList.Select(t => t.CellValue).Contains("核算单元(医技组)"))
merge = 3;
var factorhead = new Row(0);
List<NestedHeaders> nesteds = new List<NestedHeaders>();
List<NestedHeaders> nesteds1 = new List<NestedHeaders>();
List<NestedHeaders> nesteds2 = new List<NestedHeaders>();
if (sheet.SheetType == (int)SheetType.Workload)
{
SheetExportResponse response = new SheetExportResponse();
factorhead.Data.Add(new Cell(0, "单元工作量绩效标准:", 1, 2, false, false, cellType: "header"));
response = AddFactor(response, factorhead, headList.ToList(), dataList);
foreach (var item in response.Header[0].Data)
{
if (item.CellValue == null)
{
NestedHeaders nestHeader = new NestedHeaders("0", 1);
nesteds.Add(nestHeader);
}
else if (item.CellValue.ToString() == "单元工作量绩效标准:")
{
NestedHeaders nestHeader = new NestedHeaders(item.CellValue.ToString(), 2);
nesteds.Add(nestHeader);
}
else
{
NestedHeaders nestHeader = new NestedHeaders(item.CellValue.ToString(), 1);
nesteds.Add(nestHeader);
}
}
}
else if (sheet.SheetType == (int)SheetType.OtherIncome || sheet.SheetType == (int)SheetType.Income || sheet.SheetType == (int)SheetType.Expend)
{
SheetExportResponse response = new SheetExportResponse();
factorhead.Data.Add(new Cell(0, "护理组分割比例", 1, merge, false, false, cellType: "header"));
response = AddFactor(response, factorhead, headList.ToList(), dataList, UnitType.护理组);
foreach (var item in response.Header[0].Data)
{
if (item.CellValue == null)
{
NestedHeaders nestHeader = new NestedHeaders("0.00%", 1);
nesteds.Add(nestHeader);
}
else if (item.CellValue.ToString() == "护理组分割比例")
{
NestedHeaders nestHeader = new NestedHeaders(item.CellValue.ToString(), 4);
nesteds.Add(nestHeader);
}
else
{
NestedHeaders nestHeader = new NestedHeaders(Math.Round(Convert.ToDecimal(item.CellValue) * 100, 2) + "%", 1);
nesteds.Add(nestHeader);
}
}
var factorhead1 = new Row(1);
SheetExportResponse response1 = new SheetExportResponse();
factorhead1.Data.Add(new Cell(0, "医生组分割比例", 1, merge, false, false, cellType: "header"));
response1 = AddFactor(response1, factorhead1, headList.ToList(), dataList, UnitType.医生组);
foreach (var item in response1.Header[0].Data)
{
if (item.CellValue == null)
{
NestedHeaders nestHeader = new NestedHeaders("0.00%", 1);
nesteds1.Add(nestHeader);
}
else if (item.CellValue.ToString() == "医生组分割比例")
{
NestedHeaders nestHeader = new NestedHeaders(item.CellValue.ToString(), 4);
nesteds1.Add(nestHeader);
}
else
{
NestedHeaders nestHeader = new NestedHeaders(Math.Round(Convert.ToDecimal(item.CellValue) * 100, 2) + "%", 1);
nesteds1.Add(nestHeader);
}
}
SheetExportResponse response2 = new SheetExportResponse();
var factorhead2 = new Row(2);
factorhead2.Data.Add(new Cell(0, "医技组分割比例", 1, merge, false, false, cellType: "header"));
response2 = AddFactor(response2, factorhead2, headList.ToList(), dataList, UnitType.医技组);
foreach (var item in response2.Header[0].Data)
{
if (item.CellValue == null)
{
NestedHeaders nestHeader = new NestedHeaders("0.00%", 1);
nesteds2.Add(nestHeader);
}
else if (item.CellValue.ToString() == "医技组分割比例")
{
NestedHeaders nestHeader = new NestedHeaders(item.CellValue.ToString(), 4);
nesteds2.Add(nestHeader);
}
else
{
NestedHeaders nestHeader = new NestedHeaders(Math.Round(Convert.ToDecimal(item.CellValue) * 100, 2) + "%", 1);
nesteds2.Add(nestHeader);
}
}
}
#endregion
//创建列头行
#region 创建列头行
List<NestedHeaders> nesteds3 = new List<NestedHeaders>();
foreach (var header in headList.Where(t => !t.ParentID.HasValue || t.ParentID.Value == 0))
{
var ss = header.CellValue;
if (sheet.SheetType == (int)SheetType.ComputeEconomic)
{
if (header.CellValue == "收入")
{
NestedHeaders item = new NestedHeaders(header.CellValue, 24);
nesteds3.Add(item);
}
else if (new[] { "收入合计", "其他收入", "其他收入合计", "支出", "支出合计", "科室可核算业绩收入" }.Contains(header.CellValue.Trim()))
{
NestedHeaders item = new NestedHeaders(header.CellValue, 3);
nesteds3.Add(item);
}
else if (header.CellValue == "核算单元")
{
NestedHeaders item = new NestedHeaders("", 1);
nesteds3.Add(item);
}
}
else
{
NestedHeaders item = new NestedHeaders(header.CellValue, 1);
nesteds3.Add(item);
}
}
List<NestedHeaders> nesteds4 = new List<NestedHeaders>();
if (headList.Any(t => t.ParentID.HasValue && t.ParentID.Value > 0))
{
List<string> heards = new List<string>();
NestedHeaders unit = new NestedHeaders("核算单元", 1);
nesteds4.Add(unit);
foreach (var header in headList.Where(t => t.ParentID.HasValue && t.ParentID.Value > 0))
{
NestedHeaders item = new NestedHeaders(header.CellValue, 1);
heards.Add(header.CellValue);
nesteds4.Add(item);
}
}
if (nesteds3.Count!=0 && nesteds4.Count==0 && nesteds.Count==0 && nesteds1.Count==0 && nesteds2.Count==0)
handson.NestHeaders = new[] { nesteds3};
else if (nesteds.Count == 0 && nesteds1.Count == 0 && nesteds2.Count == 0)
handson.NestHeaders = new[] { nesteds3, nesteds4 };
else if (nesteds1.Count == 0 && nesteds2.Count == 0 && nesteds4.Count == 0)
handson.NestHeaders = new[] { nesteds, nesteds3 };
else if (nesteds4.Count == 0)
handson.NestHeaders = new[] { nesteds, nesteds1, nesteds2, nesteds3 };
List<im_header> headers = new List<im_header>();
foreach (var head in headList)
{
if (!headList.Any(t => t.ParentID == head.ID))
headers.Add(head);
}
#endregion
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
column.ReadOnly = true;
}
}
if (dataList == null || dataList.Count == 0) return handson;
Row rowbody = null;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var rowNumber in dataList.Select(t => t.RowNumber).Distinct()) //.OrderBy(t => t)
{
Dictionary<int, string> firstDic = new Dictionary<int, string>();
foreach (var head in headers)
{
if (head.CellValue.Contains("核算单元类型"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).UnitType;
var unitType = value.HasValue ? ((UnitType)value).ToString() : "";
firstDic.Add(head.ID, unitType);
}
else if (head.CellValue.Contains("核算单元人员数量"))
{
var data = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.SignID == head.SignID);
var value = data?.CellValue;
if (value.HasValue && value.Value > 0)
firstDic.Add(head.ID, value.ToString());
}
else if (head.CellValue.Contains("核算单元"))
{
if (head.CellValue.Contains("医生组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 1);
firstDic.Add(head.ID, value?.AccountingUnit);
}
else if (head.CellValue.Contains("护理组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 2);
firstDic.Add(head.ID, value?.AccountingUnit);
}
else if (head.CellValue.Contains("医技组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 3);
firstDic.Add(head.ID, value?.AccountingUnit);
}
else
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
firstDic.Add(head.ID, value?.AccountingUnit);
}
}
else if (head.CellValue.Contains("科室名称"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
firstDic.Add(head.ID, value.Department);
}
else if (head.CellValue.Contains("备注"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
firstDic.Add(head.ID, value.Remark);
}
else if (head.CellValue.Contains("人员工号"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).JobNumber;
firstDic.Add(head.ID, value);
}
else if (head.CellValue.Contains("医生姓名"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).EmployeeName;
firstDic.Add(head.ID, value);
}
else if (!firstDic.Any(t=>t.Key==head.ID))
{
var data = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.SignID == head.SignID);
var value = data?.CellValue;
firstDic.Add(head.ID, value.ToString());
}
}
var cells = (from conf in clinicEmpDic
join fst in firstDic on conf.Key equals fst.Key
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
public static Dictionary<string, string> AccountDic { get; } = new Dictionary<string, string>
{
{nameof(res_account.AccountingUnit),"核算单元"},
{nameof(res_account.Number),"核算单元医生数量"},
{nameof(res_account.BasicFactor),"医生基础系数"},
{nameof(res_account.SlopeFactor),"倾斜系数"},
{nameof(res_account.OtherPerfor1),"其他绩效1"},
{nameof(res_account.OtherPerfor2),"其他绩效2"},
{nameof(res_account.MedicineExtra),"药占比奖罚"},
{nameof(res_account.MaterialsExtra),"材料占比奖罚" },
{nameof(res_account.Extra),"医院奖罚"},
{nameof(res_account.ScoringAverage),"考核对分率"},
{nameof(res_account.AdjustFactor),"调节系数"},
{nameof(res_account.Income),"科室业绩"},
{nameof(res_account.PerforFee),"业绩绩效"},
{nameof(res_account.WorkloadFee),"工作量绩效"},
{nameof(res_account.PerforTotal),"绩效合计"},
{nameof(res_account.Avg),"人均绩效"},
{nameof(res_account.RealGiveFee),"实发绩效"}
};
#endregion
} }
} }
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