新增多个商品
This commit is contained in:
parent
4dd9afca16
commit
e393372751
@ -169,14 +169,14 @@ class TestController extends AbstractController
|
|||||||
// 下载阿里云图片
|
// 下载阿里云图片
|
||||||
$oss = new Oss();
|
$oss = new Oss();
|
||||||
|
|
||||||
$filename = "Basic/images/prescription.jpg";
|
$filename = "basic/file/prescription.jpg";
|
||||||
$sign_image = $oss->getObjectToRAM($filename);
|
$sign_image = $oss->getObjectToRAM($filename);
|
||||||
|
|
||||||
$manager = new ImageManager();
|
$manager = new ImageManager();
|
||||||
|
|
||||||
$image = $manager->make($sign_image);
|
$image = $manager->make($sign_image);
|
||||||
|
|
||||||
$fontPath = './runtime/ZiYuYongSongTi-2.ttf';
|
$fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||||
|
|
||||||
// 处方号
|
// 处方号
|
||||||
$image->text('1234567890', 1480, 540, function ($font) use($fontPath) {
|
$image->text('1234567890', 1480, 540, function ($font) use($fontPath) {
|
||||||
@ -504,17 +504,154 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_11(){
|
public function test_11(){
|
||||||
// $ca = new Ca();
|
|
||||||
// $prescription_pdf_result = $ca->getSignedFile("491925054435950592","1641368425758359554");
|
|
||||||
// if (empty($prescription_pdf_result)){
|
|
||||||
// throw new BusinessException("下载处方签章文件失败");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $oss = new Oss();
|
|
||||||
// $filename = "applet/prescription/" . "499993319660314624" . '.' . 'pdf';
|
|
||||||
// $prescription_pdf_url = $oss->putObject($filename, $prescription_pdf_result);
|
|
||||||
|
|
||||||
// $OrderPrescriptionService = new OrderPrescriptionService();
|
$oss = new Oss();
|
||||||
// $result = $OrderPrescriptionService->openPrescription("499871705345941504",1);
|
|
||||||
|
$filename = "basic/file/prescription.jpg";
|
||||||
|
$sign_image = $oss->getObjectToRAM($filename);
|
||||||
|
|
||||||
|
$manager = new ImageManager();
|
||||||
|
|
||||||
|
$image = $manager->make($sign_image);
|
||||||
|
|
||||||
|
$fontPath = './extend/Ca/ZiYuYongSongTi-2.ttf';
|
||||||
|
|
||||||
|
// 处方号
|
||||||
|
$image->text('1234567890', 1480, 540, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 日期
|
||||||
|
$image->text('2023-03-21', 354, 675, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 科室
|
||||||
|
$image->text('测试科室1', 1385, 675, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 姓名
|
||||||
|
$image->text('测试姓名', 354, 795, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 性别
|
||||||
|
$image->text('男', 1385, 790, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 年龄
|
||||||
|
$image->text('19', 354, 900, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 过敏史
|
||||||
|
$image->text('对阿莫西林过敏对阿莫西林过敏', 405, 1030, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初步诊断
|
||||||
|
$image->text('对阿莫西林过敏对阿莫西林过敏', 445, 1145, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 医生建议
|
||||||
|
$image->text('没有建议', 445, 1252, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(60);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['product'] = [
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药1(50ml*10)",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药2(50ml*10)",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药3(50ml*10)",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药4(50ml*10)",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"product_name" => "感冒药5(50ml*10)",
|
||||||
|
"single_unit" => "一次一包",
|
||||||
|
"frequency_use" => "1天3次",
|
||||||
|
"single_use" => "口服",
|
||||||
|
"prescription_product_num" => "X1盒",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// 用药
|
||||||
|
foreach ($data['product'] as $key => $item){
|
||||||
|
$x_axis = 229;
|
||||||
|
$y_axis = 1600 + $key * 250;
|
||||||
|
$x_axis_num = 1900;// 数量使用
|
||||||
|
|
||||||
|
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
$image->text("X1盒", $x_axis_num, $y_axis, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+70, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+140, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将处理后的图片重新保存到其他路径
|
||||||
|
$image->save('./runtime/2.jpg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,13 +320,9 @@ class OrderPrescriptionService extends BaseService
|
|||||||
|
|
||||||
// 商品数据
|
// 商品数据
|
||||||
foreach ($order_prescription_product as $key => $item){
|
foreach ($order_prescription_product as $key => $item){
|
||||||
if ($key <= 2){
|
|
||||||
$x_axis = 229;
|
$x_axis = 229;
|
||||||
$y_axis = 1600 + $key * 350;
|
$y_axis = 1600 + $key * 250;
|
||||||
}else{
|
$x_axis_num = 1900;// 数量使用
|
||||||
$x_axis = 1240;
|
|
||||||
$y_axis = 1600 + ($key - 3) * 350;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 商品名称
|
// 商品名称
|
||||||
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
|
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
|
||||||
@ -335,15 +331,21 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$image->text("X" . $item['prescription_product_num'] . $item['packaging_unit'], $x_axis_num, $y_axis, function ($font) use($fontPath) {
|
||||||
|
$font->file($fontPath);
|
||||||
|
$font->size(50);
|
||||||
|
$font->align('left');
|
||||||
|
});
|
||||||
|
|
||||||
// 用量
|
// 用量
|
||||||
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+90, function ($font) use($fontPath) {
|
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+70, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(50);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 用法
|
// 用法
|
||||||
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+180, function ($font) use($fontPath) {
|
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+140, function ($font) use($fontPath) {
|
||||||
$font->file($fontPath);
|
$font->file($fontPath);
|
||||||
$font->size(50);
|
$font->size(50);
|
||||||
$font->align('left');
|
$font->align('left');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user