Добавлено сохранение правок поверх МИС
Добавлено версионирование сохраненных правок Добавлено сохранение отчета мед. сестры
This commit is contained in:
@@ -18,6 +18,9 @@ class MedicalHistoryCorrection extends Model
|
||||
'urgency_id',
|
||||
'hospital_result_id',
|
||||
'visit_result_id',
|
||||
'user_id',
|
||||
'mis_user_id',
|
||||
'comment',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UnifiedMedicalHistory extends MaterializedViewModel
|
||||
{
|
||||
protected $table = 'v_unified_medical_history';
|
||||
protected $table = 'v_unified_medical_history_nurse';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $casts = [
|
||||
@@ -16,4 +16,31 @@ class UnifiedMedicalHistory extends MaterializedViewModel
|
||||
'death_date' => 'datetime',
|
||||
'male' => 'boolean',
|
||||
];
|
||||
|
||||
public function migrations(): \Illuminate\Database\Eloquent\Relations\HasMany|MedicalHistory
|
||||
{
|
||||
return $this->hasMany(MigrationPatient::class, 'medical_history_id', 'id');
|
||||
}
|
||||
|
||||
public function operations(): \Illuminate\Database\Eloquent\Relations\HasMany|MedicalHistory
|
||||
{
|
||||
return $this->hasMany(SurgicalOperation::class, 'medical_history_id', 'id');
|
||||
}
|
||||
|
||||
public function latestMigration()
|
||||
{
|
||||
return $this->hasOne(MigrationPatient::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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user