新增获取处方详情接口
This commit is contained in:
parent
929767de14
commit
0370c31431
@ -28,4 +28,31 @@ class UserPharmacistController extends AbstractController
|
||||
$data = $UserPharmacistService->getPrescriptionList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置上下线
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putOnOff(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserPharmacistRequest::class);
|
||||
$request->scene('putOnOff')->validateResolved();
|
||||
|
||||
$UserPharmacistService = new UserPharmacistService();
|
||||
$data = $UserPharmacistService->putOnOff();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方详情
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getPrescriptionInfo(): ResponseInterface
|
||||
{
|
||||
$UserPharmacistService = new UserPharmacistService();
|
||||
$data = $UserPharmacistService->getPrescriptionInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,9 @@ class UserPharmacistRequest extends FormRequest
|
||||
'pharmacist_audit_status',
|
||||
'platform_audit_status',
|
||||
],
|
||||
'putOnOff' => [ // 设置上下线
|
||||
'is_online',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -32,6 +35,7 @@ class UserPharmacistRequest extends FormRequest
|
||||
return [
|
||||
'pharmacist_audit_status' => 'required|integer|min:0|max:2',
|
||||
'platform_audit_status' => 'required|integer|min:0|max:2',
|
||||
'is_online' => 'required|integer|min:0|max:1',
|
||||
];
|
||||
}
|
||||
|
||||
@ -49,6 +53,10 @@ class UserPharmacistRequest extends FormRequest
|
||||
'platform_audit_status.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'platform_audit_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'platform_audit_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_online.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_online.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_online.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_online.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Model\UserPharmacist;
|
||||
|
||||
/**
|
||||
* 药师
|
||||
*/
|
||||
@ -29,4 +33,73 @@ class UserPharmacistService extends BaseService
|
||||
}
|
||||
return success($prescription);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置上下线
|
||||
* @return array
|
||||
*/
|
||||
public function putOnOff(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$is_online = $this->request->input('is_online');
|
||||
|
||||
// 获取药师数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$user_pharmacist = UserPharmacist::getOne($params);
|
||||
if (empty($user_pharmacist)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['is_online'] = $is_online;
|
||||
|
||||
$params = array();
|
||||
$params['pharmacist_id'] = $user_pharmacist['pharmacist_id'];
|
||||
UserPharmacist::editUserPharmacist($params, $data);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方详情
|
||||
* @return array
|
||||
*/
|
||||
public function getPrescriptionInfo(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_prescription_id = $this->request->route('order_prescription_id');
|
||||
|
||||
// 获取药师数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$user_pharmacist = UserPharmacist::getOne($params);
|
||||
if (empty($user_pharmacist)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$fields = [
|
||||
"order_prescription_id",
|
||||
"order_inquiry_id",
|
||||
"prescription_status",
|
||||
"pharmacist_audit_status",
|
||||
"platform_audit_status",
|
||||
"prescription_img",
|
||||
];
|
||||
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $order_prescription_id;
|
||||
$params['pharmacist_id'] = $user_info['client_user_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params, $fields);
|
||||
if (empty($order_prescription)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$order_prescription['prescription_img'] = addAliyunOssWebsite($order_prescription['prescription_img']);
|
||||
|
||||
return success($order_prescription->toArray());
|
||||
}
|
||||
}
|
||||
@ -357,10 +357,16 @@ Router::addGroup('/pharmacist', function () {
|
||||
// 首页
|
||||
Router::get('/index', [IndexController::class, 'pharmacistIndex']);
|
||||
|
||||
// 设置上下线
|
||||
Router::put('/on-off', [UserPharmacistController::class, 'putOnOff']);
|
||||
|
||||
// 处方
|
||||
Router::addGroup('/prescription', function () {
|
||||
// 获取药师审核处方列表
|
||||
Router::get('', [UserPharmacistController::class, 'getPrescriptionList']);
|
||||
|
||||
// 获取处方详情
|
||||
Router::get('/info/{order_prescription_id:\d+}', [UserPharmacistController::class, 'getPrescriptionInfo']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user