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
9c1c7b76
authored
Nov 16, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增审方接口
parent
71e84059
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
app/Api/Controllers/DoctorController.php
+3
-1
app/Api/Controllers/PharmacyController.php
+24
-1
No files found.
app/Api/Controllers/DoctorController.php
View file @
9c1c7b76
...
@@ -75,7 +75,7 @@ public function prescription(Request $request)
...
@@ -75,7 +75,7 @@ public function prescription(Request $request)
{
{
$id
=
$request
->
input
(
'id'
);
$id
=
$request
->
input
(
'id'
);
if
(
empty
(
$id
)
||
!
filter_var
(
$id
,
FILTER_VALIDATE_INT
))
{
if
(
empty
(
$id
)
||
!
filter_var
(
$id
,
FILTER_VALIDATE_INT
))
{
return
$this
->
failed
(
'
无效的 ID,
ID 不能为空且必须为整数'
);
return
$this
->
failed
(
'ID 不能为空且必须为整数'
);
}
}
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
$doctor
=
DoctorModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$doctor
=
DoctorModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
...
@@ -88,6 +88,8 @@ public function prescription(Request $request)
...
@@ -88,6 +88,8 @@ public function prescription(Request $request)
}
}
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
;
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
;
if
(
$prescription
->
save
())
{
if
(
$prescription
->
save
())
{
# TODO 增加开方日志
return
$this
->
success
(
'开方成功'
);
return
$this
->
success
(
'开方成功'
);
}
else
{
}
else
{
return
$this
->
failed
(
'开方失败'
);
return
$this
->
failed
(
'开方失败'
);
...
...
app/Api/Controllers/PharmacyController.php
View file @
9c1c7b76
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
use
App\Http\Controllers\BaseApiController
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\PharmacyCorrectionModel
;
use
App\Models\PharmacyCorrectionModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -74,5 +75,27 @@ public function correction(Request $request)
...
@@ -74,5 +75,27 @@ public function correction(Request $request)
}
}
// 药店审方
// 药店审方
public
function
approval
(
Request
$request
)
{}
public
function
prescription
(
Request
$request
)
{
$id
=
$request
->
input
(
'id'
);
if
(
empty
(
$id
)
||
!
filter_var
(
$id
,
FILTER_VALIDATE_INT
))
{
return
$this
->
failed
(
'ID 不能为空且必须为整数'
);
}
$authInfo
=
auth
(
'api'
)
->
user
();
$Pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$Pharmacy
)
{
return
$this
->
failed
(
'药店信息不存在'
);
}
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$id
)
->
where
(
'pharmacy_id'
,
$Pharmacy
->
id
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
)
->
first
();
if
(
$prescription
){
return
$this
->
failed
(
'该处方已审核'
);
}
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
;
if
(
$prescription
->
save
())
{
# TODO 增加审方日志
return
$this
->
success
(
'审方成功'
);
}
else
{
return
$this
->
failed
(
'审方失败'
);
}
}
}
}
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