新增消息推送,新增处方平台查询处方状态
This commit is contained in:
parent
ecbd558c22
commit
4bd15135c7
@ -10,6 +10,7 @@ use App\Model\UserCoupon;
|
|||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Services\ImService;
|
use App\Services\ImService;
|
||||||
use App\Services\InquiryService;
|
use App\Services\InquiryService;
|
||||||
|
use App\Services\MessagePush;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
use Hyperf\Amqp\Message\ConsumerDelayedMessageTrait;
|
use Hyperf\Amqp\Message\ConsumerDelayedMessageTrait;
|
||||||
use Hyperf\Amqp\Message\ProducerDelayedMessageTrait;
|
use Hyperf\Amqp\Message\ProducerDelayedMessageTrait;
|
||||||
@ -164,10 +165,14 @@ class CancelUnInquiryOrdersDelayDirectConsumer extends ConsumerMessage
|
|||||||
// 发送IM消息-问诊退款
|
// 发送IM消息-问诊退款
|
||||||
$imService->inquiryRefund($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
$imService->inquiryRefund($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||||
|
|
||||||
Log::getInstance()->info("取消未接诊问诊订单成功,发送IM消息成功");
|
// 发送站内消息-医生未接诊
|
||||||
|
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||||
|
$MessagePush->patientNoInquiry();
|
||||||
|
|
||||||
|
Log::getInstance()->info("取消未接诊问诊订单成功,发送消息成功");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 验证失败
|
// 验证失败
|
||||||
Log::getInstance()->error("取消未接诊问诊订单成功,发送IM消息失败:" . $e->getMessage());
|
Log::getInstance()->error("取消未接诊问诊订单成功,发送消息失败:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result::ACK;
|
return Result::ACK;
|
||||||
|
|||||||
@ -24,6 +24,7 @@ use App\Services\UserDoctorService;
|
|||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
use Extend\Alibaba\Oss;
|
use Extend\Alibaba\Oss;
|
||||||
use Extend\Ca\Ca;
|
use Extend\Ca\Ca;
|
||||||
|
use Extend\Prescription\Prescription;
|
||||||
use Hyperf\Amqp\Producer;
|
use Hyperf\Amqp\Producer;
|
||||||
use Hyperf\DbConnection\Db;
|
use Hyperf\DbConnection\Db;
|
||||||
use Hyperf\Utils\ApplicationContext;
|
use Hyperf\Utils\ApplicationContext;
|
||||||
@ -581,6 +582,11 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_11(){
|
public function test_11(){
|
||||||
|
$Prescription = new Prescription();
|
||||||
|
$result = $Prescription->getPrescription();
|
||||||
|
dump($result);
|
||||||
|
die;
|
||||||
|
|
||||||
$order_prescription_id = "501751534291394561";
|
$order_prescription_id = "501751534291394561";
|
||||||
|
|
||||||
// 获取处方数据
|
// 获取处方数据
|
||||||
|
|||||||
@ -27,9 +27,6 @@ use Psr\Container\NotFoundExceptionInterface;
|
|||||||
*/
|
*/
|
||||||
class MessagePush extends BaseService
|
class MessagePush extends BaseService
|
||||||
{
|
{
|
||||||
// 推送类型 1:站内 2:订阅 3:短信
|
|
||||||
public int $push_type;
|
|
||||||
|
|
||||||
// 用户数据(存在被推送者时存在,否则为空)
|
// 用户数据(存在被推送者时存在,否则为空)
|
||||||
public array $user = [];
|
public array $user = [];
|
||||||
|
|
||||||
@ -37,17 +34,11 @@ class MessagePush extends BaseService
|
|||||||
public array $order_inquiry = [];
|
public array $order_inquiry = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $push_type 推送类型 1:站内 2:订阅 3:短信
|
|
||||||
* @param string $to_user_id 用户id(存在被推送者时存在,否则为空)
|
* @param string $to_user_id 用户id(存在被推送者时存在,否则为空)
|
||||||
* @param string $order_inquiry_id 问诊订单id
|
* @param string $order_inquiry_id 问诊订单id
|
||||||
*/
|
*/
|
||||||
public function __construct(int $push_type, string $to_user_id = "", string $order_inquiry_id = "")
|
public function __construct(string $to_user_id = "", string $order_inquiry_id = "")
|
||||||
{
|
{
|
||||||
if (!in_array($push_type, [1, 2, 3])) {
|
|
||||||
throw new BusinessException("推送类型错误:" . $push_type);
|
|
||||||
}
|
|
||||||
$this->push_type = $push_type;
|
|
||||||
|
|
||||||
if (!empty($to_user_id)) {
|
if (!empty($to_user_id)) {
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['user_id'] = $to_user_id;
|
$params['user_id'] = $to_user_id;
|
||||||
@ -79,7 +70,6 @@ class MessagePush extends BaseService
|
|||||||
public function patientNoInquiry(): bool
|
public function patientNoInquiry(): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->push_type == 1) {
|
|
||||||
// 站内
|
// 站内
|
||||||
// 服务消息
|
// 服务消息
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -114,7 +104,7 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
} elseif ($this->push_type == 2) {
|
|
||||||
// 订阅
|
// 订阅
|
||||||
// 获取医生数据
|
// 获取医生数据
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -129,7 +119,7 @@ class MessagePush extends BaseService
|
|||||||
$sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI";//问诊异常通知
|
$sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI";//问诊异常通知
|
||||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||||
$sub_data['params']['data'] = [
|
$sub_data['params']['data'] = [
|
||||||
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
|
"character_string1" => (string)$this->order_inquiry['inquiry_no'],// 订单ID
|
||||||
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
||||||
"date3" => $this->order_inquiry['created_at'],// 问诊时间
|
"date3" => $this->order_inquiry['created_at'],// 问诊时间
|
||||||
"thing4" => inquiryCancelReasonToString($this->order_inquiry['cancel_reason']),// 取消原因
|
"thing4" => inquiryCancelReasonToString($this->order_inquiry['cancel_reason']),// 取消原因
|
||||||
@ -146,8 +136,6 @@ class MessagePush extends BaseService
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,6 +202,35 @@ class Prescription
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取处方订单
|
||||||
|
* @param string $order_product_no 商品订单号
|
||||||
|
* @param string $prescription_code 处方单号
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPrescription(string $order_product_no,string $prescription_code): array
|
||||||
|
{
|
||||||
|
$option = [
|
||||||
|
"json" => [
|
||||||
|
"terminalCode" => "ZD-10003",
|
||||||
|
"orderNo" => $order_product_no,
|
||||||
|
"prescriptionNo" => $prescription_code,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->httpRequest($this->api_url . $this->version . '/prescription/searchPresStatus', $option);
|
||||||
|
if (empty($response)){
|
||||||
|
// 返回值错误为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求封装
|
* 请求封装
|
||||||
* @param string $path
|
* @param string $path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user