新增医生开具处方对接ca平台

This commit is contained in:
2023-03-30 17:28:58 +08:00
parent 89c9eadb1b
commit 70932a142c
3 changed files with 57 additions and 15 deletions
+14 -4
View File
@@ -235,17 +235,20 @@ class OrderPrescriptionService extends BaseService
$product['prescription_product_num'] = $item['prescription_product_num'] . $item['packaging_unit']; // 商品数量 + 基本包装单位(例:盒/瓶)
$data['product'][] = $product;
}
dump("签名获取成功");
$cert_sign_result = $ca->getCertSign("491925054435950592", "491925054435950592", $data);
// 验证云证书签名-验证无需处理,只要不返回错误即可
$ca->verifyPkcs7($cert_sign_result['signP7'],$data);
// 生成处方pdf图片
dump("签名验证成功");
// 下载基础处方pdf图片
$oss = new Oss();
$filename = "basic/file/prescription.jpg";
$prescription_image = $oss->getObjectToRAM($filename);
dump("下载基础处方pdf图片成功");
$manager = new ImageManager();
$image = $manager->make($prescription_image);
@@ -361,6 +364,7 @@ class OrderPrescriptionService extends BaseService
// 图片生成的处方pdf存储为本地文件
$pdf->Output(dirname(__DIR__, 2) . "/" . $filename ,"F");
dump("图片生成pdf成功");
// 下载签名图片
$style = "image/resize,m_lfit,w_100,h_350";
$sign_image = $oss->getCusTomObjectToRAM($sign_image_path,$style);
@@ -369,6 +373,8 @@ class OrderPrescriptionService extends BaseService
throw new BusinessException("签名图片下载失败");
}
dump("下载签名图片成功");
if ($user['user_type'] == 2){
$sign_param = [
[ // 医生端
@@ -406,13 +412,17 @@ class OrderPrescriptionService extends BaseService
throw new BusinessException("处方签章失败");
}
dump("处方pdf进行签章成功");
// 下载处方签章文件
$file_id = $sign_pdf_result[0]['fileId'];
$prescription_pdf_result = $ca->getSignedFile("491925054435950592",$file_id);
if (empty($result)){
if (empty($prescription_pdf_result)){
throw new BusinessException("下载处方签章文件失败");
}
dump("下载处方签章文件成功");
// 上传oss
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);