Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e0776be
authored
Nov 20, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打印
parent
48841c6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
+19
-10
app/Admin/Controllers/PrescriptionPrintController.php
+10
-10
app/Models/PrescriptionModel.php
+9
-0
No files found.
app/Admin/Controllers/PrescriptionPrintController.php
View file @
6e0776be
...
@@ -60,14 +60,14 @@ public function search()
...
@@ -60,14 +60,14 @@ public function search()
return
response
()
->
json
([
return
response
()
->
json
([
'status'
=>
true
,
'status'
=>
true
,
'data'
=>
[
'data'
=>
[
'img_url'
=>
Storage
::
url
(
$prescription
->
prescription_pic_eseal
)
,
'img_url'
=>
$prescription
->
prescription_pic_eseal
,
],
],
]);
]);
}
elseif
(
$prescription
->
prescription_pic
)
{
}
elseif
(
$prescription
->
prescription_pic
)
{
return
response
()
->
json
([
return
response
()
->
json
([
'status'
=>
true
,
'status'
=>
true
,
'data'
=>
[
'data'
=>
[
'img_url'
=>
Storage
::
url
(
$prescription
->
prescription_pic
)
,
'img_url'
=>
$prescription
->
prescription_pic
,
],
],
]);
]);
}
}
...
@@ -144,7 +144,7 @@ public function search()
...
@@ -144,7 +144,7 @@ public function search()
foreach
(
$medicines
as
$medicine
)
{
foreach
(
$medicines
as
$medicine
)
{
// 打印药品名称、规格和盒数
// 打印药品名称、规格和盒数
$medicineText
=
"
{
$medicine
[
'drug_name'
]
}
{
$medicine
[
'spec'
]
}
{
$medicine
[
'num'
]
}{
$medicine
[
'unit'
]
}
"
;
$medicineText
=
"
{
$medicine
[
'drug_name'
]
}
{
$medicine
[
'spec'
]
}
{
$medicine
[
'num'
]
}{
$medicine
[
'unit'
]
}
"
;
$img
->
text
(
$medicineText
,
5
50
,
$yCoordinate
,
function
(
$font
)
{
$img
->
text
(
$medicineText
,
4
50
,
$yCoordinate
,
function
(
$font
)
{
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
$font
->
size
(
32
);
$font
->
size
(
32
);
$font
->
color
(
'#000000'
);
$font
->
color
(
'#000000'
);
...
@@ -155,11 +155,11 @@ public function search()
...
@@ -155,11 +155,11 @@ public function search()
$yCoordinate
+=
40
;
// 根据字体大小调整行间距
$yCoordinate
+=
40
;
// 根据字体大小调整行间距
// 打印 sig 信息
// 打印 sig 信息
$img
->
text
(
'Sig: '
.
$medicine
[
'dosage_desc'
],
5
50
,
$yCoordinate
,
function
(
$font
)
{
$img
->
text
(
'Sig: '
.
$medicine
[
'dosage_desc'
],
4
50
,
$yCoordinate
,
function
(
$font
)
{
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
$font
->
size
(
32
);
$font
->
size
(
32
);
$font
->
color
(
'#000000'
);
$font
->
color
(
'#000000'
);
$font
->
align
(
'
center
'
);
$font
->
align
(
'
left
'
);
});
});
// 增加 Y 坐标以准备打印下一个药品
// 增加 Y 坐标以准备打印下一个药品
...
@@ -180,16 +180,16 @@ public function search()
...
@@ -180,16 +180,16 @@ public function search()
// 医师签名图片
// 医师签名图片
if
(
$prescription
->
doctor_signed_pic
)
{
if
(
$prescription
->
doctor_signed_pic
)
{
$pharmacistSignPath
=
Storage
::
url
(
$prescription
->
doctor_signed_pic
);
$pharmacistSignPath
=
file_get_contents
(
$prescription
->
doctor_signed_pic
);
$doctorSign
=
Image
::
read
(
file_get_contents
(
$pharmacistSignPath
)
);
$doctorSign
=
Image
::
read
(
$pharmacistSignPath
);
$doctorSign
->
rotate
(
90
);
$doctorSign
->
rotate
(
90
);
$doctorSign
->
resize
(
150
,
100
);
$doctorSign
->
resize
(
150
,
100
);
$img
->
place
(
$doctorSign
,
'bottom-left'
,
400
,
410
);
$img
->
place
(
$doctorSign
,
'bottom-left'
,
400
,
410
);
}
}
// 药师签名图片
// 药师签名图片
if
(
$prescription
->
pharmacist_signed_pic
)
{
if
(
$prescription
->
pharmacist_signed_pic
)
{
$pharmacistSignPath
=
Storage
::
url
(
$prescription
->
pharmacist_signed_pic
);
$pharmacistSignPath
=
file_get_contents
(
$prescription
->
pharmacist_signed_pic
);
$pharmacistSign
=
Image
::
read
(
file_get_contents
(
$pharmacistSignPath
)
);
$pharmacistSign
=
Image
::
read
(
$pharmacistSignPath
);
$pharmacistSign
->
rotate
(
90
);
$pharmacistSign
->
rotate
(
90
);
$pharmacistSign
->
resize
(
150
,
100
);
$pharmacistSign
->
resize
(
150
,
100
);
$img
->
place
(
$pharmacistSign
,
'bottom-left'
,
870
,
410
);
$img
->
place
(
$pharmacistSign
,
'bottom-left'
,
870
,
410
);
...
@@ -204,7 +204,7 @@ public function search()
...
@@ -204,7 +204,7 @@ public function search()
// 电子印章版处方图片生成
// 电子印章版处方图片生成
$eseal
=
Image
::
read
(
public_path
(
'static/images/dianzizhang.png'
));
$eseal
=
Image
::
read
(
public_path
(
'static/images/dianzizhang.png'
));
// $eseal->rotate(90);
// $eseal->rotate(90);
$eseal
->
resize
(
150
,
15
0
);
// $eseal->resize(500, 50
0);
$img
->
place
(
$eseal
,
'bottom-right'
,
180
,
500
);
$img
->
place
(
$eseal
,
'bottom-right'
,
180
,
500
);
$picEsealName
=
$prescriptionNo
.
'-eseal.jpg'
;
$picEsealName
=
$prescriptionNo
.
'-eseal.jpg'
;
$tempEsealPath
=
storage_path
(
'app/public'
)
.
$picEsealName
;
$tempEsealPath
=
storage_path
(
'app/public'
)
.
$picEsealName
;
...
...
app/Models/PrescriptionModel.php
View file @
6e0776be
...
@@ -72,4 +72,13 @@ public function getPrescriptionPicAttribute($value)
...
@@ -72,4 +72,13 @@ public function getPrescriptionPicAttribute($value)
return
Storage
::
url
(
$value
);
return
Storage
::
url
(
$value
);
}
}
public
function
getPrescriptionPicEsealAttribute
(
$value
)
{
if
(
Str
::
contains
(
$value
,
'//'
)
||
!
$value
)
{
return
$value
;
}
return
Storage
::
url
(
$value
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment