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
e7cf05a2
authored
Nov 22, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处方单手动开具增加开方日志
parent
d1a9e4bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
app/Api/Controllers/DoctorController.php
+18
-5
No files found.
app/Api/Controllers/DoctorController.php
View file @
e7cf05a2
...
...
@@ -5,8 +5,11 @@
use
App\Http\Controllers\BaseApiController
;
use
App\Models\DoctorCorrectionModel
;
use
App\Models\DoctorModel
;
use
App\Models\PatientModel
;
use
App\Models\PrescriptionLogModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\User
;
use
Datetime
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Validator
;
...
...
@@ -62,22 +65,32 @@ public function upload(Request $request)
// 医师开方接口
public
function
prescription
(
Request
$request
)
{
$id
=
$request
->
input
(
'id'
);
if
(
empty
(
$
id
)
||
!
filter_var
(
$id
,
FILTER_VALIDATE_INT
))
{
return
$this
->
failed
(
'ID 不能为空
且必须为整数
'
);
$
prescription_
id
=
$request
->
input
(
'id'
);
if
(
empty
(
$
prescription_id
))
{
return
$this
->
failed
(
'ID 不能为空'
);
}
$authInfo
=
auth
(
'api'
)
->
user
();
$doctor
=
DoctorModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$doctor
)
{
return
$this
->
failed
(
'医师信息不存在'
);
}
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$id
)
->
first
();
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$
prescription_
id
)
->
first
();
if
(
$prescription
->
doctor_id
!=
$doctor
->
id
)
{
return
$this
->
failed
(
'您没有权限开方该处方'
);
}
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
;
if
(
$prescription
->
save
())
{
// TODO 增加开方日志
// 获取患者信息
$patient
=
PatientModel
::
where
(
'id'
,
$prescription
->
patient_id
)
->
first
();
// 生成医师开方日志
$dateTime
=
new
DateTime
(
$prescription
->
created_at
);
$dateTime
->
modify
(
'+3 minutes'
);
$prescription_at
=
$dateTime
->
format
(
'Y-m-d H:i:s'
);
$doctorLog
=
new
PrescriptionLogModel
;
$doctorLog
->
pharmacy_id
=
$prescription
->
pharmacy_id
;
$doctorLog
->
pharmacy_name
=
$prescription
->
pharmacy_name
;
$doctorLog
->
log_info
=
$doctor
->
mame
.
'在'
.
$prescription_at
.
'为'
.
$prescription
->
patient_name
.
'('
.
$patient
->
mobile
.
')开具处方单(处方单编号:'
.
$prescription_id
.
')'
;
$doctorLog
->
save
();
return
$this
->
success
(
'开方成功'
);
}
else
{
...
...
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