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
e6d5f985
authored
Dec 03, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫码新增问诊人
parent
45e8ada9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
app/Api/Controllers/PharmacistController.php
+36
-0
routes/api.php
+2
-0
No files found.
app/Api/Controllers/PharmacistController.php
View file @
e6d5f985
...
...
@@ -100,6 +100,42 @@ public function add(Request $request)
return
$this
->
failed
(
'药师新增失败!'
);
}
public
function
scanAdd
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'未找到药店信息!'
);
}
// 检查是否传递了药师的id
$pharmacistId
=
$request
->
input
(
'id'
);
if
(
$pharmacistId
)
{
// 查询并复制已有药师数据
$existingPharmacist
=
PharmacistModel
::
where
(
'id'
,
$pharmacistId
)
->
first
();
if
(
!
$existingPharmacist
)
{
return
$this
->
failed
(
'未找到对应药师信息!'
);
}
$pharmacist
=
$existingPharmacist
->
replicate
();
// 设置药师属性
$pharmacist
->
pharmacy_id
=
$pharmacy
->
id
;
$pharmacist
->
name
=
$pharmacist
->
name
??
''
;
$pharmacist
->
id_card
=
$pharmacist
->
id_card
??
''
;
$pharmacist
->
mobile
=
$pharmacist
->
mobile
??
''
;
$pharmacist
->
license_number
=
$pharmacist
->
license_number
??
''
;
$pharmacist
->
practicing_license
=
$pharmacist
->
practicing_license
??
''
;
$pharmacist
->
practicing_license_expired_time
=
$pharmacist
->
practicing_license_expired_time
??
null
;
$pharmacist
->
physician_license
=
$pharmacist
->
physician_license
??
''
;
$pharmacist
->
status
=
0
;
// 保存药师数据
if
(
$pharmacist
->
save
())
{
return
$this
->
success
(
$pharmacist
);
}
}
return
$this
->
failed
(
'药师新增失败!'
);
}
// 药师编辑
public
function
update
(
Request
$request
)
{
...
...
routes/api.php
View file @
e6d5f985
...
...
@@ -65,6 +65,8 @@
Route
::
get
(
'/patients'
,
'App\Api\Controllers\PatientController@patientList'
);
# 问诊人新增
Route
::
post
(
'/patients-add'
,
'App\Api\Controllers\PatientController@add'
);
# 问诊人扫码新增
Route
::
post
(
'/patients-scan-add'
,
'App\Api\Controllers\PatientController@scanAdd'
);
# 问诊人编辑
Route
::
post
(
'/patients-update'
,
'App\Api\Controllers\PatientController@update'
);
# 问诊人删除
...
...
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