微调

parent 392c418e
...@@ -70,12 +70,12 @@ public ApiResponse Search([FromBody] SearchReportRequest report) ...@@ -70,12 +70,12 @@ public ApiResponse Search([FromBody] SearchReportRequest report)
if (report.Values == null || !report.Values.Any()) if (report.Values == null || !report.Values.Any())
return new ApiResponse(ResponseType.OK, new List<ReportData>()); return new ApiResponse(ResponseType.OK, new List<ReportData>());
string[] keys = new string[] { "year", "month", }; //string[] keys = new string[] { "year", "month", };
foreach (var item in report.Values.Where(t => keys.Contains(t.Title))) //foreach (var item in report.Values.Where(t => keys.Contains(t.Title)))
{ //{
if (item.Values == null || !item.Values.Any(t => !string.IsNullOrEmpty(t))) // if (item.Values == null || !item.Values.Any(t => !string.IsNullOrEmpty(t)))
return new ApiResponse(ResponseType.OK, new List<ReportData>()); // return new ApiResponse(ResponseType.OK, new List<ReportData>());
} //}
var userId = claimService.GetUserId(); var userId = claimService.GetUserId();
var result = reportDataService.GetReportData(report.HospitalId, report.GroupId, report.ReportId, report.Values ?? new List<SelectionValues>(), userId); var result = reportDataService.GetReportData(report.HospitalId, report.GroupId, report.ReportId, report.Values ?? new List<SelectionValues>(), userId);
......
...@@ -142,8 +142,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId, ...@@ -142,8 +142,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
List<ReportData> result = new List<ReportData>(); List<ReportData> result = new List<ReportData>();
foreach (var report in reports) foreach (var report in reports)
{ {
var sql = report.Content.ToLower(); var sql = report.Content;
//不重复条件,动态拼接WHERE条件 //不重复条件,动态拼接WHERE条件
string @where = ""; string @where = "";
if (selections != null && selections.Any()) if (selections != null && selections.Any())
...@@ -168,6 +167,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId, ...@@ -168,6 +167,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
{ {
sql = Regex.Replace(sql, item.Key, item.Value.ToString(), RegexOptions.IgnoreCase); sql = Regex.Replace(sql, item.Key, item.Value.ToString(), RegexOptions.IgnoreCase);
} }
logger.LogInformation($"报表SQL语句:{sql}");
// 执行SQL // 执行SQL
var chartData = reportRepository.DapperQuery<ChartData>(sql, null); var chartData = reportRepository.DapperQuery<ChartData>(sql, null);
...@@ -307,7 +307,7 @@ private string AddSelectionToReportTitle(List<rep_selection> selections, List<Se ...@@ -307,7 +307,7 @@ private string AddSelectionToReportTitle(List<rep_selection> selections, List<Se
foreach (var key in keys1) foreach (var key in keys1)
{ {
var list = values.FirstOrDefault(w => w.Title.ToLower() == key)?.Values; var list = values.FirstOrDefault(w => w.Title.ToLower() == key)?.Values;
if (list != null && list.Any()) if (list != null && list.Any(w => !string.IsNullOrEmpty(w)))
{ {
var arr = Array.ConvertAll(list.ToArray(), input => int.Parse(input)); var arr = Array.ConvertAll(list.ToArray(), input => int.Parse(input));
pairs.Add(key, arr.Max()); pairs.Add(key, arr.Max());
......
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