From fa44ffae3f7e086802db311ec6dd81a77fdb0e84 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 27 Mar 2023 09:00:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9F=BA=E7=A1=80=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/MessageNotice.php | 10 +++--- app/Model/MessageNoticeSystem.php | 12 +++++--- app/Services/InquiryService.php | 44 +++++++++++++++++++++------ app/Services/MessageNoticeService.php | 16 +++++----- 4 files changed, 55 insertions(+), 27 deletions(-) diff --git a/app/Model/MessageNotice.php b/app/Model/MessageNotice.php index 0b33abb..6b85a35 100644 --- a/app/Model/MessageNotice.php +++ b/app/Model/MessageNotice.php @@ -21,8 +21,11 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $notice_content 内容 * @property int $send_status 发送状态(0:未处理 1:已发送 2:发送失败) * @property string $send_fail_reason 发送失败原因 - * @property int $link_type 链接类型(1:无按钮 2:我的账户 3:联系客服 4:问诊消息 5:多点执业认证 6:协议书) - * @property string $notice_params 通知参数(json数据,此字段内容和link_type字段有关联) + * @property int $button_type 按钮类型(1:我的账户 2:联系客服 3:查看协议 4:订单详情 5:查看处方 ) + * @property int $link_type 跳转页面类型(1:聊天详情页 2:问诊结束列表页 3:问诊消息列表页 4:我的名片 5:我的简介 6:我的账户 7:我的福利 8:药品订单详情页 9:物流详情 10:问诊订单详情 11:联系客服 12:协议详情 13:处方详情) + * @property string $link_params 跳转参数(json) + * @property int $show_type 展示类型(1:医生数据) + * @property string $show_params 展示数据(json) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -38,7 +41,7 @@ class MessageNotice extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['notice_id', 'user_id', 'user_type', 'notice_type', 'notice_system_type', 'read_status', 'from_name', 'notice_title', 'notice_send_time', 'notice_content', 'send_status', 'send_fail_reason', 'link_type', 'notice_params', 'created_at', 'updated_at']; + protected array $fillable = ['notice_id', 'user_id', 'user_type', 'notice_type', 'notice_system_type', 'read_status', 'from_name', 'notice_title', 'notice_send_time', 'notice_content', 'send_status', 'send_fail_reason', 'button_type', 'link_type', 'link_params', 'show_type', 'show_params', 'created_at', 'updated_at']; protected string $primaryKey = "message_id"; @@ -107,5 +110,4 @@ class MessageNotice extends Model return $data; } - } diff --git a/app/Model/MessageNoticeSystem.php b/app/Model/MessageNoticeSystem.php index af593e5..19cfadd 100644 --- a/app/Model/MessageNoticeSystem.php +++ b/app/Model/MessageNoticeSystem.php @@ -13,14 +13,18 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $notice_id 主键id * @property int $notice_type 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息) * @property int $notice_system_type 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息) + * @property int $read_status 读取状态(0:未读 1:已读) * @property string $from_name 发送人姓名 * @property string $notice_title 消息标题 + * @property string $notice_send_time 发送时间 * @property string $notice_content 内容 * @property int $send_status 发送状态(0:未处理 1:已发送 2:发送失败) - * @property string $notice_send_time 发送时间 * @property string $send_fail_reason 发送失败原因 - * @property int $link_type 链接类型(1:无按钮 2:我的账户 3:联系客服 4:问诊消息 5:多点执业认证 6:协议书) - * @property string $notice_params 通知参数(json数据,此字段内容和link_type字段有关联) + * @property int $button_type 按钮类型(1:我的账户 2:联系客服 3:查看协议 4:订单详情 5:查看处方 ) + * @property int $link_type 跳转页面类型(1:聊天详情页 2:问诊结束列表页 3:问诊消息列表页 4:我的名片 5:我的简介 6:我的账户 7:我的福利 8:药品订单详情页 9:物流详情 10:问诊订单详情 11:联系客服 12:协议详情 13:处方详情) + * @property string $link_params 跳转参数(json) + * @property int $show_type 展示类型(1:医生数据) + * @property string $show_params 展示数据(json) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -36,7 +40,7 @@ class MessageNoticeSystem extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['notice_id', 'notice_type', 'notice_system_type', 'from_name', 'notice_title', 'notice_content', 'send_status', 'notice_send_time', 'send_fail_reason', 'link_type', 'notice_params', 'created_at', 'updated_at']; + protected array $fillable = ['notice_id', 'notice_type', 'notice_system_type', 'read_status', 'from_name', 'notice_title', 'notice_send_time', 'notice_content', 'send_status', 'send_fail_reason', 'button_type', 'link_type', 'link_params', 'show_type', 'show_params', 'created_at', 'updated_at']; protected string $primaryKey = "message_id"; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index c4818c6..2d82bbc 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -18,6 +18,7 @@ use App\Model\OrderInquiryRefund; use App\Model\PatientFamily; use App\Model\PatientFamilyHealth; use App\Model\PatientFamilyPersonal; +use App\Model\PatientFollow; use App\Model\Product; use App\Model\SystemInquiryConfig; use App\Model\User; @@ -600,19 +601,40 @@ class InquiryService extends BaseService return fail(); } - // 沟通次数,沟通时长 - $times_number = 0; - $duration = 0; - $params = array(); - $params['inquiry_type'] = $order_inquiry['inquiry_type']; - $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; - $system_inquiry_config = SystemInquiryConfig::getOne($params); - if (!empty($system_inquiry_config)){ - $times_number = $system_inquiry_config['times_number']; - $duration = $system_inquiry_config['duration']; + $times_number = 0; // 沟通次数 + $duration = 0; // 沟通时长 + $follow = false; // 关注状态 + $is_evaluation = false; // 评价状态 + + if ($user_info['user_type'] == 1){ + + // 沟通次数,沟通时长 + $params = array(); + $params['inquiry_type'] = $order_inquiry['inquiry_type']; + $params['inquiry_mode'] = $order_inquiry['inquiry_mode']; + $system_inquiry_config = SystemInquiryConfig::getOne($params); + if (!empty($system_inquiry_config)){ + $times_number = $system_inquiry_config['times_number']; + $duration = $system_inquiry_config['duration']; + } + + // 关注状态 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['doctor_id'] = $order_inquiry['doctor_id']; + $follow = PatientFollow::getExists($params); + + // 评价状态 + $params = array(); + $params['doctor_id'] = $order_inquiry['doctor_id']; + $params['patient_id'] = $user_info['client_user_id']; + $params['order_inquiry_id'] = $order_inquiry_id;; + $is_evaluation = OrderEvaluation::getExists($params); } + + $result = array(); $result['doctor_user_id'] = $user_doctor['user_id']; $result['patient_user_id'] = $order_inquiry['user_id']; @@ -624,6 +646,8 @@ class InquiryService extends BaseService $result['inquiry_status'] = $order_inquiry['inquiry_status']; $result['times_number'] = $times_number; $result['duration'] = $duration; + $result['follow'] = $follow; + $result['is_evaluation'] = $is_evaluation; return success($result); } diff --git a/app/Services/MessageNoticeService.php b/app/Services/MessageNoticeService.php index d0c5378..07204d9 100644 --- a/app/Services/MessageNoticeService.php +++ b/app/Services/MessageNoticeService.php @@ -30,15 +30,13 @@ class MessageNoticeService extends BaseService $result = MessageNotice::getMessageNoticePage($params,["*"],$page,$per_page); if (!empty($result['data'])){ foreach ($result['data'] as &$item){ - /** - * 处理通知参数(json数据,此字段内容和link_type字段有关联) - * link_type - * 1(无按钮):空 - * 2(我的账户):空 - * 3(联系客服):空 - * 4(问诊消息): - */ - $item['notice_params'] = json_decode($item['notice_params']) ?: []; + if (!empty($item['link_params'])){ + $item['link_params'] = json_decode($item['link_params']); + } + + if (!empty($item['show_params'])){ + $item['show_params'] = json_decode($item['show_params']); + } } } return success($result);