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
0bb778bc
authored
Nov 13, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处方单列表
parent
765a84b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
11 deletions
+39
-11
app/Api/Controllers/DrugController.php
+6
-5
app/Api/Controllers/PatientController.php
+1
-1
app/Api/Controllers/PrescriptionController.php
+32
-5
No files found.
app/Api/Controllers/DrugController.php
View file @
0bb778bc
...
@@ -30,17 +30,18 @@ public function drugList(Request $request)
...
@@ -30,17 +30,18 @@ public function drugList(Request $request)
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
}
#
药品7日内限购
//
药品7日内限购
public
function
drugLimit
(
Request
$request
)
public
function
drugLimit
(
Request
$request
)
{
{
$drug_id
=
$request
->
input
(
'drug_id'
);
$drug_id
=
$request
->
input
(
'drug_id'
);
#
判断当前药品有没有设置7日内限购
//
判断当前药品有没有设置7日内限购
$drug
=
DrugModel
::
query
()
->
find
(
$drug_id
);
$drug
=
DrugModel
::
query
()
->
find
(
$drug_id
);
#
当前药品未设置则使用全局的7日内限购
//
当前药品未设置则使用全局的7日内限购
$limit_num
=
0
;
$limit_num
=
0
;
if
(
$drug
->
limit_num
==
0
)
{
if
(
$drug
->
limit_num
==
0
)
{
}
}
return
$this
->
success
(
$limit_num
);
return
$this
->
success
(
$limit_num
);
}
}
...
...
app/Api/Controllers/PatientController.php
View file @
0bb778bc
...
@@ -46,7 +46,7 @@ public function add(Request $request)
...
@@ -46,7 +46,7 @@ public function add(Request $request)
$idCardInfo
=
Util
::
getIdCardInfo
(
$data
[
'id_card'
]);
$idCardInfo
=
Util
::
getIdCardInfo
(
$data
[
'id_card'
]);
$data
[
'gender'
]
=
$idCardInfo
[
'gender'
];
$data
[
'gender'
]
=
$idCardInfo
[
'gender'
];
#
$data['age'] = $idCardInfo['age'];
//
$data['age'] = $idCardInfo['age'];
$res
=
PatientModel
::
create
(
$data
);
$res
=
PatientModel
::
create
(
$data
);
if
(
$res
)
{
if
(
$res
)
{
return
$this
->
success
(
$res
);
return
$this
->
success
(
$res
);
...
...
app/Api/Controllers/PrescriptionController.php
View file @
0bb778bc
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
// 问诊人控制器
// 问诊人控制器
class
PrescriptionController
extends
BaseApiController
class
PrescriptionController
extends
BaseApiController
{
{
public
function
test
()
public
function
test
()
{
{
// 分派医师 医师当日开方未达到上限以及是否在时间段的搜索出来
// 分派医师 医师当日开方未达到上限以及是否在时间段的搜索出来
...
@@ -35,13 +34,42 @@ public function test()
...
@@ -35,13 +34,42 @@ public function test()
public
function
prescriptionList
(
Request
$request
)
public
function
prescriptionList
(
Request
$request
)
{
{
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
$userInfo
=
User
::
with
([
'doctor'
,
'pharmacist'
])
->
find
(
$authInfo
->
id
);
$query
=
PrescriptionModel
::
query
();
$query
=
PrescriptionModel
::
query
();
// TODO 判断当前登录的用户角色
// TODO 判断当前登录的用户角色
# $userInfo = User::with(['doctor', 'pharmacist'])->find($authInfo->id);
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_USER
){
$query
->
where
(
'user_id'
,
$authInfo
->
id
);
}
else
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_DOCTOR
){
// 医师
$doctor
=
DoctorModel
::
query
()
->
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$query
->
where
(
'doctor_id'
,
$doctor
->
id
);
}
else
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_PHARMACY
){
// 药店
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$query
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
);
}
$prescription
=
$query
->
get
();
# 时间段
$start_time
=
$request
->
input
(
'start_time'
);
$end_time
=
$request
->
input
(
'end_time'
);
if
(
$start_time
&&
$end_time
)
{
$query
->
whereBetween
(
'created_at'
,
[
$start_time
,
$end_time
]);
}
else
if
(
$start_time
)
{
$query
->
where
(
'created_at'
,
'>='
,
$start_time
);
}
else
if
(
$end_time
)
{
$query
->
where
(
'created_at'
,
'<='
,
$end_time
);
}
# 状态
$status
=
$request
->
input
(
'status'
);
if
(
$status
)
{
$query
->
where
(
'status'
,
$status
);
}
# 分页
$page
=
$request
->
input
(
'page'
,
1
);
$perPage
=
$request
->
input
(
'per_page'
,
10
);
$prescription
=
$query
->
orderBy
(
'id'
,
'desc'
)
->
paginate
(
$perPage
,
[
'*'
],
'page'
,
$page
);
# $prescription = $query->paginate(10);
return
$this
->
success
(
$prescription
);
return
$this
->
success
(
$prescription
);
}
}
...
@@ -122,5 +150,4 @@ public function create(Request $request)
...
@@ -122,5 +150,4 @@ public function create(Request $request)
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
}
}
}
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