105 lines
3.1 KiB
PHP
105 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Constants\HttpEnumCode;
|
|
use App\Model\OrderPrescription;
|
|
use App\Model\UserPharmacist;
|
|
|
|
/**
|
|
* 药师
|
|
*/
|
|
class UserPharmacistService extends BaseService
|
|
{
|
|
/**
|
|
* 获取药师审核处方列表
|
|
* @return array
|
|
*/
|
|
public function getPrescriptionList(): array
|
|
{
|
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
|
|
|
$pharmacist_audit_status = $this->request->input('pharmacist_audit_status');
|
|
$platform_audit_status = $this->request->input('platform_audit_status');
|
|
$page = $this->request->input('page', 1);
|
|
$per_page = $this->request->input('per_page', 10);
|
|
|
|
$OrderPrescriptionService = new OrderPrescriptionService();
|
|
$prescription = $OrderPrescriptionService->getPharmacistWaitAuditPage($user_info['client_user_id'], $pharmacist_audit_status, $platform_audit_status, $page, $per_page);
|
|
if (!empty($prescription['data'])) {
|
|
foreach ($prescription['data'] as &$item) {
|
|
$item['prescription_img'] = addAliyunOssWebsite($item['prescription_img']);
|
|
}
|
|
}
|
|
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());
|
|
}
|
|
} |