Много чего

This commit is contained in:
brusnitsyn
2025-12-25 17:30:50 +09:00
parent c4bb7ec6f9
commit a5209f45c8
25 changed files with 1521 additions and 574 deletions

View File

@@ -11,6 +11,11 @@ class SttMedicalHistory extends Model
{
protected $primaryKey = 'MedicalHistoryID';
protected $table = 'stt_medicalhistory';
protected $keyType = 'string';
protected $casts = [
'MedicalHistoryID' => 'string',
];
public function getFullNameAttribute()
{
@@ -19,12 +24,12 @@ class SttMedicalHistory extends Model
public function archiveHistory()
{
return $this->morphMany(ArchiveHistory::class, 'historyable');
return $this->hasMany(ArchiveHistory::class, 'mis_history_id', 'MedicalHistoryID');
}
public function archiveInfo()
{
return $this->morphOne(ArchiveInfo::class, 'historyable');
return $this->hasOne(ArchiveInfo::class, 'mis_history_id', 'MedicalHistoryID');
}
/**
@@ -41,7 +46,6 @@ class SttMedicalHistory extends Model
$hasNotBadStatus = $this->archiveInfo()
->whereNotNull('status_id')
->whereNot('status_id', 1)
->whereNot('status_id', 3)
->whereNot('status_id', 4)
->exists();