42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
class PrescriptionChinese extends \common\modelsgii\PrescriptionChinese
|
|
{
|
|
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
public function getPrescription(){
|
|
return $this->hasOne(Prescription::class,['prescription_no'=>'prescription_no']);
|
|
}
|
|
|
|
public function getPatients(){
|
|
return $this->hasOne(UserPatient::class,['id'=>'up_id']);
|
|
}
|
|
|
|
public function getDepart(){
|
|
return $this->hasMany(DoctorInfo::class,['id'=>'su_id']);
|
|
}
|
|
|
|
public function getDoctor(){
|
|
return $this->hasOne(DoctorInfo::class,['su_id'=>'su_id']);
|
|
}
|
|
|
|
public function getPharmacistInfo(){
|
|
return $this->hasOne(PharmacistrInfo::class,['su_id'=>'pharmacist_id']);
|
|
}
|
|
} |