新增阿里云oss上传文件
This commit is contained in:
@@ -41,6 +41,10 @@ class SafeService extends BaseService
|
||||
// 证书
|
||||
$dir = $dir . 'cert/';
|
||||
break;
|
||||
case 3:
|
||||
// 名片
|
||||
$dir = $dir . 'card/';
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Amqp\Producer\PrescriptionDistributePhProducer;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\BasicBank;
|
||||
@@ -14,6 +15,7 @@ use App\Model\DoctorBankCard;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\DoctorInquiryConfig;
|
||||
use App\Model\DoctorWord;
|
||||
use App\Model\Hospital;
|
||||
use App\Model\InquiryCaseProduct;
|
||||
use App\Model\OrderEvaluation;
|
||||
use App\Model\OrderInquiry;
|
||||
@@ -27,12 +29,19 @@ use App\Model\User;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Utils\Mask;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\Wechat\Wechat;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\IdGeneratorInterface;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class UserDoctorService extends BaseService
|
||||
{
|
||||
@@ -1097,9 +1106,9 @@ class UserDoctorService extends BaseService
|
||||
return fail();
|
||||
}
|
||||
|
||||
if (in_array($order_inquiry['inquiry_status'], [1, 2,3,6,7])){
|
||||
if (in_array($order_inquiry['inquiry_status'], [1, 2, 3, 6, 7])) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单无法开具处方");
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "订单无法开具处方");
|
||||
}
|
||||
|
||||
// 检测处方是否重复开具
|
||||
@@ -1108,7 +1117,7 @@ class UserDoctorService extends BaseService
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (!empty($order_prescription)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单已开具处方,无法重复开具");
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "订单已开具处方,无法重复开具");
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
@@ -1127,9 +1136,9 @@ class UserDoctorService extends BaseService
|
||||
$data['patient_age'] = $order_inquiry['patient_age'];
|
||||
$data['doctor_advice'] = $doctor_advice;
|
||||
$order_prescription = OrderPrescription::addOrderPrescription($data);
|
||||
if (empty($order_prescription)){
|
||||
if (empty($order_prescription)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR,"处方开具失败");
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
|
||||
}
|
||||
|
||||
foreach ($prescription_icd as $item) {
|
||||
@@ -1224,6 +1233,89 @@ class UserDoctorService extends BaseService
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生名片
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DecodingExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
*/
|
||||
public function getDoctorInfoCard(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
$fields = [
|
||||
'doctor_id',
|
||||
'iden_auth_status',
|
||||
'idcard_status',
|
||||
'multi_point_status',
|
||||
'hospital_id',
|
||||
];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||
}
|
||||
|
||||
$res = $this->checkDoctorAuth($user_doctor);
|
||||
if ($res !== true) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
}
|
||||
|
||||
// 获取医生医院
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params);
|
||||
if (empty($hospital)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取医生分享二维码
|
||||
$qr_code = $user_doctor['qr_code'];
|
||||
if (empty($qr_code)){
|
||||
$weChat = new Wechat(1);
|
||||
|
||||
$options = [
|
||||
"scene" => "doctor_id=" . $user_doctor['doctor_id'],// query 参数
|
||||
"page" => "",
|
||||
"check_path" => false,
|
||||
"env_version" => "develop",
|
||||
];
|
||||
|
||||
$img_buffer = $weChat->getUnlimitedQRCode($options);
|
||||
|
||||
$oss = new Oss();
|
||||
|
||||
$filename = $user_doctor['doctor_id'] . '.' . 'jpg';
|
||||
|
||||
$qr_code = $oss->putObject($filename, $img_buffer);
|
||||
|
||||
// 存储至医生表
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
|
||||
$data = array();
|
||||
$data['qr_code'] = $qr_code;
|
||||
UserDoctor::editUserDoctor($params,$data);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['user_name'] = $user_doctor['user_name'];
|
||||
$result['doctor_title'] = DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
$result['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
$result['department_custom_name'] = $user_doctor['department_custom_name'];
|
||||
$result['hospital_name'] = $hospital['hospital_name'];
|
||||
$result['qr_code_url'] = addAliyunOssWebsite($user_doctor['qr_code']);
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测医生身份认证
|
||||
* @param object|array $user_doctor 医生表数据
|
||||
|
||||
Reference in New Issue
Block a user