新增对接检测所,新增医生短信推送
This commit is contained in:
@@ -20,6 +20,7 @@ use App\Model\UserDoctor;
|
||||
use App\Model\UserLocation;
|
||||
use App\Utils\Log;
|
||||
use App\Utils\PcreMatch;
|
||||
use Extend\Detection\Wy;
|
||||
use Extend\Wechat\WechatPay;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
@@ -537,16 +538,27 @@ class DetectionService extends BaseService
|
||||
$detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic);
|
||||
}
|
||||
|
||||
// 获取检测所
|
||||
// 检测检测管编码是否已被使用
|
||||
$params = array();
|
||||
$params['detection_bar_code'] = $request_params['detection_bar_code'];
|
||||
$result = OrderDetection::getOne($params);
|
||||
if (!empty($result)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"检测管已被使用");
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
// 上报数据
|
||||
$wy = new Wy($order_detection['detection_organ_id']);
|
||||
$wy->report($order_detection);
|
||||
|
||||
// 修改检测订单
|
||||
$data = array();
|
||||
$data['detection_pic'] = $detection_pic ?? "";
|
||||
$data['detection_bar_code'] = $request_params['detection_bar_code'];
|
||||
$data['detection_status'] = 3;
|
||||
$data['detection_organ_id'] = 1;// 检测机构id
|
||||
$data['detection_time'] = date('Y-m-d H:i:s', time());// 上传检测时间
|
||||
|
||||
$params = array();
|
||||
$params['order_detection_id'] = $order_detection_id;
|
||||
@@ -556,12 +568,11 @@ class DetectionService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"绑定失败");
|
||||
}
|
||||
|
||||
// 上报数据
|
||||
|
||||
Db::commit();
|
||||
}catch (\Exception $e){
|
||||
}catch (\Throwable $e){
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
|
||||
Log::getInstance("DetectionService-bindDetectionTube")->error($e->getMessage());
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "绑定失败");
|
||||
}
|
||||
|
||||
return success();
|
||||
|
||||
@@ -729,7 +729,7 @@ class ImService extends BaseService
|
||||
$cloud_custom_data['patient_family_data']['patient_age'] = $order_detection['patient_age'];
|
||||
|
||||
$message_content = [
|
||||
'Text' => $doctor_name . "医生您好,我在您那里开具的【" . $detection_project_name . "】服务,报告单已出,请您查看报告并详细的做一下解读,谢谢医生。",
|
||||
'Text' => $doctor_name . "医生您好,您给我开具的【" . $detection_project_name . "】检测项目报告已经出来啦,请您抽空查看报告并做一下解读,谢谢。",
|
||||
];
|
||||
|
||||
$this->sendMessage($patient_user_id,$doctor_user_id, $message_content, "TIMTextElem", $cloud_custom_data);
|
||||
|
||||
@@ -2338,7 +2338,7 @@ class MessagePush extends BaseService
|
||||
// 短信
|
||||
$sms_data = array();
|
||||
$sms_data['template_code'] = "SMS_462035956";
|
||||
$sms_data['scene_desc'] = "您的{$detection_project['detection_project_name']}报告单已出,请联系医生做报告解读。平台已赠送您和医生5个沟通回合,请珍惜沟通机会,请前往肝胆相照互联网医院微信小程序“个人中心”-“检测订单”-“订单详情”查看报告。";
|
||||
$sms_data['scene_desc'] = "新报告生成通知";
|
||||
$sms_data['phone'] = $this->user['mobile'];
|
||||
$sms_data['user_id'] = $this->user['user_id'];
|
||||
|
||||
@@ -2360,4 +2360,52 @@ class MessagePush extends BaseService
|
||||
Log::getInstance("MessagePush-patientDetectionResultNotice")->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 医生-通知医生患者检测报告已生成
|
||||
* 短信
|
||||
* @param string $order_detection_id
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function doctorDetectionResultNotice(string $order_detection_id): void
|
||||
{
|
||||
// 获取检测订单
|
||||
$params = array();
|
||||
$params['order_detection_id'] = $order_detection_id;
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)) {
|
||||
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("无检测订单数据");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取检测项目
|
||||
$params = array();
|
||||
$params['detection_project_id'] = $order_detection['detection_project_id'];
|
||||
$detection_project = DetectionProject::getOne($params);
|
||||
if (empty($detection_project)) {
|
||||
Log::getInstance("MessagePush-patientDetectionResultNotice")->error("检测项目错误");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取系统接诊配置
|
||||
$data = array();
|
||||
$data['template_code'] = "SMS_461980700";
|
||||
$data['scene_desc'] = "通知医生患者检测报告已生成";
|
||||
$data['phone'] = $this->user['mobile'];
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
|
||||
$template_param = array();
|
||||
$template_param['name'] = $order_detection['patient_name'];
|
||||
$template_param['report'] = $detection_project['detection_project_name'];
|
||||
$data['template_param'] = $template_param;
|
||||
|
||||
$message = new SendSmsMessageProducer($data);
|
||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||
$result = $producer->produce($message);
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user