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
49ae6fc4
authored
Nov 18, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增开店闭店、营业时间接口
parent
17cb9774
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
1 deletions
+80
-1
app/Api/Controllers/DoctorController.php
+17
-0
app/Api/Controllers/PharmacyController.php
+55
-1
routes/api.php
+8
-0
No files found.
app/Api/Controllers/DoctorController.php
View file @
49ae6fc4
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
use
App\Models\DoctorCorrectionModel
;
use
App\Models\DoctorCorrectionModel
;
use
App\Models\DoctorModel
;
use
App\Models\DoctorModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\User
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Storage
;
...
@@ -119,4 +120,20 @@ public function correction(Request $request)
...
@@ -119,4 +120,20 @@ public function correction(Request $request)
return
$this
->
failed
(
'纠错失败'
);
return
$this
->
failed
(
'纠错失败'
);
}
}
// 医师退出
public
function
logout
()
{
$authInfo
=
auth
(
'api'
)
->
user
();
$user
=
User
::
where
(
'id'
,
$authInfo
->
id
)
->
where
(
'last_login_type'
,
User
::
LOGIN_TYPE_DOCTOR
)
->
first
();
if
(
!
$user
)
{
return
$this
->
failed
(
'用户不存在'
);
}
$user
->
last_login_type
=
User
::
LOGIN_TYPE_USER
;
if
(
$user
->
save
())
{
return
$this
->
success
(
'退出成功!'
);
}
return
$this
->
failed
(
'退出失败!'
);
}
}
}
app/Api/Controllers/PharmacyController.php
View file @
49ae6fc4
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
App\Models\PrescriptionLogModel
;
use
App\Models\PrescriptionLogModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\User
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -95,7 +96,6 @@ public function prescription(Request $request)
...
@@ -95,7 +96,6 @@ public function prescription(Request $request)
}
}
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
;
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
;
if
(
$prescription
->
save
())
{
if
(
$prescription
->
save
())
{
$patient_id
=
$prescription
->
patient_id
;
$patient_id
=
$prescription
->
patient_id
;
$patient
=
PatientModel
::
where
(
'id'
,
$patient_id
)
->
first
();
$patient
=
PatientModel
::
where
(
'id'
,
$patient_id
)
->
first
();
// 增加审方日志
// 增加审方日志
...
@@ -111,4 +111,58 @@ public function prescription(Request $request)
...
@@ -111,4 +111,58 @@ public function prescription(Request $request)
return
$this
->
failed
(
'审方失败'
);
return
$this
->
failed
(
'审方失败'
);
}
}
}
}
// 设置店铺营业时间
public
function
setBusinessTime
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$request
->
validate
([
'business_start'
=>
'required|date_format:H:i:s'
,
// 验证格式为 HH:mm
'business_end'
=>
'required|date_format:H:i:s'
,
// 验证格式为 HH:mm
]);
// 将时间格式化为 H:i:s 格式
$pharmacy
->
business_start
=
Carbon
::
createFromFormat
(
'H:i:s'
,
$request
->
input
(
'business_start'
))
->
format
(
'H:i:s'
);
$pharmacy
->
business_end
=
Carbon
::
createFromFormat
(
'H:i:s'
,
$request
->
input
(
'business_end'
))
->
format
(
'H:i:s'
);
if
(
$pharmacy
->
save
())
{
return
$this
->
success
(
'设置成功!'
);
}
else
{
return
$this
->
failed
(
'设置失败'
);
}
}
// 开店或闭店
public
function
open
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'药店信息不存在'
);
}
$is_open
=
$request
->
input
(
'is_open'
);
$pharmacy
->
is_open
=
$is_open
;
if
(
$pharmacy
->
save
())
{
return
$this
->
success
(
'操作成功!'
);
}
else
{
return
$this
->
failed
(
'操作失败'
);
}
}
// 药店退出登录
public
function
logout
()
{
$authInfo
=
auth
(
'api'
)
->
user
();
$user
=
User
::
where
(
'id'
,
$authInfo
->
id
)
->
where
(
'last_login_type'
,
User
::
LOGIN_TYPE_PHARMACY
)
->
first
();
if
(
!
$user
)
{
return
$this
->
failed
(
'用户不存在'
);
}
$user
->
last_login_type
=
User
::
LOGIN_TYPE_USER
;
if
(
$user
->
save
())
{
return
$this
->
success
(
'退出成功!'
);
}
return
$this
->
failed
(
'退出失败!'
);
}
}
}
routes/api.php
View file @
49ae6fc4
...
@@ -45,6 +45,12 @@
...
@@ -45,6 +45,12 @@
Route
::
post
(
'/pharmacy-correction'
,
'App\Api\Controllers\PharmacyController@correction'
);
Route
::
post
(
'/pharmacy-correction'
,
'App\Api\Controllers\PharmacyController@correction'
);
# 药店审方
# 药店审方
Route
::
post
(
'/pharmacy-prescription'
,
'App\Api\Controllers\PharmacyController@prescription'
);
Route
::
post
(
'/pharmacy-prescription'
,
'App\Api\Controllers\PharmacyController@prescription'
);
# 药店营业时间
Route
::
post
(
'/pharmacy-time'
,
'App\Api\Controllers\PharmacyController@setBusinessTime'
);
# 开店或闭店
Route
::
post
(
'/pharmacy-open'
,
'App\Api\Controllers\PharmacyController@open'
);
# 药店退出
Route
::
post
(
'/pharmacy-logout'
,
'App\Api\Controllers\PharmacyController@logout'
);
# 获取诊断列表
# 获取诊断列表
Route
::
get
(
'/diagnosis'
,
'App\Api\Controllers\DiagnosisController@diagnosisList'
);
Route
::
get
(
'/diagnosis'
,
'App\Api\Controllers\DiagnosisController@diagnosisList'
);
# 获取问诊人列表
# 获取问诊人列表
...
@@ -73,6 +79,8 @@
...
@@ -73,6 +79,8 @@
Route
::
post
(
'/dcotor-upload'
,
'App\Api\Controllers\PrescriptionController@upload'
);
Route
::
post
(
'/dcotor-upload'
,
'App\Api\Controllers\PrescriptionController@upload'
);
# 医师纠错
# 医师纠错
Route
::
post
(
'/dcotor-correction'
,
'App\Api\Controllers\PrescriptionController@correction'
);
Route
::
post
(
'/dcotor-correction'
,
'App\Api\Controllers\PrescriptionController@correction'
);
# 医师退出
Route
::
post
(
'/dcotor-logout'
,
'App\Api\Controllers\PrescriptionController@logout'
);
# 药师列表
# 药师列表
Route
::
get
(
'/pharmacists'
,
'App\Api\Controllers\PharmacistController@pharmacistList'
);
Route
::
get
(
'/pharmacists'
,
'App\Api\Controllers\PharmacistController@pharmacistList'
);
# 药师详情
# 药师详情
...
...
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