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
63381db1
authored
Dec 01, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
b004237f
7196e7ea
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
30 deletions
+67
-30
app/Api/Controllers/PharmacistController.php
+5
-2
app/Api/Controllers/PrescriptionController.php
+34
-24
app/Console/Commands/PrescriptionCommand.php
+18
-0
app/Console/Commands/TestCommand.php
+1
-1
app/Console/Kernel.php
+3
-1
app/Models/PharmacistModel.php
+0
-1
docker-compose.yml
+1
-0
resources/views/admin/prescription-print.blade.php
+5
-1
No files found.
app/Api/Controllers/PharmacistController.php
View file @
63381db1
...
...
@@ -205,11 +205,14 @@ public function delete(Request $request)
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'该药店不存在'
);
}
// 判断该药店下是否有几个开启的药师
# 判断该药店下是否有几个开启的药师
$pharmacist
=
PharmacistModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
where
(
'status'
,
1
)
->
count
();
if
(
$pharmacist
<=
1
)
{
if
(
$pharmacist
<=
1
)
{
return
$this
->
failed
(
'无法删除,至少需要一个开启的药师!'
);
}
$id
=
$request
->
input
(
'id'
);
$data
=
PharmacistModel
::
where
(
'id'
,
$id
)
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
first
();
if
(
!
$data
)
{
...
...
app/Api/Controllers/PrescriptionController.php
View file @
63381db1
...
...
@@ -262,14 +262,24 @@ public function create(Request $request)
$prescription
->
pharmacy_id
=
$pharmacy
->
id
;
$prescription
->
pharmacy_name
=
$pharmacy
->
name
;
// 分派药师,先搜索是否存在默认药师,如果不存在则随机抽取一个
$pharmacist
=
PharmacistModel
::
where
(
'status'
,
1
)
$pharmacist
=
PharmacistModel
::
where
(
'status'
,
PharmacistModel
::
IS_STATUS_TRUE
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
function
(
$query
)
{
$query
->
where
(
'is_default'
,
1
)
->
orWhere
(
'is_default'
,
0
);
})
->
inRandomOrder
()
->
where
(
'is_default'
,
PharmacistModel
::
IS_DEFAULT_TRUE
)
->
first
();
if
(
!
$pharmacist
)
{
$pharmacist
=
PharmacistModel
::
where
(
'status'
,
PharmacistModel
::
IS_STATUS_TRUE
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
inRandomOrder
()
->
first
();
}
// $pharmacist = PharmacistModel::where('status', 1)
// ->where('pharmacy_id', $pharmacy_id)
// ->where(function ($query) {
// $query->where('is_default', 1)
// ->orWhere('is_default', 0);
// })
// ->inRandomOrder()
// ->first();
if
(
!
$pharmacist
)
{
return
$this
->
failed
(
'药师信息不存在'
);
...
...
@@ -300,15 +310,15 @@ public function create(Request $request)
// 判断是否为医师自动开方
// $prescription_auto = $site_config['prescription_auto'];
if
(
$randomDoctor
->
is_auto
==
1
)
{
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
;
$prescription
->
save
();
// 生成医师开方日志
$doctorLog
=
new
PrescriptionLogModel
;
$doctorLog
->
pharmacy_id
=
$pharmacy_id
;
$doctorLog
->
pharmacy_name
=
$pharmacy
->
name
;
$currentTime
=
$prescription_at
;
$doctorLog
->
log_info
=
$randomDoctor
->
name
.
'在'
.
$prescription_at
.
'为'
.
$patient
->
name
.
'('
.
$patient
->
mobile
.
')开具处方单(处方单编号:'
.
$prescription_number
.
')'
;
$doctorLog
->
save
();
//
$prescription->status = PrescriptionModel::PRESCRIPTION_STATUS_REVIEWING;
//
$prescription->save();
//
//
生成医师开方日志
//
$doctorLog = new PrescriptionLogModel;
//
$doctorLog->pharmacy_id = $pharmacy_id;
//
$doctorLog->pharmacy_name = $pharmacy->name;
//
$currentTime = $prescription_at;
//
$doctorLog->log_info = $randomDoctor->name.'在'.$prescription_at.'为'.$patient->name.'('.$patient->mobile.')开具处方单(处方单编号:'.$prescription_number.')';
//
$doctorLog->save();
}
elseif
(
$randomDoctor
->
is_auto
==
0
)
{
// 手动开方发送医师通知短信
if
(
env
(
'SMS_CHANNEL'
)
==
'chengliye'
)
{
...
...
@@ -330,15 +340,15 @@ public function create(Request $request)
// 药店自动审方(必须处方单待审方)
if
(
$pharmacy
->
is_auto
==
1
&&
$prescription
->
status
==
PrescriptionModel
::
PRESCRIPTION_STATUS_REVIEWING
)
{
$prescription
->
status
=
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
;
$prescription
->
save
();
// 生成药师审方日志
$pharmacistLog
=
new
PrescriptionLogModel
;
$pharmacistLog
->
pharmacy_id
=
$pharmacy_id
;
$pharmacistLog
->
pharmacy_name
=
$pharmacy
->
name
;
$currentTime
=
$review_at
;
$pharmacistLog
->
log_info
=
$pharmacist
->
name
.
'在'
.
$review_at
.
'为'
.
$patient
->
name
.
'('
.
$patient
->
mobile
.
')审方(处方单编号:'
.
$prescription_number
.
')'
;
$pharmacistLog
->
save
();
//
$prescription->status = PrescriptionModel::PRESCRIPTION_STATUS_SUCCESS;
//
$prescription->save();
//
//
生成药师审方日志
//
$pharmacistLog = new PrescriptionLogModel;
//
$pharmacistLog->pharmacy_id = $pharmacy_id;
//
$pharmacistLog->pharmacy_name = $pharmacy->name;
//
$currentTime = $review_at;
//
$pharmacistLog->log_info = $pharmacist->name.'在'.$review_at.'为'.$patient->name.'('.$patient->mobile.')审方(处方单编号:'.$prescription_number.')';
//
$pharmacistLog->save();
}
elseif
(
$pharmacy
->
is_auto
==
0
)
{
// 手动审方发送药店通知短信
if
(
env
(
'SMS_CHANNEL'
)
==
'chengliye'
)
{
...
...
app/Console/Commands/PrescriptionCommand.php
View file @
63381db1
...
...
@@ -59,6 +59,11 @@ public function autoPrescriptionGen()
// 查询对应的医师是手动并且药师为自动
// $pharmacist = PharmacyModel::where('id', $prescription->pharmacy_id)->first();
$doctor
=
DoctorModel
::
where
(
'id'
,
$prescription
->
doctor_id
)
->
first
();
if
(
$doctor
==
null
)
{
continue
;
}
// if ($doctor->is_auto == 0 && $pharmacist->is_auto == 1) {
if
(
$doctor
->
is_auto
==
1
)
{
// 更新处方单状态
...
...
@@ -68,6 +73,11 @@ public function autoPrescriptionGen()
$prescriptionInfo
->
save
();
// 获取患者信息
$patient
=
PatientModel
::
where
(
'id'
,
$prescriptionInfo
->
patient_id
)
->
first
();
if
(
$patient
==
null
)
{
continue
;
}
// 生成审方日志
$dateTime
=
new
DateTime
(
$prescription
->
created_at
);
$dateTime
->
modify
(
'+3 minutes'
);
...
...
@@ -101,6 +111,11 @@ public function autoPrescriptionReview()
$pharmacist
=
PharmacyModel
::
where
(
'id'
,
$prescription
->
pharmacy_id
)
->
first
();
// $doctor = DoctorModel::where('id', $prescription->doctor_id)->first();
// if ($doctor->is_auto == 0 && $pharmacist->is_auto == 1) {
if
(
$pharmacist
==
null
)
{
continue
;
}
if
(
$pharmacist
->
is_auto
==
1
)
{
// 更新处方单状态
$prescriptionInfo
=
PrescriptionModel
::
find
(
$prescription
->
id
);
...
...
@@ -109,6 +124,9 @@ public function autoPrescriptionReview()
$prescriptionInfo
->
save
();
// 获取患者信息
$patient
=
PatientModel
::
where
(
'id'
,
$prescriptionInfo
->
patient_id
)
->
first
();
if
(
$patient
==
null
)
{
continue
;
}
// 生成审方日志
$dateTime
=
new
DateTime
(
$prescription
->
created_at
);
$dateTime
->
modify
(
'+5 minutes'
);
...
...
app/Console/Commands/TestCommand.php
View file @
63381db1
...
...
@@ -28,7 +28,7 @@ class TestCommand extends Command
public
function
handle
()
{
// 刷新问诊问题
$prescriptions
=
PrescriptionModel
::
all
();
$prescriptions
=
PrescriptionModel
::
orderBy
(
'id'
,
'desc'
)
->
get
();
foreach
(
$prescriptions
as
$prescription
)
{
$inquiry_info
=
$prescription
->
inquiry_info
;
foreach
(
$inquiry_info
as
&
$v
)
{
...
...
app/Console/Kernel.php
View file @
63381db1
...
...
@@ -13,7 +13,9 @@ class Kernel extends ConsoleKernel
protected
function
schedule
(
Schedule
$schedule
)
:
void
{
// $schedule->command('inspire')->hourly();
// $schedule->command('mohe:prescription')->everyMinute();
# $schedule->command('mohe:prescription')->everyMinute();
}
/**
...
...
app/Models/PharmacistModel.php
View file @
63381db1
...
...
@@ -34,7 +34,6 @@ class PharmacistModel extends Model
// 是否启用[0=否,1=是]
const
IS_STATUS_FALSE
=
0
;
const
IS_STATUS_TRUE
=
1
;
const
IS_STATUS_MAP
=
[
...
...
docker-compose.yml
View file @
63381db1
...
...
@@ -90,3 +90,4 @@ services:
ipv4_address
:
${DOCKER_IP_PREFIX}.7
entrypoint
:
[
"
/var/www/artisan"
,
"
mohe:prescription"
]
resources/views/admin/prescription-print.blade.php
View file @
63381db1
...
...
@@ -66,6 +66,10 @@
$
(
'#is_eseal'
).
on
(
'change'
,
()
=>
this
.
search
());
<<<<<<<
HEAD
=======
>>>>>>>
master
console
.
log
(
'事件绑定完成'
);
}
...
...
@@ -170,7 +174,7 @@
// 将表单添加到搜索表单下方
$('.search-form').after(formHtml);
$(document).find('#editable-drug-list select').select2();
$('#editable-drug-list').on('change', 'select', this.editableDrugListChangeHandler);
}
...
...
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