Commit 1777ace9 by lujunyi

打印处方单

parent bc527fab
...@@ -28,7 +28,7 @@ public function index(Content $content): Content ...@@ -28,7 +28,7 @@ public function index(Content $content): Content
public function search() public function search()
{ {
$prescriptionNo = request('prescription_no'); $prescriptionNo = request('prescription_no');
$printEseal = request('print_eseal', 0); // 是否打印电子印章,实时生成 $isEseal = request('is_eseal', 0); // 是否打印电子印章,实时生成
if (empty($prescriptionNo)) { if (empty($prescriptionNo)) {
return response()->json([ return response()->json([
...@@ -44,7 +44,7 @@ public function search() ...@@ -44,7 +44,7 @@ public function search()
return response()->json(['status' => false, 'message' => '未找到该处方']); return response()->json(['status' => false, 'message' => '未找到该处方']);
} }
// 检查处方图片是否已经生成 // 检查处方图片是否已经生成
if ($printEseal && $prescription->prescription_pic_eseal) { if ($isEseal && $prescription->prescription_pic_eseal) {
return response()->json([ return response()->json([
'status' => true, 'status' => true,
'data' => [ 'data' => [
...@@ -67,7 +67,7 @@ public function search() ...@@ -67,7 +67,7 @@ public function search()
$imageWidth = 1653; $imageWidth = 1653;
$centerX = $imageWidth / 2; // 手动调整 X 坐标以居中 $centerX = $imageWidth / 2; // 手动调整 X 坐标以居中
// 医院 // 医院
$img->text($prescription->doctor_online_hospital_name, $centerX, 70, function ($font) { $img->text("{$prescription->doctor_online_hospital_name}处方笺", $centerX, 70, function ($font) {
$font->filename(public_path('static/fonts/SimHei.ttf')); $font->filename(public_path('static/fonts/SimHei.ttf'));
$font->size(72); $font->size(72);
$font->color('#000000'); $font->color('#000000');
...@@ -75,7 +75,7 @@ public function search() ...@@ -75,7 +75,7 @@ public function search()
$font->valign('top'); // 确保文本垂直对齐方式 $font->valign('top'); // 确保文本垂直对齐方式
}); });
// 处方单编号 // 处方单编号
$img->text("处方编号:{$prescription->id}", 1170, 190, function ($font) { $img->text("处方编号:{$prescription->id}", 1170, 190, function ($font) {
$font->filename(public_path('static/fonts/SimHei.ttf')); $font->filename(public_path('static/fonts/SimHei.ttf'));
$font->size(24); $font->size(24);
$font->color('#000000'); $font->color('#000000');
...@@ -212,7 +212,7 @@ public function search() ...@@ -212,7 +212,7 @@ public function search()
$prescription->prescription_pic_eseal = $cosEsealPath; $prescription->prescription_pic_eseal = $cosEsealPath;
$prescription->save(); // 保存处方图片路径 $prescription->save(); // 保存处方图片路径
if ($printEseal = true) { if ($isEseal) {
$imgUrl = Storage::url($cosEsealPath); $imgUrl = Storage::url($cosEsealPath);
} else { } else {
$imgUrl = Storage::url($cosPath); $imgUrl = Storage::url($cosPath);
......
<div class="search-form"> <div class="search-form">
<div class="input-group mb-3"> <div class="input-group mb-3" style="max-width: 600px;">
<input type="text" class="form-control" id="prescription_no" placeholder="请输入处方编号"> <input type="text" class="form-control" id="prescription_no" placeholder="请输入处方编号" style="width: 200px;">
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-primary" type="button" id="search-btn"> <div class="form-check" style="margin-left: 10px;">
<input type="checkbox" class="form-check-input" id="is_eseal" name="is_eseal">
<label class="form-check-label" for="is_eseal">带电子印章</label>
</div>
<button class="btn btn-primary" type="button" id="search-btn" style="margin-left: 10px;">
<i class="fa fa-search"></i> 搜索 <i class="fa fa-search"></i> 搜索
</button> </button>
</div> </div>
...@@ -59,12 +63,13 @@ ...@@ -59,12 +63,13 @@
search() { search() {
console.log('进入搜索方法'); console.log('进入搜索方法');
let prescriptionNo = $('#prescription_no').val(); let prescriptionNo = $('#prescription_no').val();
let isEseal = $('#is_eseal').is(':checked') ? 1 : 0;
if (!prescriptionNo) { if (!prescriptionNo) {
Dcat.warning('请输入处方编号'); Dcat.warning('请输入处方编号');
return; return;
} }
console.log('开始发送请求,处方编号:', prescriptionNo); console.log('开始发送请求,处方编号:', prescriptionNo, '电子印章:', isEseal);
Dcat.loading(); Dcat.loading();
$.ajax({ $.ajax({
...@@ -73,6 +78,7 @@ ...@@ -73,6 +78,7 @@
dataType: 'json', dataType: 'json',
data: { data: {
prescription_no: prescriptionNo, prescription_no: prescriptionNo,
is_eseal: isEseal,
_token: '{{ csrf_token() }}' _token: '{{ csrf_token() }}'
}, },
success: (response) => { success: (response) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment