62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace common\modelsgii\oldDb;
|
|
|
|
/**
|
|
* This is the model class for table "yii_granular_medicine".
|
|
*
|
|
* @property int $id
|
|
* @property string $name 名字
|
|
* @property int $number 数量
|
|
* @property int $r_id 药方id
|
|
* @property int $created_at
|
|
* @property int $updated_at
|
|
*/
|
|
class GranularMedicine extends \common\core\BaseActiveRecord
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'yii_granular_medicine';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['drug_id', 'name', 'number', 'price'], 'required'],
|
|
[['drug_id', 'number', 'order','created_at', 'updated_at'], 'integer'],
|
|
[['name'], 'string', 'max' => 30],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'drug_id' => '药品ID',
|
|
'name' => '名字',
|
|
'number' => '数量',
|
|
'order' => '1先下 2后下',
|
|
'price' => '价格',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
];
|
|
}
|
|
|
|
public function getUnit(){
|
|
return $this->hasOne(WestUnit::class,['id' => 'unit']);
|
|
}
|
|
|
|
public function getUseWay(){
|
|
return $this->hasOne(DrugUseWay::class,['id' => 'order']);
|
|
}
|
|
}
|