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
e0d006b4
authored
Dec 04, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://git.imohe.com/zhaozengyu/tzt-admin
into develop
parents
51b4c420
ba70faaf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
7 deletions
+98
-7
app/Api/Controllers/PatientController.php
+2
-0
app/Api/Controllers/PharmacistController.php
+38
-2
app/Api/Controllers/PharmacyController.php
+4
-4
app/Api/Controllers/PrescriptionController.php
+1
-1
app/Console/Commands/InitPharmacyDrugTcm.php
+50
-0
routes/api.php
+3
-0
No files found.
app/Api/Controllers/PatientController.php
View file @
e0d006b4
...
...
@@ -86,8 +86,10 @@ public function add(Request $request)
// if ($verificationCode != $code) {
// return $this->failed('验证码错误');
// }
// $idCardInfo = Util::getIdCardInfo($data['id_card']);
$patient
->
name
=
$data
[
'name'
];
$patient
->
id_card
=
$data
[
'id_card'
];
$patient
->
mobile
=
$mobile
;
...
...
app/Api/Controllers/PharmacistController.php
View file @
e0d006b4
...
...
@@ -17,7 +17,7 @@ public function pharmacistList()
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$pharmacist
=
PharmacistModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
get
();
...
...
@@ -35,7 +35,7 @@ public function detail(Request $request)
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$pharmacist
=
PharmacistModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
where
(
'id'
,
$pharmacist_id
)
->
first
();
if
(
!
$pharmacist
)
{
...
...
@@ -100,6 +100,42 @@ public function add(Request $request)
return
$this
->
failed
(
'药师新增失败!'
);
}
public
function
scanAdd
(
Request
$request
)
{
$authInfo
=
auth
(
'api'
)
->
user
();
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'未找到药店信息!'
);
}
// 检查是否传递了药师的id
$pharmacistId
=
$request
->
input
(
'id'
);
if
(
$pharmacistId
)
{
// 查询并复制已有药师数据
$existingPharmacist
=
PharmacistModel
::
where
(
'id'
,
$pharmacistId
)
->
first
();
if
(
!
$existingPharmacist
)
{
return
$this
->
failed
(
'未找到对应药师信息!'
);
}
$pharmacist
=
$existingPharmacist
->
replicate
();
// 设置药师属性
$pharmacist
->
pharmacy_id
=
$pharmacy
->
id
;
$pharmacist
->
name
=
$pharmacist
->
name
??
''
;
$pharmacist
->
id_card
=
$pharmacist
->
id_card
??
''
;
$pharmacist
->
mobile
=
$pharmacist
->
mobile
??
''
;
$pharmacist
->
license_number
=
$pharmacist
->
license_number
??
''
;
$pharmacist
->
practicing_license
=
$pharmacist
->
practicing_license
??
''
;
$pharmacist
->
practicing_license_expired_time
=
$pharmacist
->
practicing_license_expired_time
??
null
;
$pharmacist
->
physician_license
=
$pharmacist
->
physician_license
??
''
;
$pharmacist
->
status
=
0
;
// 保存药师数据
if
(
$pharmacist
->
save
())
{
return
$this
->
success
(
$pharmacist
);
}
}
return
$this
->
failed
(
'药师新增失败!'
);
}
// 药师编辑
public
function
update
(
Request
$request
)
{
...
...
app/Api/Controllers/PharmacyController.php
View file @
e0d006b4
...
...
@@ -58,7 +58,7 @@ public function detail(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
return
$this
->
success
(
$pharmacy
);
...
...
@@ -70,7 +70,7 @@ public function correction(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$content
=
$request
->
input
(
'content'
);
if
(
empty
(
$content
))
{
...
...
@@ -98,7 +98,7 @@ public function prescription(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$Pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$Pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$id
)
->
where
(
'pharmacy_id'
,
$Pharmacy
->
id
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
)
->
first
();
if
(
!
$prescription
)
{
...
...
@@ -150,7 +150,7 @@ public function open(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
$is_open
=
$request
->
input
(
'is_open'
);
...
...
app/Api/Controllers/PrescriptionController.php
View file @
e0d006b4
...
...
@@ -120,7 +120,7 @@ public function create(Request $request)
return
$this
->
failed
(
'用户端暂时无法开处方'
);
$pharmacy
=
PharmacyModel
::
find
(
$pharmacy_id
);
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'
药店信息不存在
'
);
return
$this
->
failed
(
'
请退出后重新登录!
'
);
}
}
else
{
return
$this
->
failed
(
'pharmacy_id不能为空'
);
...
...
app/Console/Commands/InitPharmacyDrugTcm.php
0 → 100644
View file @
e0d006b4
<?php
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
use
App\Models\DrugModel
;
use
App\Models\PharmacyDrugModel
;
class
InitPharmacyDrugTcm
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'mohe:init-pharmacy-drug-tcm {pharmacy_id}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'同步中药到指定药店'
;
/**
* Execute the console command.
*/
public
function
handle
()
{
//
$pharmacy_id
=
$this
->
argument
(
'pharmacy_id'
)
??
0
;
if
(
intval
(
$pharmacy_id
)
<
1
)
{
$this
->
info
(
'请输入正确的药店id'
);
return
;
}
$this
->
info
(
'开始同步药库中药到指定药店...'
);
$drugs
=
DrugModel
::
query
()
->
where
(
'drug_type'
,
DrugModel
::
DRUG_TYPE_TCM
)
->
get
();
if
(
$drugs
->
count
()
>
0
){
foreach
(
$drugs
as
$drug
)
{
$pharmacyDrug
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'drug_id'
,
$drug
->
id
)
->
first
();
if
(
empty
(
$pharmacyDrug
)
){
$pharmacyDrug
=
new
PharmacyDrugModel
();
$pharmacyDrug
->
drug_id
=
$drug
->
id
;
$pharmacyDrug
->
pharmacy_id
=
$pharmacy_id
;
$pharmacyDrug
->
unit
=
$drug
->
unit
;
$pharmacyDrug
->
save
();
}
}
}
}
}
routes/api.php
View file @
e0d006b4
...
...
@@ -24,6 +24,7 @@
Route
::
get
(
'test'
,
'App\Api\Controllers\SiteConfigController@test'
);
Route
::
get
(
'qrcode'
,
'App\Api\Controllers\PatientController@getQrCode'
);
// 需要验证是否登录的路由组
Route
::
middleware
([
'jwt.auth'
,
'checkrole'
])
->
group
(
function
()
{
// 获取用户信息
...
...
@@ -68,6 +69,8 @@
Route
::
get
(
'/patients'
,
'App\Api\Controllers\PatientController@patientList'
);
# 问诊人新增
Route
::
post
(
'/patients-add'
,
'App\Api\Controllers\PatientController@add'
);
# 问诊人扫码新增
Route
::
post
(
'/patients-scan-add'
,
'App\Api\Controllers\PatientController@scanAdd'
);
# 问诊人编辑
Route
::
post
(
'/patients-update'
,
'App\Api\Controllers\PatientController@update'
);
# 问诊人删除
...
...
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