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
ba70faaf
authored
Dec 04, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f6a32fdb
7e00f0f4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
7 deletions
+48
-7
app/Api/Controllers/PatientController.php
+2
-0
app/Api/Controllers/PharmacistController.php
+38
-2
app/Api/Controllers/PharmacyController.php
+4
-4
app/Api/Controllers/PrescriptionController.php
+1
-1
routes/api.php
+3
-0
No files found.
app/Api/Controllers/PatientController.php
View file @
ba70faaf
...
...
@@ -86,8 +86,10 @@ public function add(Request $request)
// if ($verificationCode != $code) {
// return $this->failed('验证码错误');
// }
// $idCardInfo = Util::getIdCardInfo($data['id_card']);
$patient
->
name
=
$data
[
'name'
];
$patient
->
id_card
=
$data
[
'id_card'
];
$patient
->
mobile
=
$mobile
;
...
...
app/Api/Controllers/PharmacistController.php
View file @
ba70faaf
...
...
@@ -17,7 +17,7 @@ public function pharmacistList()
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$pharmacist
=
PharmacistModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
get
();
...
...
@@ -35,7 +35,7 @@ public function detail(Request $request)
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$pharmacist
=
PharmacistModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
where
(
'id'
,
$pharmacist_id
)
->
first
();
if
(
!
$pharmacist
)
{
...
...
@@ -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
)
{
...
...
app/Api/Controllers/PharmacyController.php
View file @
ba70faaf
...
...
@@ -58,7 +58,7 @@ public function detail(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
return
$this
->
success
(
$pharmacy
);
...
...
@@ -70,7 +70,7 @@ public function correction(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$content
=
$request
->
input
(
'content'
);
if
(
empty
(
$content
))
{
...
...
@@ -98,7 +98,7 @@ public function prescription(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$Pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$Pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$id
)
->
where
(
'pharmacy_id'
,
$Pharmacy
->
id
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
)
->
first
();
if
(
!
$prescription
)
{
...
...
@@ -150,7 +150,7 @@ public function open(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$is_open
=
$request
->
input
(
'is_open'
);
...
...
app/Api/Controllers/PrescriptionController.php
View file @
ba70faaf
...
...
@@ -120,7 +120,7 @@ public function create(Request $request)
return
$this
->
failed
(
'用户端暂时无法开处方'
);
$pharmacy
=
PharmacyModel
::
find
(
$pharmacy_id
);
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
}
else
{
return
$this
->
failed
(
'pharmacy_id不能为空'
);
...
...
routes/api.php
View file @
ba70faaf
...
...
@@ -24,6 +24,7 @@
Route
::
get
(
'test'
,
'App\Api\Controllers\SiteConfigController@test'
);
Route
::
get
(
'qrcode'
,
'App\Api\Controllers\PatientController@getQrCode'
);
// 需要验证是否登录的路由组
Route
::
middleware
([
'jwt.auth'
,
'checkrole'
])
->
group
(
function
()
{
// 获取用户信息
...
...
@@ -68,6 +69,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