52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Mis\SttMedicalHistory as MisMedicalHistory;
|
|
use App\Models\SI\SttMedicalHistory as SiMedicalHistory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ArchiveInfo extends Model
|
|
{
|
|
|
|
protected static function booted()
|
|
{
|
|
static::creating(function (ArchiveInfo $model) {
|
|
$model->status_id = 2;
|
|
});
|
|
}
|
|
|
|
protected $connection = 'pgsql';
|
|
protected $table = 'archive_infos';
|
|
|
|
protected $fillable = [
|
|
'foxpro_history_id',
|
|
'mis_history_id',
|
|
'foxpro_num',
|
|
'mis_num',
|
|
'archive_num',
|
|
'post_in',
|
|
'status_id'
|
|
];
|
|
|
|
public function foxproHistory()
|
|
{
|
|
return $this->belongsTo(SiMedicalHistory::class, 'foxpro_history_id', 'keykarta');
|
|
}
|
|
|
|
public function misHistory()
|
|
{
|
|
return $this->belongsTo(MisMedicalHistory::class, 'mis_history_id', 'MedicalHistoryID');
|
|
}
|
|
|
|
public function historyType()
|
|
{
|
|
return $this->mis_history_id !== null ? 'mis' : 'foxpro';
|
|
}
|
|
|
|
public function status()
|
|
{
|
|
return $this->belongsTo(ArchiveStatus::class);
|
|
}
|
|
}
|