更新
This commit is contained in:
@@ -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