This commit is contained in:
2023-03-21 15:52:49 +08:00
parent 84d1ebbc12
commit 45e8b8ae6b
2 changed files with 92 additions and 36 deletions
+41 -5
View File
@@ -216,20 +216,56 @@ class TestController extends AbstractController
"frequency_use" => "1天3次",
"single_use" => "口服",
"prescription_product_num" => "X1盒",
]
],
[
"product_name" => "感冒药350ml*10",
"single_unit" => "一次一包",
"frequency_use" => "1天3次",
"single_use" => "口服",
"prescription_product_num" => "X1盒",
],
[
"product_name" => "感冒药450ml*10",
"single_unit" => "一次一包",
"frequency_use" => "1天3次",
"single_use" => "口服",
"prescription_product_num" => "X1盒",
],
[
"product_name" => "感冒药550ml*10",
"single_unit" => "一次一包",
"frequency_use" => "1天3次",
"single_use" => "口服",
"prescription_product_num" => "X1盒",
],
];
// 用药
foreach ($data['product'] as $key => $item){
$image->text($item['product_name'], 229, 1530 + ($key+1) * 100, function ($font) use($fontPath) {
if ($key <= 2){
$x_axis = 229;
$y_axis = 1600 + $key * 350;
}else{
$x_axis = 1240;
$y_axis = 1600 + ($key - 3) * 350;
}
$image->text($item['product_name'], $x_axis, $y_axis, function ($font) use($fontPath) {
$font->file($fontPath);
$font->size(60);
$font->size(50);
$font->align('left');
});
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], 229, 1530 + ($key+1) * 100, function ($font) use($fontPath) {
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], $x_axis, $y_axis+90, function ($font) use($fontPath) {
$font->file($fontPath);
$font->size(60);
$font->size(50);
$font->align('left');
});
$image->text("用法:" . $item['single_use'], $x_axis, $y_axis+180, function ($font) use($fontPath) {
$font->file($fontPath);
$font->size(50);
$font->align('left');
});
}