Commit 235e54d3 by 纪旭 韦

Merge branch 'develop' into feature/绩效发放

# Conflicts:
#	performance/Performance.Services/ComputeService.cs
parents 439f4778 a19c74c2
...@@ -38,7 +38,6 @@ public class TemplateController : Controller ...@@ -38,7 +38,6 @@ public class TemplateController : Controller
private readonly AllotService allotService; private readonly AllotService allotService;
private readonly LogManageService logService; private readonly LogManageService logService;
private readonly IServiceScopeFactory serviceScopeFactory; private readonly IServiceScopeFactory serviceScopeFactory;
private readonly IBackgroundTaskQueue _backgroundTaskQueue;
private readonly ExtractService extractService; private readonly ExtractService extractService;
public TemplateController( public TemplateController(
...@@ -53,7 +52,6 @@ public class TemplateController : Controller ...@@ -53,7 +52,6 @@ public class TemplateController : Controller
HospitalService hospitalService, HospitalService hospitalService,
AllotService allotService, AllotService allotService,
LogManageService logService, LogManageService logService,
IBackgroundTaskQueue backgroundTaskQueue,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
ExtractService extractService) ExtractService extractService)
{ {
...@@ -69,7 +67,6 @@ public class TemplateController : Controller ...@@ -69,7 +67,6 @@ public class TemplateController : Controller
this.allotService = allotService; this.allotService = allotService;
this.logService = logService; this.logService = logService;
this.serviceScopeFactory = serviceScopeFactory; this.serviceScopeFactory = serviceScopeFactory;
_backgroundTaskQueue = backgroundTaskQueue;
this.extractService = extractService; this.extractService = extractService;
} }
...@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
{ {
logger.LogInformation("同一项目中进行提取"); logger.LogInformation("同一项目中进行提取");
_backgroundTaskQueue.QueueBackgroundWorkItem(async token => Task.Run(() =>
{ {
Thread.Sleep(1000);
using (var scope = serviceScopeFactory.CreateScope()) using (var scope = serviceScopeFactory.CreateScope())
{ {
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>(); var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
......
...@@ -2001,8 +2001,12 @@ private decimal GetDecimal(decimal? value, decimal _ = 0) ...@@ -2001,8 +2001,12 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
/// <returns></returns> /// <returns></returns>
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ {
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId && t.Route.Equals(route, StringComparison.OrdinalIgnoreCase)); var init = new List<cof_alias>();
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId) ?? new List<cof_alias>();
alias = alias.Where(t => t.Route.Equals(route, StringComparison.OrdinalIgnoreCase)).OrderBy(w => w.Id).ToList() ?? new List<cof_alias>();
if (alias == null || alias.Count == 0)
{
var pairs = new Dictionary<string, List<cof_alias>> var pairs = new Dictionary<string, List<cof_alias>>
{ {
{ "/result/compute" , ComputeConfig.AllComputeView }, { "/result/compute" , ComputeConfig.AllComputeView },
...@@ -2013,12 +2017,7 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) ...@@ -2013,12 +2017,7 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate }, { "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate },
{ "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate }, { "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate },
}; };
var init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>(); init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
foreach (var item in init)
{
item.HospitalId = hospitalId;
item.Route = route;
item.OriginalName = item.Alias;
} }
if (alias != null && alias.Count > 0) if (alias != null && alias.Count > 0)
......
...@@ -209,11 +209,12 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri ...@@ -209,11 +209,12 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
if (dynamics != null && dynamics.Count() > 0) if (dynamics != null && dynamics.Count() > 0)
{ {
worksheet.SetValue(1, 1, $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}");
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys; var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
{ {
worksheet.SetValue(1, col + 1, headList[col].Alias); worksheet.SetValue(2, col + 1, headList[col].Alias);
} }
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
{ {
...@@ -223,24 +224,36 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri ...@@ -223,24 +224,36 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
var temp = (IDictionary<string, object>)data; var temp = (IDictionary<string, object>)data;
var value = temp[headList[col].Name]; var value = temp[headList[col].Name];
worksheet.Cells[row + 2, col + 1].Value = value; worksheet.Cells[row + 3, col + 1].Value = value;
} }
if (col == 0) if (col == 0)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计"); worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计");
else else
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address); worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address);
} }
}
worksheet.View.FreezePanes(2, 1); #region 样式设置
for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++) for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++)
{ {
worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++) for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{ {
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin); worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00"; worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
} }
} }
worksheet.Cells[1, 1, 1, headList.Count].Merge = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
worksheet.Cells[1, 1, 1, headList.Count].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Bold = true;
worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Size = 16;
worksheet.Row(1).Height = 24;
worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true;
worksheet.View.FreezePanes(3, 1);
worksheet.Cells.AutoFitColumns();
#endregion
}
package.Save(); package.Save();
} }
return filepath; return filepath;
......
...@@ -52,6 +52,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -52,6 +52,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
pairs.Add(workbook.GetSheetAt(i).SheetName, i); pairs.Add(workbook.GetSheetAt(i).SheetName, i);
} }
try
{
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
...@@ -60,34 +62,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -60,34 +62,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
string[] keyArray = new string[] { "开单", "就诊", "执行" }; string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key))) if (keyArray.Any(key => module.ModuleName.Contains(key)))
{ {
var item = pairs.Where(t => t.Key.StartsWith("1.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
} }
} }
} }
foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess } foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
if (sheet == null) if (sheet == null)
{ {
//string key = "工作量"; var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First();
//if (module.ModuleName.Contains(key))
//{
var item = pairs.Where(t => t.Key.StartsWith("3.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point; var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
ClearSheetTemplate(newSheet, point, (SheetType)module.SheetType); ClearSheetTemplate(newSheet, point, (SheetType)module.SheetType);
//}
} }
} }
} }
catch
{
}
}
public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, SheetType sheetType) public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, SheetType sheetType)
{ {
......
...@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id)) if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id))
{ {
factors = factors.Where(t => t.ExModuleId == module.Id).ToList(); factors = factors.Where(t => t.ExModuleId == module.Id).ToList();
categories = categories.Union(factors.Select(t => t.Charge)).Distinct(); // categories = categories.Union(factors.Select(t => t.Charge)).Distinct();
headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer }) headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer })
.Select(t => new ExcelHeader .Select(t => new ExcelHeader
{ {
......
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