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
de95b3c8
authored
Dec 04, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
增加日志
parents
ed15e104
b3c78569
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
app/Admin/Controllers/DoctorController.php
+2
-2
app/Api/Controllers/DrugController.php
+17
-2
app/Api/Controllers/PrescriptionController.php
+3
-3
app/Models/DoctorModel.php
+1
-0
No files found.
app/Admin/Controllers/DoctorController.php
View file @
de95b3c8
...
...
@@ -48,7 +48,7 @@ protected function grid()
$grid
->
column
(
'user.openid'
,
'关联用户'
);
$grid
->
column
(
'created_at'
);
// $grid->column('updated_at')->sortable();
$grid
->
column
(
'type'
,
'医师类型'
)
->
using
(
DoctorModel
::
DOCTOR_TYPE_MAP
);
$grid
->
column
(
'type'
,
'医师类型'
)
->
using
(
DoctorModel
::
DOCTOR_TYPE_MAP
);
// 快捷搜索
$grid
->
quickSearch
([
'name'
,
'mobile'
,
'id_card'
])
->
placeholder
(
'请输入[姓名|手机号|身份证号码]'
)
->
width
(
25
);
...
...
@@ -131,7 +131,7 @@ protected function form()
$form
->
display
(
'user_id'
);
$form
->
switch
(
'status'
);
$form
->
switch
(
'is_auto'
);
$form
->
radio
(
'type'
,
'医师类型'
)
->
options
(
DoctorModel
::
DOCTOR_TYPE_MAP
)
->
default
(
DoctorModel
::
DOCTOR_TYPE_WM
)
->
required
();
$form
->
radio
(
'type'
,
'医师类型'
)
->
options
(
DoctorModel
::
DOCTOR_TYPE_MAP
)
->
default
(
DoctorModel
::
DOCTOR_TYPE_WM
)
->
required
();
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
...
...
app/Api/Controllers/DrugController.php
View file @
de95b3c8
...
...
@@ -128,7 +128,7 @@ public function drugLimit(Request $request)
$drugCounts
[
$drugId
]
=
(
$drugCounts
[
$drugId
]
??
0
)
+
$drugInfo
[
'num'
];
}
}
// 查询已经开过方的药方(7天内)
$sevenDayAgo
=
Carbon
::
now
()
->
subDay
(
7
);
$prescriptions_7
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
...
...
@@ -159,9 +159,12 @@ public function drugLimit(Request $request)
if
(
$canBuyMahuangCount
<
0
)
{
$canBuyMahuangCount
=
0
;
}
Log
::
info
(
'all_limit_num=>'
.
$limit_num
.
' drugCounts=>'
.
json_encode
(
$drugCounts
)
.
' drugs=>'
.
json_encode
(
$drugs
)
.
' canBuyMahuangCount=>'
.
$canBuyMahuangCount
);
// 处理麻黄素药品数据
$mahuangsu_buy_num
=
0
;
// 本次购买麻黄素药品数量
$exclusions
=
[];
// 单个药品的排他管理
foreach
(
$drugs
as
&
$drug
)
{
$drugModel
=
DrugModel
::
find
(
$drug
[
'drug_id'
]);
if
(
!
$drugModel
)
{
...
...
@@ -169,6 +172,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
)
{
...
...
@@ -182,7 +187,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
;
...
...
@@ -200,6 +205,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
]);
}
...
...
app/Api/Controllers/PrescriptionController.php
View file @
de95b3c8
...
...
@@ -109,9 +109,9 @@ public function create(Request $request)
$inquirys
=
$request
->
input
(
'inquirys'
);
// [['inquiry_id'=>1, 'answer'=>1]]
$drugs
=
$request
->
input
(
'drugs'
);
// [['pharmacy_drug_id'=>2, 'num'=>1]]
$prescription_type
=
$request
->
input
(
'prescription_type'
,
0
);
#
医师类型
$doctor_type
=
$prescription_type
==
PrescriptionModel
::
PRESCRIPTION_TYPE_WM
?
[
DoctorModel
::
DOCTOR_TYPE_ALL
,
DoctorModel
::
DOCTOR_TYPE_WM
]
:
[
DoctorModel
::
DOCTOR_TYPE_ALL
,
DoctorModel
::
DOCTOR_TYPE_TCM
];
//
医师类型
$doctor_type
=
$prescription_type
==
PrescriptionModel
::
PRESCRIPTION_TYPE_WM
?
[
DoctorModel
::
DOCTOR_TYPE_ALL
,
DoctorModel
::
DOCTOR_TYPE_WM
]
:
[
DoctorModel
::
DOCTOR_TYPE_ALL
,
DoctorModel
::
DOCTOR_TYPE_TCM
];
$pharmacy
=
null
;
$open_source
=
0
;
// 获取当前用户信息,如果是药店则无需传pharmacy_id参数
...
...
app/Models/DoctorModel.php
View file @
de95b3c8
...
...
@@ -55,6 +55,7 @@ class DoctorModel extends Model
self
::
DOCTOR_TYPE_WM
=>
'西药'
,
self
::
DOCTOR_TYPE_TCM
=>
'中药'
,
];
// 医师所属于的用户,一对一
public
function
user
()
{
...
...
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