Commit 8d57d416 by lcx

绩效抽取数据文件名称错误、运营分析获取科室的数据

parent 5993b6ad
...@@ -13,13 +13,13 @@ namespace Performance.Services.ExtractExcelService ...@@ -13,13 +13,13 @@ namespace Performance.Services.ExtractExcelService
{ {
public class ExtractHelper public class ExtractHelper
{ {
public static string GetExtractFile(int hospitalId, ref string newFilePath, string allotFilePath = "") public static string GetExtractFile(int hospitalId, per_allot allot, ref string newFilePath, string allotFilePath = "")
{ {
string originalPath = string.IsNullOrEmpty(allotFilePath) string originalPath = string.IsNullOrEmpty(allotFilePath)
? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template", "医院绩效模板.xlsx") ? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template", "医院绩效模板.xlsx")
: allotFilePath; : allotFilePath;
CloseAutoFilter(originalPath); CloseAutoFilter(originalPath);
var (tempPath, filePath) = CopyOriginalFile(hospitalId, originalPath); var (tempPath, filePath) = CopyOriginalFile(hospitalId, originalPath, allot);
newFilePath = filePath; newFilePath = filePath;
return tempPath; return tempPath;
} }
...@@ -31,14 +31,14 @@ public static string GetExtractFile(int hospitalId, string prefix = "绩效提 ...@@ -31,14 +31,14 @@ public static string GetExtractFile(int hospitalId, string prefix = "绩效提
return Path.Combine(dpath, $"{prefix}{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx"); return Path.Combine(dpath, $"{prefix}{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx");
} }
private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalId, string originalPath) private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalId, string originalPath, per_allot allot)
{ {
var ext = FileHelper.GetExtension(originalPath); var ext = FileHelper.GetExtension(originalPath);
var dpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files", $"{hospitalId}", "autoextract"); var dpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files", $"{hospitalId}", "autoextract");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}"); string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
FileHelper.Copy(originalPath, tempPath); FileHelper.Copy(originalPath, tempPath);
string filePath = Path.Combine(dpath, $"绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}"); string filePath = Path.Combine(dpath, $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
return (tempPath, filePath); return (tempPath, filePath);
} }
......
...@@ -96,11 +96,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -96,11 +96,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }; var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, 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);
extractFilePath = $"{allot.Year}_{allot.Month}_" + extractFilePath;
if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败"); if (!FileHelper.IsExistFile(templateFilePath)) throw new PerformanceException("抽取文件创建失败");
workbook = ExcelHelper.GetWorkbook(templateFilePath); workbook = ExcelHelper.GetWorkbook(templateFilePath);
......
...@@ -427,11 +427,9 @@ public SheetExportResponse Operation(ReportRequest request) ...@@ -427,11 +427,9 @@ public SheetExportResponse Operation(ReportRequest request)
if (years == null || !years.Any()) return sheet; if (years == null || !years.Any()) return sheet;
string sql = $"select * from view_operation_report_result where hospitalid = @hospitalid and year in @year"; string sql = $"select * from view_operation_report_result where hospitalid = @hospitalid and year in @year and accountingunit in @accountingunit";
if (request.AccountingUnit != null && request.AccountingUnit.Any()) if (request.AccountingUnit == null || !request.AccountingUnit.Any())
{ request.AccountingUnit = new string[] { "全院运营分析" };
sql += " and accountingunit in @accountingunit";
}
var data = perforReportRepository.DapperQuery<view_operation_report_result>(sql, new { hospitalId = request.HospitalId, year = years, accountingunit = request.AccountingUnit })?.ToList(); var data = perforReportRepository.DapperQuery<view_operation_report_result>(sql, new { hospitalId = request.HospitalId, year = years, accountingunit = request.AccountingUnit })?.ToList();
......
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