新增对接检测所,新增医生短信推送
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Amqp\Producer\AutoCompleteInquiryDelayDirectProducer;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\BasicDetectionOrgan;
|
||||
use App\Model\BasicLogisticsCompany;
|
||||
use App\Model\DetectionProject;
|
||||
use App\Model\Hospital;
|
||||
@@ -35,6 +36,7 @@ use App\Services\InquiryService;
|
||||
use App\Services\MessagePush;
|
||||
use App\Services\OrderPrescriptionService;
|
||||
use App\Utils\Log;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\TencentIm\Account;
|
||||
use Extend\TencentIm\Message;
|
||||
use Extend\TencentIm\Profile;
|
||||
@@ -1328,12 +1330,54 @@ class CallBackController extends AbstractController
|
||||
public function DetectionResultCallBack(): ResponseInterface
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
$auth = $this->request->getHeader("Authorization");
|
||||
if (empty($auth)){
|
||||
return $this->detectionResultFailReturn("非法请求");
|
||||
}
|
||||
|
||||
try {
|
||||
Log::getInstance("detectionResult")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
// 检测参数
|
||||
if (!isset($request_params['appId'])){
|
||||
return $this->detectionResultFailReturn("缺少appId参数");
|
||||
}
|
||||
|
||||
if (!isset($request_params['orderCode'])){
|
||||
return $this->detectionResultFailReturn("缺少orderCode参数");
|
||||
}
|
||||
|
||||
if (!isset($request_params['detectBarcode'])){
|
||||
return $this->detectionResultFailReturn("缺少detectBarcode参数");
|
||||
}
|
||||
|
||||
if (!isset($request_params['pdfReport'])){
|
||||
return $this->detectionResultFailReturn("缺少pdfReport参数");
|
||||
}
|
||||
|
||||
// 检测签名
|
||||
// $params = array();
|
||||
// $params['app_id'] = $request_params['appId'];
|
||||
// $basic_detection_organ = BasicDetectionOrgan::getOne($params);
|
||||
// if (empty($basic_detection_organ)){
|
||||
// return $this->detectionResultFailReturn("非法appId");
|
||||
// }
|
||||
//
|
||||
// $time = date('Y-m-d');
|
||||
// $sign = md5($basic_detection_organ['app_id'] . $basic_detection_organ['app_secret'] . $time);
|
||||
// if ($auth != $sign){
|
||||
// return $this->detectionResultFailReturn("签名错误");
|
||||
// }
|
||||
|
||||
// 检测pdf文件
|
||||
$pdfData = base64_decode($request_params['pdfReport']);
|
||||
if (!$pdfData){
|
||||
return $this->detectionResultFailReturn("文件错误");
|
||||
}
|
||||
|
||||
Log::getInstance("CallBackController-DetectionResultCallBack")->info(json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
// 获取检测订单数据
|
||||
$params = array();
|
||||
$params['detection_no'] = "D549534850211602432";
|
||||
$params['detection_no'] = $request_params['orderCode'];
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)){
|
||||
return $this->detectionResultFailReturn("非法订单");
|
||||
@@ -1344,6 +1388,14 @@ class CallBackController extends AbstractController
|
||||
return $this->detectionResultFailReturn("订单状态错误,无法处理");
|
||||
}
|
||||
|
||||
if (!empty($order_detection['detection_result_pdf'])){
|
||||
return $this->detectionResultSuccessReturn();
|
||||
}
|
||||
|
||||
// if ($order_detection['detection_bar_code'] != $request_params['detectBarcode']){
|
||||
// return $this->detectionResultFailReturn("检测条码无法对应");
|
||||
// }
|
||||
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_detection['doctor_id'];
|
||||
@@ -1377,6 +1429,12 @@ class CallBackController extends AbstractController
|
||||
return $this->detectionResultFailReturn("患者信息错误");
|
||||
}
|
||||
|
||||
// 上传处方图片至oss
|
||||
$oss = new Oss();
|
||||
$detection_result_pdf_name = "applet/patient/detection/pdf/" . $order_detection['order_detection_id'] . '.' . 'pdf';
|
||||
$detection_result_pdf = $oss->putObject($detection_result_pdf_name, $pdfData);
|
||||
$detection_result_pdf = '/' . $detection_result_pdf;
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
@@ -1431,10 +1489,11 @@ class CallBackController extends AbstractController
|
||||
return $this->detectionResultFailReturn("问诊订单病例创建失败");
|
||||
}
|
||||
|
||||
// 修改检测状态
|
||||
// 修改检测订单
|
||||
$data = array();
|
||||
$data['detection_status'] = 4;
|
||||
$data['detection_time'] = date('Y-m-d H:i:s',time());
|
||||
$data['detection_result_pdf'] = $detection_result_pdf;
|
||||
$data['detection_result_date'] = date('Y-m-d H:i:s',time());
|
||||
$data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];// 订单-问诊id
|
||||
|
||||
$params = array();
|
||||
@@ -1494,7 +1553,9 @@ class CallBackController extends AbstractController
|
||||
$MessagePush = new MessagePush($order_detection['user_id']);
|
||||
$MessagePush->patientDetectionResultNotice($order_detection['order_detection_id']);
|
||||
|
||||
// 医生-发送检测报告短信
|
||||
// 医生-通知医生患者检测报告已生成
|
||||
$MessagePush = new MessagePush($user_doctor['user_id']);
|
||||
$MessagePush->doctorDetectionResultNotice($order_detection['order_detection_id']);
|
||||
}catch (\Throwable $e){
|
||||
Log::getInstance("detectionResult")->error($e->getMessage());
|
||||
}
|
||||
@@ -1518,9 +1579,8 @@ class CallBackController extends AbstractController
|
||||
new SwooleStream(
|
||||
strval(
|
||||
json_encode([
|
||||
'result' => false,
|
||||
'returnCode' => "500",
|
||||
'message' => $message,
|
||||
'code' => 0,
|
||||
'msg' => $message,
|
||||
], JSON_UNESCAPED_UNICODE)
|
||||
)
|
||||
)
|
||||
@@ -1540,9 +1600,8 @@ class CallBackController extends AbstractController
|
||||
new SwooleStream(
|
||||
strval(
|
||||
json_encode([
|
||||
'result' => true,
|
||||
'returnCode' => "200",
|
||||
'message' => $message,
|
||||
'code' => 1,
|
||||
'msg' => $message,
|
||||
], JSON_UNESCAPED_UNICODE)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user