* добавил объединение изменений движений
* добавил автоматическое создание движения при редактировании * добавил функционал для сохранения отчета и пациентов * изменил форматирование дат * добавил частичную перезагрузку при сохранении изменений
This commit is contained in:
@@ -69,7 +69,7 @@ class MigrationPatient extends MaterializedViewModel
|
||||
{
|
||||
return $query->where('out_date', '>', $from)
|
||||
->where('out_date', '<=', $to)
|
||||
->whereNotIn('stat_cure_result_id', [3, 4, 7])
|
||||
->whereNotIn('visit_result_id', [3, 4, 5, 6])
|
||||
->whereNull('death_date'); // умершие не считаются "выбывшими домой"
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class MigrationPatient extends MaterializedViewModel
|
||||
{
|
||||
return $query->where('out_date', '>', $from)
|
||||
->where('out_date', '<=', $to)
|
||||
->whereIn('stat_cure_result_id', [3, 4, 7]);
|
||||
->whereIn('visit_result_id', [3, 4]);
|
||||
}
|
||||
|
||||
public function scopeDeceased($query, string $from, string $to)
|
||||
@@ -89,17 +89,13 @@ class MigrationPatient extends MaterializedViewModel
|
||||
|
||||
public function scopeCurrent($query, DateRange $dateRange)
|
||||
{
|
||||
// return $query->where('ingoing_date', '<', $dateRange->startSql())
|
||||
// ->where(function ($q) use ($dateRange) {
|
||||
// $q->whereNull('out_date')->orWhere('out_date', '>', $dateRange->endSql());
|
||||
// });
|
||||
// return $query->where('ingoing_date', '<=', $dateRange->endSql())
|
||||
// ->has('medicalHistory')
|
||||
// ->where(function ($q) use ($dateRange) {
|
||||
// $q->whereNull('out_date')
|
||||
// ->orWhere('out_date', '>=', $dateRange->startSql())
|
||||
// ->where('out_date', '<=', $dateRange->endSql());
|
||||
// });
|
||||
return $query->where('is_actually_current', true);
|
||||
}
|
||||
|
||||
public function scopeCurrentMigration($query, $historyId)
|
||||
{
|
||||
return $query->where('medical_history_id', $historyId)
|
||||
->orderBy('ingoing_date', 'desc')
|
||||
->limit(1)->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user