You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.6 KiB
76 lines
1.6 KiB
3 weeks ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
||
|
class RegistrationRecord extends Model
|
||
|
{
|
||
|
use HasFactory;
|
||
|
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*
|
||
|
* @var array<int, string>
|
||
|
*/
|
||
|
protected $fillable = [
|
||
|
'relate_order_id',
|
||
|
'relate_patient_id',
|
||
|
'reg_id',
|
||
|
'dept_id',
|
||
|
'dept_name',
|
||
|
'dept_location',
|
||
|
'doctor_id',
|
||
|
'doctor_name',
|
||
|
'visit_date',
|
||
|
'begin_time',
|
||
|
'end_time',
|
||
|
'lock_status',
|
||
|
'lock_at',
|
||
|
'extra_info',
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* The attributes that should be cast.
|
||
|
*
|
||
|
* @var array<string, string>
|
||
|
*/
|
||
|
protected $casts = [
|
||
|
'id' => 'integer',
|
||
|
'relate_order_id' => 'integer',
|
||
|
'relate_patient_id' => 'integer',
|
||
|
'lock_status' => 'integer',
|
||
|
'lock_at' => 'datetime',
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* Relationships Order.
|
||
|
*/
|
||
|
public function order(): BelongsTo
|
||
|
{
|
||
|
return $this->belongsTo(Order::class, 'relate_order_id');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Relationships Patient.
|
||
|
*/
|
||
|
public function patient(): BelongsTo
|
||
|
{
|
||
|
return $this->belongsTo(Patient::class, 'relate_patient_id');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取挂号记录by reg_id
|
||
|
* @param string $reg_id
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getRecordByRegID(string $reg_id): mixed
|
||
|
{
|
||
|
return $this->where('reg_id', $reg_id)->first();
|
||
|
}
|
||
|
}
|