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
849bf977
authored
Nov 19, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增医师自动开方接口,药师删除接口
parent
493ca4cd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
8 deletions
+44
-8
app/Api/Controllers/DoctorController.php
+16
-0
app/Api/Controllers/PharmacistController.php
+21
-0
app/Api/Controllers/PrescriptionController.php
+0
-8
app/Api/Controllers/UserController.php
+2
-0
routes/api.php
+5
-0
No files found.
app/Api/Controllers/DoctorController.php
View file @
849bf977
...
...
@@ -97,6 +97,22 @@ public function prescription(Request $request)
}
}
// 医师自动开方
public
function
isAuto
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
$doctor
=
DoctorModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$doctor
)
{
return
$this
->
failed
(
'医师信息不存在'
);
}
$doctor
->
is_auto
=
$request
->
input
(
'is_auto'
);
if
(
$doctor
->
save
())
{
return
$this
->
success
(
'设置成功'
);
}
return
$this
->
failed
(
'设置失败'
);
}
// 医师纠错
public
function
correction
(
Request
$request
)
{
...
...
app/Api/Controllers/PharmacistController.php
View file @
849bf977
...
...
@@ -230,4 +230,25 @@ public function upload(Request $request)
return
$this
->
failed
(
'签名图片上传失败'
);
}
}
// 药师删除
public
function
delete
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'该药店不存在'
);
}
$id
=
$request
->
input
(
'id'
);
$data
=
PharmacistModel
::
where
(
'id'
,
$id
)
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
first
();
if
(
!
$data
)
{
return
$this
->
failed
(
'该药师不存在'
);
}
if
(
$data
->
delete
())
{
return
$this
->
success
(
$data
);
}
return
$this
->
failed
(
'删除失败'
);
}
}
app/Api/Controllers/PrescriptionController.php
View file @
849bf977
...
...
@@ -13,7 +13,6 @@
use
App\Models\PrescriptionLogModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\User
;
use
App\Services\SmsService
;
use
Carbon\Carbon
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -212,13 +211,6 @@ public function create(Request $request)
$currentTime
=
Carbon
::
now
()
->
toDateTimeString
();
$pharmacistLog
->
log_info
=
$pharmacist
->
name
.
'在'
.
$currentTime
.
'为'
.
$patient
->
name
.
'('
.
$patient
->
mobile
.
')审方(处方单编号:'
.
$prescription_number
.
')'
;
$pharmacistLog
->
save
();
// TODO 给医师发送短信
$mobile
=
'18321861540'
;
$templateName
=
'verification_code'
;
$templateData
=
[
'code'
=>
'1234'
];
$smsService
=
new
SmsService
();
$response
=
$smsService
->
sendSms
(
$mobile
,
$templateName
,
$templateData
);
// TODO 给药师发送短信
return
$this
->
success
(
'ok'
);
...
...
app/Api/Controllers/UserController.php
View file @
849bf977
...
...
@@ -72,6 +72,8 @@ public function smsCode(Request $request)
return
response
()
->
json
([
'error'
=>
'手机号格式不正确'
]);
}
// TODO 增加手机验证码发送频率限制
// 检查手机号在医师或者药店表中是否存在
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
...
...
routes/api.php
View file @
849bf977
...
...
@@ -86,6 +86,8 @@
Route
::
post
(
'/dcotor-correction'
,
'App\Api\Controllers\PrescriptionController@correction'
);
# 医师退出
Route
::
post
(
'/dcotor-logout'
,
'App\Api\Controllers\PrescriptionController@logout'
);
# 医师自动开方
Route
::
post
(
'/dcotor-auto'
,
'App\Api\Controllers\PrescriptionController@isAuto'
);
# 药师列表
Route
::
get
(
'/pharmacists'
,
'App\Api\Controllers\PharmacistController@pharmacistList'
);
# 药师详情
...
...
@@ -100,4 +102,6 @@
Route
::
post
(
'/pharmacist-setDefault'
,
'App\Api\Controllers\PharmacistController@setDefault'
);
# 药师签名上传
Route
::
post
(
'/pharmacist-upload'
,
'App\Api\Controllers\PharmacistController@upload'
);
# 药师删除
Route
::
post
(
'/pharmacist-delete'
,
'App\Api\Controllers\PharmacistController@delete'
);
});
\ No newline at end of file
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