From 01e2152ec205e7933b367c67ac8791dbb142f15e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 23 Mar 2023 15:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=91=E9=80=81=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1log=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientFamilyController.php | 15 +++++++++++++++ app/Request/PatientFamilyRequest.php | 3 +++ app/Services/PatientFamilyService.php | 20 ++++++++++++++++++++ config/routes.php | 9 +++++++++ extend/Alibaba/Dysms.php | 13 +++++++++++-- 5 files changed, 58 insertions(+), 2 deletions(-) diff --git a/app/Controller/PatientFamilyController.php b/app/Controller/PatientFamilyController.php index cbfd58f..3a5b302 100644 --- a/app/Controller/PatientFamilyController.php +++ b/app/Controller/PatientFamilyController.php @@ -202,6 +202,21 @@ class PatientFamilyController extends AbstractController return $this->response->json($data); } + /** + * 获取家庭成员用药记录列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getFamilyProductRecord(): ResponseInterface + { + $request = $this->container->get(PatientFamilyRequest::class); + $request->scene('getFamilyProductRecordList')->validateResolved(); + + $patientFamilyService = new PatientFamilyService(); + $data = $patientFamilyService->getFamilyProductRecord(); + return $this->response->json($data); + } /** * 检测入参身份证号 diff --git a/app/Request/PatientFamilyRequest.php b/app/Request/PatientFamilyRequest.php index 741a2de..05eafcc 100644 --- a/app/Request/PatientFamilyRequest.php +++ b/app/Request/PatientFamilyRequest.php @@ -87,6 +87,9 @@ class PatientFamilyRequest extends FormRequest 'diagnosis_hospital',//确诊医院 'drugs_name', // 家族病史 ], + 'getFamilyProductRecord' => [ // 获取家庭成员用药记录列表 + 'family_id', + ], ]; /** diff --git a/app/Services/PatientFamilyService.php b/app/Services/PatientFamilyService.php index 925ff38..e13a321 100644 --- a/app/Services/PatientFamilyService.php +++ b/app/Services/PatientFamilyService.php @@ -850,4 +850,24 @@ class PatientFamilyService extends BaseService return success(); } + + /** + * 获取家庭成员用药记录列表 + * @return array + */ + public function getFamilyProductRecord(): array + { + $user_info = $this->request->getAttribute("userInfo"); + + $family_id = $this->request->input('family_id'); + $page = $this->request->input('page', 1); + $per_page = $this->request->input('per_page', 10); + + + + + + return success(); + } + } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 700df12..81f1f28 100644 --- a/config/routes.php +++ b/config/routes.php @@ -292,6 +292,12 @@ Router::addGroup('/patient', function () { // 新增家庭成员-健康情况 Router::post('', [PatientFamilyController::class, 'addFamilyHealth']); }); + + // 药品 + Router::addGroup('/product', function () { + // 获取家庭成员用药记录列表 + Router::get('/record', [PatientFamilyController::class, 'getFamilyProductRecordList']); + }); }); // 病例 @@ -302,6 +308,7 @@ Router::addGroup('/patient', function () { // 药品 Router::addGroup('/product', function () { + // 购物车 Router::addGroup('/shopping', function () { // 获取购物车 Router::get('/cart', [UserPatientController::class, 'addShoppingCart']); @@ -312,6 +319,8 @@ Router::addGroup('/patient', function () { // 修改购物车 Router::put('/cart', [UserPatientController::class, 'putShoppingCart']); }); + + }); // 订单 diff --git a/extend/Alibaba/Dysms.php b/extend/Alibaba/Dysms.php index d38fc05..fd3c5f8 100644 --- a/extend/Alibaba/Dysms.php +++ b/extend/Alibaba/Dysms.php @@ -4,6 +4,7 @@ namespace Extend\Alibaba; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; use App\Model\LogSms; +use App\Utils\Log; use Darabonba\OpenApi\OpenApiClient; use AlibabaCloud\OpenApiUtil\OpenApiUtilClient; @@ -100,13 +101,21 @@ class Dysms throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::CODE_FAIL)); } + Log::getInstance()->info("发送短信日志:" . json_encode($result['body'],JSON_UNESCAPED_UNICODE)); + if ($result['body']['Code'] != "OK"){ - throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL); + if (isset($result['body']['MessageIm'])){ + throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL); + } + throw new BusinessException("短信发送失败",HttpEnumCode::CODE_FAIL); } if (empty($result['body']['RequestId'])){ // 无唯一值 - throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL); + if (isset($result['body']['MessageIm'])){ + throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL); + } + throw new BusinessException("短信发送失败",HttpEnumCode::CODE_FAIL); } // 记录log