This commit is contained in:
wucongxing 2023-04-03 14:34:14 +08:00
parent 2aacffb95e
commit f0fb754d82
3 changed files with 72 additions and 3 deletions

View File

@ -34,13 +34,14 @@ class TestController extends AbstractController
// $this->test_3(); // $this->test_3();
// $this->test_4(); // $this->test_4();
// $this->test_6(); // $this->test_6();
$this->test_9(); // $this->test_9();
// $this->test_10(); // $this->test_10();
// $this->test_11(); // $this->test_11();
// $this->test_5(); // $this->test_5();
// $this->test_1(); // $this->test_1();
// $this->test_11(); // $this->test_11();
// $this->test_12(); // $this->test_12();
$this->test_13();
} }
// 获取云证书-首次 // 获取云证书-首次
@ -498,7 +499,7 @@ class TestController extends AbstractController
// 下载签章的pdf文件 // 下载签章的pdf文件
public function test_9(){ public function test_9(){
$ca = new Ca(); $ca = new Ca();
$result = $ca->getSignedFile("5345345461","1642762886467977217"); $result = $ca->getSignedFile("5345345461","1642769369872105473");
if (empty($result)){ if (empty($result)){
return fail(); return fail();
} }
@ -643,4 +644,65 @@ class TestController extends AbstractController
// dump($result); // 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);
}
} }

View File

@ -452,6 +452,10 @@ class OrderPrescriptionService extends BaseService
// 打开处方pdf文件 // 打开处方pdf文件
$pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf",'r'); $pdf_file = fopen("./runtime/" . $order_prescription['order_prescription_id'] . ".pdf",'r');
if (!$pdf_file){
throw new BusinessException("处方图片打开失败");
}
// 处方pdf进行签章 // 处方pdf进行签章
$data = array(); $data = array();
@ -529,11 +533,12 @@ class OrderPrescriptionService extends BaseService
throw new BusinessException("下载处方签章文件失败"); throw new BusinessException("下载处方签章文件失败");
} }
dump("下载处方签章文件成功"); dump("下载医院处方签章文件成功");
// 上传oss // 上传oss
$hospital_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf'; $hospital_filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
$prescription_pdf_url = $oss->putObject($hospital_filename, $prescription_pdf_result); $prescription_pdf_url = $oss->putObject($hospital_filename, $prescription_pdf_result);
dump("上传医院处方签章文件成功");
} }
$result = array(); $result = array();

View File

@ -127,6 +127,8 @@ class UserPharmacistService extends BaseService
public function putPrescriptionVerify(): array public function putPrescriptionVerify(): array
{ {
$user_info = $this->request->getAttribute("userInfo") ?? []; $user_info = $this->request->getAttribute("userInfo") ?? [];
$user_info['user_id'] = "534534546";
$user_info['client_user_id'] = "534534546";
$order_prescription_id = $this->request->route('order_prescription_id'); $order_prescription_id = $this->request->route('order_prescription_id');
$pharmacist_audit_status = $this->request->input('pharmacist_audit_status'); $pharmacist_audit_status = $this->request->input('pharmacist_audit_status');