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
7aa53d26
authored
Dec 04, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
限购修改
parent
e0d006b4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
app/Api/Controllers/PatientController.php
+0
-1
app/Api/Controllers/PharmacistController.php
+4
-3
app/Console/Commands/InitPharmacyDrugTcm.php
+7
-5
No files found.
app/Api/Controllers/PatientController.php
View file @
7aa53d26
...
@@ -89,7 +89,6 @@ public function add(Request $request)
...
@@ -89,7 +89,6 @@ public function add(Request $request)
// $idCardInfo = Util::getIdCardInfo($data['id_card']);
// $idCardInfo = Util::getIdCardInfo($data['id_card']);
$patient
->
name
=
$data
[
'name'
];
$patient
->
name
=
$data
[
'name'
];
$patient
->
id_card
=
$data
[
'id_card'
];
$patient
->
id_card
=
$data
[
'id_card'
];
$patient
->
mobile
=
$mobile
;
$patient
->
mobile
=
$mobile
;
...
...
app/Api/Controllers/PharmacistController.php
View file @
7aa53d26
...
@@ -106,7 +106,7 @@ public function scanAdd(Request $request)
...
@@ -106,7 +106,7 @@ public function scanAdd(Request $request)
// 获取药店信息
// 获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'未找到药店信息!'
);
return
$this
->
failed
(
'未找到药店信息!'
);
}
}
// 检查是否传递了药师的id
// 检查是否传递了药师的id
...
@@ -114,14 +114,14 @@ public function scanAdd(Request $request)
...
@@ -114,14 +114,14 @@ public function scanAdd(Request $request)
if
(
$pharmacistId
)
{
if
(
$pharmacistId
)
{
// 查询并复制已有药师数据
// 查询并复制已有药师数据
$existingPharmacist
=
PharmacistModel
::
where
(
'id'
,
$pharmacistId
)
->
first
();
$existingPharmacist
=
PharmacistModel
::
where
(
'id'
,
$pharmacistId
)
->
first
();
if
(
!
$existingPharmacist
)
{
if
(
!
$existingPharmacist
)
{
return
$this
->
failed
(
'未找到对应药师信息!'
);
return
$this
->
failed
(
'未找到对应药师信息!'
);
}
}
$pharmacist
=
$existingPharmacist
->
replicate
();
$pharmacist
=
$existingPharmacist
->
replicate
();
// 设置药师属性
// 设置药师属性
$pharmacist
->
pharmacy_id
=
$pharmacy
->
id
;
$pharmacist
->
pharmacy_id
=
$pharmacy
->
id
;
$pharmacist
->
name
=
$pharmacist
->
name
??
''
;
$pharmacist
->
name
=
$pharmacist
->
name
??
''
;
$pharmacist
->
id_card
=
$pharmacist
->
id_card
??
''
;
$pharmacist
->
id_card
=
$pharmacist
->
id_card
??
''
;
$pharmacist
->
mobile
=
$pharmacist
->
mobile
??
''
;
$pharmacist
->
mobile
=
$pharmacist
->
mobile
??
''
;
$pharmacist
->
license_number
=
$pharmacist
->
license_number
??
''
;
$pharmacist
->
license_number
=
$pharmacist
->
license_number
??
''
;
$pharmacist
->
practicing_license
=
$pharmacist
->
practicing_license
??
''
;
$pharmacist
->
practicing_license
=
$pharmacist
->
practicing_license
??
''
;
...
@@ -133,6 +133,7 @@ public function scanAdd(Request $request)
...
@@ -133,6 +133,7 @@ public function scanAdd(Request $request)
return
$this
->
success
(
$pharmacist
);
return
$this
->
success
(
$pharmacist
);
}
}
}
}
return
$this
->
failed
(
'药师新增失败!'
);
return
$this
->
failed
(
'药师新增失败!'
);
}
}
...
...
app/Console/Commands/InitPharmacyDrugTcm.php
View file @
7aa53d26
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
namespace
App\Console\Commands
;
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
use
App\Models\DrugModel
;
use
App\Models\DrugModel
;
use
App\Models\PharmacyDrugModel
;
use
App\Models\PharmacyDrugModel
;
use
Illuminate\Console\Command
;
class
InitPharmacyDrugTcm
extends
Command
class
InitPharmacyDrugTcm
extends
Command
{
{
/**
/**
...
@@ -30,14 +31,15 @@ public function handle()
...
@@ -30,14 +31,15 @@ public function handle()
$pharmacy_id
=
$this
->
argument
(
'pharmacy_id'
)
??
0
;
$pharmacy_id
=
$this
->
argument
(
'pharmacy_id'
)
??
0
;
if
(
intval
(
$pharmacy_id
)
<
1
)
{
if
(
intval
(
$pharmacy_id
)
<
1
)
{
$this
->
info
(
'请输入正确的药店id'
);
$this
->
info
(
'请输入正确的药店id'
);
return
;
return
;
}
}
$this
->
info
(
'开始同步药库中药到指定药店...'
);
$this
->
info
(
'开始同步药库中药到指定药店...'
);
$drugs
=
DrugModel
::
query
()
->
where
(
'drug_type'
,
DrugModel
::
DRUG_TYPE_TCM
)
->
get
();
$drugs
=
DrugModel
::
query
()
->
where
(
'drug_type'
,
DrugModel
::
DRUG_TYPE_TCM
)
->
get
();
if
(
$drugs
->
count
()
>
0
)
{
if
(
$drugs
->
count
()
>
0
)
{
foreach
(
$drugs
as
$drug
)
{
foreach
(
$drugs
as
$drug
)
{
$pharmacyDrug
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'drug_id'
,
$drug
->
id
)
->
first
();
$pharmacyDrug
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'drug_id'
,
$drug
->
id
)
->
first
();
if
(
empty
(
$pharmacyDrug
)
)
{
if
(
empty
(
$pharmacyDrug
))
{
$pharmacyDrug
=
new
PharmacyDrugModel
();
$pharmacyDrug
=
new
PharmacyDrugModel
();
$pharmacyDrug
->
drug_id
=
$drug
->
id
;
$pharmacyDrug
->
drug_id
=
$drug
->
id
;
$pharmacyDrug
->
pharmacy_id
=
$pharmacy_id
;
$pharmacyDrug
->
pharmacy_id
=
$pharmacy_id
;
...
...
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