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
4ecd7fa3
authored
Nov 22, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开方bug修复
parent
59a9ef05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
app/Api/Controllers/PrescriptionController.php
+14
-9
No files found.
app/Api/Controllers/PrescriptionController.php
View file @
4ecd7fa3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
// 问诊人控制器
// 问诊人控制器
class
PrescriptionController
extends
BaseApiController
class
PrescriptionController
extends
BaseApiController
{
{
...
@@ -98,7 +99,7 @@ public function detail(Request $request)
...
@@ -98,7 +99,7 @@ public function detail(Request $request)
public
function
create
(
Request
$request
)
public
function
create
(
Request
$request
)
{
{
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
Log
::
info
(
"开方请求参数:"
.
json_encode
(
$request
->
all
()));
Log
::
info
(
'开方请求参数:'
.
json_encode
(
$request
->
all
()));
$pharmacy_id
=
$request
->
input
(
'pharmacy_id'
,
0
);
$pharmacy_id
=
$request
->
input
(
'pharmacy_id'
,
0
);
$patient_id
=
$request
->
input
(
'patient_id'
);
$patient_id
=
$request
->
input
(
'patient_id'
);
$diagnosis_id
=
$request
->
input
(
'diagnosis_id'
);
$diagnosis_id
=
$request
->
input
(
'diagnosis_id'
);
...
@@ -202,16 +203,20 @@ public function create(Request $request)
...
@@ -202,16 +203,20 @@ public function create(Request $request)
return
$prescriptionCounts
->
get
(
$doctorId
,
0
)
<
$prescription_limit
;
return
$prescriptionCounts
->
get
(
$doctorId
,
0
)
<
$prescription_limit
;
})
->
values
()
->
all
();
})
->
values
()
->
all
();
// 随机取一个随机医师
// 随机取一个随机医师
$randomDoctor
=
DoctorModel
::
whereIn
(
'id'
,
$availableDoctors
)
$randomQuery
=
DoctorModel
::
query
()
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
);
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
if
(
count
(
$availableDoctors
)
>
0
)
{
->
inRandomOrder
()
$randomQuery
->
whereIn
(
'id'
,
$availableDoctors
);
->
first
();
}
$randomDoctor
=
$randomQuery
->
inRandomOrder
()
->
first
();
// $randomDoctor = DoctorModel::whereIn('id', $availableDoctors)
// ->where('status', DoctorModel::STATUS_TRUE)
// ->inRandomOrder()
// ->first();
}
else
{
}
else
{
$randomDoctor
=
DoctorModel
::
inRandomOrder
()
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
->
first
();
$randomDoctor
=
DoctorModel
::
inRandomOrder
()
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
->
first
();
}
}
#
记录开方医师信息
//
记录开方医师信息
Log
::
info
(
"医师:"
.
json_encode
(
$randomDoctor
));
Log
::
info
(
'医师:'
.
json_encode
(
$randomDoctor
));
$prescription
->
doctor_id
=
$randomDoctor
->
id
;
$prescription
->
doctor_id
=
$randomDoctor
->
id
;
$prescription
->
doctor_name
=
$randomDoctor
->
name
;
$prescription
->
doctor_name
=
$randomDoctor
->
name
;
$prescription
->
doctor_online_hospital_name
=
$randomDoctor
->
online_hospital_name
;
$prescription
->
doctor_online_hospital_name
=
$randomDoctor
->
online_hospital_name
;
...
@@ -232,7 +237,7 @@ public function create(Request $request)
...
@@ -232,7 +237,7 @@ public function create(Request $request)
})
})
->
inRandomOrder
()
->
inRandomOrder
()
->
first
();
->
first
();
Log
::
info
(
"药师:"
.
json_encode
(
$pharmacist
));
Log
::
info
(
'药师:'
.
json_encode
(
$pharmacist
));
$prescription
->
pharmacist_id
=
$pharmacist
->
id
;
$prescription
->
pharmacist_id
=
$pharmacist
->
id
;
$prescription
->
pharmacist_name
=
$pharmacist
->
name
;
$prescription
->
pharmacist_name
=
$pharmacist
->
name
;
$prescription
->
pharmacist_license_number
=
$pharmacist
->
license_number
;
$prescription
->
pharmacist_license_number
=
$pharmacist
->
license_number
;
...
...
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