Commit 4e8ad3d1 by 李承祥

添加日志

parent 331719ba
......@@ -35,7 +35,7 @@ public ExtractRequestValidator()
{
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.HospitalId).NotNull().GreaterThan(0);
RuleFor(x => x.UseScheme).NotNull().InclusiveBetween(1, 2);
//RuleFor(x => x.UseScheme).NotNull().InclusiveBetween(1, 2);
}
}
}
......@@ -118,7 +118,7 @@ public void Index([FromBody]AllotRequest request)
public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
{
LogHelper.Information("请求参数:" + JsonHelper.Serialize(request), "提取绩效数据");
string filePath = newExtractService.ExtractData(request.AllotId, "", request.HospitalId);
string filePath = newExtractService.ExtractData(request.AllotId, request.Email, request.HospitalId);
LogHelper.Information("提取文件路径:" + filePath, "提取绩效数据");
if (!string.IsNullOrEmpty(filePath) && FileHelper.IsExistFile(filePath))
{
......
......@@ -179,6 +179,7 @@ public string ExtractData(int allotId, string email, int hospitalId)
{
workbook.Write(file);
}
LogHelper.Information($"{hospital.HosName}HIS数据提取成功,文件路径:{newPath}。", "提取绩效数据");
SendEmail(email, newPath, $"{hospital.HosName}HIS数据提取成功", $"{hospital.HosName}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}成功提取。");
return newPath;
}
......@@ -239,6 +240,8 @@ private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sh
var head = sheet.GetRow(sheetRead.Point.HeaderFirstRowNum.Value);
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
LogHelper.Information($"写入额外收入列头信息", "提取绩效数据");
//写入列头信息
foreach (var item in itemList)
{
......@@ -274,6 +277,7 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
var technicianFactor = sheet.GetRow(sheetRead.Point.AccountingUnit.First(t => t.UnitType == "医技组").FactorRow.Value);
var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value);
LogHelper.Information($"写入收入列头信息", "提取绩效数据");
//写入列头信息
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
foreach (var item in itemList)
......@@ -306,6 +310,8 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
if (result != null)
allExtract.AddRange(result);
}
LogHelper.Information($"填充收入数据", "提取绩效数据");
//写入数据
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1;
foreach (var department in allExtract.Select(t => t.Department).Distinct())
......@@ -393,6 +399,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 0);
var factor = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 1);
LogHelper.Information($"写入工作量列头信息", "提取绩效数据");
//写入列头信息
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 2;
foreach (var item in itemList)
......@@ -430,6 +437,8 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
{
specialHead = itemList.Select(t => t.ItemName).Intersect(extractHead.Distinct())?.ToList();
}
LogHelper.Information($"填充工作量数据", "提取绩效数据");
//写入数据
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 2;
foreach (var department in allExtract.Select(t => t.Department).Distinct())
......@@ -465,6 +474,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
private List<ExtractDto> QueryDatabase(List<sys_hospitalconfig> hospitalConfigList, mod_extract extract, per_allot allot, string category = null)
{
LogHelper.Information($"执行SQL脚本获取数据,", "提取绩效数据");
var config = hospitalConfigList.FirstOrDefault(t => t.Type == extract.SourceType);
var parameters = GetParameters(allot);
using (var connection = ConnectionBuilder.Create(DatabaseType.SqlServer, config.DbSource, config.DbName, config.DbUser, config.DbPassword))
......@@ -473,6 +483,7 @@ private List<ExtractDto> QueryDatabase(List<sys_hospitalconfig> hospitalConfigLi
{
extract.ExecuteScript = Regex.Replace(extract.ExecuteScript, item.Key, item.Value, RegexOptions.IgnoreCase);
}
LogHelper.Information($"SQL脚本{extract.ExecuteScript},", "提取绩效数据");
var result = connection.Query<ExtractDto>(extract.ExecuteScript, commandTimeout: 20000);
if (result != null && result.Count() > 0)
......@@ -502,6 +513,8 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
var head = sheet.GetRow(sheetRead.Point.HeaderFirstRowNum.Value);
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
LogHelper.Information($"写入成本支出列头信息", "提取绩效数据");
//写入列头信息
foreach (var item in itemList)
{
......@@ -538,6 +551,7 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充人员信息,", "提取绩效数据");
var dictionary = new Dictionary<string, Func<im_employee, object>>
{
{ "核算单元", (t) => t.AccountingUnit },
......@@ -577,6 +591,7 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充特殊核算单元绩效测算表,", "提取绩效数据");
var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>>
{
{ "科室", (special,lastAllot) => special.Department },
......@@ -656,6 +671,7 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast,
private void WriteAccountBasic(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充临床科室医护绩效测算表,", "提取绩效数据");
var dictionary = new Dictionary<string, Func<im_accountbasic, object>>
{
{ "核算单元类型", (t) => t.UnitType },
......
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