Commit 4c293338 by lcx

4.1未获取到科室信息时,读取Excel中的科室信息

parent 3e92581b
......@@ -25,11 +25,20 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{
try
{
if (!exdict.ContainsKey(ExDataDict.AccountingBasic))
exdict.Add(ExDataDict.AccountingBasic, new List<Account>());
var accountingUnits = new List<Account>();
if (data != null && data is List<per_dept_dic> departments && departments.Any())
{
logger.LogInformation("4.1所有系统科室: " + JsonHelper.Serialize(departments));
int dataFirstRowNum = point.DataFirstRowNum.Value;
var accountingUnits = departments.Select(t => new Account
accountingUnits = departments.Select(t => new Account
{
UnitType = t.UnitType.NoBlank(),
AccountingUnit = t.AccountingUnit.NoBlank()
......@@ -39,12 +48,12 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
accountingUnits = accountingUnits.Where(t => !t.AccountingUnit.Contains("非核算"))?.ToList();
if (accountingUnits == null || !accountingUnits.Any()) return;
if (accountingUnits != null && accountingUnits.Any())
WriteAccountingUnitDataNonexistent(sheet, point, style, accountingUnits, tuples);
}
logger.LogInformation("4.1所有科室: " + JsonHelper.Serialize(accountingUnits));
WriteAccountingUnitDataNonexistent(sheet, point, style, accountingUnits, tuples);
var accountBasic = new List<Account>();
for (int i = point.DataFirstRowNum.Value; i < sheet.LastRowNum + accountingUnits.Count + 1; i++)
......@@ -59,7 +68,11 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
});
}
exdict.Add(ExDataDict.AccountingBasic, accountBasic);
exdict[ExDataDict.AccountingBasic] = accountBasic;
}
catch (Exception ex)
{
logger.LogError("4.1所有科室被获取时发生异常:" + ex.ToString());
}
}
......
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