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
dd2248f8
authored
Dec 23, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加药店端展示外部处方单
parent
52935ca0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
3 deletions
+172
-3
app/Admin/Controllers/ExternalPrescriptionController.php
+4
-3
app/Admin/Controllers/PharmacyExternalPrescriptionController.php
+168
-0
No files found.
app/Admin/Controllers/ExternalPrescriptionController.php
View file @
dd2248f8
...
@@ -20,6 +20,7 @@ class ExternalPrescriptionController extends AdminController
...
@@ -20,6 +20,7 @@ class ExternalPrescriptionController extends AdminController
protected
function
grid
()
protected
function
grid
()
{
{
return
Grid
::
make
(
new
ExternalPrescriptionModel
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
ExternalPrescriptionModel
(),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
orderBy
(
'id'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'external_prescription_id'
);
$grid
->
column
(
'external_prescription_id'
);
$grid
->
column
(
'issue_at'
)
->
sortable
();
$grid
->
column
(
'issue_at'
)
->
sortable
();
...
@@ -70,7 +71,7 @@ protected function grid()
...
@@ -70,7 +71,7 @@ protected function grid()
$filter
->
expand
();
// 默认展开搜索框
$filter
->
expand
();
// 默认展开搜索框
$filter
->
equal
(
'external_prescription_id'
,
'580处方单编号'
)
->
width
(
3
);
$filter
->
equal
(
'external_prescription_id'
,
'580处方单编号'
)
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
,
'药店编号'
)
->
width
(
3
);
//
$filter->equal('pharmacy_id','药店编号')->width(3);
});
});
// 行按钮控制
// 行按钮控制
...
@@ -90,7 +91,7 @@ protected function grid()
...
@@ -90,7 +91,7 @@ protected function grid()
*/
*/
protected
function
detail
(
$id
)
protected
function
detail
(
$id
)
{
{
return
Show
::
make
(
$id
,
new
ExternalPrescription
(),
function
(
Show
$show
)
{
return
Show
::
make
(
$id
,
new
ExternalPrescription
Model
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'id'
);
$show
->
field
(
'external_prescription_id'
);
$show
->
field
(
'external_prescription_id'
);
$show
->
field
(
'issue_at'
);
$show
->
field
(
'issue_at'
);
...
@@ -125,7 +126,7 @@ protected function detail($id)
...
@@ -125,7 +126,7 @@ protected function detail($id)
*/
*/
protected
function
form
()
protected
function
form
()
{
{
return
Form
::
make
(
new
ExternalPrescription
(),
function
(
Form
$form
)
{
return
Form
::
make
(
new
ExternalPrescription
Model
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
display
(
'id'
);
$form
->
text
(
'external_prescription_id'
);
$form
->
text
(
'external_prescription_id'
);
$form
->
text
(
'issue_at'
);
$form
->
text
(
'issue_at'
);
...
...
app/Admin/Controllers/PharmacyExternalPrescriptionController.php
0 → 100644
View file @
dd2248f8
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\ToolBar\Actions\AddPharmacyDrugAction
;
use
App\Admin\Repositories\PharmacyDrugRepository
;
use
App\Models\DosageModel
;
use
App\Models\DrugModel
;
use
App\Models\DrugUnitModel
;
use
App\Models\ExternalPrescriptionModel
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Show
;
class
PharmacyExternalPrescriptionController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
ExternalPrescriptionModel
(),
function
(
Grid
$grid
)
{
if
(
!
Admin
::
user
()
->
pharmacy_id
)
{
admin_exit
(
Content
::
make
()
->
withError
(
trans
(
'admin.deny'
)));
}
$grid
->
model
()
->
orderBy
(
'id'
,
'DESC'
);
$grid
->
model
()
->
where
(
'pharmacy_id'
,
Admin
::
user
()
->
pharmacy_id
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'external_prescription_id'
);
$grid
->
column
(
'issue_at'
)
->
sortable
();
$grid
->
column
(
'status'
);
$grid
->
column
(
'company_name'
);
$grid
->
column
(
'pharmacy_name'
);
// $grid->column('pharmacy_id');
$grid
->
column
(
'agent'
);
$grid
->
column
(
'patient_name'
);
$grid
->
column
(
'patient_mobile'
);
$grid
->
column
(
'patient_gender'
)
->
using
(
ExternalPrescriptionModel
::
SEX_MAP
);
$grid
->
column
(
'patient_age'
);
$grid
->
column
(
'patient_id_card'
);
$grid
->
column
(
'doctor_name'
);
$grid
->
column
(
'diagnosis'
);
$grid
->
column
(
'drug_info'
)
->
display
(
function
(
$drugInfoJson
)
{
// 尝试将 $drugInfoJson 解码为数组
$drugInfoArray
=
json_decode
(
$drugInfoJson
,
true
);
// 检查解码是否成功且 $drugInfoArray 是一个数组
if
(
is_array
(
$drugInfoArray
))
{
// 使用 array_map 来格式化每个药物的信息
$formattedDrugs
=
array_map
(
function
(
$item
)
{
return
$item
[
'drug_name'
]
.
' : '
.
(
$item
[
'drug_spec'
]
??
''
)
.
' : '
.
$item
[
'drug_num'
];
},
$drugInfoArray
);
// 将数组转换为以逗号分隔的字符串(或根据您的需求进行其他格式化)
return
implode
(
', '
,
$formattedDrugs
);
}
else
{
// 如果解码失败或 $drugInfoJson 不是一个有效的 JSON 字符串,返回原始值或错误消息
return
$drugInfoJson
;
// 或者返回一个错误消息,如 'Invalid JSON'
}
})
->
label
();
// 设置列的标签
$grid
->
column
(
'pharmacist_name'
);
$grid
->
column
(
'review_at'
);
$grid
->
column
(
'pharmacist_attr'
);
$grid
->
column
(
'dispatcher'
);
$grid
->
column
(
'checker'
);
$grid
->
column
(
'dispenser'
);
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
// 工具栏普通按钮
$grid
->
tools
(
function
(
$tools
)
{
$tools
->
append
(
new
ExternalPrescriptionImportAction
());
// 导入药品信息
});
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
//$filter->equal('id');
$filter
->
panel
();
// 更改为 panel 布局
$filter
->
expand
();
// 默认展开搜索框
$filter
->
equal
(
'external_prescription_id'
,
'580处方单编号'
)
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
,
'药店编号'
)
->
width
(
3
);
});
// 行按钮控制
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableDeleteButton
();
// 禁用删除按钮
$grid
->
disableEditButton
();
// 禁用编辑按钮
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
ExternalPrescriptionModel
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'external_prescription_id'
);
$show
->
field
(
'issue_at'
);
$show
->
field
(
'status'
);
$show
->
field
(
'company_name'
);
$show
->
field
(
'pharmacy_name'
);
$show
->
field
(
'pharmacy_id'
);
$show
->
field
(
'agent'
);
$show
->
field
(
'patient_name'
);
$show
->
field
(
'patient_mobile'
);
$show
->
field
(
'patient_gender'
);
$show
->
field
(
'patient_age'
);
$show
->
field
(
'patient_id_card'
);
$show
->
field
(
'doctor_name'
);
$show
->
field
(
'diagnosis'
);
$show
->
field
(
'drug_info'
);
$show
->
field
(
'pharmacist_name'
);
$show
->
field
(
'review_at'
);
$show
->
field
(
'pharmacist_attr'
);
$show
->
field
(
'dispatcher'
);
$show
->
field
(
'checker'
);
$show
->
field
(
'dispenser'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
ExternalPrescriptionModel
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'external_prescription_id'
);
$form
->
text
(
'issue_at'
);
$form
->
text
(
'status'
);
$form
->
text
(
'company_name'
);
$form
->
text
(
'pharmacy_name'
);
$form
->
text
(
'pharmacy_id'
);
$form
->
text
(
'agent'
);
$form
->
text
(
'patient_name'
);
$form
->
text
(
'patient_mobile'
);
$form
->
text
(
'patient_gender'
);
$form
->
text
(
'patient_age'
);
$form
->
text
(
'patient_id_card'
);
$form
->
text
(
'doctor_name'
);
$form
->
text
(
'diagnosis'
);
$form
->
text
(
'drug_info'
);
$form
->
text
(
'pharmacist_name'
);
$form
->
text
(
'review_at'
);
$form
->
text
(
'pharmacist_attr'
);
$form
->
text
(
'dispatcher'
);
$form
->
text
(
'checker'
);
$form
->
text
(
'dispenser'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
\ No newline at end of file
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