修改消息通知,新增患者问诊病例
This commit is contained in:
parent
aa8cbcf9e8
commit
84c24faf70
@ -9,6 +9,7 @@ use App\Amqp\Producer\CancelUnInquiryOrdersDelayDirectProducer;
|
||||
use App\Amqp\Producer\UserCouponExpiredDelayDirectProducer;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Services\ImService;
|
||||
use App\Services\InquiryService;
|
||||
@ -55,6 +56,15 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 获取病例数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)){
|
||||
Log::getInstance('queue-AssignDoctor')->error("错误:患者病例错误");
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
$res = $this->checkInquiryStatus($order_inquiry);
|
||||
if (!$res){
|
||||
@ -245,7 +255,7 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance("queue-AssignDoctor")->info("成功");
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollBack();
|
||||
Log::getInstance("queue-AssignDoctor")->error("失败:" . $e->getMessage());
|
||||
return Result::REQUEUE; // 重回队列
|
||||
@ -262,14 +272,19 @@ class AssignDoctorDelayDirectConsumer extends ConsumerMessage
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
// 发送IM消息-等待医生接诊
|
||||
// 发送im消息
|
||||
$imService = new ImService();
|
||||
|
||||
// 患者病例
|
||||
$imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']);
|
||||
|
||||
// 等待医生接诊
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 医生-医生有新问诊 站内、订阅失败发送短信
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->doctorHaveNewInquiry();
|
||||
}catch (\Exception $e){
|
||||
}catch (\Throwable $e){
|
||||
Log::getInstance("queue-AssignDoctor")->error("发送消息异常错误:" . $e->getMessage());
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
@ -90,6 +90,15 @@ class CallBackController extends AbstractController
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 获取病例数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)){
|
||||
Log::getInstance()->info("问诊微信支付回调数据处理失败,患者病例错误");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_inquiry['inquiry_status'] != 1) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
@ -174,8 +183,11 @@ class CallBackController extends AbstractController
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 发送IM消息-等待医生接诊
|
||||
// 发送im消息
|
||||
$imService = new ImService();
|
||||
// 患者病例
|
||||
$imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']);
|
||||
// 等待医生接诊
|
||||
$imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅失败发送短信消息-医生有新问诊
|
||||
@ -1321,7 +1333,7 @@ class CallBackController extends AbstractController
|
||||
|
||||
// 获取检测订单数据
|
||||
$params = array();
|
||||
$params['detection_no'] = "D547814062550614016";
|
||||
$params['detection_no'] = "D548076621233111040";
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)){
|
||||
return $this->detectionResultFailReturn("非法订单");
|
||||
|
||||
@ -739,4 +739,42 @@ class ImService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 患者病例
|
||||
* @param array|object $order_inquiry
|
||||
* @param string $doctor_user_id
|
||||
* @param string $disease_desc
|
||||
* @return void
|
||||
*/
|
||||
public function patientCase(array|object $order_inquiry, string $doctor_user_id,string $disease_desc): void
|
||||
{
|
||||
try {
|
||||
// 发送消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = $order_inquiry['inquiry_type'];
|
||||
$cloud_custom_data['message_rounds'] = 0;
|
||||
$cloud_custom_data['patient_family_data']['patient_name'] = $order_inquiry['patient_name'];
|
||||
$cloud_custom_data['patient_family_data']['patient_sex'] = $order_inquiry['patient_sex'];
|
||||
$cloud_custom_data['patient_family_data']['patient_age'] = $order_inquiry['patient_age'];
|
||||
|
||||
// 消息内容
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 11;
|
||||
$message_content_data['title'] = "患者信息";
|
||||
$message_content_data['desc'] = "";
|
||||
$message_content_data['data']['order_no'] = $order_inquiry['inquiry_no'];
|
||||
$message_content_data['data']['disease_desc'] = $disease_desc ?: "";
|
||||
$message_content_data['data']['message_path'] = "/Pages/yishi/case/index?order_inquiry_id=" . $order_inquiry['order_inquiry_id']; // 跳转地址(小程序内页)
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($doctor_user_id, $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -905,6 +905,15 @@ class PatientOrderService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "非法订单");
|
||||
}
|
||||
|
||||
// 获取病例数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "患者病例错误");
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_inquiry['inquiry_status'] != 1) {
|
||||
Db::rollBack();
|
||||
@ -964,8 +973,12 @@ class PatientOrderService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "医生数据错误");
|
||||
}
|
||||
|
||||
// 发送IM消息-等待医生接诊
|
||||
// 发送im消息
|
||||
$imService = new ImService();
|
||||
// 患者病例
|
||||
$imService->patientCase($order_inquiry,$user_doctor['user_id'],$order_inquiry_case['disease_desc']);
|
||||
|
||||
// 等待医生接诊
|
||||
$imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅失败发送短信消息-医生有新问诊
|
||||
|
||||
@ -1271,7 +1271,7 @@ class UserDoctorService extends BaseService
|
||||
$prescription_icd = $this->request->input('prescription_icd');
|
||||
$doctor_advice = $this->request->input('doctor_advice');
|
||||
$prescription_product = $this->request->input('prescription_product');
|
||||
$disease_desc = $this->request->input('disease_desc');
|
||||
$disease_desc = $this->request->input('disease_desc'); // 病情主诉
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user