1
This commit is contained in:
@@ -112,9 +112,9 @@ class OrderPrescriptionService extends BaseService
|
||||
* 开具处方
|
||||
* @param string $order_prescription_id
|
||||
* @param string $user_id
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function openPrescription(string $order_prescription_id,string $user_id): string
|
||||
public function openPrescription(string $order_prescription_id,string $user_id): array
|
||||
{
|
||||
try {
|
||||
// 获取用户数据
|
||||
@@ -253,7 +253,8 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
$image = $manager->make($prescription_image);
|
||||
|
||||
$fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||
// $fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||
$fontPath = './extend/Ca/msyh.ttf';
|
||||
|
||||
// 处方号
|
||||
$image->text($order_prescription['prescription_code'], 1480, 540, function ($font) use($fontPath) {
|
||||
@@ -354,6 +355,12 @@ class OrderPrescriptionService extends BaseService
|
||||
|
||||
// 生成图片
|
||||
$img_result = (string) $image->encode('png', 75);
|
||||
dump("处方图片生成成功");
|
||||
|
||||
// 上传处方图片至oss
|
||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'jpg';
|
||||
$prescription_img_url = $oss->putObject($filename, $img_result);
|
||||
dump("处方图片上传oss成功");
|
||||
|
||||
// 图片生成pdf
|
||||
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||
@@ -432,7 +439,10 @@ class OrderPrescriptionService extends BaseService
|
||||
$filename = "applet/prescription/" . $order_prescription['order_prescription_id'] . '.' . 'pdf';
|
||||
$prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
||||
|
||||
return $prescription_pdf_url;
|
||||
$result = array();
|
||||
$result['prescription_img_url'] = $prescription_img_url ?: "";
|
||||
$result['prescription_pdf_url'] = $prescription_pdf_url ?: "";
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user