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
fa09b3f7
authored
Nov 12, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
本地
parent
7c00f2ef
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
16 deletions
+136
-16
app/Api/Controllers/DrugController.php
+2
-0
app/Api/Controllers/InquiryController.php
+39
-0
app/Api/Controllers/PatientController.php
+30
-13
app/Api/Controllers/PrescriptionController.php
+54
-0
database/migrations/2024_11_04_220223_create_doctor_table.php
+2
-1
database/migrations/2024_11_04_224709_create_pharmacist_table.php
+1
-0
routes/api.php
+8
-2
No files found.
app/Api/Controllers/DrugController.php
View file @
fa09b3f7
...
@@ -18,6 +18,8 @@ public function test()
...
@@ -18,6 +18,8 @@ public function test()
public
function
drugList
(
Request
$request
)
public
function
drugList
(
Request
$request
)
{
{
// $code = $request->input('code');
// $code = $request->input('code');
# TODO 通过药店编号筛选药品列表
# pharmacy_id = $request->input('code');
$data
=
DrugModel
::
query
()
->
paginate
(
10
);
$data
=
DrugModel
::
query
()
->
paginate
(
10
);
// $total = DrugModel::query()->count();
// $total = DrugModel::query()->count();
...
...
app/Api/Controllers/InquiryController.php
0 → 100644
View file @
fa09b3f7
<?php
namespace
App\Api\Controllers
;
use
App\Common\Util
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\InquiryModel
;
use
App\Models\DrugRelatedTagModel
;
use
App\Models\DrugTagRelatedInquiryModel
;
use
Illuminate\Http\Request
;
// 问诊问题控制器
class
InquiryController
extends
BaseApiController
{
public
function
InquirytList
(
Request
$request
)
{
$inquiry_list
=
[];
# 获取通用问题
$inquiry_list_1
=
InquiryModel
::
query
()
->
get
()
->
toArray
();
# 通过药品id获取标签
$inquiry_list_2
=
[];
$drug_ids
=
$request
->
input
(
'drug_ids'
);
if
(
$drug_ids
)
{
$tag_ids
=
DrugRelatedTagModel
::
whereIn
(
'drug_id'
,
explode
(
','
,
$drug_ids
))
->
pluck
(
'tag_id'
)
->
toArray
();
# 获取标签关联的问题
if
(
$tag_ids
){
$inquiry_ids
=
DrugTagRelatedInquiryModel
::
whereIn
(
'tag_id'
,
$tag_ids
)
->
pluck
(
'inquiry_id'
)
->
toArray
();
# 获取非通用问题
if
(
$inquiry_ids
){
$inquiry_list_2
=
InquiryModel
::
whereIn
(
'id'
,
array_column
(
$inquiry_ids
,
'inquiry_id'
))
->
get
()
->
toArray
();
}
}
}
# 合并问题列表
$inquiry_list
=
array_merge
(
$inquiry_list_1
,
$inquiry_list_2
);
return
$this
->
success
(
$inquiry_list
);
}
}
\ No newline at end of file
app/Api/Controllers/PatientController.php
View file @
fa09b3f7
...
@@ -18,9 +18,15 @@ public function test()
...
@@ -18,9 +18,15 @@ public function test()
// 获取问诊人列表
// 获取问诊人列表
public
function
patientList
(
Request
$request
)
public
function
patientList
(
Request
$request
)
{
{
$login_type
=
$request
->
input
(
'login_type'
);
$
search_input
=
$request
->
input
(
'search_input
'
);
$
id
=
$request
->
input
(
'id
'
);
$query
=
PatientModel
::
query
();
$query
=
PatientModel
::
query
();
if
(
$login_type
==
0
){
# 用户
$query
=
$query
->
where
(
'user_id'
,
$id
);
}
else
if
(
$login_type
==
2
){
# 药店
$query
=
$query
->
where
(
'pharmacy_id'
,
$id
);
}
$search_input
=
$request
->
input
(
'search_input'
);
if
(
$search_input
)
{
if
(
$search_input
)
{
$query
->
where
(
'mobile'
,
'like'
,
"%
{
$search_input
}
%"
);
$query
->
where
(
'mobile'
,
'like'
,
"%
{
$search_input
}
%"
);
// ->orWhere('mobile', 'like', "%{$search_input}%");
// ->orWhere('mobile', 'like', "%{$search_input}%");
...
@@ -75,7 +81,6 @@ public function delete(Request $request)
...
@@ -75,7 +81,6 @@ public function delete(Request $request)
return
$this
->
error
(
401
,
'该问诊人不存在'
);
return
$this
->
error
(
401
,
'该问诊人不存在'
);
}
}
$data
->
delete
();
$data
->
delete
();
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
}
...
@@ -84,16 +89,21 @@ public function setDefault(Request $request)
...
@@ -84,16 +89,21 @@ public function setDefault(Request $request)
{
{
// 通过id找到是否存在默认问诊人,如果存在比对id是否相同,如果不同则修改默认问诊人状态
// 通过id找到是否存在默认问诊人,如果存在比对id是否相同,如果不同则修改默认问诊人状态
// TODO 验证条件待调整
// TODO 验证条件待调整
$id
=
$request
->
input
(
'id'
);
$login_type
=
$request
->
input
(
'login_type'
);
$data
=
PatientModel
::
where
(
'is_default'
,
1
)
->
where
(
'id'
,
$id
)
->
first
();
$uid
=
$request
->
input
(
'uid'
);
# 把该账号下的默认问诊人状态改为0
$query
=
PatientModel
::
where
(
'id'
,
$uid
)
->
where
(
'is_default'
,
1
);
if
(
$login_type
==
0
){
$query
=
$query
->
where
(
'user_id'
,
$uid
);
}
else
if
(
$login_type
==
2
){
$query
=
$query
->
where
(
'pharmacy_id'
,
$uid
);
}
$data
=
$query
->
first
();
if
(
$data
)
{
if
(
$data
)
{
if
(
$data
[
'id'
]
==
$id
)
{
$data
->
is_default
=
0
;
return
$this
->
success
([
'msg'
=>
'该问诊人已经是默认问诊人'
]);
$data
->
save
();
}
else
{
$data
->
is_default
=
0
;
$data
->
save
();
}
}
}
# 把当前问诊人设为默认
$id
=
$request
->
input
(
'id'
);
$id
=
$request
->
input
(
'id'
);
$data
=
PatientModel
::
find
(
$id
);
$data
=
PatientModel
::
find
(
$id
);
if
(
!
$data
)
{
if
(
!
$data
)
{
...
@@ -101,19 +111,26 @@ public function setDefault(Request $request)
...
@@ -101,19 +111,26 @@ public function setDefault(Request $request)
}
}
$data
->
is_default
=
1
;
$data
->
is_default
=
1
;
$data
->
save
();
$data
->
save
();
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
}
// 获取默认问诊人
// 获取默认问诊人
public
function
getDefault
(
Request
$request
)
public
function
getDefault
(
Request
$request
)
{
{
$login_type
=
$request
->
input
(
'login_type'
);
$id
=
$request
->
input
(
'id'
);
$id
=
$request
->
input
(
'id'
);
$data
=
PatientModel
::
where
(
'id'
,
$id
)
->
where
(
'is_default'
,
1
)
->
first
();
$query
=
PatientModel
::
where
(
'is_default'
,
1
);
if
(
$login_type
==
0
){
$query
=
$query
->
where
(
'user_id'
,
$id
);
}
else
if
(
$login_type
==
2
){
$query
=
$query
->
where
(
'pharmacy_id'
,
$id
);
}
$data
=
$query
->
first
();
if
(
$data
)
{
if
(
$data
)
{
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
else
{
}
else
{
return
$this
->
error
(
401
,
'暂无默认问诊人'
);
return
$this
->
error
(
401
,
'暂无默认问诊人'
);
}
}
}
}
}
}
app/Api/Controllers/PrescriptionController.php
0 → 100644
View file @
fa09b3f7
<?php
namespace
App\Api\Controllers
;
use
App\Common\Util
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\PrescriptionModel
;
use
App\Models\PatientModel
;
use
Illuminate\Http\Request
;
// 问诊人控制器
class
PrescriptionController
extends
BaseApiController
{
# 开方
public
function
create
(
Request
$request
)
{
# $userId = auth('api')->user()->id;
# 生成处方单号
$patient_id
=
$request
->
input
(
'patient_id'
);
# 获取问诊人信息
$patient
=
PatientModel
::
query
()
->
where
(
'id'
,
$patient_id
)
->
first
();
$data
=
[];
$data
[
'prescription_umber'
]
=
""
;
# TODO 处方单编号生成逻辑待定
$data
[
'status'
]
=
0
;
# TODO Model中增加枚举
$data
[
'user_id'
]
=
""
;
# TODO 获取当前用户ID
$data
[
'patient_id'
]
=
$patient_id
;
# 问诊人编号
$data
[
'patient_name'
]
=
$patient
->
name
;
# 问诊人姓名
$data
[
'patient_age'
]
=
$patient
->
age
;
# 问诊人年龄
$data
[
'patient_gender'
]
=
$patient
->
gender
;
# 问诊人性别
# 分派医师 医师当日开方未达到上限以及是否在时间段的搜索出来
# 给医师发送短信
# 判断是否为医师自动开方
# 生成医师开方日志
# 分派药师
# 判断是否药师自动审方
# 生成药师审方日志
# 给药师发送短信
# 生成处方单信息
}
}
\ No newline at end of file
database/migrations/2024_11_04_220223_create_doctor_table.php
View file @
fa09b3f7
...
@@ -22,7 +22,7 @@ public function up()
...
@@ -22,7 +22,7 @@ public function up()
$table
->
string
(
'license_no'
,
30
)
->
comment
(
'执照编号'
);
$table
->
string
(
'license_no'
,
30
)
->
comment
(
'执照编号'
);
$table
->
string
(
'license_no_pic'
)
->
comment
(
'执行证书'
);
$table
->
string
(
'license_no_pic'
)
->
comment
(
'执行证书'
);
$table
->
string
(
'license_no_period'
)
->
comment
(
'执行证书有效期'
);
$table
->
string
(
'license_no_period'
)
->
comment
(
'执行证书有效期'
);
$table
->
string
(
'physician_license'
,
30
)
->
comment
(
'执业资格证书'
);
$table
->
string
(
'physician_license'
)
->
comment
(
'执业资格证书'
);
$table
->
string
(
'id_card_front_pic'
)
->
comment
(
'身份证正面照'
);
$table
->
string
(
'id_card_front_pic'
)
->
comment
(
'身份证正面照'
);
$table
->
string
(
'id_card_back_pic'
)
->
comment
(
'身份证反面照'
);
$table
->
string
(
'id_card_back_pic'
)
->
comment
(
'身份证反面照'
);
$table
->
string
(
'online_hospital_name'
,
128
)
->
comment
(
'互联网医院名称'
);
$table
->
string
(
'online_hospital_name'
,
128
)
->
comment
(
'互联网医院名称'
);
...
@@ -32,6 +32,7 @@ public function up()
...
@@ -32,6 +32,7 @@ public function up()
$table
->
text
(
'introduction'
)
->
nullable
()
->
comment
(
'简介'
);
$table
->
text
(
'introduction'
)
->
nullable
()
->
comment
(
'简介'
);
$table
->
boolean
(
'status'
)
->
default
(
0
)
->
comment
(
'是否启用[0=未启用,1=启用]'
);
$table
->
boolean
(
'status'
)
->
default
(
0
)
->
comment
(
'是否启用[0=未启用,1=启用]'
);
$table
->
text
(
'signed_pic'
)
->
nullable
()
->
comment
(
'签名照'
);
$table
->
text
(
'signed_pic'
)
->
nullable
()
->
comment
(
'签名照'
);
$table
->
bigInteger
(
'user_id'
)
->
nullable
()
->
unique
(
'uk_userid'
)
->
comment
(
'用户表ID'
);
$table
->
timestamps
();
$table
->
timestamps
();
$table
->
softDeletes
();
$table
->
softDeletes
();
});
});
...
...
database/migrations/2024_11_04_224709_create_pharmacist_table.php
View file @
fa09b3f7
...
@@ -25,6 +25,7 @@ public function up()
...
@@ -25,6 +25,7 @@ public function up()
$table
->
string
(
'physician_license'
)
->
comment
(
'执业资格证书'
);
$table
->
string
(
'physician_license'
)
->
comment
(
'执业资格证书'
);
$table
->
string
(
'signed_pic'
)
->
comment
(
'签名照'
);
$table
->
string
(
'signed_pic'
)
->
comment
(
'签名照'
);
$table
->
boolean
(
'status'
)
->
default
(
0
)
->
comment
(
'启用[0=未启用,1=启用]'
);
$table
->
boolean
(
'status'
)
->
default
(
0
)
->
comment
(
'启用[0=未启用,1=启用]'
);
$table
->
bigInteger
(
'user_id'
)
->
nullable
()
->
unique
(
'uk_userid'
)
->
comment
(
'用户表ID'
);
$table
->
timestamps
();
$table
->
timestamps
();
$table
->
softDeletes
();
$table
->
softDeletes
();
});
});
...
...
routes/api.php
View file @
fa09b3f7
...
@@ -41,12 +41,17 @@
...
@@ -41,12 +41,17 @@
Route
::
post
(
'/patients-setDefault'
,
'App\Api\Controllers\PatientController@setDefault'
);
Route
::
post
(
'/patients-setDefault'
,
'App\Api\Controllers\PatientController@setDefault'
);
# 获取默认问诊人
# 获取默认问诊人
Route
::
post
(
'/patients-getDefault'
,
'App\Api\Controllers\PatientController@getDefault'
);
Route
::
post
(
'/patients-getDefault'
,
'App\Api\Controllers\PatientController@getDefault'
);
# 获取问诊问题列表
Route
::
get
(
'/inquirys'
,
'App\Api\Controllers\InquiryController@InquirytList'
);
# 开方
Route
::
post
(
'/prescription-create'
,
'App\Api\Controllers\PrescriptionController@create'
);
// 需要验证是否登录的路由组
// 需要验证是否登录的路由组
Route
::
middleware
([
'jwt.auth'
])
->
group
(
function
()
{
Route
::
middleware
([
'jwt.auth'
])
->
group
(
function
()
{
// 获取用户信息
// 获取用户信息
Route
::
get
(
'/users'
,
'App\Api\Controllers\UserController@userInfo'
);
Route
::
get
(
'/users'
,
'App\Api\Controllers\UserController@userInfo'
);
// 获取药品列表
});
});
\ 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