修改问诊消息im发送
This commit is contained in:
parent
b8bdf25d36
commit
47e7e17c03
@ -178,8 +178,6 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
|
||||
try {
|
||||
// 分配医生成功,发送消息
|
||||
$ImService = new ImService();
|
||||
|
||||
// 获取订单医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
@ -189,32 +187,9 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
// 自定义消息
|
||||
$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'] = 1;
|
||||
$message_content_data['title'] = "--等待医生接诊--";
|
||||
if ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} else {
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
}
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
// 发送问诊消息-等待医生接诊
|
||||
$imService = new ImService();
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
Log::getInstance()->info("分配医生成功,发送系统问诊消息成功");
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -150,8 +150,6 @@ class CallBackController extends AbstractController
|
||||
// 专家-公益,发送im消息
|
||||
Log::getInstance()->info("开始发送im消息");
|
||||
|
||||
$ImService = new ImService();
|
||||
|
||||
// 获取订单医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||
@ -161,34 +159,9 @@ class CallBackController extends AbstractController
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 自定义消息
|
||||
$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'] = 1;
|
||||
$message_content_data['title'] = "--等待医生接诊--";
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为专家问诊,可以在24小时内和医生沟通20个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
}else{
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
}
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
|
||||
// 发送问诊消息-等待医生接诊
|
||||
$imService = new ImService();
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
Log::getInstance()->info("发送im消息成功");
|
||||
}
|
||||
|
||||
@ -363,6 +363,7 @@ class UserDoctorController extends AbstractController
|
||||
/**
|
||||
* 新增医生接诊
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function addDoctorInquiry(): ResponseInterface
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ class ImService extends BaseService
|
||||
$params = array();
|
||||
$params['user_id'] = $user_id;
|
||||
$user = User::getOne($params);
|
||||
if (empty($user)){
|
||||
if (empty($user)) {
|
||||
throw new BusinessException("用户数据错误");
|
||||
}
|
||||
|
||||
@ -42,32 +42,32 @@ class ImService extends BaseService
|
||||
$account = new Account();
|
||||
// 查询账号导入状态
|
||||
$res = $account->checkAccountStatus($user['user_id']);
|
||||
if (!$res){
|
||||
if (!$res) {
|
||||
// 创建单个账号
|
||||
$account->createAccount($user_id,$user['user_name'],$avatar);
|
||||
$account->createAccount($user_id, $user['user_name'], $avatar);
|
||||
}
|
||||
|
||||
// 检测用户资料
|
||||
$profile = new Profile();
|
||||
$result = $profile->getOneAccountPortraitList($user['user_id']);
|
||||
if (!empty($result)){
|
||||
if (!empty($result)) {
|
||||
$arg = array();
|
||||
|
||||
// 头像
|
||||
if (in_array('Tag_Profile_IM_Image',$result)){
|
||||
if (in_array('Tag_Profile_IM_Image', $result)) {
|
||||
$arg['Tag_Profile_IM_Image'] = $avatar;
|
||||
}
|
||||
|
||||
// 性别
|
||||
if (in_array('Tag_Profile_IM_Gender',$result)){
|
||||
if (in_array('Tag_Profile_IM_Gender', $result)) {
|
||||
$arg['Tag_Profile_IM_Gender'] = sexToImSex($user['sex']);
|
||||
}
|
||||
|
||||
if ($user['user_type'] == 2){
|
||||
if ($user['user_type'] == 2) {
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
throw new BusinessException("医生数据错误");
|
||||
}
|
||||
|
||||
@ -75,23 +75,23 @@ class ImService extends BaseService
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params);
|
||||
if (empty($hospital)){
|
||||
if (empty($hospital)) {
|
||||
throw new BusinessException("医生医院数据错误");
|
||||
}
|
||||
|
||||
// 医院
|
||||
if (in_array('Tag_Profile_Custom_Hname',$result)){
|
||||
if (in_array('Tag_Profile_Custom_Hname', $result)) {
|
||||
$arg['Tag_Profile_Custom_Hname'] = $hospital['hospital_name'];
|
||||
}
|
||||
|
||||
// 职称
|
||||
if (in_array('Tag_Profile_Custom_Title',$result)){
|
||||
if (in_array('Tag_Profile_Custom_Title', $result)) {
|
||||
$arg['Tag_Profile_Custom_Title'] = $user_doctor['doctor_title'] ?? DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arg)){
|
||||
$profile->setProfile($user['user_id'],$arg);
|
||||
if (!empty($arg)) {
|
||||
$profile->setProfile($user['user_id'], $arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ class ImService extends BaseService
|
||||
$params = array();
|
||||
$params['user_id'] = $user_id;
|
||||
$user = User::getOne($params);
|
||||
if (empty($user)){
|
||||
if (empty($user)) {
|
||||
throw new BusinessException("用户数据错误");
|
||||
}
|
||||
|
||||
@ -123,24 +123,24 @@ class ImService extends BaseService
|
||||
$profile = new Profile();
|
||||
$result = $profile->getOneAccountPortraitList($user['user_id']);
|
||||
|
||||
if (!empty($result)){
|
||||
if (!empty($result)) {
|
||||
$arg = array();
|
||||
|
||||
// 头像
|
||||
if (in_array('Tag_Profile_IM_Image',$result)){
|
||||
if (in_array('Tag_Profile_IM_Image', $result)) {
|
||||
$arg['Tag_Profile_IM_Image'] = $avatar;
|
||||
}
|
||||
|
||||
// 性别
|
||||
if (in_array('Tag_Profile_IM_Gender',$result)){
|
||||
if (in_array('Tag_Profile_IM_Gender', $result)) {
|
||||
$arg['Tag_Profile_IM_Gender'] = sexToImSex($user['sex']);
|
||||
}
|
||||
|
||||
if ($user['user_type'] == 2){
|
||||
if ($user['user_type'] == 2) {
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
throw new BusinessException("医生数据错误");
|
||||
}
|
||||
|
||||
@ -148,23 +148,23 @@ class ImService extends BaseService
|
||||
$params = array();
|
||||
$params['hospital_id'] = $user_doctor['hospital_id'];
|
||||
$hospital = Hospital::getOne($params);
|
||||
if (empty($hospital)){
|
||||
if (empty($hospital)) {
|
||||
throw new BusinessException("医生医院数据错误");
|
||||
}
|
||||
|
||||
// 医院
|
||||
if (in_array('Tag_Profile_Custom_Hname',$result)){
|
||||
if (in_array('Tag_Profile_Custom_Hname', $result)) {
|
||||
$arg['Tag_Profile_Custom_Hname'] = $hospital['hospital_name'];
|
||||
}
|
||||
|
||||
// 职称
|
||||
if (in_array('Tag_Profile_Custom_Title',$result)){
|
||||
if (in_array('Tag_Profile_Custom_Title', $result)) {
|
||||
$arg['Tag_Profile_Custom_Title'] = $user_doctor['doctor_title'] ?? DoctorTitleCode::getMessage($user_doctor['doctor_title']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arg)){
|
||||
$profile->setProfile($user['user_id'],$arg);
|
||||
if (!empty($arg)) {
|
||||
$profile->setProfile($user['user_id'], $arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,15 +180,15 @@ class ImService extends BaseService
|
||||
* @param string $sign 签名
|
||||
* @return bool
|
||||
*/
|
||||
public function validateSign(string $request_time,string $sign): bool
|
||||
public function validateSign(string $request_time, string $sign): bool
|
||||
{
|
||||
$token = config('im.token');
|
||||
if (empty($token)){
|
||||
if (empty($token)) {
|
||||
throw new BusinessException("Im Token Config Error");
|
||||
}
|
||||
|
||||
$sys_sign = hash("sha256", $token . $request_time);
|
||||
if ($sign != $sys_sign){
|
||||
if ($sign != $sys_sign) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ class ImService extends BaseService
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addRecentContactRecordCache(string $doctor_id,string $inquiry_type,string $patient_user_id,array $content): void
|
||||
public function addRecentContactRecordCache(string $doctor_id, string $inquiry_type, string $patient_user_id, array $content): void
|
||||
{
|
||||
$redis_key = "recentContact" . $doctor_id . $inquiry_type;
|
||||
|
||||
@ -213,7 +213,7 @@ class ImService extends BaseService
|
||||
|
||||
$redis = $this->container->get(Redis::class);
|
||||
|
||||
$redis->hSet($redis_key,$hash_key,json_encode($content,JSON_UNESCAPED_UNICODE));
|
||||
$redis->hSet($redis_key, $hash_key, json_encode($content, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,7 +228,7 @@ class ImService extends BaseService
|
||||
public function sendMessage(string $from_user_id, string $to_user_id, array $message_content, string $message_type, array $cloud_custom_data): void
|
||||
{
|
||||
try {
|
||||
if (!empty($from_user_id)){
|
||||
if (!empty($from_user_id)) {
|
||||
// 检测并创建发送者资料
|
||||
$this->setUserProfile($from_user_id);
|
||||
}
|
||||
@ -239,11 +239,11 @@ class ImService extends BaseService
|
||||
$message = new Message();
|
||||
|
||||
$arg = array();
|
||||
if (!empty($from_user_id)){
|
||||
if (!empty($from_user_id)) {
|
||||
$arg['From_Account'] = $from_user_id; // 发送方user_id 如系统发送,无需填写
|
||||
}
|
||||
$arg['To_Account'] = $to_user_id; // 接收方user_id
|
||||
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback',"ForbidAfterSendMsgCallback"];
|
||||
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback', "ForbidAfterSendMsgCallback"];
|
||||
$arg['SendMsgControl'] = ['NoUnread'];
|
||||
|
||||
$arg['MsgBody'] = [
|
||||
@ -254,30 +254,31 @@ class ImService extends BaseService
|
||||
];
|
||||
|
||||
$arg['CloudCustomData'] = "";
|
||||
if (!empty($cloud_custom_data)){
|
||||
$arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
|
||||
if (!empty($cloud_custom_data)) {
|
||||
$arg['CloudCustomData'] = json_encode($cloud_custom_data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
// 该条消息是否需要已读回执,0为不需要,1为需要,默认为0
|
||||
$arg['IsNeedReadReceipt'] = 1;
|
||||
|
||||
$message->sendMessage($arg);
|
||||
}catch (\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 问诊已结束
|
||||
public function sendInquiryEnd(array $order_inquiry,string $from_user_id){
|
||||
/**
|
||||
* 问诊已结束
|
||||
* @param array|object $order_inquiry 问诊订单数据
|
||||
* @param string $doctor_user_id 医生用户id
|
||||
* @param string $patient_user_id 患者用户id
|
||||
* @return void
|
||||
*/
|
||||
public function inquiryEnd(array|object $order_inquiry, string $doctor_user_id, string $patient_user_id): void
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
@ -288,16 +289,164 @@ class ImService extends BaseService
|
||||
$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'] = 1;
|
||||
$message_content_data['title'] = "问诊已结束";
|
||||
$message_content_data['message_type'] = 8;
|
||||
$message_content_data['title'] = "--问诊已结束--";
|
||||
$message_content_data['desc'] = "线上咨询不能代替问诊,医生的回复仅为建议。";
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($from_user_id, $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
$this->sendMessage($patient_user_id, $doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
// 消息内容 医生-患者
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 1;
|
||||
$message_content_data['title'] = "--问诊已结束--";
|
||||
$message_content_data['desc'] = "线上咨询不能代替问诊,医生的回复仅为建议。";
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($doctor_user_id, $patient_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 等待医生接诊
|
||||
* @param array|object $order_inquiry 问诊订单数据
|
||||
* @param string $doctor_user_id 医生用户id
|
||||
* @param string $patient_user_id 患者用户id
|
||||
* @return void
|
||||
*/
|
||||
public function waitDoctorInquiry(array|object $order_inquiry, string $doctor_user_id, string $patient_user_id): 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'] = 8;
|
||||
$message_content_data['title'] = "--等待医生接诊--";
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为专家问诊,可以在24小时内和医生沟通20个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 3){
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} else {
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
}
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($patient_user_id, $doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
// 消息内容 医生-患者
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 1;
|
||||
$message_content_data['title'] = "--等待医生接诊--";
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为专家问诊,可以在24小时内和医生沟通20个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 3){
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
} else {
|
||||
$message_content_data['desc'] = "温馨提示:当前服务为公益问诊,可以在24小时内和医生沟通10个回合。医生均为一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
}
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($doctor_user_id, $patient_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生接诊
|
||||
* @param array|object $order_inquiry 问诊订单数据
|
||||
* @param string $doctor_user_id 医生用户id
|
||||
* @param string $patient_user_id 患者用户id
|
||||
* @return void
|
||||
*/
|
||||
public function doctorInquiry(array|object $order_inquiry, string $doctor_user_id, string $patient_user_id): 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'] = 8;
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续60分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 3){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可一次描述需要问诊的内容,以免浪费问诊次数,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 4){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续30分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
}
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($patient_user_id, $doctor_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
// 消息内容 医生-患者
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 1;
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续60分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 3){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可一次描述需要问诊的内容,以免浪费问诊次数,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 4){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续30分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
}
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data, JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$this->sendMessage($doctor_user_id, $patient_user_id, $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1641,44 +1641,9 @@ class UserDoctorService extends BaseService
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
OrderInquiry::edit($params,$data);
|
||||
|
||||
// 发送问诊消息
|
||||
$ImService = new ImService();
|
||||
|
||||
// 发送消息
|
||||
$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'] = 1;
|
||||
$message_content_data['title'] = "";
|
||||
$message_content_data['desc'] = "";
|
||||
|
||||
if ($order_inquiry['inquiry_type'] == 1){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续60分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 3){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续24小时--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可一次描述需要问诊的内容,以免浪费问诊次数,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
} elseif ($order_inquiry['inquiry_type'] == 4){
|
||||
$message_content_data['title'] = "--问诊已开始,本次问诊可持续30分钟--";
|
||||
$message_content_data['desc'] = "医生已接诊,您可继续补充问诊内容,如目前症状、患病时长、检查及用药情况、需要的帮助等,线上咨询不能代表面诊,医生的回复仅为建议。";
|
||||
}
|
||||
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_info['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
// 发送问诊消息-医生接诊
|
||||
$imService = new ImService();
|
||||
$imService->doctorInquiry($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
@ -1761,29 +1726,9 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "添加患者历史问诊表失败");
|
||||
}
|
||||
|
||||
// 发送问诊消息
|
||||
$ImService = new ImService();
|
||||
|
||||
// 发送消息
|
||||
$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'] = 1;
|
||||
$message_content_data['title'] = "问诊已结束";
|
||||
$message_content_data['desc'] = "线上咨询不能代替问诊,医生的回复仅为建议。";
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_info['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
// 发送问诊消息-问诊已结束
|
||||
$imService = new ImService();
|
||||
$imService->inquiryEnd($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user