* добавил удаление карты, если она была добавлена не из МИС

* добавил диалог при удалении карты
* добавил сохранение движения
* добавил вывод сохраненного отчета
* изменил логику сохранения отчета
This commit is contained in:
brusnitsyn
2026-05-06 17:03:41 +09:00
parent fe2264dfce
commit 2026a1ca9f
22 changed files with 928 additions and 195 deletions

View File

@@ -25,10 +25,37 @@ class ReportNursePatient extends Model
];
protected $casts = [
'birth_date' => 'date',
'recipient_date' => 'datetime',
'extract_date' => 'datetime',
'death_date' => 'datetime',
'birth_date' => 'date:Y-m-d',
'recipient_date' => 'datetime:Y-m-d H:i:s',
'extract_date' => 'datetime:Y-m-d H:i:s',
'death_date' => 'datetime:Y-m-d H:i:s',
'male' => 'boolean',
];
public function migrations(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(ReportNurseMigrationPatient::class, 'medical_history_id', 'id');
}
public function operations(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(SurgicalOperation::class, 'medical_history_id', 'id');
}
public function latestMigration()
{
return $this->hasOne(ReportNurseMigrationPatient::class, 'medical_history_id', 'id')
->latest('ingoing_date');
}
public function operationsInDepartment($query, $departmentId)
{
return $this->operations()->where('department_id', $departmentId);
}
// Скоупы
public function scopeUrgency($query, $typeId) // 1 = Экстренно, 2 = Планово
{
return $query->where('urgency_id', $typeId);
}
}