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
2471f9e9
authored
Dec 23, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-1220' into develop
parents
00ef425d
61fc9d4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
3 deletions
+71
-3
app/Admin/Controllers/ExternalPrescriptionController.php
+2
-1
app/Admin/Extensions/ToolBar/Forms/ExternalPrescriptionImportForm.php
+55
-1
app/Models/ExternalPrescriptionModel.php
+14
-1
No files found.
app/Admin/Controllers/ExternalPrescriptionController.php
View file @
2471f9e9
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
use
Dcat\Admin\Show
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
App\Models\ExternalPrescriptionModel
;
use
App\Admin\Extensions\ToolBar\Actions\ExternalPrescriptionImportAction
;
use
App\Admin\Extensions\ToolBar\Actions\ExternalPrescriptionImportAction
;
class
ExternalPrescriptionController
extends
AdminController
class
ExternalPrescriptionController
extends
AdminController
{
{
...
@@ -29,7 +30,7 @@ protected function grid()
...
@@ -29,7 +30,7 @@ protected function grid()
$grid
->
column
(
'agent'
);
$grid
->
column
(
'agent'
);
$grid
->
column
(
'patient_name'
);
$grid
->
column
(
'patient_name'
);
$grid
->
column
(
'patient_mobile'
);
$grid
->
column
(
'patient_mobile'
);
$grid
->
column
(
'patient_gender'
);
$grid
->
column
(
'patient_gender'
)
->
using
(
ExternalPrescriptionModel
::
SEX_MAP
)
;
$grid
->
column
(
'patient_age'
);
$grid
->
column
(
'patient_age'
);
$grid
->
column
(
'patient_id_card'
);
$grid
->
column
(
'patient_id_card'
);
$grid
->
column
(
'doctor_name'
);
$grid
->
column
(
'doctor_name'
);
...
...
app/Admin/Extensions/ToolBar/Forms/ExternalPrescriptionImportForm.php
View file @
2471f9e9
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
use
App\Models\DosageModel
;
use
App\Models\DosageModel
;
use
App\Models\ExternalPrescriptionModel
;
use
App\Models\ExternalPrescriptionModel
;
use
App\Models\PharmacyModel
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Http\JsonResponse
;
use
Dcat\Admin\Http\JsonResponse
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\Admin\Widgets\Form
;
...
@@ -48,7 +49,45 @@ public function handle(array $input): JsonResponse
...
@@ -48,7 +49,45 @@ public function handle(array $input): JsonResponse
}
}
$prescriptions
[
$prescriptionNo
][
'药品明细'
][]
=
$drug_info
;
$prescriptions
[
$prescriptionNo
][
'药品明细'
][]
=
$drug_info
;
}
}
Log
::
info
(
"prescriptions====>"
.
json_encode
(
$prescriptions
));
// 循环插入数据
foreach
(
$prescriptions
as
$prescriptionNo
=>
$prescription
){
// 校验数据库中是否存在该数据
$externalPrescriptionModel
=
ExternalPrescriptionModel
::
where
(
'prescription_no'
,
$prescriptionNo
)
->
first
();
if
(
!
$externalPrescriptionModel
){
$externalPrescriptionModel
=
new
ExternalPrescriptionModel
;
}
// 查找对应的药店ID
$pharmacy
=
PharmacyModel
::
where
(
'name'
,
$prescription
[
'门店名称'
])
->
first
();
$pharmacyId
=
0
;
if
(
!
$pharmacy
){
$pharmacyId
=
$pharmacy
->
id
;
}
$externalPrescriptionModel
->
external_prescription_id
=
$prescriptionNo
;
$externalPrescriptionModel
->
issue_at
=
$prescription
[
'处方开具时间'
];
$externalPrescriptionModel
->
status
=
$prescription
[
'处方状态'
];
$externalPrescriptionModel
->
company_name
=
$prescription
[
'企业名称'
];
$externalPrescriptionModel
->
pharmacy_name
=
$prescription
[
'门店名称'
];
$externalPrescriptionModel
->
pharmacy_id
=
$pharmacyId
;
$externalPrescriptionModel
->
agent
=
$prescription
[
'会员/代理人'
];
$externalPrescriptionModel
->
patient_name
=
$prescription
[
'就诊人姓名'
];
$externalPrescriptionModel
->
patient_mobile
=
$prescription
[
'就诊人电话'
];
$externalPrescriptionModel
->
patient_gender
=
self
::
getGender
(
$prescription
[
'就诊人性别'
]);
$externalPrescriptionModel
->
patient_age
=
$prescription
[
'就诊人年龄'
];
$externalPrescriptionModel
->
patient_id_card
=
$prescription
[
'就诊人身份证号'
];
$externalPrescriptionModel
->
doctor_name
=
$prescription
[
'接诊医师姓名'
];
$externalPrescriptionModel
->
diagnosis
=
$prescription
[
'诊断'
];
$externalPrescriptionModel
->
drug_info
=
$prescription
[
'药品明细'
];
$externalPrescriptionModel
->
pharmacist_name
=
$prescription
[
'审核药师'
];
$externalPrescriptionModel
->
review_at
=
$prescription
[
'药师审核时间'
];
$externalPrescriptionModel
->
pharmacist_attr
=
$prescription
[
'药师属性'
];
$externalPrescriptionModel
->
dispatcher
=
$prescription
[
'调配人'
];
$externalPrescriptionModel
->
checker
=
$prescription
[
'核对人'
];
$externalPrescriptionModel
->
dispenser
=
$prescription
[
'发药人'
];
if
(
$externalPrescriptionModel
->
save
()
){
$successNum
++
;
}
}
// Log::info("prescriptions====>".json_encode($prescriptions));
}
}
$return
=
$this
->
response
()
->
success
(
"导入成功
{
$successNum
}
条"
)
->
refresh
();
$return
=
$this
->
response
()
->
success
(
"导入成功
{
$successNum
}
条"
)
->
refresh
();
...
@@ -79,4 +118,18 @@ public function form()
...
@@ -79,4 +118,18 @@ public function form()
// $downloadUrl = admin_url('dosage-template');
// $downloadUrl = admin_url('dosage-template');
// $this->html("<a target='_blank' href='{$downloadUrl}'>下载用法用量导入模板</a>");
// $this->html("<a target='_blank' href='{$downloadUrl}'>下载用法用量导入模板</a>");
}
}
private
static
function
getGender
(
$value
){
$value
=
trim
(
$value
);
switch
(
$value
)
{
case
'男'
:
return
1
;
case
'女'
:
return
2
;
default
:
return
0
;
}
}
}
}
\ No newline at end of file
app/Models/ExternalPrescription.php
→
app/Models/ExternalPrescription
Model
.php
View file @
2471f9e9
...
@@ -6,11 +6,24 @@
...
@@ -6,11 +6,24 @@
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
ExternalPrescription
extends
Model
class
ExternalPrescription
Model
extends
Model
{
{
use
HasDateTimeFormatter
;
use
HasDateTimeFormatter
;
use
SoftDeletes
;
use
SoftDeletes
;
// 性别[0=未知,1=男,2=女]
const
SEX_UNDEFINED
=
0
;
const
SEX_MALE
=
1
;
const
SEX_FEMALE
=
2
;
// 性别-文字映射
const
SEX_MAP
=
[
self
::
SEX_UNDEFINED
=>
'未知'
,
self
::
SEX_MALE
=>
'男'
,
self
::
SEX_FEMALE
=>
'女'
,
];
protected
$table
=
'external_prescription'
;
protected
$table
=
'external_prescription'
;
...
...
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