From 2ee8f81956b3fd17e84ed3df32dcaf8ec3118aa1 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 1 Mar 2024 11:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=8F=AF?= =?UTF-8?q?=E5=A4=84=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DoctorInquiryConfigController.php | 18 ++++----- app/Request/DoctorInquiryConfigRequest.php | 6 +-- app/Services/DoctorInquiryService.php | 6 +-- app/Services/InquiryService.php | 4 +- app/Services/PatientDoctorService.php | 21 +++------- app/Services/UserDoctorService.php | 39 ++++++++++++++++++- config/routes.php | 6 +-- 7 files changed, 63 insertions(+), 37 deletions(-) diff --git a/app/Controller/DoctorInquiryConfigController.php b/app/Controller/DoctorInquiryConfigController.php index 655be85..3b98f12 100644 --- a/app/Controller/DoctorInquiryConfigController.php +++ b/app/Controller/DoctorInquiryConfigController.php @@ -18,13 +18,13 @@ class DoctorInquiryConfigController extends AbstractController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function getInquiryConfig(): ResponseInterface + public function getDoctorInquiryConfig(): ResponseInterface { $request = $this->container->get(DoctorInquiryConfigRequest::class); - $request->scene('getInquiryConfig')->validateResolved(); + $request->scene('getDoctorInquiryConfig')->validateResolved(); $DoctorInquiryService = new DoctorInquiryService(); - $data = $DoctorInquiryService->getInquiryConfig(); + $data = $DoctorInquiryService->getDoctorInquiryConfig(); return $this->response->json($data); } @@ -34,13 +34,13 @@ class DoctorInquiryConfigController extends AbstractController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function putInquiryOpen(): ResponseInterface + public function putDoctorInquiryOpen(): ResponseInterface { $request = $this->container->get(DoctorInquiryConfigRequest::class); - $request->scene('putInquiryOpen')->validateResolved(); + $request->scene('putDoctorInquiryOpen')->validateResolved(); $DoctorInquiryService = new DoctorInquiryService(); - $data = $DoctorInquiryService->putInquiryOpen(); + $data = $DoctorInquiryService->putDoctorInquiryOpen(); return $this->response->json($data); } @@ -50,13 +50,13 @@ class DoctorInquiryConfigController extends AbstractController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function putInquiryConfig(): ResponseInterface + public function putDoctorInquiryConfig(): ResponseInterface { $request = $this->container->get(DoctorInquiryConfigRequest::class); - $request->scene('putInquiryConfig')->validateResolved(); + $request->scene('putDoctorInquiryConfig')->validateResolved(); $DoctorInquiryService = new DoctorInquiryService(); - $data = $DoctorInquiryService->putInquiryConfig(); + $data = $DoctorInquiryService->putDoctorInquiryConfig(); return $this->response->json($data); } diff --git a/app/Request/DoctorInquiryConfigRequest.php b/app/Request/DoctorInquiryConfigRequest.php index b701535..b3ed7cb 100644 --- a/app/Request/DoctorInquiryConfigRequest.php +++ b/app/Request/DoctorInquiryConfigRequest.php @@ -11,16 +11,16 @@ use Hyperf\Validation\Rule; class DoctorInquiryConfigRequest extends FormRequest { protected array $scenes = [ - 'getInquiryConfig' => [ // 获取医生问诊配置 + 'getDoctorInquiryConfig' => [ // 获取医生问诊配置 'inquiry_type', 'inquiry_mode', ], - 'putInquiryOpen' => [ // 医生问诊开关 + 'putDoctorInquiryOpen' => [ // 医生问诊开关 'inquiry_type', 'inquiry_mode', 'is_open', ], - 'putInquiryConfig' => [ // 修改医生问诊配置 + 'putDoctorInquiryConfig' => [ // 修改医生问诊配置 'inquiry_type', 'inquiry_mode', 'inquiry_price', diff --git a/app/Services/DoctorInquiryService.php b/app/Services/DoctorInquiryService.php index ceb03f5..8f0fd7c 100644 --- a/app/Services/DoctorInquiryService.php +++ b/app/Services/DoctorInquiryService.php @@ -20,7 +20,7 @@ class DoctorInquiryService extends BaseService * 获取医生问诊配置 * @return array */ - public function getInquiryConfig(): array + public function getDoctorInquiryConfig(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; @@ -138,7 +138,7 @@ class DoctorInquiryService extends BaseService * 医生问诊开关 * @return array */ - public function putInquiryOpen(): array + public function putDoctorInquiryOpen(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; @@ -226,7 +226,7 @@ class DoctorInquiryService extends BaseService * 修改医生问诊配置 * @return array */ - public function putInquiryConfig(): array + public function putDoctorInquiryConfig(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index e4d7a03..c276f6d 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1051,6 +1051,8 @@ class InquiryService extends BaseService /** * 结束问诊 * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function putFinishInquiry(): array { @@ -1664,7 +1666,7 @@ class InquiryService extends BaseService * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function inquiryRefund(string $order_inquiry_id, string $refund_reason) + public function inquiryRefund(string $order_inquiry_id, string $refund_reason): void { // 获取订单数据 $params = array(); diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index c5270ba..df3dd27 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -110,17 +110,8 @@ class PatientDoctorService extends BaseService } // 处理可处方字段 - $user_doctor['multi_point_enable'] = 0; - - $params = array(); - $params['doctor_id'] = $user_doctor["doctor_id"]; - $params['inquiry_type'] = 4; - $params['inquiry_mode'] = 1; - $params['is_enable'] = 1; - $result = DoctorInquiryConfig::getOne($params); - if (!empty($result)){ - $user_doctor['multi_point_enable'] = 1; - } + $userDoctorService = new UserDoctorService(); + $user_doctor['multi_point_enable'] = $userDoctorService->getDoctorMultiPointEnable($user_doctor["doctor_id"]); // 好评率-超过5个已结束的订单后展示 $user_doctor['praise_rate'] = floor($user_doctor['praise_rate'] * 0.05 * 100) / 100; @@ -453,6 +444,7 @@ class PatientDoctorService extends BaseService return success(); } + $userDoctorService = new UserDoctorService(); foreach ($recommend_doctors as $recommend_doctor) { $data = array(); $data['doctor_id'] = $recommend_doctor['doctor_id']; @@ -472,12 +464,9 @@ class PatientDoctorService extends BaseService $data['is_online'] = $recommend_doctor['user']['is_online']; } + // 是否开启问诊购药 foreach ($recommend_doctor['DoctorInquiryConfig'] as $doctor_inquiry_config) { - if ($doctor_inquiry_config['inquiry_mode'] == 1){ - if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['is_enable'] == 1) { - $data['multi_point_enable'] = 1; // 是否开启问诊购药 - } - } + $data['multi_point_enable'] = $userDoctorService->getDoctorMultiPointEnable("",$doctor_inquiry_config); } $data['doctor_inquiry_config'] = $recommend_doctor['DoctorInquiryConfig']; diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 87f0cc6..b445da6 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2216,6 +2216,10 @@ class UserDoctorService extends BaseService $result['is_online'] = $user['is_online']; } + // 处理可处方字段 + $userDoctorService = new UserDoctorService(); + $result['multi_point_enable'] = $userDoctorService->getDoctorMultiPointEnable($doctor_id); + return success($result); } @@ -2295,8 +2299,8 @@ class UserDoctorService extends BaseService return fail(); } - $value['times_number'] = $doctor_inquiry_config_service['service_period']; // 服务回合数(0表示不限次) - $value['duration'] = $doctor_inquiry_config_service['duration']; // 服务周期(天,不存在0的情况) + $value['times_number'] = $doctor_inquiry_config_service['service_rounds']; // 服务回合数(0表示不限次) + $value['duration'] = $doctor_inquiry_config_service['service_period']; // 服务周期(天,不存在0的情况) $value['service_content'] = $doctor_inquiry_config_service['service_content'];// 服务内容 $value['service_process'] = $doctor_inquiry_config_service['service_process'];// 服务流程 @@ -2711,4 +2715,35 @@ class UserDoctorService extends BaseService } + /** + * 获取医生是否可处方图标展示状态 + * @param string $doctor_id 医生id + * @param array|object|null $doctor_inquiry_config 医生问诊配置 + * @return int + */ + public function getDoctorMultiPointEnable(string $doctor_id = "",array|object $doctor_inquiry_config = null): int + { + $multi_point_enable = 0; // 是否开启问诊购药 + if (!empty($doctor_inquiry_config)){ + if ($doctor_inquiry_config['inquiry_type'] == 4 && $doctor_inquiry_config['inquiry_mode'] == 1 && $doctor_inquiry_config['is_enable'] == 1){ + $multi_point_enable = 1; + } + } else { + if (empty($doctor_id)){ + return $multi_point_enable; + } + + $params = array(); + $params['doctor_id'] = $doctor_id; + $params['inquiry_type'] = 4; + $params['inquiry_mode'] = 1; + $params['is_enable'] = 1; + $result = DoctorInquiryConfig::getOne($params); + if (!empty($result)){ + $multi_point_enable = 1; // 是否开启问诊购药 + } + } + + return $multi_point_enable; + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index f8696ef..b328481 100644 --- a/config/routes.php +++ b/config/routes.php @@ -101,13 +101,13 @@ Router::addGroup('/doctor', function () { // 问诊配置 Router::addGroup('/config', function () { // 获取医生问诊配置 - Router::get('', [DoctorInquiryConfigController::class, 'getInquiryConfig']); + Router::get('', [DoctorInquiryConfigController::class, 'getDoctorInquiryConfig']); // 修改医生问诊配置 - Router::put('', [DoctorInquiryConfigController::class, 'putInquiryConfig']); + Router::put('', [DoctorInquiryConfigController::class, 'putDoctorInquiryConfig']); // 医生问诊开关 - Router::put('/open', [DoctorInquiryConfigController::class, 'putInquiryOpen']); + Router::put('/open', [DoctorInquiryConfigController::class, 'putDoctorInquiryOpen']); // 获取医生问诊配置-疑难会诊-服务设置 Router::get('/service', [DoctorInquiryConfigController::class, 'getInquiryServiceConfig']);