Подготовка к переводу на MV

This commit is contained in:
brusnitsyn
2026-05-04 22:24:11 +09:00
parent 82673f385b
commit 51a4b5b9de
3 changed files with 44 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ class ReportService
?ReportMetadataReadService $reportMetadataReadService = null,
?ReportSaveOrchestrator $reportSaveOrchestrator = null,
?ReportRuntimeService $reportRuntimeService = null,
protected MetrikaService $metrikaService
) {
$this->autoFillReportPayloadBuilder = $autoFillReportPayloadBuilder ?? app(AutoFillReportPayloadBuilder::class);
$this->reportPatientsReadService = $reportPatientsReadService ?? app(ReportPatientsReadService::class);
@@ -289,4 +290,24 @@ class ReportService
{
return $this->reportMetadataReadService->getRecipientPlanOfYear($department, $dateRange);
}
public function getReportInfo(User $user, Department $department, DateRange $dateRange)
{
$report = $this->resolveReport($department->department_id, $dateRange);
$metrics = $this->metrikaService->getMetricsForReport($report);
}
private function resolveReport(int $departmentId, DateRange $dateRange)
{
$query = Report::query()
->where('rf_department_id', $departmentId)
->exactPeriod($dateRange->startSql(), $dateRange->endSql())
->orderByDesc('report_id');
if ($dateRange->isOneDay) {
return $query->first();
}
return $query->onlySubmitted()->first();
}
}