修正路由
This commit is contained in:
parent
083484aad6
commit
65a5f6bc4d
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Request\PatientFamilyRequest;
|
||||
use App\Services\PatientFamilyService;
|
||||
use App\Services\PatientPathographyService;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@ -250,15 +251,4 @@ class PatientFamilyController extends AbstractController
|
||||
$data = $patientFamilyService->getFamilyCase();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测家庭成员是否存在病情记录
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function existFamilyPathography(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
$data = $patientFamilyService->existFamilyPathography();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
32
app/Controller/PatientPathographyController.php
Normal file
32
app/Controller/PatientPathographyController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Request\PatientPathographyRequest;
|
||||
use App\Services\PatientPathographyService;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 家庭成员病情记录
|
||||
*/
|
||||
class PatientPathographyController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 检测家庭成员是否存在病情记录
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function existFamilyPathography(): ResponseInterface
|
||||
{
|
||||
try {
|
||||
$request = $this->container->get(PatientPathographyRequest::class);
|
||||
$request->scene('existFamilyPathography')->validateResolved();
|
||||
|
||||
$PatientPathographyService = new PatientPathographyService();
|
||||
$data = $PatientPathographyService->existFamilyPathography();
|
||||
return $this->response->json($data);
|
||||
}catch (\Throwable $e){
|
||||
return $this->response->json(fail());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,9 +8,9 @@ use Hyperf\Validation\Request\FormRequest;
|
||||
class PatientPathographyRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
// 'existFamilyPathography' => [ // 获取患者优惠卷列表
|
||||
// 'user_coupon_status',
|
||||
// ],
|
||||
'existFamilyPathography' => [ // 获取患者优惠卷列表
|
||||
'family_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -27,9 +27,7 @@ class PatientPathographyRequest extends FormRequest
|
||||
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',
|
||||
'family_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@ -39,8 +37,7 @@ class PatientPathographyRequest extends FormRequest
|
||||
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),
|
||||
'family_id.required' => 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),
|
||||
|
||||
@ -1044,28 +1044,5 @@ class PatientFamilyService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测家庭成员是否存在病情记录
|
||||
* @return array
|
||||
*/
|
||||
public function existFamilyPathography(): array
|
||||
{
|
||||
$user_info = $this->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);
|
||||
}
|
||||
}
|
||||
36
app/Services/PatientPathographyService.php
Normal file
36
app/Services/PatientPathographyService.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Model\PatientPathography;
|
||||
|
||||
/**
|
||||
* 家庭成员病情记录
|
||||
*/
|
||||
class PatientPathographyService extends BaseService
|
||||
{
|
||||
/**
|
||||
* 检测家庭成员是否存在病情记录
|
||||
* @return array
|
||||
*/
|
||||
public function existFamilyPathography(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
$family_id = $this->request->input('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);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
@ -384,10 +385,10 @@ Router::addGroup('/patient', function () {
|
||||
// 病情记录
|
||||
Router::addGroup('/pathography', function () {
|
||||
// 检测家庭成员是否存在病情记录
|
||||
Router::get('/exist/{family_id:\d+}', [PatientFamilyController::class, 'existFamilyPathography']);
|
||||
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||
|
||||
// // 获取家庭成员病情记录列表-分页
|
||||
// Router::get('/exist/{family_id:\d+}', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||
// 获取家庭成员病情记录列表-分页
|
||||
Router::get('/{family_id:\d+}', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user