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
0914b832
authored
Dec 07, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
1b6fa3c7
0e000050
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
app/Api/Controllers/PatientController.php
+11
-2
No files found.
app/Api/Controllers/PatientController.php
View file @
0914b832
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
App\Models\User
;
use
App\Models\User
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Log
;
use
Jxlwqq\IdValidator\IdValidator
;
use
Jxlwqq\IdValidator\IdValidator
;
use
Milon\Barcode\DNS2D
;
use
Milon\Barcode\DNS2D
;
...
@@ -220,8 +221,8 @@ public function duplicate(Request $request)
...
@@ -220,8 +221,8 @@ public function duplicate(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
// 确保传递了 ID 参数
// 确保传递了 ID 参数
if
(
!
isset
(
$data
[
'id'
])
||
empty
(
$data
[
'id'
]))
{
if
(
!
isset
(
$data
[
'id'
])
||
empty
(
$data
[
'id'
])
||
!
is_numeric
(
$data
[
'id'
])
)
{
return
$this
->
failed
(
'
ID 参数缺失
'
);
return
$this
->
failed
(
'
无效二维码
'
);
}
}
// 根据传递的 ID 查找对应患者数据
// 根据传递的 ID 查找对应患者数据
...
@@ -238,6 +239,14 @@ public function duplicate(Request $request)
...
@@ -238,6 +239,14 @@ public function duplicate(Request $request)
$newPatient
->
user_id
=
$authInfo
->
id
;
$newPatient
->
user_id
=
$authInfo
->
id
;
}
elseif
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
// 药店
}
elseif
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
// 药店
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
// 校验该药店是否已经存在手机号+用户名
$patientInfo
=
PatientModel
::
where
(
'mobile'
,
$existingPatient
->
mobile
)
->
where
(
'name'
,
$existingPatient
->
name
)
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
first
();
// Log::info('patient=>'. json_encode($patientInfo).'=='.json_encode($existingPatient).'=='. $pharmacy->id);
if
(
$patientInfo
)
{
// return $this->failed('该问诊人信息已存在');
// return $this->failed('该问诊人信息已存在', ['data' => false], 200);
return
$this
->
success
(
$patientInfo
);
}
if
(
$pharmacy
)
{
if
(
$pharmacy
)
{
$newPatient
->
pharmacy_id
=
$pharmacy
->
id
;
$newPatient
->
pharmacy_id
=
$pharmacy
->
id
;
}
else
{
}
else
{
...
...
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