Много чего

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

@@ -8,36 +8,43 @@ use Illuminate\Database\Eloquent\Model;
class SttMedicalHistory extends Model
{
protected $table = 'si_stt_patients';
protected $table = 'foxpro_original_patient';
protected $primaryKey = 'keykarta';
protected $connection = 'pgsql';
protected $keyType = 'string';
public $incrementing = false;
protected $casts = [
'keykarta' => 'string',
];
protected $fillable = [
'family', // Фамилия
'name', // Имя
'fam', // Фамилия
'im', // Имя
'ot', // Отчество
'daterecipient', // Д. пост. (mpostdate)
'dateextract', // Д. вып. (menddate)
'mpostdate', // Д. пост. (mpostdate)
'menddate', // Д. вып. (menddate)
'narhiv', // № в архиве
'datearhiv', // Д. архив
'statgod', // Год нахождения в стационаре
'snils', // Год нахождения в стационаре
'enp', // ЕНП
'medcardnum', // № карты
'nkarta', // № карты
'dr', // ДР
];
public function getFullNameAttribute()
{
return "$this->family $this->name $this->ot";
return "$this->fam $this->im $this->ot";
}
public function archiveHistory()
{
return $this->morphMany(ArchiveHistory::class, 'historyable');
return $this->hasMany(ArchiveHistory::class, 'foxpro_history_id', 'keykarta');
}
public function archiveInfo()
{
return $this->morphOne(ArchiveInfo::class, 'historyable');
return $this->hasOne(ArchiveInfo::class, 'foxpro_history_id', 'keykarta');
}
/**