This commit is contained in:
2023-04-03 14:34:14 +08:00
parent 2aacffb95e
commit f0fb754d82
3 changed files with 72 additions and 3 deletions
+64 -2
View File
@@ -34,13 +34,14 @@ class TestController extends AbstractController
// $this->test_3();
// $this->test_4();
// $this->test_6();
$this->test_9();
// $this->test_9();
// $this->test_10();
// $this->test_11();
// $this->test_5();
// $this->test_1();
// $this->test_11();
// $this->test_12();
$this->test_13();
}
// 获取云证书-首次
@@ -498,7 +499,7 @@ class TestController extends AbstractController
// 下载签章的pdf文件
public function test_9(){
$ca = new Ca();
$result = $ca->getSignedFile("5345345461","1642762886467977217");
$result = $ca->getSignedFile("5345345461","1642769369872105473");
if (empty($result)){
return fail();
}
@@ -643,4 +644,65 @@ class TestController extends AbstractController
// dump($result);
}
public function test_13(){
$oss = new Oss();
$hospital_sign_image_path = "basic/file/hospital_signature.png";
// 下载医院签名图片
$style = "image/resize,w_300,h_300";
$sign_image = $oss->getCusTomObjectToRAM($hospital_sign_image_path,$style);
$sign_image = base64_encode($sign_image);
if (!$sign_image){
throw new BusinessException("医院签名图片下载失败");
}
$sign_param = [
[ // 医院签章
"llx"=>"1550", // 左边底部X坐标
"lly"=>"1350", // 左边底部Y坐标
"urx"=>"2250", // 右边上部x坐标
"ury"=>"650", // 右边上部y坐标
"pageList"=>[1],
"sealImg"=>$sign_image
],
];
// 打开处方pdf文件
unset($pdf_file);
$pdf_file = fopen("./runtime/" . "501383937792086017" . ".pdf",'r');
$ca = new Ca();
// 处方pdf进行签章
$data = array();
$data['sign_param'] = json_encode($sign_param);
$data['pdf_file'] = $pdf_file;
$hospital_sign_pdf_result = $ca->addSignPdf("5345345461",$data);
if (empty($hospital_sign_pdf_result[0]['fileId'])){
throw new BusinessException("处方签章失败");
}
dump($hospital_sign_pdf_result);
dump("处方pdf进行医院签章成功");
// 下载处方签章文件
unset($prescription_pdf_result);
$file_id = $hospital_sign_pdf_result[0]['fileId'];
$prescription_pdf_result = $ca->getSignedFile("5345345461",$file_id);
if (empty($prescription_pdf_result)){
throw new BusinessException("下载处方签章文件失败");
}
dump("下载医院处方签章文件成功");
$file = fopen("./runtime/test.pdf", "w") or die("Unable to open file!");
fwrite($file, $prescription_pdf_result);
fclose($file);
}
}