57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
use App\Enums\RecordStatusEnum;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
class Sample extends BaseModel
|
|
{
|
|
public $timestamps = false;
|
|
use HasFactory;
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'samples';
|
|
|
|
protected $fillable = ['patient_id','admission_date','sample_number','sample_source_id','physician_id',
|
|
'sample_condition','reject_comment_id','collected_date','received_date','diagnosis','is_urgent', 'is_printed', 'printed_by','printed_at',
|
|
'approved_by','approved_date', 'requested_date','is_accept_request','organization_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD,
|
|
BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD,
|
|
'result_template_id'
|
|
];
|
|
|
|
//protected $appendsv = ['state'];
|
|
protected $append = ['state','progress'];
|
|
|
|
public static function boot()
|
|
{
|
|
parent::boot();
|
|
}
|
|
|
|
public function lab(){
|
|
return $this->belongsTo(Organization::class, 'organization_id','id');
|
|
}
|
|
|
|
public function patient(){
|
|
return $this->belongsTo(Patient::class, 'patient_id','id');
|
|
}
|
|
|
|
public function entryBy(){
|
|
return $this->belongsTo(User::class, 'created_by', 'id');
|
|
}
|
|
|
|
public function modifiedBy(){
|
|
return $this->belongsTo(User::class, 'updated_by', 'id');
|
|
}
|
|
|
|
public function physician(){
|
|
return $this->belongsTo(Physician::class, 'physician_id', 'id');
|
|
}
|
|
|
|
|
|
}
|