Работа над журналом для ст. мед сестер

This commit is contained in:
brusnitsyn
2026-05-04 17:11:16 +09:00
parent f107ebd167
commit 7a58812072
61 changed files with 3532 additions and 1163 deletions

View File

@@ -17,10 +17,28 @@ use Illuminate\Support\Facades\Log;
class AutoReportService
{
public function __construct(
protected ReportService $reportService,
protected DateRangeService $dateRangeService,
protected ReportSavePathService $reportSavePathService,
) {}
mixed $dateRangeService = null,
mixed $reportSavePathService = null,
?ReportSavePathService $legacyReportSavePathService = null,
) {
if ($dateRangeService instanceof ReportService) {
$this->dateRangeService = $reportSavePathService instanceof DateRangeService
? $reportSavePathService
: app(DateRangeService::class);
$this->reportSavePathService = $legacyReportSavePathService ?? app(ReportSavePathService::class);
return;
}
$this->dateRangeService = $dateRangeService instanceof DateRangeService
? $dateRangeService
: app(DateRangeService::class);
$this->reportSavePathService = $reportSavePathService ?? app(ReportSavePathService::class);
}
protected DateRangeService $dateRangeService;
protected ReportSavePathService $reportSavePathService;
/**
* Заполнить отчеты для пользователя за период
@@ -34,16 +52,11 @@ class AutoReportService
): int {
$createdCount = 0;
// Для многодневного диапазона расширяем конец на 1 день,
// чтобы покрыть последние сутки (07:00 -> 07:00) целиком.
$start = \Carbon\Carbon::createFromFormat('Y-m-d', $startDate, 'Asia/Yakutsk');
$end = \Carbon\Carbon::createFromFormat('Y-m-d', $endDate, 'Asia/Yakutsk');
$periodEnd = $start->equalTo($end)
? $end->copy()
: $end->copy()->addDay();
// Создаем период по дням
$period = CarbonPeriod::create($start->toDateString(), $periodEnd->toDateString());
$period = CarbonPeriod::create($start->toDateString(), $end->toDateString());
foreach ($period as $date) {
$dateRange = $this->dateRangeService->getNormalizedDateRange($user, $date, $date);