96 lines
2.3 KiB
PHP
96 lines
2.3 KiB
PHP
<?php
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
|
|
class ServiceUser extends \common\modelsgii\ServiceUser
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 可覆盖 fields() 方法来增加、删除、重命名、重定义字段
|
|
*/
|
|
public function fields()
|
|
{
|
|
$fields = parent::fields();
|
|
// 删除一些包含敏感信息的字段
|
|
unset($fields['password']);
|
|
return $fields;
|
|
}
|
|
|
|
//关联基础信息-医生
|
|
public function getDocInfo()
|
|
{
|
|
return $this->hasOne(DoctorInfo::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//关联认证信息-医生
|
|
public function getDocIdentity()
|
|
{
|
|
return $this->hasOne(DoctorIdentity::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//关联执业信息-医生
|
|
public function getDocPracticing()
|
|
{
|
|
return $this->hasOne(DoctorPracticing::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//关联服务信息-医生
|
|
public function getDocService()
|
|
{
|
|
return $this->hasOne(DoctorService::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
|
|
//药师-关联基础信息
|
|
public function getDrugInfo()
|
|
{
|
|
return $this->hasOne(PharmacistrInfo::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//药师-关联认证信息
|
|
public function getDrugIdentity()
|
|
{
|
|
return $this->hasOne(PharmacistIdentity::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//药师-关联执业信息
|
|
public function getDrugPracticing()
|
|
{
|
|
return $this->hasOne(PharmacistPracticing::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//导医-关联基础信息
|
|
public function getLeadInfo()
|
|
{
|
|
return $this->hasOne(LeadInfo::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//客服-关联基础信息
|
|
public function getServInfo()
|
|
{
|
|
return $this->hasOne(ServInfo::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
//关联门店
|
|
public function getStore()
|
|
{
|
|
return $this->hasOne(StoreDoctor::className(),['su_id'=>'id']);
|
|
}
|
|
|
|
|
|
} |