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
889240a2
authored
Nov 30, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into hotfix
parents
e12dee54
e0705467
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
9 deletions
+87
-9
app/Admin/Controllers/PharmacyDrugController.php
+1
-1
app/Admin/Controllers/PrescriptionLogController.php
+1
-0
app/Admin/Controllers/PrescriptionPrintController.php
+2
-1
app/Api/Controllers/DrugController.php
+1
-0
app/Api/Controllers/PatientController.php
+8
-4
app/Api/Controllers/UserController.php
+8
-3
app/Console/Commands/InitPharmacyDrugCommand.php
+66
-0
No files found.
app/Admin/Controllers/PharmacyDrugController.php
View file @
889240a2
...
@@ -66,7 +66,7 @@ protected function grid()
...
@@ -66,7 +66,7 @@ protected function grid()
// 行按钮控制
// 行按钮控制
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableDeleteButton
();
// 禁用删除按钮
//
$grid->disableDeleteButton(); // 禁用删除按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
// 工具栏按钮控制
// 工具栏按钮控制
...
...
app/Admin/Controllers/PrescriptionLogController.php
View file @
889240a2
...
@@ -33,6 +33,7 @@ protected function grid()
...
@@ -33,6 +33,7 @@ protected function grid()
$filter
->
expand
();
// 默认展开搜索框
$filter
->
expand
();
// 默认展开搜索框
$filter
->
like
(
'pharmacy_name'
)
->
width
(
3
);
$filter
->
like
(
'pharmacy_name'
)
->
width
(
3
);
$filter
->
between
(
'created_at'
,
'创建时间'
)
->
date
()
->
width
(
3
);
});
});
// 行按钮控制
// 行按钮控制
...
...
app/Admin/Controllers/PrescriptionPrintController.php
View file @
889240a2
...
@@ -52,8 +52,9 @@ public function search()
...
@@ -52,8 +52,9 @@ public function search()
}
}
try
{
try
{
$pharmacy_id
=
Admin
::
user
()
->
pharmacy_id
;
// 获取处方信息
// 获取处方信息
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$prescriptionNo
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
first
();
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$prescriptionNo
)
->
where
(
'
pharmacy_id'
,
$pharmacy_id
)
->
where
(
'
status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
first
();
if
(
!
$prescription
)
{
if
(
!
$prescription
)
{
return
response
()
->
json
([
'status'
=>
false
,
'message'
=>
'未找到该处方或还未审方成功~'
]);
return
response
()
->
json
([
'status'
=>
false
,
'message'
=>
'未找到该处方或还未审方成功~'
]);
}
}
...
...
app/Api/Controllers/DrugController.php
View file @
889240a2
...
@@ -117,6 +117,7 @@ public function drugLimit(Request $request)
...
@@ -117,6 +117,7 @@ public function drugLimit(Request $request)
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
->
where
(
'is_voided'
,
PrescriptionModel
::
IS_VOIDED_FALSE
)
// 未作废的处方
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
...
...
app/Api/Controllers/PatientController.php
View file @
889240a2
...
@@ -24,15 +24,19 @@ public function patientList(Request $request)
...
@@ -24,15 +24,19 @@ public function patientList(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
$query
=
PatientModel
::
query
();
$query
=
PatientModel
::
query
();
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_USER
)
{
// 用户
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_USER
)
{
// 用户
$query
=
$query
->
where
(
'user_id'
,
$authInfo
->
id
);
$query
->
where
(
'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
();
$query
=
$query
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
);
$query
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
);
}
}
$search_input
=
$request
->
input
(
'search_input'
);
$search_input
=
$request
->
input
(
'search_input'
);
if
(
$search_input
)
{
if
(
$search_input
)
{
$query
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
$query
->
where
(
function
(
$q
)
use
(
$search_input
)
{
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
$q
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
});
// $query->where('id_card', 'like', "%{$search_input}%");
// $query->orWhere('name', 'like', "%{$search_input}%");
// ->orWhere('mobile', 'like', "%{$search_input}%");
// ->orWhere('mobile', 'like', "%{$search_input}%");
}
}
// 分页
// 分页
...
...
app/Api/Controllers/UserController.php
View file @
889240a2
...
@@ -144,8 +144,11 @@ public function bindRole(Request $request)
...
@@ -144,8 +144,11 @@ public function bindRole(Request $request)
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
if
(
$verificationCode
!=
$code
)
{
if
(
$verificationCode
!=
$code
)
{
return
$this
->
failed
(
'验证码错误'
);
return
$this
->
failed
(
'验证码错误
,请重新发送!
'
);
}
}
// 验证通过清除验证码
cache
()
->
forget
(
"sms_verification_code_
{
$mobile
}
"
);
// 验证手机号是否存在
// 验证手机号是否存在
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
...
@@ -160,8 +163,10 @@ public function bindRole(Request $request)
...
@@ -160,8 +163,10 @@ public function bindRole(Request $request)
}
}
// 把所有user_id:$authInfo->id的置为0
// 把所有user_id:$authInfo->id的置为0
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
update
([
'user_id'
=>
0
]);
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
update
([
'user_id'
=>
0
]);
$pharmacy
->
user_id
=
$authInfo
->
id
;
// 重新绑定
$pharmacy
->
save
();
PharmacyModel
::
where
(
'id'
,
$pharmacy
->
id
)
->
update
([
'user_id'
=>
$authInfo
->
id
]);
// $pharmacy->user_id = $authInfo->id;
// $pharmacy->save();
}
elseif
(
$login_type
==
User
::
LOGIN_TYPE_DOCTOR
)
{
}
elseif
(
$login_type
==
User
::
LOGIN_TYPE_DOCTOR
)
{
$doctor
=
DoctorModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
$doctor
=
DoctorModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
...
...
app/Console/Commands/InitPharmacyDrugCommand.php
0 → 100644
View file @
889240a2
<?php
namespace
App\Console\Commands
;
use
App\Models\PharmacyDrugModel
;
use
App\Models\PharmacyModel
;
use
Illuminate\Console\Command
;
class
InitPharmacyDrugCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'init:pharmacy_drug {pharmacy_id}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'药店药品复制'
;
/**
* Execute the console command.
*/
public
function
handle
()
{
$this
->
info
(
'开始药店药品复制...'
);
// 以药店1的药品为模板复制到其他药店
$pharmacy_id
=
$this
->
argument
(
'pharmacy_id'
)
??
0
;
if
(
intval
(
$pharmacy_id
)
<=
1
)
{
$this
->
info
(
'请输入正确的药店id'
);
return
;
}
// 查找一下传入的药店id是否存在
$pharmacy
=
PharmacyModel
::
where
(
'id'
,
$pharmacy_id
)
->
first
();
if
(
empty
(
$pharmacy
))
{
$this
->
info
(
'药店不存在,请重新输入'
);
return
;
}
$pharmacyDrugList
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
1
)
->
get
();
if
(
$pharmacyDrugList
->
count
()
<=
0
)
{
$this
->
info
(
'模板药店药品为空'
);
return
;
}
foreach
(
$pharmacyDrugList
as
$pharmacyDrug
)
{
// 查找该药品在该药店是否存在,如果存在则跳过,如果不存在则复制
$is_exists
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'drug_id'
,
$pharmacyDrug
->
drug_id
)
->
first
();
if
(
!
empty
(
$is_exists
))
{
continue
;
}
$newPharmacyDrug
=
new
PharmacyDrugModel
();
$newPharmacyDrug
->
pharmacy_id
=
$pharmacy_id
;
$newPharmacyDrug
->
drug_id
=
$pharmacyDrug
->
drug_id
;
$newPharmacyDrug
->
unit
=
$pharmacyDrug
->
unit
;
$newPharmacyDrug
->
save
();
}
}
}
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