新增获取合作公司检测项目接口
This commit is contained in:
parent
d7adc01b84
commit
822756c39c
@ -25,4 +25,17 @@ class DetectionController extends AbstractController
|
|||||||
$data = $detectionService->getDetectionProjectList();
|
$data = $detectionService->getDetectionProjectList();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取合作公司检测项目
|
||||||
|
* @return ResponseInterface
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function getDetectionProject(): ResponseInterface
|
||||||
|
{
|
||||||
|
$detectionService = new DetectionService();
|
||||||
|
$data = $detectionService->getDetectionProject();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -13,9 +13,7 @@ class DetectionService extends BaseService
|
|||||||
*/
|
*/
|
||||||
public function getDetectionProjectList(): array
|
public function getDetectionProjectList(): array
|
||||||
{
|
{
|
||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
|
||||||
$company_id = $this->request->input("company_id",1);
|
$company_id = $this->request->input("company_id",1);
|
||||||
// $detection_project_id = $this->request->input("detection_project_id",1);
|
|
||||||
|
|
||||||
// 获取合作公司数据
|
// 获取合作公司数据
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -28,14 +26,44 @@ class DetectionService extends BaseService
|
|||||||
// 获取项目数据
|
// 获取项目数据
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['company_id'] = $company_id;
|
$params['company_id'] = $company_id;
|
||||||
$detection_project = DetectionProject::getList($params);
|
$detection_projects = DetectionProject::getList($params);
|
||||||
|
if (empty($detection_projects)){
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($detection_projects as &$value){
|
||||||
|
$value['img_path'] = addAliyunOssWebsite($value['img_path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success($detection_projects->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取合作公司检测项目
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDetectionProject(): array
|
||||||
|
{
|
||||||
|
$company_id = $this->request->input("company_id",1);
|
||||||
|
$detection_project_id = $this->request->route('detection_project_id',1);
|
||||||
|
|
||||||
|
// 获取合作公司数据
|
||||||
|
$params = array();
|
||||||
|
$params['company_id'] = $company_id;
|
||||||
|
$basic_company = BasicCompany::getOne($params);
|
||||||
|
if (empty($basic_company)){
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取项目数据
|
||||||
|
$params = array();
|
||||||
|
$params['detection_project_id'] = $detection_project_id;
|
||||||
|
$detection_project = DetectionProject::getOne($params);
|
||||||
if (empty($detection_project)){
|
if (empty($detection_project)){
|
||||||
return fail();
|
return fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($detection_project as &$value){
|
$detection_project['img_path'] = addAliyunOssWebsite($detection_project['img_path']);
|
||||||
$value['img_path'] = addAliyunOssWebsite($value['img_path']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return success($detection_project->toArray());
|
return success($detection_project->toArray());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,6 +276,9 @@ Router::addGroup('/patient', function () {
|
|||||||
|
|
||||||
// 获取合作公司检测项目列表
|
// 获取合作公司检测项目列表
|
||||||
Router::get('/project', [DetectionController::class, 'getDetectionProjectList']);
|
Router::get('/project', [DetectionController::class, 'getDetectionProjectList']);
|
||||||
|
|
||||||
|
// 获取合作公司检测项目列表
|
||||||
|
Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 医生数据
|
// 医生数据
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user