新增检测家庭成员是否存在病情记录接口
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Services\PatientPathographyService;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 病情记录
|
||||
*/
|
||||
class PatientPathographyController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 检测家庭成员是否存在病情记录
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function existFamilyPathography(): ResponseInterface
|
||||
{
|
||||
$PatientPathographyService = new PatientPathographyService();
|
||||
$data = $PatientPathographyService->existFamilyPathography();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class PatientPathographyRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
// 'existFamilyPathography' => [ // 获取患者优惠卷列表
|
||||
// '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' => "请勿超出最大添加数量",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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->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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user