Добавил возможность ограничения выборки пациентов по диагнозу
This commit is contained in:
@@ -127,6 +127,7 @@ class DutyReportService
|
||||
return MedicalHistory::query()
|
||||
->whereHas('migrations', function ($q) use ($departmentId, $dateRange, $startYear) {
|
||||
$q->where('department_id', $departmentId)
|
||||
// ->whereNotIn('diagnosis_code', ['Z00.8', 'Z76.1', 'Z76.2', 'Z76.3']) // Исключаем осмотры и наблюдения
|
||||
->where('ingoing_date', '<=', $dateRange->endSql())
|
||||
->where(function ($sub) use ($dateRange, $startYear) {
|
||||
// Миграции без out_date (еще лежат)
|
||||
|
||||
@@ -14,6 +14,7 @@ class MedicalHistoryService
|
||||
$startYear = $dateRange->startDate->copy()->startOfYear()->format('Y-m-d');
|
||||
$periodMigrationFilter = function ($q) use ($departmentId, $dateRange, $startYear) {
|
||||
$q->where('department_id', $departmentId)
|
||||
// ->whereNotIn('diagnosis_code', ['Z76.1', 'Z76.2', 'Z76.3']) // Исключаем осмотры и наблюдения
|
||||
->where('ingoing_date', '<=', $dateRange->endSql())
|
||||
->where(function ($sub) use ($dateRange, $startYear) {
|
||||
// Миграции без out_date (еще лежат)
|
||||
|
||||
@@ -96,6 +96,7 @@ class NurseReportService
|
||||
$query = UnifiedMedicalHistory::query()
|
||||
->whereHas('migrations', function ($q) use ($departmentId, $dateRange, $startYear) {
|
||||
$q->where('department_id', $departmentId)
|
||||
// ->whereNotIn('diagnosis_code', ['Z00.8', 'Z76.1', 'Z76.2', 'Z76.3']) // Исключаем осмотры и наблюдения
|
||||
->where('ingoing_date', '<=', $dateRange->endSql())
|
||||
->where(function ($sub) use ($dateRange, $startYear) {
|
||||
$sub->whereNull('out_date')
|
||||
@@ -110,6 +111,7 @@ class NurseReportService
|
||||
})
|
||||
->with(['migrations' => function ($q) use ($departmentId, $dateRange, $startYear) {
|
||||
$q->where('department_id', $departmentId)
|
||||
// ->whereNotIn('diagnosis_code', ['Z00.8', 'Z76.1', 'Z76.2', 'Z76.3']) // Исключаем осмотры и наблюдения
|
||||
->where('ingoing_date', '<=', $dateRange->endSql())
|
||||
->where(function ($sub) use ($dateRange, $startYear) {
|
||||
$sub->whereNull('out_date')
|
||||
|
||||
Reference in New Issue
Block a user