Профиль хирургии

This commit is contained in:
brusnitsyn
2026-03-25 17:37:32 +09:00
parent 52a80ccd3b
commit f566ab96df
75 changed files with 3841 additions and 1009 deletions

View File

@@ -45,7 +45,7 @@ class ReportController extends Controller
$endDateCarbon = Carbon::now();
// Определяем даты в зависимости от роли
[$startDate, $endDate] = $this->dateService->getDateRangeForUser($user, $request->query('startAt'), $request->query('endAt'));
[$startDate, $endDate] = $this->dateRangeService->getDateRangeForUser($user, $request->query('startAt'), $request->query('endAt'));
if (Carbon::parse($startDate)->isValid()) {
$startDateCarbon = Carbon::parse($startDate)->setTimeZone('Asia/Yakutsk');
}
@@ -737,12 +737,16 @@ class ReportController extends Controller
if ($isHeadOrAdmin) {
// Заведующий: используем whereInDepartment
$query = MisMigrationPatient::whereInDepartment($branchId)
->whereBetween('DateIngoing', [$startDate, $endDate]);
// ->whereBetween('DateIngoing', [$startDate, $endDate]);
->where('DateIngoing', '>=', $startDate)
->where('DateIngoing', '<=', $endDate);
} else {
// Врач: используем currentlyInTreatment + фильтр по дате
$query = MisMigrationPatient::currentlyInTreatment($branchId)
->when($today, function ($query) use ($startDate, $endDate) {
return $query->whereBetween('DateIngoing', [$startDate, $endDate]);
// return $query->whereBetween('DateIngoing', [$startDate, $endDate]);
return $query->where('DateIngoing', '>=', $startDate)
->where('DateIngoing', '<=', $endDate);
});
}
}
@@ -757,7 +761,9 @@ class ReportController extends Controller
// Получаем истории
$query = MisMedicalHistory::whereIn('MedicalHistoryID', $medicalHistoryIds)
->with(['surgicalOperations' => function ($query) use ($startDate, $endDate) {
$query->whereBetween('Date', [$startDate, $endDate]);
// $query->whereBetween('Date', [$startDate, $endDate]);
$query->where('Date', '>=', $startDate)
->where('Date', '<=', $endDate);
}])
->orderBy('DateRecipient', 'DESC');
@@ -874,7 +880,9 @@ class ReportController extends Controller
private function getSurgicalPatients(string $status, bool $isHeadOrAdmin, $branchId, $startDate, $endDate, bool $returnedCount = false)
{
$query = MisSurgicalOperation::where('rf_StationarBranchID', $branchId)
->whereBetween('Date', [$startDate, $endDate])
// ->whereBetween('Date', [$startDate, $endDate])
->where('Date', '>=', $startDate)
->where('Date', '<=', $endDate)
->orderBy('Date', 'DESC');
if ($status === 'plan') {
@@ -953,6 +961,7 @@ class ReportController extends Controller
})
->active()
->whereNotIn('LPUDoctorID', [0, 1])
->orderBy('FAM_V')
->get();
return response()->json([
@@ -967,8 +976,10 @@ class ReportController extends Controller
{
if (Carbon::parse($startDate)->diffInDays(Carbon::parse($endDate)) > 1.0)
return Report::where('rf_department_id', $departmentId)
->whereBetween('created_at', [$startDate, $endDate])
->orderBy('created_at', 'ASC')
// ->whereBetween('created_at', [$startDate, $endDate])
->where('sent_at', '>=', $startDate)
->where('sent_at', '<=', $endDate)
->orderBy('sent_at', 'ASC')
->get();
else
return Report::where('rf_department_id', $departmentId)