Commit e61d2e75 by zry

Merge branch 'feature/dongfang' of http://192.168.18.110:8880/zry/performance into feature/dongfang

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