Commit f636c8e4 by lcx

添加performances方法

parent 02316f54
......@@ -46,13 +46,14 @@ public PerformanceQuery(GraphQLService service)
);
Field<ListGraphType<ReportPerformanceType>>("performances",
arguments: new QueryArguments
(
new QueryArgument<StringGraphType>() { Name = QueryParams.category }
),
arguments: Arguments(),
resolve: context =>
{
return new List<EntityModels.report_performance>();
int reportId = context.Arguments.ContainsKey(QueryParams.reportId)
? ConvertHelper.To<int>(context.Arguments[QueryParams.reportId])
: 0;
var parameters = GetDynamicParameters(context.Arguments, QueryParams.hospitalId, QueryParams.year, QueryParams.month);
return service.GetReportPerformance(reportId, parameters);
}
);
}
......
......@@ -69,9 +69,31 @@ public List<ChartData> GetChartData(int reportId, DynamicParameters parameters)
}
catch (Exception ex)
{
logger.LogError("获取报表数据异常: " + ex.ToString());
logger.LogError("GetChartData获取报表数据异常: " + ex.ToString());
return new List<ChartData>();
}
}
public List<report_performance> GetReportPerformance(int reportId, DynamicParameters parameters)
{
if (reportId == 0) return new List<report_performance>();
try
{
var report = repreportRepository.GetEntity(t => t.ID == reportId);
if (report == null || string.IsNullOrEmpty(report.Content)) return new List<report_performance>();
var sql = report.Content.ToLower();
var chartData = repreportRepository.DapperQuery<report_performance>(sql, parameters);
return chartData != null && chartData.Any() ? chartData.ToList() : new List<report_performance>();
}
catch (Exception ex)
{
logger.LogError("GetReportPerformance获取报表数据异常: " + ex.ToString());
return new List<report_performance>();
}
}
}
}
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