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
dc8f0da8
authored
Dec 23, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-1220' into develop
parents
4d0e725a
105a7230
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
352 additions
and
0 deletions
+352
-0
app/Admin/Controllers/ExternalPrescriptionController.php
+139
-0
app/Admin/Extensions/ToolBar/Actions/ExternalPrescriptionImportAction.php
+22
-0
app/Admin/Extensions/ToolBar/Forms/ExternalPrescriptionImportForm.php
+68
-0
app/Admin/Repositories/ExternalPrescription.php
+16
-0
app/Admin/routes.php
+4
-0
app/Models/ExternalPrescription.php
+18
-0
database/migrations/2024_12_23_112136_create_external_prescription_table.php
+53
-0
lang/zh_CN/external-prescription.php
+32
-0
No files found.
app/Admin/Controllers/ExternalPrescriptionController.php
0 → 100644
View file @
dc8f0da8
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\ExternalPrescription
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Models\PharmacyModel
;
use
App\Admin\Extensions\ToolBar\Actions\ExternalPrescriptionImportAction
;
class
ExternalPrescriptionController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
ExternalPrescription
(),
function
(
Grid
$grid
)
{
$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'
);
$grid
->
column
(
'patient_age'
);
$grid
->
column
(
'patient_id_card'
);
$grid
->
column
(
'doctor_name'
);
$grid
->
column
(
'diagnosis'
);
$grid
->
column
(
'drug_info'
);
$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
);
});
// 行按钮控制
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableDeleteButton
();
// 禁用删除按钮
$grid
->
disableEditButton
();
// 禁用编辑按钮
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
ExternalPrescription
(),
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
ExternalPrescription
(),
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'
);
});
}
}
app/Admin/Extensions/ToolBar/Actions/ExternalPrescriptionImportAction.php
0 → 100644
View file @
dc8f0da8
<?php
namespace
App\Admin\Extensions\ToolBar\Actions
;
use
App\Admin\Extensions\ToolBar\Forms\DrugImportForm
;
use
App\Admin\Extensions\ToolBar\Forms\ExternalPrescriptionImportForm
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Dcat\Admin\Widgets\Modal
;
class
ExternalPrescriptionImportAction
extends
AbstractTool
{
public
$title
=
'导入580处方单'
;
public
function
html
()
:
Modal
{
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
new
ExternalPrescriptionImportForm
())
->
button
(
"<button class='btn btn-success'><i class='feather icon-upload'></i>
{
$this
->
title
}
</button>"
);
}
}
app/Admin/Extensions/ToolBar/Forms/ExternalPrescriptionImportForm.php
0 → 100644
View file @
dc8f0da8
<?php
namespace
App\Admin\Extensions\ToolBar\Forms
;
use
App\Models\DosageModel
;
use
App\Models\ExternalPrescriptionModel
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Http\JsonResponse
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\EasyExcel\Excel
;
use
Dcat\EasyExcel\Support\SheetCollection
;
use
Illuminate\Support\Facades\Log
;
use
Exception
;
set_time_limit
(
1800
);
ini_set
(
'memory_limit'
,
'-1'
);
ini_set
(
'max_execution_time'
,
10800
);
ini_set
(
'max_input_time'
,
10800
);
class
ExternalPrescriptionImportForm
extends
Form
{
/**
* 处理表单提交逻辑.
*/
public
function
handle
(
array
$input
)
:
JsonResponse
{
// 表单参数
$file
=
$input
[
'import_file'
];
$filePath
=
storage_path
(
'app/'
.
$file
);
Log
::
info
(
"====>"
.
$filePath
);
try
{
// 每100行数据为一批数据进行读取
$chunkSize
=
10
;
$successNum
=
0
;
$failNum
=
0
;
$data
=
Excel
::
import
(
$filePath
)
->
sheet
(
'处方明细列表'
)
->
toArray
();
Log
::
info
(
"====>"
.
json_encode
(
$data
));
$return
=
$this
->
response
()
->
success
(
"导入成功
{
$successNum
}
条"
)
->
refresh
();
unlink
(
$filePath
);
}
catch
(
Exception
$e
)
{
$return
=
$this
->
response
()
->
error
(
"导入失败
{
$failNum
}
条:"
.
$e
->
getMessage
());
}
return
$return
;
}
/**
* 构造表单.
*/
public
function
form
()
{
$this
->
file
(
'import_file'
,
'文件'
)
->
disk
(
'local'
)
->
accept
(
'xlsx,csv'
)
->
maxSize
(
1024
*
30
)
->
autoUpload
()
->
uniqueName
()
->
required
()
->
help
(
"导入要求:<br />
<span style='color:red;'>
1、支持xlsx、csv两种格式
</span>"
);
// $downloadUrl = admin_url('dosage-template');
// $this->html("<a target='_blank' href='{$downloadUrl}'>下载用法用量导入模板</a>");
}
}
\ No newline at end of file
app/Admin/Repositories/ExternalPrescription.php
0 → 100644
View file @
dc8f0da8
<?php
namespace
App\Admin\Repositories
;
use
App\Models\ExternalPrescription
as
Model
;
use
Dcat\Admin\Repositories\EloquentRepository
;
class
ExternalPrescription
extends
EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected
$eloquentClass
=
Model
::
class
;
}
app/Admin/routes.php
View file @
dc8f0da8
...
...
@@ -49,6 +49,8 @@
$router
->
resource
(
'prescription'
,
'PrescriptionController'
);
// 处方-处方日志
$router
->
resource
(
'prescription-log'
,
'PrescriptionLogController'
);
// 处方-外部处方列表
$router
->
resource
(
'external-prescription'
,
'ExternalPrescriptionController'
);
// 系统-设置
$router
->
resource
(
'site-config'
,
'SiteConfigController'
);
...
...
@@ -76,6 +78,8 @@
$router
->
get
(
'/print'
,
'PrintController@print'
);
// 药店-设置
$router
->
resource
(
'pharmacy-config'
,
'PharmacyConfigController'
);
// 药店-外部处方单
$router
->
resource
(
'pharmacy-external-prescription'
,
'PharmacyExternalPrescriptionController'
);
});
$router
->
get
(
'/auth/smscode'
,
'AuthController@getLoginSmsCode'
);
/** 药店菜单-end **/
...
...
app/Models/ExternalPrescription.php
0 → 100644
View file @
dc8f0da8
<?php
namespace
App\Models
;
use
Dcat\Admin\Traits\HasDateTimeFormatter
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\Model
;
class
ExternalPrescription
extends
Model
{
use
HasDateTimeFormatter
;
use
SoftDeletes
;
protected
$table
=
'external_prescription'
;
}
database/migrations/2024_12_23_112136_create_external_prescription_table.php
0 → 100644
View file @
dc8f0da8
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateExternalPrescriptionTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'external_prescription'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'external_prescription_id'
)
->
default
(
''
)
->
comment
(
'外部处方单编号'
);
$table
->
timestamp
(
'issue_at'
)
->
comment
(
'处方开具时间'
);
$table
->
string
(
'status'
)
->
default
(
''
)
->
comment
(
'状态'
);
$table
->
string
(
'company_name'
)
->
default
(
''
)
->
comment
(
'企业名称'
);
$table
->
string
(
'pharmacy_name'
)
->
default
(
''
)
->
comment
(
'药店名称'
);
$table
->
integer
(
'pharmacy_id'
)
->
comment
(
'药店编号'
);
$table
->
string
(
'agent'
)
->
default
(
''
)
->
comment
(
'会员/代理人'
);
$table
->
string
(
'patient_name'
)
->
default
(
''
)
->
comment
(
'就诊人姓名'
);
$table
->
string
(
'patient_mobile'
)
->
default
(
''
)
->
comment
(
'就诊人手机号'
);
$table
->
tinyInteger
(
'patient_gender'
)
->
comment
(
'性别。[1=男性,2=女性,0=未知]'
);
$table
->
integer
(
'patient_age'
)
->
comment
(
'就诊人年龄'
);
$table
->
string
(
'patient_id_card'
)
->
nullable
()
->
comment
(
'就诊人身份证'
);
$table
->
string
(
'doctor_name'
)
->
default
(
''
)
->
comment
(
'接诊医师'
);
$table
->
string
(
'diagnosis'
)
->
default
(
''
)
->
comment
(
'诊断'
);
$table
->
text
(
'drug_info'
)
->
nullable
()
->
comment
(
'用药信息'
);
$table
->
string
(
'pharmacist_name'
)
->
nullable
()
->
comment
(
'审核药师'
);
$table
->
timestamp
(
'review_at'
)
->
nullable
()
->
comment
(
'审核时间'
);
$table
->
string
(
'pharmacist_attr'
)
->
nullable
()
->
comment
(
'药师属性'
);
$table
->
string
(
'dispatcher'
)
->
nullable
()
->
comment
(
'调配人'
);
$table
->
string
(
'checker'
)
->
nullable
()
->
comment
(
'核对人'
);
$table
->
string
(
'dispenser'
)
->
nullable
()
->
comment
(
'发药人'
);
$table
->
timestamps
();
$table
->
softDeletes
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'external_prescription'
);
}
}
lang/zh_CN/external-prescription.php
0 → 100644
View file @
dc8f0da8
<?php
return
[
'labels'
=>
[
'ExternalPrescription'
=>
'580处方单'
,
'external-prescription'
=>
'580处方单'
,
],
'fields'
=>
[
'external_prescription_id'
=>
'580处方单编号'
,
'issue_at'
=>
'处方开具时间'
,
'status'
=>
'状态'
,
'company_name'
=>
'企业名称'
,
'pharmacy_name'
=>
'药店名称'
,
'pharmacy_id'
=>
'药店编号'
,
'agent'
=>
'会员/代理人'
,
'patient_name'
=>
'就诊人姓名'
,
'patient_mobile'
=>
'就诊人手机号'
,
'patient_gender'
=>
'就诊人性别'
,
'patient_age'
=>
'就诊人年龄'
,
'patient_id_card'
=>
'就诊人身份证'
,
'doctor_name'
=>
'接诊医师姓名'
,
'diagnosis'
=>
'诊断'
,
'drug_info'
=>
'用药信息'
,
'pharmacist_name'
=>
'审核药师'
,
'review_at'
=>
'审核时间'
,
'pharmacist_attr'
=>
'药师属性'
,
'dispatcher'
=>
'调配人'
,
'checker'
=>
'核对人'
,
'dispenser'
=>
'发药人'
,
],
'options'
=>
[
],
];
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