新增等待创建检测订单队列,修改im报告推送
This commit is contained in:
@@ -1337,7 +1337,7 @@ class CallBackController extends AbstractController
|
||||
* 检测所结果回调
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function DetectionResultCallBack(): ResponseInterface
|
||||
public function DetectionResultCallBack1(): ResponseInterface
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
$auth = $this->request->header("Authorization");
|
||||
@@ -1510,6 +1510,10 @@ class CallBackController extends AbstractController
|
||||
$params['order_detection_id'] = $order_detection['order_detection_id'];
|
||||
OrderDetection::editOrderDetection($params,$data);
|
||||
|
||||
// 回填检测结果字段
|
||||
$order_detection['detection_result_pdf'] = $detection_result_pdf;
|
||||
$order_detection['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
|
||||
// 添加自动完成队列
|
||||
$time = 1000 * 60 * 60 * 24 * 3;
|
||||
|
||||
@@ -1577,6 +1581,109 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测所结果回调
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function DetectionResultCallBack(): ResponseInterface
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
$auth = $this->request->header("Authorization");
|
||||
if (empty($auth)){
|
||||
return $this->detectionResultFailReturn("非法请求");
|
||||
}
|
||||
|
||||
Log::getInstance("CallBackController-DetectionResultCallBack")->info("处理检测所结果");
|
||||
|
||||
try {
|
||||
// 检测参数
|
||||
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('Ymd');
|
||||
$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("文件错误");
|
||||
}
|
||||
|
||||
// 获取检测订单数据
|
||||
$params = array();
|
||||
$params['detection_no'] = $request_params['orderCode'];
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)){
|
||||
return $this->detectionResultFailReturn("非法订单");
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if ($order_detection['detection_status'] != 3){
|
||||
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("检测条码无法对应");
|
||||
}
|
||||
|
||||
// 上传处方图片至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 {
|
||||
// 修改检测订单
|
||||
$data = array();
|
||||
$data['detection_result_pdf'] = $detection_result_pdf;
|
||||
$data['detection_result_date'] = date('Y-m-d H:i:s',time());
|
||||
|
||||
$params = array();
|
||||
$params['order_detection_id'] = $order_detection['order_detection_id'];
|
||||
OrderDetection::editOrderDetection($params,$data);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollBack();
|
||||
return $this->detectionResultFailReturn($e->getMessage());
|
||||
}
|
||||
|
||||
return $this->detectionResultSuccessReturn();
|
||||
} catch (\Throwable $e) {
|
||||
return $this->detectionResultFailReturn("异常:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测所结果回调失败
|
||||
* @param string $message
|
||||
|
||||
Reference in New Issue
Block a user