Commit 8a4db225 by lcx

抽取获取核算单元类型

parent e09100a7
......@@ -223,7 +223,10 @@ public string AlllotExecute(string email, sys_hospital hospital, List<sys_hospit
List<AccountUnitEntity> unitList = new List<AccountUnitEntity>();
if (lastAllot != null)
{
unitList = perforImdataRepository.GetAccountUnit(lastAllot.ID).ToList();
logger.LogInformation($"lastAllot.ID: {lastAllot.ID}, lastAllot date: {lastAllot.Year}-{lastAllot.Month}, unitList count: {unitList?.Count ?? 0}");
}
for (int i = 0; i < workbook.NumberOfSheets; i++)
{
......@@ -888,19 +891,19 @@ private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<Acco
var newCell = row.CreateCell(i);
if (headName.Replace("\n", "") == "核算单元(医生组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit ?? unitList.FirstOrDefault(t => t.SheetName != sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else if (headName.Replace("\n", "") == "核算单元(护理组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 2)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 2)?.AccountingUnit ?? unitList.FirstOrDefault(t => t.SheetName != sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
else if (headName.Replace("\n", "") == "核算单元(医技组)")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 3)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 3)?.AccountingUnit ?? unitList.FirstOrDefault(t => t.SheetName != sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
......@@ -1039,8 +1042,7 @@ private void WriteWorkData(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
var newCell = row.CreateCell(i);
if (headName == "核算单元")
{
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName
&& t.Department == department)?.AccountingUnit;
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department)?.AccountingUnit ?? unitList.FirstOrDefault(t => t.SheetName != sheet.SheetName && t.Department == department)?.AccountingUnit;
newCell.SetCellValue(dept ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
}
......
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