Commit 560f4bda by lcx

补充科室信息

parent 6c6049b7
......@@ -398,7 +398,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
}
if (rowDatas == null || !rowDatas.Any())
rowDatas = GetAccountExtra(allot, sheet.SheetType.Value);
rowDatas = GetAccountExtra(allot, sheet.SheetType.Value, sheetName);
rowDatas?.RemoveAll(t => !t.CellData.Any(w => !string.IsNullOrEmpty(w.Value?.ToString())));
if (rowDatas != null && rowDatas.Any())
......@@ -534,6 +534,113 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType)
return handsonRows;
}
private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType, string sheetName)
{
List<HandsonRowData> handsonRows = new List<HandsonRowData>();
var unitTypes = new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.护理组.ToString(), UnitType.特殊核算组.ToString() };
var departments = perforPerdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId && unitTypes.Contains(t.UnitType) && !string.IsNullOrEmpty(t.Department) && t.Department.Replace("无", "").Replace("/", "").Trim() != "");
if (departments == null || !departments.Any()) return handsonRows;
var data = departments.GroupBy(t => t.Department).Select(t => new
{
Department = t.Key,
AccountingUnitDoctor = GetAccountingUnit(t.FirstOrDefault(group => group.Source == "门诊" && group.UnitType == UnitType.医生组.ToString())?.AccountingUnit,
t.FirstOrDefault(group => group.Source == "住院" && group.UnitType == UnitType.医生组.ToString())?.AccountingUnit),
AccountingUnitTechnician = GetAccountingUnit(t.FirstOrDefault(group => group.Source == "门诊" && group.UnitType == UnitType.医技组.ToString())?.AccountingUnit,
t.FirstOrDefault(group => group.Source == "住院" && group.UnitType == UnitType.医技组.ToString())?.AccountingUnit),
AccountingUnitNurse = GetAccountingUnit(t.FirstOrDefault(group => group.Source == "门诊" && group.UnitType == UnitType.护理组.ToString())?.AccountingUnit,
t.FirstOrDefault(group => group.Source == "住院" && group.UnitType == UnitType.护理组.ToString())?.AccountingUnit),
AccountingUnitSpecial = t.FirstOrDefault(group => group.UnitType == UnitType.特殊核算组.ToString())?.Department
}).OrderBy(t => t.Department).ToList();
int rownumber;
switch (sheetType)
{
case (int)SheetType.OtherIncome:
data = data.Where(t => string.IsNullOrEmpty(t.AccountingUnitSpecial))?.ToList();
if (data != null && data.Any())
{
rownumber = 0;
foreach (var item in data)
{
List<HandsonCellData> handsonCells = new List<HandsonCellData>();
handsonCells.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnitTechnician));
handsonCells.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnitDoctor));
handsonCells.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnitNurse));
handsonCells.Add(new HandsonCellData("科室名称", item.Department));
handsonRows.Add(new HandsonRowData(rownumber, handsonCells));
rownumber++;
}
}
break;
case (int)SheetType.SpecialUnit:
var specials = data.Where(t => !string.IsNullOrEmpty(t.AccountingUnitSpecial)).Select(t => t.AccountingUnitSpecial);
if (specials != null && specials.Any())
{
rownumber = 0;
foreach (var item in specials)
{
List<HandsonCellData> handsonCells = new List<HandsonCellData>();
handsonCells.Add(new HandsonCellData("科室名称", item));
handsonRows.Add(new HandsonRowData(rownumber, handsonCells));
rownumber++;
}
}
break;
case int type when type == (int)SheetType.Workload && sheetName.Contains("医生"):
data = data.Where(t => string.IsNullOrEmpty(t.AccountingUnitSpecial) && (!string.IsNullOrEmpty(t.AccountingUnitDoctor) || !string.IsNullOrEmpty(t.AccountingUnitTechnician)))?.ToList();
if (data != null && data.Any())
{
rownumber = 0;
foreach (var item in data)
{
List<HandsonCellData> handsonCells = new List<HandsonCellData>();
handsonCells.Add(new HandsonCellData("核算单元", GetAccountingUnit(item.AccountingUnitDoctor, item.AccountingUnitTechnician)));
handsonCells.Add(new HandsonCellData("科室名称", item.Department));
handsonRows.Add(new HandsonRowData(rownumber, handsonCells));
rownumber++;
}
}
break;
case int type when type == (int)SheetType.Workload && sheetName.Contains("护理"):
data = data.Where(t => string.IsNullOrEmpty(t.AccountingUnitSpecial) && !string.IsNullOrEmpty(t.AccountingUnitNurse))?.ToList();
if (data != null && data.Any())
{
rownumber = 0;
foreach (var item in data)
{
List<HandsonCellData> handsonCells = new List<HandsonCellData>();
handsonCells.Add(new HandsonCellData("核算单元", item.AccountingUnitNurse));
handsonCells.Add(new HandsonCellData("科室名称", item.Department));
handsonRows.Add(new HandsonRowData(rownumber, handsonCells));
rownumber++;
}
}
break;
}
return handsonRows;
}
private string GetAccountingUnit(params string[] account)
{
if (account == null || !account.Any()) return "";
return account.FirstOrDefault(t => !string.IsNullOrEmpty(t?.Trim()));
}
private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictionary<string, object> dic)
{
var setdata = from cfg in columns
......
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