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
2c52ce36
authored
Dec 04, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单个药品排他
parent
19c9faba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
app/Api/Controllers/DrugController.php
+14
-1
No files found.
app/Api/Controllers/DrugController.php
View file @
2c52ce36
...
...
@@ -161,6 +161,7 @@ public function drugLimit(Request $request)
// 处理麻黄素药品数据
$mahuangsu_buy_num
=
0
;
// 本次购买麻黄素药品数量
$exclusions
=
[];
// 单个药品的排他管理
foreach
(
$drugs
as
&
$drug
)
{
$drugModel
=
DrugModel
::
find
(
$drug
[
'drug_id'
]);
if
(
!
$drugModel
)
{
...
...
@@ -168,6 +169,8 @@ public function drugLimit(Request $request)
return
$this
->
failed
(
$errMsg
,
[
'add_status'
=>
false
]);
}
$exclusions
[
$drug
[
'drug_id'
]]
=
$drug
->
excluded_drug_ids
;
$drug
[
'drug_name'
]
=
0
;
// 冗余药品名称
$drug
[
'mahuangsu_status'
]
=
0
;
// 0:不是麻黄素药品
$drug
[
'limit_num'
]
=
$limit_num
;
// 赋值全局限购数量
if
(
$drugModel
->
limit_buy_7
>
0
)
{
...
...
@@ -181,7 +184,7 @@ public function drugLimit(Request $request)
return
$this
->
failed
(
$errMsg
,
[
'add_status'
=>
false
]);
}
$isBlack
=
false
;
$isBlack
=
false
;
// 药品默认不再限制名单中
foreach
(
$limit_keywords
as
$keyword
)
{
if
(
Str
::
contains
(
$drugModel
->
name
,
$keyword
))
{
$isBlack
=
true
;
...
...
@@ -199,6 +202,16 @@ public function drugLimit(Request $request)
}
}
}
// 检查单个药品的排他
if
(
$exclusions
)
{
foreach
(
$drugs
as
$drugItem
)
{
if
(
in_array
(
$drugItem
[
'drug_id'
],
$exclusions
[
$drugItem
[
'drug_id'
]]))
{
$errMsg
=
'药品['
.
$drugItem
[
'name'
]
.
']和您的其他药品不能同时购买~'
;
return
$this
->
failed
(
$errMsg
,
[
'add_status'
=>
false
]);
}
}
}
return
$this
->
success
([
'add_status'
=>
true
]);
}
...
...
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