更新
This commit is contained in:
@@ -95,4 +95,8 @@ class Appointment extends BaseModel
|
||||
return $this->hasOne('app\adminapi\logic\auth\AdminLogic', 'id', 'doctor_id')
|
||||
->bind(['doctor_name' => 'name']);
|
||||
}
|
||||
public function diagnosis(){
|
||||
|
||||
return $this->belongsTo('app\common\model\tcm\Diagnosis', 'patient_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,19 @@ class Diagnosis extends BaseModel
|
||||
{
|
||||
return !empty($data['past_history']) ? explode(',', $data['past_history']) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes BMI 计算(身高cm,体重kg)
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return float|null
|
||||
*/
|
||||
public function getBmiAttr($value, $data)
|
||||
{
|
||||
if (!empty($data['height']) && !empty($data['weight'])) {
|
||||
$heightM = $data['height'] / 100;
|
||||
return round($data['weight'] / ($heightM * $heightM), 2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user