Commit 417dcd4e by ruyun.zhang

科室大屏绩效发放占比支持核算组别

parent 8b6a7ec3
......@@ -10,7 +10,7 @@ namespace Performance.Api
{
public class PerformanceQuery : ObjectGraphType
{
public PerformanceQuery(GraphQLService service, ClaimService claimService, PerforUserRepository userRepository)
public PerformanceQuery(GraphQLService service, ClaimService claimService)
{
Field<ListGraphType<ReportDataType>>("info",
resolve: context =>
......@@ -60,16 +60,8 @@ public PerformanceQuery(GraphQLService service, ClaimService claimService, Perfo
: 0;
var parameters = GetDynamicParameters(context.Arguments, QueryParams.hospitalId, QueryParams.year, QueryParams.month, QueryParams.accountingUnit, QueryParams.category, QueryParams.itemName);
var userId = claimService.GetUserId();
var userInfo = userRepository.GetUser(userId);
if (userInfo?.URole != null)
{
var unitTypes = UnitTypeUtil.GetMaps(userInfo?.URole.Type ?? 0);
if (unitTypes.Any())
parameters.Add("unittype", unitTypes);
}
return service.GetReportPerformance(reportId, parameters);
return service.GetReportPerformance(reportId, parameters, userId);
}
);
}
......
......@@ -16,18 +16,20 @@ public class GraphQLService : IAutoInjection
private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforRepreportRepository repreportRepository;
private readonly PerforReportperformanceRepository reportperformanceRepository;
private readonly PerforUserRepository _userRepository;
public GraphQLService(
ILogger<GraphQLService> logger,
PerforPeremployeeRepository peremployeeRepository,
PerforRepreportRepository repreportRepository,
PerforReportperformanceRepository reportperformanceRepository
)
PerforReportperformanceRepository reportperformanceRepository,
PerforUserRepository userRepository)
{
this.logger = logger;
this.peremployeeRepository = peremployeeRepository;
this.repreportRepository = repreportRepository;
this.reportperformanceRepository = reportperformanceRepository;
_userRepository = userRepository;
}
public List<ReportData> GetReportsInfo()
......@@ -74,7 +76,7 @@ public List<ChartData> GetChartData(int reportId, DynamicParameters parameters)
}
}
public List<ReportTable> GetReportPerformance(int reportId, DynamicParameters parameters)
public List<ReportTable> GetReportPerformance(int reportId, DynamicParameters parameters, int userId)
{
if (reportId == 0) return new List<ReportTable>();
......@@ -86,6 +88,14 @@ public List<ReportTable> GetReportPerformance(int reportId, DynamicParameters pa
var sql = report.Content.ToLower();
string where = GetQueryCondition(sql, parameters);
sql = sql.Replace("{wh}", where);
// 在科室查看报表ID=50时,明确指明需要使用unittype字段时起效,防止{wh}错误带入
var userInfo = _userRepository.GetUser(userId);
if (userInfo?.URole != null)
{
var unitTypes = UnitTypeUtil.GetMaps(userInfo?.URole.Type ?? 0);
if (unitTypes.Any())
parameters.Add("unittype", unitTypes);
}
var chartData = repreportRepository.DapperQuery<ReportTable>(sql, parameters, 60 * 5);
......
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