|
|
|
@ -14,10 +14,8 @@ namespace app\service\api\apiService; |
|
|
|
use app\model\campus\Campus; |
|
|
|
use app\model\campus_person_role\CampusPersonRole; |
|
|
|
use app\model\chat_friends\ChatFriends; |
|
|
|
use app\model\chat_messages\ChatMessages; |
|
|
|
use app\model\dict\Dict; |
|
|
|
use app\model\physical_test\PhysicalTest; |
|
|
|
use core\base\BaseApiService; |
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
/** |
|
|
|
* 体测报告-控制器服务层 |
|
|
|
@ -32,32 +30,41 @@ class PhysicalTestService extends BaseApiService |
|
|
|
} |
|
|
|
|
|
|
|
//查询列表 |
|
|
|
public function getTestList(array $where) |
|
|
|
public function getList(array $where,string $field = '*') |
|
|
|
{ |
|
|
|
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数 |
|
|
|
$page = $page_params['page']; |
|
|
|
$limit = $page_params['limit']; |
|
|
|
|
|
|
|
$model = new ChatFriends(); |
|
|
|
$model = new PhysicalTest(); |
|
|
|
//判断用没有员工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']); |
|
|
|
if (!empty($where['resource_id'])) { |
|
|
|
$model = $model->where('resource_id', $where['resource_id']); |
|
|
|
} |
|
|
|
|
|
|
|
$data = $model |
|
|
|
->field($field) |
|
|
|
->order('id','desc') |
|
|
|
->append([ |
|
|
|
'customerResources' |
|
|
|
]) |
|
|
|
->with([ |
|
|
|
'personnel', |
|
|
|
'customer', |
|
|
|
'customerResourcesHasOne' |
|
|
|
]) |
|
|
|
->paginate([ |
|
|
|
'list_rows' => $limit, |
|
|
|
'page' => $page, |
|
|
|
])->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($data['data'] as &$v) { |
|
|
|
$age = $v['customerResourcesHasOne']['age'];//年龄 |
|
|
|
$gender = $v['customerResourcesHasOne']['gender'] == 'female' ? 2:1 ;//性别( 1:男,2:女) |
|
|
|
$height = $v['height'];//身高 |
|
|
|
$weight = $v['weight'];//体重 |
|
|
|
$v['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分 |
|
|
|
} |
|
|
|
|
|
|
|
return $data; |
|
|
|
} |
|
|
|
|
|
|
|
|