修改家庭档案接口
This commit is contained in:
@@ -6,11 +6,13 @@ use App\Constants\HttpEnumCode;
|
||||
use App\Model\DoctorPharmacistCert;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\Ca\Ca;
|
||||
use Intervention\Image\ImageManager;
|
||||
use TCPDF;
|
||||
|
||||
class TestController extends AbstractController
|
||||
{
|
||||
public function test(){
|
||||
$this->test_4();
|
||||
$this->test_5();
|
||||
}
|
||||
|
||||
// 获取云证书-首次
|
||||
@@ -57,14 +59,14 @@ class TestController extends AbstractController
|
||||
$data['doctor_advice'] = "多吃药";
|
||||
$data['product'] = [
|
||||
[
|
||||
"product_name" => "感冒药1",
|
||||
"product_name" => "感冒药1(50ml*10)",
|
||||
"single_unit" => "一次一包",
|
||||
"frequency_use" => "1天3次",
|
||||
"single_use" => "口服",
|
||||
"prescription_product_num" => "X1盒",
|
||||
],
|
||||
[
|
||||
"product_name" => "感冒药2",
|
||||
"product_name" => "感冒药2(50ml*10)",
|
||||
"single_unit" => "一次一包",
|
||||
"frequency_use" => "1天3次",
|
||||
"single_use" => "口服",
|
||||
@@ -122,8 +124,119 @@ class TestController extends AbstractController
|
||||
dump($data);
|
||||
}
|
||||
|
||||
// 处理处方pdf图片
|
||||
// 生成处方pdf图片
|
||||
public function test_5(){
|
||||
// 下载阿里云图片
|
||||
$oss = new Oss();
|
||||
|
||||
$filename = "Basic/images/prescription_img.jpg";
|
||||
$sign_image = $oss->getObjectToRAM($filename);
|
||||
|
||||
$manager = new ImageManager();
|
||||
|
||||
$image = $manager->make($sign_image);
|
||||
|
||||
$fontPath = './runtime/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盒",
|
||||
]
|
||||
];
|
||||
|
||||
// 用药
|
||||
foreach ($data['product'] as $key => $item){
|
||||
$image->text($item['product_name'], 229, 1530 + ($key+1) * 100, function ($font) use($fontPath) {
|
||||
$font->file($fontPath);
|
||||
$font->size(60);
|
||||
$font->align('left');
|
||||
});
|
||||
|
||||
$image->text("用量:" . $item['single_unit'] . " " . $item['frequency_use'], 229, 1530 + ($key+1) * 100, function ($font) use($fontPath) {
|
||||
$font->file($fontPath);
|
||||
$font->size(60);
|
||||
$font->align('left');
|
||||
});
|
||||
}
|
||||
|
||||
// 将处理后的图片重新保存到其他路径
|
||||
$image->save('./runtime/2.jpg');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user