diff --git a/app/Controller/PatientCaseController.php b/app/Controller/PatientCaseController.php index 9d55f5c..769436f 100644 --- a/app/Controller/PatientCaseController.php +++ b/app/Controller/PatientCaseController.php @@ -93,4 +93,26 @@ class PatientCaseController extends AbstractController $data = $PatientCaseService->sendCaseUnfilledFieldsToDoctor(); return $this->response->json($data); } + + /** + * 获取服务包订单病例详情-基础 + * @return ResponseInterface + */ + public function getPatientFamilyServiceCaseSimple(): ResponseInterface + { + $PatientCaseService = new PatientCaseService(); + $data = $PatientCaseService->getPatientFamilyServiceCaseSimple(); + return $this->response->json($data); + } + + /** + * 获取服务包订单病例详情 + * @return ResponseInterface + */ + public function getPatientFamilyServiceCase(): ResponseInterface + { + $PatientCaseService = new PatientCaseService(); + $data = $PatientCaseService->getPatientFamilyServiceCase(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/PatientCaseService.php b/app/Services/PatientCaseService.php index d666f6f..a18c3f7 100644 --- a/app/Services/PatientCaseService.php +++ b/app/Services/PatientCaseService.php @@ -7,12 +7,15 @@ use App\Model\BasicJob; use App\Model\BasicNation; use App\Model\DetectionProject; use App\Model\InquiryCaseProduct; +use App\Model\Order; use App\Model\OrderDetection; use App\Model\OrderInquiry; use App\Model\OrderInquiryCase; use App\Model\OrderPrescription; use App\Model\OrderPrescriptionIcd; use App\Model\OrderPrescriptionProduct; +use App\Model\OrderServicePackage; +use App\Model\OrderServicePackageCase; use App\Model\PatientFamily; use App\Model\PatientFamilyHealth; use App\Model\PatientFamilyPersonal; @@ -630,4 +633,90 @@ class PatientCaseService extends BaseService return success(); } + + /** + * 获取服务包订单病例详情-基础 + * @return array + */ + public function getPatientFamilyServiceCaseSimple(): array + { + $order_no = $this->request->route('order_no'); + + // 获取订单数据 + $params = array(); + $params['order_no'] = $order_no; + $order = Order::getOne($params); + if (empty($order)) { + return fail(); + } + + $params = array(); + $params['order_no'] = $order_no; + $order_service_package = OrderServicePackage::getOne($params); + if (empty($order_service_package)) { + return fail(); + } + + $params = array(); + $params['order_id'] = $order['order_id']; + $order_service_package_case = OrderServicePackageCase::getOne($params); + if (empty($order_service_package_case)) { + return fail(); + } + + $result = array(); + $result['patient_name'] = $order_service_package['patient_name']; + $result['patient_sex'] = $order_service_package['patient_sex']; + $result['patient_age'] = $order_service_package['patient_age']; + $result['disease_desc'] = $order_service_package_case['disease_desc']; + $result['created_at'] = $order_service_package['created_at']; // 创建时间 + + return success($result); + } + + /** + * 获取服务包订单病例详情 + * @return array + */ + public function getPatientFamilyServiceCase(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + $order_no = $this->request->route('order_no'); + + // 获取订单数据 + $params = array(); + $params['order_no'] = $order_no; + $order = Order::getOne($params); + if (empty($order)) { + return fail(); + } + + $params = array(); + $params['order_no'] = $order_no; + $order_service_package = OrderServicePackage::getOne($params); + if (empty($order_service_package)) { + return fail(); + } + + $params = array(); + $params['order_id'] = $order['order_id']; + $order_service_package_case = OrderServicePackageCase::getOne($params); + if (empty($order_service_package_case)) { + return fail(); + } + + $order_service_package_case = $order_service_package_case->toArray(); + + // 复诊凭证 + if (!empty($order_service_package_case['diagnose_images'])) { + $diagnose_images = explode(',', $order_service_package_case['diagnose_images']); + foreach ($diagnose_images as &$item) { + $item = addAliyunOssWebsite($item); + } + + $order_service_package_case['diagnose_images'] = $diagnose_images; + } + + return success($order_service_package_case); + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index e8d51dd..ae59f57 100644 --- a/config/routes.php +++ b/config/routes.php @@ -868,6 +868,12 @@ Router::addGroup('/case', function () { // 获取问诊订单病例详情 Router::get('/inquiry', [PatientCaseController::class, 'getPatientFamilyInquiryCase']); + // 获取服务包订单病例详情-基础 + Router::get('/service/simple/{order_no}', [PatientCaseController::class, 'getPatientFamilyServiceCaseSimple']); + + // 获取服务包订单病例详情 + Router::get('/service/{order_no}', [PatientCaseController::class, 'getPatientFamilyServiceCase']); + // 病例未填字段 Router::addGroup('/fields', function () { // 获取问诊订单病例缺少字段