|
|
|
@ -69,21 +69,34 @@ class PhysicalTestService extends BaseApiService |
|
|
|
} |
|
|
|
|
|
|
|
//查询详情 |
|
|
|
public function getTestInfo(array $where) |
|
|
|
public function getInfo(array $where,string $field = '*') |
|
|
|
{ |
|
|
|
$model = new ChatFriends(); |
|
|
|
//判断用没有员工id |
|
|
|
if (!empty($where['personnel_id'])) { |
|
|
|
$model = $model->where('personnel_id', $where['personnel_id']); |
|
|
|
} |
|
|
|
if (!empty($where['customer_resources_id'])) { |
|
|
|
$model = $model->where('customer_resources_id', $where['customer_resources_id']); |
|
|
|
$model = new PhysicalTest(); |
|
|
|
//判断用没有体测报告id |
|
|
|
if (!empty($where['id'])) { |
|
|
|
$model = $model->where('id', $where['id']); |
|
|
|
} |
|
|
|
$data = $model->find(); |
|
|
|
|
|
|
|
$data = $model |
|
|
|
->field($field) |
|
|
|
->append([ |
|
|
|
'customerResources' |
|
|
|
]) |
|
|
|
->with([ |
|
|
|
'customerResourcesHasOne' |
|
|
|
]) |
|
|
|
->find(); |
|
|
|
|
|
|
|
|
|
|
|
if ($data) { |
|
|
|
$data = $data->toArray(); |
|
|
|
|
|
|
|
$age = $data['customerResourcesHasOne']['age'];//年龄 |
|
|
|
$gender = $data['customerResourcesHasOne']['gender'] == 'female' ? 2 : 1;//性别( 1:男,2:女) |
|
|
|
$height = $data['height'];//身高 |
|
|
|
$weight = $data['weight'];//体重 |
|
|
|
$data['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分 |
|
|
|
|
|
|
|
$res = [ |
|
|
|
'code' => 1, |
|
|
|
'msg' => '操作成功', |
|
|
|
|