From cfbbdbfe1476312f8455f5a99f9777b8c2f68f11 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 6 Apr 2023 17:49:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=97=AE=E8=AF=8A=E8=AF=84=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/InquiryController.php | 11 +++ app/Controller/TestController.php | 73 ++++++++++--------- app/Services/InquiryService.php | 38 ++++++++++ config/routes.php | 3 + .../RegulatoryPlatform/regulatoryPlatform.php | 46 +++++++++++- 5 files changed, 135 insertions(+), 36 deletions(-) diff --git a/app/Controller/InquiryController.php b/app/Controller/InquiryController.php index 2e88ba5..5a32e21 100644 --- a/app/Controller/InquiryController.php +++ b/app/Controller/InquiryController.php @@ -74,6 +74,17 @@ class InquiryController extends AbstractController return $this->response->json($data); } + /** + * 获取订单问诊评价 + * @return ResponseInterface + */ + public function getInquiryEvaluation(): ResponseInterface + { + $InquiryService = new InquiryService(); + $data = $InquiryService->getInquiryEvaluation(); + return $this->response->json($data); + } + /** * 获取问诊最低价格 * @return ResponseInterface diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index 0241984..1fbbd27 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -704,40 +704,47 @@ class TestController extends AbstractController $params['platform_audit_status'] = 1; $order_prescription = OrderPrescription::getOne($params); - $arg = array(); - $arg['thirdUniqueid'] = $order_inquiry['order_inquiry_id']; // 唯一标识 - $arg['orgName'] = "成都金牛欣欣相照互联网医院"; // 机构名称 - $arg['orgCode'] = "MA6CGUDA251010619D2112"; // 机构编码 - $arg['channelName'] = "成都金牛欣欣相照互联网医院";//平台名称 - $arg['section'] = $hospital_department_custom['department_name'];//科室名称 - $arg['sectionCode'] = $hospital_department_custom['department_code'];//科室编码 - $arg['docName'] = $user_doctor['user_name'];// 姓名(医师、护师、技师) - $arg['certificateNum'] = $user_doctor_info['qualification_cert_num']; // 执业资格证号 - $arg['patientName'] = $order_inquiry['patient_name']; // 患者姓名 - $arg['patientAge'] = $order_inquiry['patient_age']; // 患者年龄 - $arg['patientSex'] = $order_inquiry['patient_sex'] == 0 ?: 1; // 患者性别 - $arg['patientIdcardType'] = 1; // 证件类型 - $arg['patientIdcardNum'] = $patient_family['id_number']; // 患者证件号码 - $arg['serviceType'] = 1; // 服务类型 1网络咨询 2网络门诊 - $arg['consultNo'] = $order_inquiry['inquiry_no']; // 网络咨询或网络门诊编号 订单编号 - $arg['consultType'] = 1; // 咨询类别 1、图文咨询 2语音咨询3、视频咨询 - $arg['consultApplyTime'] = $order_inquiry['created_at']; // 咨询申请时间 - $arg['consultStartTime'] = $order_inquiry['reception_time']; // 咨询开始时间 - $arg['consultEndTime'] = $order_inquiry['complete_time']; // 咨询结束时间 - $arg['feeType'] = 1; // 费别 1自费 2医保 - $arg['price'] = $order_inquiry['payment_amount_total']; // 咨询价格 元 - $arg['isReply'] = 1; //咨询是否回复 0未回复 1已回复 - $arg['patientEvaluate'] = 1; //患者满意度 1-5 1代表非常满意 5代表非常不满意 - $arg['complainInfo'] = "无"; //投诉举报信息 - $arg['disposeResult'] = "无"; //处理结果信息 - $arg['isRiskWarn'] = 1; //是否进行诊前风险提示 0否 1是 - $arg['isPatientSign'] = 1; //是否确认患者为签约对象 0否 1是 - $arg['uploadTime'] = date('Y-m-d H:i:s',time()); //上传时间 - $arg['medicalHistory'] = $order_inquiry_case['disease_desc']; //患者病史描述 - $arg['docAdvice'] = $order_prescription['doctor_advice'] ?? "无"; // 医生建议描述 医嘱 - $arg['isMark'] = 1;//是否留痕 1:代表留痕;0代表未留痕 + // 网络咨询(网络门诊)服务 +// $arg = array(); +// $arg['thirdUniqueid'] = $order_inquiry['order_inquiry_id']; // 唯一标识 +// $arg['orgName'] = "成都金牛欣欣相照互联网医院"; // 机构名称 +// $arg['orgCode'] = "MA6CGUDA251010619D2112"; // 机构编码 +// $arg['channelName'] = "成都金牛欣欣相照互联网医院";//平台名称 +// $arg['section'] = $hospital_department_custom['department_name'];//科室名称 +// $arg['sectionCode'] = $hospital_department_custom['department_code'];//科室编码 +// $arg['docName'] = $user_doctor['user_name'];// 姓名(医师、护师、技师) +// $arg['certificateNum'] = $user_doctor_info['qualification_cert_num']; // 执业资格证号 +// $arg['patientName'] = $order_inquiry['patient_name']; // 患者姓名 +// $arg['patientAge'] = $order_inquiry['patient_age']; // 患者年龄 +// $arg['patientSex'] = $order_inquiry['patient_sex'] == 0 ?: 1; // 患者性别 +// $arg['patientIdcardType'] = 1; // 证件类型 +// $arg['patientIdcardNum'] = $patient_family['id_number']; // 患者证件号码 +// $arg['serviceType'] = 1; // 服务类型 1网络咨询 2网络门诊 +// $arg['consultNo'] = $order_inquiry['inquiry_no']; // 网络咨询或网络门诊编号 订单编号 +// $arg['consultType'] = 1; // 咨询类别 1、图文咨询 2语音咨询3、视频咨询 +// $arg['consultApplyTime'] = $order_inquiry['created_at']; // 咨询申请时间 +// $arg['consultStartTime'] = $order_inquiry['reception_time']; // 咨询开始时间 +// $arg['consultEndTime'] = $order_inquiry['complete_time']; // 咨询结束时间 +// $arg['feeType'] = 1; // 费别 1自费 2医保 +// $arg['price'] = $order_inquiry['payment_amount_total']; // 咨询价格 元 +// $arg['isReply'] = 1; //咨询是否回复 0未回复 1已回复 +// $arg['patientEvaluate'] = 1; //患者满意度 1-5 1代表非常满意 5代表非常不满意 +// $arg['complainInfo'] = "无"; //投诉举报信息 +// $arg['disposeResult'] = "无"; //处理结果信息 +// $arg['isRiskWarn'] = 1; //是否进行诊前风险提示 0否 1是 +// $arg['isPatientSign'] = 1; //是否确认患者为签约对象 0否 1是 +// $arg['uploadTime'] = date('Y-m-d H:i:s',time()); //上传时间 +// $arg['medicalHistory'] = $order_inquiry_case['disease_desc']; //患者病史描述 +// $arg['docAdvice'] = $order_prescription['doctor_advice'] ?? "无"; // 医生建议描述 医嘱 +// $arg['isMark'] = 1;//是否留痕 1:代表留痕;0代表未留痕 +// +// $result = $regulatoryPlatform->uploadConsult($arg); - $result = $regulatoryPlatform->uploadConsult($arg); + //上报 网络复诊服务 + $arg = array(); + $arg['thirdUniqueid'] = + + $result = $regulatoryPlatform->uploadFurtherConsult($arg); dump($result); } } \ No newline at end of file diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 57404dd..16bfd1e 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -536,6 +536,44 @@ class InquiryService extends BaseService return success(); } + /** + * 获取订单问诊评价 + * @return array + */ + public function getInquiryEvaluation(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + $order_inquiry_id = $this->request->route('order_inquiry_id'); + + $result = array(); + $result['is_evaluation'] = false; + $result['avg_score'] = 0; + + $params = array(); + $params['order_inquiry_id'] = $order_inquiry_id; + $params['patient_id'] = $user_info['client_user_id']; + $order_inquiry = OrderInquiry::getOne($params); + if (empty($order_inquiry)) { + return success($result); + } + + + + // 检测是否评价过 + $params = array(); + $params['doctor_id'] = $order_inquiry['doctor_id']; + $params['patient_id'] = $order_inquiry['patient_id']; + $params['order_inquiry_id'] = $order_inquiry_id;; + $order_evaluation = OrderEvaluation::getOne($params); + if (empty($order_evaluation)) { + return success($result); + } + + $result['avg_score'] = floor($order_evaluation['avg_score'] * 0.05); + $result['is_evaluation'] = true; + return success($result); + } + /** * 获取问诊最低价格 * @return array diff --git a/config/routes.php b/config/routes.php index c2642d7..6f6d1d6 100644 --- a/config/routes.php +++ b/config/routes.php @@ -237,6 +237,9 @@ Router::addGroup('/patient', function () { // 新增问诊评价 Router::post('/evaluation', [InquiryController::class, 'addInquiryEvaluation']); + // 获取订单问诊评价 + Router::get('/evaluation/{order_inquiry_id:\d+}', [InquiryController::class, 'getInquiryEvaluation']); + // 获取问诊最低价格 Router::get('/lowest-price', [InquiryController::class, 'getInquiryLowestPrice']); }); diff --git a/extend/RegulatoryPlatform/regulatoryPlatform.php b/extend/RegulatoryPlatform/regulatoryPlatform.php index fb8ac82..0b81c53 100644 --- a/extend/RegulatoryPlatform/regulatoryPlatform.php +++ b/extend/RegulatoryPlatform/regulatoryPlatform.php @@ -91,11 +91,12 @@ class regulatoryPlatform /** * 上报 网络咨询(网络门诊)服务 * @param array $arg - * @return mixed + * @return array * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function uploadConsult(array $arg){ + public function uploadConsult(array $arg): array + { try { $this->redis = $this->container->get(Redis::class); @@ -120,7 +121,46 @@ class regulatoryPlatform } } - return $response['data']; + return $response; + } catch (GuzzleException $e) { + throw new BusinessException($e->getMessage()); + } + } + + /** + * 上报 网络复诊服务 + * @param array $arg + * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function uploadFurtherConsult(array $arg): array + { + try { + $this->redis = $this->container->get(Redis::class); + + $access_token = $this->redis->get("regulatory_platform_access_token"); + if (empty($access_token)) { + $access_token = $this->getAccessToken(); + } + + $arg['accessToken'] = $access_token; + $arg['clientId'] = $this->client_id; + + $option = [ + "json" => $arg + ]; + + $response = $this->httpRequest($this->api_url . '/wjw/upload/uploadFurtherConsult', $option); + if (isset($response['status'])) { + if ($response['status'] != 0) { + if (!empty($response['message'])) { + throw new BusinessException($response['message']); + } + } + } + + return $response; } catch (GuzzleException $e) { throw new BusinessException($e->getMessage()); }