51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace common\models\oldDb;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveQuery;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class PhysicalReserve extends \common\modelsgii\oldDb\PhysicalReserve
|
|
{
|
|
public function behaviors(): array
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 分院关联
|
|
* @return ActiveQuery
|
|
*/
|
|
public function getYard(): ActiveQuery
|
|
{
|
|
return $this->hasOne(HospitalYard::className(),['id'=>'yard_id']);
|
|
}
|
|
|
|
/**
|
|
* 用户关联
|
|
* @return ActiveQuery
|
|
*/
|
|
public function getUser(): ActiveQuery
|
|
{
|
|
return $this->hasOne(User::className(),['id'=>'user_id'])->select('id,mobile,nickname,idcard');
|
|
}
|
|
|
|
/**
|
|
* 体检套餐关联
|
|
* @return ActiveQuery
|
|
*/
|
|
public function getPackage(): ActiveQuery
|
|
{
|
|
return $this->hasOne(PhysicalPackage::className(),['id'=>'physical_id']);
|
|
}
|
|
}
|