Commit 72a97144 by lcx

提取bug修改

parent 3dd3d5a8
......@@ -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 filed = new Dictionary<string, Func<ExtractTransDto, string>>();
var filed = fieldOut;
if (sheetType == SheetType.Income)
{
if (sheet.SheetName.Contains("住院") || sheet.SheetName.Contains("门诊"))
filed = sheet.SheetName.Contains("住院") ? fieldInpat : fieldOut;
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;
}
else if (sheet.SheetName.Contains("工作量"))
......
......@@ -106,17 +106,18 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
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);
if (workbook == null) throw new PerformanceException("文件读取失败");
if (workbook == null) throw new Exception("文件读取失败");
WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
allot.IsExtracting = isSingle ? 2 : 0;
allot.ExtractPath = extractFilePath;
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"写入数据至Excel文件", 1, isSingle);
workbook.EvaluateAll();
using (FileStream file = new FileStream(extractFilePath, FileMode.OpenOrCreate))
{
......@@ -133,6 +134,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
finally
{
logService.ReturnTheLog(allotId, groupName, 3, "", 100, 5, isSingle);
if (allot.IsExtracting != 3)
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
UpdateAllot(connection, allot);
}
return extractFilePath;
......
......@@ -272,7 +272,8 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
{
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
{
......@@ -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);
}
}
......@@ -336,7 +341,8 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
{
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue;
try
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
if (querydata != null && querydata.Any())
{
......@@ -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);
}
......
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