This commit is contained in:
2023-03-31 16:10:53 +08:00
parent 8be42f20f0
commit 878bd21ec0
8 changed files with 98 additions and 27 deletions
+20 -13
View File
@@ -21,7 +21,9 @@ use Extend\Ca\Ca;
use Hyperf\Amqp\Producer;
use Hyperf\DbConnection\Db;
use Hyperf\Utils\ApplicationContext;
use Imagick;
use Intervention\Image\ImageManager;
use Spatie\PdfToImage\Pdf;
use TCPDF;
class TestController extends AbstractController
@@ -505,22 +507,27 @@ class TestController extends AbstractController
}
public function test_11(){
$OrderPrescriptionService = new OrderPrescriptionService();
$prescription_img = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,$user_info['user_id']);
if (empty($prescription_img)){
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR, "处方开具失败");
$ca = new Ca();
$prescription_pdf_result = $ca->getSignedFile("491925054435950592","1641368425758359554");
if (empty($prescription_pdf_result)){
throw new BusinessException("下载处方签章文件失败");
}
// 修改处方表
$data = array();
$data['prescription_img'] = $prescription_img;
$data['doctor_created_time'] = date('Y-m-d H:i:s',time());
$file = fopen("./runtime/test.pdf", "w") or die("Unable to open file!");
fwrite($file, $prescription_pdf_result);
fclose($file);
$params = array();
$params['order_prescription_id'] = $order_prescription->order_prescription_id;
OrderPrescription::edit($params,$data);
// 将临时文件转换为图片
$pdf = new Pdf("./runtime/test.pdf");
$pdf->saveImage("./runtime/test.jpg");
// dump($prescription_pdf_result);
//
// $manager = new ImageManager();
// $image = $manager->make($prescription_pdf_result)->convert('jpg');
//
// // 保存图片
// $image->save('./runtime/image.jpg');
}
}