Commit f4f9fa75 by lcx

Merge branch 'develop20211216' into develop

parents 2fae6b6d 72a97144
...@@ -197,14 +197,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s ...@@ -197,14 +197,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{ {
var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList(); var departments = data.Select(s => s.Department ?? "")/*.Where(w => !string.IsNullOrEmpty(w))*/.Distinct().ToList();
var filed = new Dictionary<string, Func<ExtractTransDto, string>>(); var filed = fieldOut;
if (sheetType == SheetType.Income) if (sheetType == SheetType.Income)
{ {
if (sheet.SheetName.Contains("住院") || sheet.SheetName.Contains("门诊")) if (sheet.SheetName.Contains("住院") || sheet.SheetName.Contains("门诊"))
filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut; filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut;
var ename = data.Where(w => w.SheetName == sheet.SheetName)?.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName; var ename = data.Where(w => w.SheetName == sheet.SheetName)?.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName;
if (ename.Contains("住院") || ename.Contains("门诊")) if (string.IsNullOrEmpty(ename) || ename.Contains("住院") || ename.Contains("门诊"))
filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat; filed = ename.Contains("住院") ? fieldInpatOut : fieldOutInpat;
} }
else if (sheet.SheetName.Contains("工作量")) else if (sheet.SheetName.Contains("工作量"))
......
...@@ -115,17 +115,18 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -115,17 +115,18 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath); var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle); logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle);
if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败"); if (!FileHelper.IsExistFile(templateFilePath)) throw new Exception("抽取文件创建失败");
workbook = ExcelHelper.GetWorkbook(templateFilePath); workbook = ExcelHelper.GetWorkbook(templateFilePath);
if (workbook == null) throw new PerformanceException("文件读取失败"); if (workbook == null) throw new Exception("文件读取失败");
WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle); WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
allot.IsExtracting = isSingle ? 2 : 0; allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath; allot.ExtractPath = extractFilePath;
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"写入数据至Excel文件", 1, isSingle);
workbook.EvaluateAll(); workbook.EvaluateAll();
using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate)) using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate))
{ {
...@@ -142,6 +143,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -142,6 +143,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
finally finally
{ {
logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle);
if (allot.IsExtracting != 3)
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
UpdateAllot(connection, allot); UpdateAllot(connection, allot);
} }
return extractFilePath; return extractFilePath;
......
...@@ -272,7 +272,8 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -272,7 +272,8 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any()) if (querydata != null && querydata.Any())
{ {
...@@ -298,7 +299,11 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -298,7 +299,11 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
}); });
} }
} }
catch (Exception ex)
{
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisItems.Select(t => t.ItemName))}”的数据已完成提取", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisItems.Select(t => t.ItemName))}”的数据已完成提取", 1, isSingle);
} }
} }
...@@ -336,7 +341,8 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -336,7 +341,8 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any()) if (querydata != null && querydata.Any())
{ {
...@@ -361,6 +367,11 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -361,6 +367,11 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
}); });
} }
} }
catch (Exception ex)
{
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisSpecials.Select(t => t.Target))}”的数据已完成提取", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"项目“{string.Join("、", thisSpecials.Select(t => t.Target))}”的数据已完成提取", 1, isSingle);
} }
......
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