Commit d34e5db6 by 李承祥

特殊科室修改

parent afbd0054
......@@ -248,7 +248,7 @@ public string AlllotExecute(string email, per_allot lastAllot, sys_hospital hosp
break;
case SheetType.SpecialUnit:
ClearData(sheet, 2);
WriteSpecialUnit(sheet, sheetRead, configs, specials, extracts, false);
WriteSpecialUnit(sheet, sheetRead, configs, specials, extracts, false, lastAllot);
break;
}
}
......@@ -596,20 +596,24 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
#endregion
private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sys_hospitalconfig> configs, List<mod_special> specials, List<mod_extract> extracts, bool IsWriteHead = true)
private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sys_hospitalconfig> configs, List<mod_special> specials, List<mod_extract> extracts, bool IsWriteHead = true, per_allot lastAllot = null)
{
var dictionary = new Dictionary<string, Func<mod_special, List<ExtractDto>, object>>
var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>>
{
{ "科室", (special,lastAllot) => special.Department },
{ "人数", (special,lastAllot) => lastAllot.Where(t=>special.Department == t.Department).Sum(t=>t.Value) },
{ "量化指标", (special,lastAllot) => special.Target},
{ "量化指标绩效分值",(special,lastAllot) => special.TargetFactor },
{ "调节系数", (special,lastAllot) => special.AdjustFactor },
{ "科室", (special,lastallot) => special.Department },
{ "人数", (special,lastallot) => lastallot.Where(t=>special.Department == t.Department).Sum(t=>t.Number) },
{ "量化指标", (special,lastallot) => special.Target},
{ "量化指标绩效分值",(special,lastallot) => special.TargetFactor },
{ "调节系数", (special,lastallot) => special.AdjustFactor },
};
var speaialList = specials?.OrderBy(t => t.Department).ToList();
if (speaialList == null || !speaialList.Any()) return;
List<im_specialunit> allotDataList = new List<im_specialunit>();
if (lastAllot != null)
allotDataList = perforImspecialunitRepository.GetEntities(t => t.AllotID == lastAllot.ID);
//查询数据
var extractIdList = speaialList.Select(t => t.ExtractId).Distinct().ToList();
var extractList = extracts.Where(t => extractIdList.Contains(t.Id)).ToList();
......@@ -668,7 +672,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy
if (dictionary.ContainsKey(cell.StringCellValue))
{
var item = dictionary.First(t => t.Key == cell.StringCellValue);
value = item.Value.Invoke(speaialList[i], allExtract) ?? "";
value = item.Value.Invoke(speaialList[i], allotDataList) ?? "";
if (item.Key == "科室" && rowIndex == mergedBegin)
{
......@@ -676,6 +680,8 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy
mergedEnd = mergedBegin + count - 1;
}
}
if (cell.StringCellValue == "数量")
value = allExtract.FirstOrDefault(t => t.Category == speaialList[i].Target && t.Department == speaialList[i].Department)?.Value;
if (!new List<string> { "量化指标", "数量", "量化指标绩效分值" }.Contains(cell.StringCellValue) && rowIndex == mergedBegin)
{
......@@ -686,7 +692,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy
var newCell = importRow.CreateCell(cellIndex);
//newCell.SetCellValue(Verify(value));
OutToExcelCell(newCell, value);
if (dictionary.ContainsKey(cell.StringCellValue))
if (dictionary.ContainsKey(cell.StringCellValue) || cell.StringCellValue == "数量")
newCell.CellStyle = style;
cellIndex++;
......
......@@ -135,29 +135,29 @@ public string ExtractData(int allotId, string email, int hospitalId)
var sheetRead = PerSheetDataFactory.GetDataRead(sheetType);
switch (sheetType)
{
//case SheetType.Employee:
// if (allotLast != null)
// WriteEmployee(sheet, allotLast.ID, sheetRead);
// break;
//case SheetType.AccountBasic:
// if (allotLast != null)
// WriteAccountBasic(sheet, allotLast.ID, sheetRead);
// break;
case SheetType.Employee:
if (allotLast != null)
WriteEmployee(sheet, allotLast.ID, sheetRead);
break;
case SheetType.AccountBasic:
if (allotLast != null)
WriteAccountBasic(sheet, allotLast.ID, sheetRead);
break;
case SheetType.SpecialUnit:
WriteSpecialUnit(sheet, hospital.ID, allot, sheetRead, hospitalConfigList);
break;
//case SheetType.Income:
// WriteIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
// break;
//case SheetType.OtherIncome:
// WriteOtherIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
// break;
//case SheetType.Expend:
// WriteExpend(sheet, hospital.ID, sheetRead);
// break;
//case SheetType.Workload:
// WriteWorkload(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
// break;
case SheetType.Income:
WriteIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
case SheetType.OtherIncome:
WriteOtherIncome(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
case SheetType.Expend:
WriteExpend(sheet, hospital.ID, sheetRead);
break;
case SheetType.Workload:
WriteWorkload(sheet, hospital.ID, unitList, sheetRead, allot, modulesList, hospitalConfigList);
break;
}
}
using (FileStream file = new FileStream(newPath, FileMode.OpenOrCreate))
......
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