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
5c0af401
authored
Nov 19, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回完整图片
parent
4e8109d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
6 deletions
+35
-6
app/Api/Controllers/PharmacistController.php
+1
-0
app/Api/Controllers/PrescriptionController.php
+5
-6
app/Models/DoctorModel.php
+11
-0
app/Models/PharmacistModel.php
+18
-0
No files found.
app/Api/Controllers/PharmacistController.php
View file @
5c0af401
...
...
@@ -189,6 +189,7 @@ public function upload(Request $request)
if
(
$pharmacist
->
save
())
{
return
$this
->
success
([
'message'
=>
'ok'
,
'url'
=>
$imageUrl
]);
}
return
$this
->
failed
(
'签名图片上传失败'
);
}
else
{
return
$this
->
failed
(
'签名图片上传失败'
);
...
...
app/Api/Controllers/PrescriptionController.php
View file @
5c0af401
...
...
@@ -175,9 +175,8 @@ public function create(Request $request)
if
(
intval
(
$prescription_limit
)
>
0
)
{
$startOfDay
=
Carbon
::
now
()
->
startOfDay
();
$endOfDay
=
Carbon
::
now
()
->
endOfDay
();
$doctorIds
=
DoctorModel
::
query
()
->
where
(
'status'
,
1
)
->
pluck
(
'id'
)
->
toArray
();
$prescriptionCounts
=
DB
::
table
(
'prescription'
)
->
select
(
'doctor_id'
,
DB
::
raw
(
'COUNT(*) as prescription_count'
))
$doctorIds
=
DoctorModel
::
query
()
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
->
pluck
(
'id'
)
->
toArray
();
$prescriptionCounts
=
PrescriptionModel
::
select
(
'doctor_id'
,
DB
::
raw
(
'COUNT(*) as prescription_count'
))
->
whereIn
(
'doctor_id'
,
$doctorIds
)
->
whereBetween
(
'created_at'
,
[
$startOfDay
,
$endOfDay
])
->
groupBy
(
'doctor_id'
)
...
...
@@ -188,13 +187,13 @@ public function create(Request $request)
return
$prescriptionCounts
->
get
(
$doctorId
,
0
)
<
$prescription_limit
;
})
->
values
()
->
all
();
// 随机取一个随机医师
$randomDoctor
=
D
B
::
table
(
'doctor'
)
->
where
In
(
'id'
,
$availableDoctors
)
$randomDoctor
=
D
octorModel
::
whereIn
(
'id'
,
$availableDoctors
)
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
->
inRandomOrder
()
->
first
();
}
else
{
$randomDoctor
=
DoctorModel
::
inRandomOrder
()
->
where
(
'status'
,
1
)
->
first
();
$randomDoctor
=
DoctorModel
::
inRandomOrder
()
->
where
(
'status'
,
DoctorModel
::
STATUS_TRUE
)
->
first
();
}
$prescription
->
doctor_id
=
$randomDoctor
->
id
;
...
...
app/Models/DoctorModel.php
View file @
5c0af401
...
...
@@ -15,6 +15,17 @@ class DoctorModel extends Model
protected
$table
=
'doctor'
;
// 医师状态[0=启用,1=禁用]
const
STATUS_FALSE
=
0
;
const
STATUS_TRUE
=
1
;
// 医师状态-文字映射
const
STATUS_MAP
=
[
self
::
STATUS_FALSE
=>
'禁用'
,
self
::
STATUS_TRUE
=>
'启用'
,
];
// 医师所属于的用户,一对一
public
function
user
()
{
...
...
app/Models/PharmacistModel.php
View file @
5c0af401
...
...
@@ -21,6 +21,24 @@ public function pharmacy()
return
$this
->
belongsTo
(
PharmacyModel
::
class
,
'pharmacy_id'
,
'id'
);
}
public
function
getPracticingLicenseAttribute
(
$value
)
{
if
(
Str
::
contains
(
$value
,
'//'
)
||
!
$value
)
{
return
$value
;
}
return
Storage
::
url
(
$value
);
}
public
function
getPhysicianLicenseAttribute
(
$value
)
{
if
(
Str
::
contains
(
$value
,
'//'
)
||
!
$value
)
{
return
$value
;
}
return
Storage
::
url
(
$value
);
}
public
function
getSignedPicAttribute
(
$value
)
{
if
(
Str
::
contains
(
$value
,
'//'
)
||
!
$value
)
{
...
...
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