From 174770cdb3a24db2d90d27a768d0fa017c99e2be Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 27 Jul 2023 09:11:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=96=BE=E7=97=85=E5=88=86=E7=B1=BB=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/BasicDataController.php | 16 ++++++ app/Controller/DetectionController.php | 4 +- app/Model/DiseaseClassDetection.php | 77 ++++++++++++++++++++++++++ app/Request/BasicDataRequest.php | 5 ++ app/Services/BasicDataService.php | 21 +++++++ app/Services/DetectionService.php | 2 +- config/routes.php | 4 +- 7 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 app/Model/DiseaseClassDetection.php diff --git a/app/Controller/BasicDataController.php b/app/Controller/BasicDataController.php index a1ef98b..52bf0ea 100644 --- a/app/Controller/BasicDataController.php +++ b/app/Controller/BasicDataController.php @@ -204,4 +204,20 @@ class BasicDataController extends AbstractController $data = $BasicDataService->getHotSearchKeyword(); return $this->response->json($data); } + + /** + * 获取检测疾病分类列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionDiseaseList(): ResponseInterface + { + $request = $this->container->get(BasicDataRequest::class); + $request->scene('getDetectionDiseaseList')->validateResolved(); + + $BasicDataService = new BasicDataService(); + $data = $BasicDataService->getDetectionDiseaseList(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 20a3644..e832871 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -27,10 +27,8 @@ class DetectionController extends AbstractController } /** - * 获取合作公司检测项目 + * 获取合作公司检测项目详情 * @return ResponseInterface - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function getDetectionProject(): ResponseInterface { diff --git a/app/Model/DiseaseClassDetection.php b/app/Model/DiseaseClassDetection.php new file mode 100644 index 0000000..0202e68 --- /dev/null +++ b/app/Model/DiseaseClassDetection.php @@ -0,0 +1,77 @@ +first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } + + /** + * 新增-批量 + * @param array $data 新增数据 + * @return \Hyperf\Database\Model\Model|DiseaseClassDetection + */ + public static function addDiseaseClassDetection(array $data): \Hyperf\Database\Model\Model|DiseaseClassDetection + { + return self::create($data); + } + + /** + * 修改-批量 + * @param array $params + * @param array $data + * @return int + */ + public static function editDiseaseClassDetection(array $params = [], array $data = []): int + { + return self::where($params)->update($data); + } +} diff --git a/app/Request/BasicDataRequest.php b/app/Request/BasicDataRequest.php index af81eae..513a55c 100644 --- a/app/Request/BasicDataRequest.php +++ b/app/Request/BasicDataRequest.php @@ -28,6 +28,9 @@ class BasicDataRequest extends FormRequest 'client_type', 'keyword_place', ], + 'getDetectionDiseaseList' => [ // 获取检测疾病分类列表 + 'detection_project_id', + ], ]; /** @@ -49,6 +52,7 @@ class BasicDataRequest extends FormRequest 'disease_class_name' => 'required', 'client_type' => 'required|integer|min:1|max:1', 'keyword_place' => 'required|integer|min:1|max:1', + 'detection_project_id' => 'required', ]; } @@ -69,6 +73,7 @@ class BasicDataRequest extends FormRequest 'keyword_place.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'keyword_place.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), 'keyword_place.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/BasicDataService.php b/app/Services/BasicDataService.php index 21b12b9..74bd041 100644 --- a/app/Services/BasicDataService.php +++ b/app/Services/BasicDataService.php @@ -8,6 +8,7 @@ use App\Model\BasicDoctorTitle; use App\Model\BasicJob; use App\Model\BasicNation; use App\Model\DiseaseClass; +use App\Model\DiseaseClassDetection; use App\Model\DiseaseClassExpertise; use App\Model\DiseaseClassIcd; use App\Model\Hospital; @@ -394,4 +395,24 @@ class BasicDataService extends BaseService return success($hot_search_keyword->toArray()); } + + /** + * 获取检测疾病分类列表 + * @return array + */ + public function getDetectionDiseaseList(): array + { + $detection_project_id = $this->request->route('detection_project_id',1); + + $params = array(); + $params['detection_project_id'] = $detection_project_id; + $params['status'] = 1; + $params['enable'] = 1; + $disease_class_detections = DiseaseClassDetection::getList($params); + if (empty($disease_class_detections)){ + return success(); + } + + return success($disease_class_detections->toArray()); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 2556027..bbaf9ef 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -39,7 +39,7 @@ class DetectionService extends BaseService } /** - * 获取合作公司检测项目 + * 获取合作公司检测项目详情 * @return array */ public function getDetectionProject(): array diff --git a/config/routes.php b/config/routes.php index 659cb03..19c8f15 100644 --- a/config/routes.php +++ b/config/routes.php @@ -277,7 +277,7 @@ Router::addGroup('/patient', function () { // 获取合作公司检测项目列表 Router::get('/project', [DetectionController::class, 'getDetectionProjectList']); - // 获取合作公司检测项目列表 + // 获取合作公司检测项目详情 Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']); }); @@ -588,7 +588,7 @@ Router::addGroup('/basic', function () { Router::get('/keyword/search', [BasicDataController::class, 'getHotSearchKeyword']); // 获取检测疾病分类列表 - Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDisease']); + Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDiseaseList']); }); // 获取医生评价