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
520f5f52
authored
Nov 18, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处方生成修改
parent
8987056c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
app/Admin/Controllers/PrescriptionPrintController.php
+16
-15
app/Api/Controllers/PrescriptionController.php
+1
-3
No files found.
app/Admin/Controllers/PrescriptionPrintController.php
View file @
520f5f52
...
@@ -99,7 +99,7 @@ public function search()
...
@@ -99,7 +99,7 @@ public function search()
$font
->
size
(
32
);
$font
->
size
(
32
);
$font
->
color
(
'#000000'
);
$font
->
color
(
'#000000'
);
});
});
// 开
放
日期
// 开
方
日期
$date
=
\Carbon\Carbon
::
parse
(
$prescription
->
prescription_at
)
->
format
(
'Y-m-d'
);
$date
=
\Carbon\Carbon
::
parse
(
$prescription
->
prescription_at
)
->
format
(
'Y-m-d'
);
$img
->
text
(
$date
,
1215
,
330
,
function
(
$font
)
{
$img
->
text
(
$date
,
1215
,
330
,
function
(
$font
)
{
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
$font
->
filename
(
public_path
(
'static/fonts/SimHei.ttf'
));
...
@@ -114,36 +114,37 @@ public function search()
...
@@ -114,36 +114,37 @@ public function search()
});
});
$drugInfo
=
$prescription
->
drug_info
;
// 每个元素包含 'pharmacy_drug', 'num'
$drugInfo
=
$prescription
->
drug_info
;
// 每个元素包含 'pharmacy_drug', 'num'
$drugInfo
=
json_decode
(
$drugInfo
,
true
);
$medicines
=
json_decode
(
$drugInfo
,
true
);
$medicines
=
[];
// $medicines = [];
foreach
(
$drugInfo
as
$v
)
{
// foreach ($drugInfo as $v) {
$pharmacyDrug
=
PharmacyDrugModel
::
with
([
'drug'
,
'dosage'
])
->
find
(
$v
[
'pharmacy_drug'
]);
// $pharmacyDrug = PharmacyDrugModel::with(['drug', 'dosage'])->find($v['pharmacy_drug']);
$medicines
[]
=
[
// $medicines[] = [
'name'
=>
$pharmacyDrug
->
drug
->
name
,
// 'drug_name' => $v['drug_name'],
'spec'
=>
$pharmacyDrug
->
drug
->
spec
,
// 'spec' => $v['spec'],
'num'
=>
$v
[
'num'
],
// 'num' => $v['num'],
'sig'
=>
$pharmacyDrug
->
dosage
->
dosage_desc
,
// 'dosage_desc' => $v['dosage_desc'],
];
// 'unit' => $v['unit'],
}
// ];
// }
// 初始 Y 坐标
// 初始 Y 坐标
$yCoordinate
=
650
;
// 根据需要调整初始 Y 坐标
$yCoordinate
=
650
;
// 根据需要调整初始 Y 坐标
foreach
(
$medicines
as
$medicine
)
{
foreach
(
$medicines
as
$medicine
)
{
// 打印药品名称、规格和盒数
// 打印药品名称、规格和盒数
$medicineText
=
"
{
$medicine
[
'
name'
]
}
{
$medicine
[
'spec'
]
}
{
$medicine
[
'num'
]
}{
$pharmacyDrug
->
unit
}
"
;
$medicineText
=
"
{
$medicine
[
'
drug_name'
]
}
{
$medicine
[
'spec'
]
}
{
$medicine
[
'num'
]
}{
$medicine
[
'unit'
]
}
"
;
$img
->
text
(
$medicineText
,
550
,
$yCoordinate
,
function
(
$font
)
{
$img
->
text
(
$medicineText
,
550
,
$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 坐标以打印下一行
$yCoordinate
+=
40
;
// 根据字体大小调整行间距
$yCoordinate
+=
40
;
// 根据字体大小调整行间距
// 打印 sig 信息
// 打印 sig 信息
$img
->
text
(
'Sig: '
.
$medicine
[
'
sig
'
],
550
,
$yCoordinate
,
function
(
$font
)
{
$img
->
text
(
'Sig: '
.
$medicine
[
'
dosage_desc
'
],
550
,
$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'
);
...
...
app/Api/Controllers/PrescriptionController.php
View file @
520f5f52
...
@@ -106,7 +106,7 @@ public function create(Request $request)
...
@@ -106,7 +106,7 @@ public function create(Request $request)
}
else
{
}
else
{
return
$this
->
failed
(
'pharmacy_id不能为空'
);
return
$this
->
failed
(
'pharmacy_id不能为空'
);
}
}
// 生成处方
$prescription
=
new
PrescriptionModel
;
$prescription
=
new
PrescriptionModel
;
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_PENDING
;
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_PENDING
;
$prescription
->
user_id
=
$authInfo
->
id
;
// 获取当前用户ID
$prescription
->
user_id
=
$authInfo
->
id
;
// 获取当前用户ID
...
@@ -156,11 +156,9 @@ public function create(Request $request)
...
@@ -156,11 +156,9 @@ public function create(Request $request)
$prescription
->
doctor_title
=
$randomDoctor
->
doctor_title
;
$prescription
->
doctor_title
=
$randomDoctor
->
doctor_title
;
$prescription
->
doctor_license_no
=
$randomDoctor
->
license_no
;
$prescription
->
doctor_license_no
=
$randomDoctor
->
license_no
;
$prescription
->
doctor_signed_pic
=
$randomDoctor
->
signed_pic
;
$prescription
->
doctor_signed_pic
=
$randomDoctor
->
signed_pic
;
// 药店信息
// 药店信息
$prescription
->
pharmacy_id
=
$pharmacy
->
id
;
$prescription
->
pharmacy_id
=
$pharmacy
->
id
;
$prescription
->
pharmacy_name
=
$pharmacy
->
name
;
$prescription
->
pharmacy_name
=
$pharmacy
->
name
;
// 分派药师,先搜索是否存在默认药师,如果不存在则随机抽取一个
// 分派药师,先搜索是否存在默认药师,如果不存在则随机抽取一个
$pharmacist
=
PharmacistModel
::
where
(
'status'
,
1
)
$pharmacist
=
PharmacistModel
::
where
(
'status'
,
1
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
...
...
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