临洮提取

parent 04be0535
......@@ -2165,6 +2165,11 @@
<param name="query"></param>
<returns></returns>
</member>
<member name="T:Performance.Api.ClearLoggerJob">
<summary>
删除历史日志
</summary>
</member>
<member name="T:Performance.Api.ExpirationLimitMiddleware">
<summary>
过期限制
......
......@@ -91,13 +91,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取HIS数据", isSingle: isSingle);
var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hisScrips == null || !hisScrips.Any()) return;
foreach (var item in hisScrips)
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取{item.SourceType} - {item.Category}数据", isSingle: isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取HIS数据完成", isSingle: isSingle);
}
catch (Exception)
{
......@@ -227,10 +230,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
}
}
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, bool isSingle)
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, string groupName, bool isSingle)
{
try
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”数据", isSingle: isSingle);
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
......@@ -259,10 +264,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
CreateTime = DateTime.Now,
});
hisdataRepository.AddRange(insertData.ToArray());
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”完成", isSingle: isSingle);
}
catch (Exception ex)
{
logger.LogError("获取his_data时发生异常:" + ex.ToString());
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL错误", $"获取HIS数据“{script.SourceType} - {script.Category}”时发生异常", 3, isSingle);
}
}
......
......@@ -159,7 +159,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
if (rowIndex >= dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
......
......@@ -106,10 +106,13 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
logService.ReturnTheLog(allotId, groupName, 2, "提取数据", $"开始格式化数据", 1, isSingle);
var standData = StandDataFormat(hospitalId, data);
logService.ReturnTheLog(allotId, groupName, 2, "提取数据", $"格式化完成", 1, isSingle);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "准备写入", $"数据提取结束准备写入", 1, isSingle);
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
......
......@@ -421,11 +421,19 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
}
logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 20000);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
try
{
logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 60 * 60 * 5);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result;
}
catch (Exception ex)
{
logger.LogError($"SQL发生异常:{execsql};{ ex }");
throw;
}
return result;
}
/// <summary>
......
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