From 142375a752c15dec2f4dad0299233a04efc9e0bc Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 20 Nov 2023 14:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B=E5=AE=B6?= =?UTF-8?q?=E5=BA=AD=E6=88=90=E5=91=98=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=97=85=E6=83=85=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PatientPathographyController.php | 23 ++++++++ app/Request/PatientPathographyRequest.php | 54 +++++++++++++++++++ app/Services/PatientPathographyService.php | 36 +++++++++++++ config/routes.php | 9 +++- 4 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 app/Controller/PatientPathographyController.php create mode 100644 app/Request/PatientPathographyRequest.php create mode 100644 app/Services/PatientPathographyService.php diff --git a/app/Controller/PatientPathographyController.php b/app/Controller/PatientPathographyController.php new file mode 100644 index 0000000..d60c722 --- /dev/null +++ b/app/Controller/PatientPathographyController.php @@ -0,0 +1,23 @@ +existFamilyPathography(); + return $this->response->json($data); + } +} \ No newline at end of file diff --git a/app/Request/PatientPathographyRequest.php b/app/Request/PatientPathographyRequest.php new file mode 100644 index 0000000..8433af7 --- /dev/null +++ b/app/Request/PatientPathographyRequest.php @@ -0,0 +1,54 @@ + [ // 获取患者优惠卷列表 +// 'user_coupon_status', +// ], + ]; + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + /** + * Get the validation rules that apply to the request. + */ + public function rules(): array + { + return [ +// 'user_coupon_status' => 'required|numeric|min:0|max:3', +// 'product_id' => 'required', +// 'shopping_cart_num' => 'required|numeric|min:0|max:999', + ]; + } + + /** + * 获取已定义验证规则的错误消息. + */ + public function messages(): array + { + return [ +// 'user_coupon_status.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'user_coupon_status.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'user_coupon_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'user_coupon_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'product_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// +// 'shopping_cart_num.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'shopping_cart_num.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'shopping_cart_num.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), +// 'shopping_cart_num.max' => "请勿超出最大添加数量", + ]; + } +} \ No newline at end of file diff --git a/app/Services/PatientPathographyService.php b/app/Services/PatientPathographyService.php new file mode 100644 index 0000000..3afd002 --- /dev/null +++ b/app/Services/PatientPathographyService.php @@ -0,0 +1,36 @@ +request->getAttribute("userInfo") ?? []; + $family_id = $this->request->route('family_id'); + + $result = array(); + $result['is_exist'] = 0; + + // 获取病情记录 + $params = array(); + $params['user_id'] = $user_info['user_id']; + $params['patient_id'] = $user_info['client_user_id']; + $params['family_id'] = $family_id; + $patient_pathography = PatientPathography::getLastOne($params); + if (!empty($patient_pathography)){ + $result['is_exist'] = 1; + } + + return success($result); + } +} \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 6be0c8f..2ee36e4 100644 --- a/config/routes.php +++ b/config/routes.php @@ -25,6 +25,7 @@ use App\Controller\PatientCenterController; use App\Controller\PatientDoctorController; use App\Controller\PatientFamilyController; use App\Controller\PatientOrderController; +use App\Controller\PatientPathographyController; use App\Controller\SafeController; use App\Controller\SystemController; use App\Controller\TestController; @@ -375,7 +376,7 @@ Router::addGroup('/patient', function () { Router::post('', [PatientFamilyController::class, 'addFamilyHealth']); }); - // 药品 + // 用药记录 Router::addGroup('/product', function () { // 获取家庭成员用药记录列表 Router::get('/record', [PatientFamilyController::class, 'getFamilyProductRecord']); @@ -485,6 +486,12 @@ Router::addGroup('/patient', function () { // 获取患者系统消息通知最后一条消息 Router::get('/system/last', [MessageNoticeController::class, 'getPatientMessageServiceLast']); }); + + // 病情记录 + Router::addGroup('/pathography', function () { + // 检测家庭成员是否存在病情记录 + Router::get('/exist/{family_id:\d+}', [PatientPathographyController::class, 'existFamilyPathography']); + }); }); // 药师端api