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
eaba5317
authored
Nov 18, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化后台添加处方
parent
7d0d403a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
4 deletions
+71
-4
app/Admin/Controllers/PrescriptionController.php
+71
-4
No files found.
app/Admin/Controllers/PrescriptionController.php
View file @
eaba5317
...
...
@@ -7,6 +7,7 @@
use
App\Models\DoctorModel
;
use
App\Models\InquiryModel
;
use
App\Models\PatientModel
;
use
App\Models\PharmacistModel
;
use
App\Models\PharmacyDrugModel
;
use
App\Models\PharmacyModel
;
use
App\Models\PrescriptionModel
;
...
...
@@ -117,15 +118,36 @@ protected function form()
{
return
Form
::
make
(
new
PrescriptionRepository
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
)
->
width
(
4
);
$form
->
radio
(
'status'
)
->
options
(
PrescriptionModel
::
PRESCRIPTION_STATUS_MAP
);
$form
->
radio
(
'status'
)
->
options
(
PrescriptionModel
::
PRESCRIPTION_STATUS_MAP
)
->
default
(
PrescriptionModel
::
PRESCRIPTION_STATUS_PENDING
);
$form
->
select
(
'patient_id'
)
->
options
(
PatientModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
hidden
(
'patient_name'
);
$form
->
hidden
(
'patient_age'
);
$form
->
hidden
(
'patient_gender'
);
$form
->
select
(
'diagnosis_id'
)
->
options
(
DiagnosiModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
select
(
'doctor_id'
)
->
options
(
DoctorModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
select
(
'pharmacy_id'
)
->
options
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
select
(
'pharmacist_id'
)
->
options
(
DoctorModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
hidden
(
'diagnosis_name'
);
$form
->
select
(
'doctor_id'
)
->
options
(
DoctorModel
::
where
(
'status'
,
1
)
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
hidden
(
'doctor_name'
);
$form
->
hidden
(
'doctor_online_hospital_name'
);
$form
->
hidden
(
'doctor_department'
);
$form
->
hidden
(
'doctor_title'
);
$form
->
hidden
(
'doctor_license_no'
);
$form
->
hidden
(
'doctor_signed_pic'
);
$form
->
select
(
'pharmacy_id'
)
->
options
(
PharmacyModel
::
where
(
'status'
,
1
)
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
hidden
(
'pharmacy_name'
);
$form
->
select
(
'pharmacist_id'
)
->
options
(
PharmacistModel
::
where
(
'status'
,
1
)
->
pluck
(
'name'
,
'id'
))
->
width
(
4
);
$form
->
hidden
(
'pharmacist_name'
);
$form
->
hidden
(
'pharmacist_license_number'
);
$form
->
hidden
(
'pharmacist_signed_pic'
);
$form
->
multipleSelect
(
'inquiry_info'
)
->
options
(
InquiryModel
::
all
()
->
pluck
(
'question'
,
'id'
))
->
width
(
4
)
->
saving
(
function
(
$v
)
{
return
json_encode
(
$v
);
});
$form
->
multipleSelect
(
'drug_info'
)
->
options
(
PharmacyDrugModel
::
with
(
'drug'
)
->
get
()
->
pluck
(
'drug'
)
->
pluck
(
'name'
,
'id'
))
->
width
(
4
)
->
saving
(
function
(
$v
)
{
return
json_encode
(
$v
);
});
...
...
@@ -133,9 +155,54 @@ protected function form()
$form
->
display
(
'created_at'
)
->
width
(
4
);
$form
->
display
(
'updated_at'
)
->
width
(
4
);
// 添加隐藏字段以保存冗余数据
$form
->
saving
(
function
(
Form
$form
)
{
$patient
=
PatientModel
::
find
(
$form
->
input
(
'patient_id'
));
$doctor
=
DoctorModel
::
find
(
$form
->
input
(
'doctor_id'
));
$pharmacist
=
PharmacistModel
::
find
(
$form
->
input
(
'pharmacist_id'
));
$diagnosis
=
DiagnosiModel
::
find
(
$form
->
input
(
'diagnosis_id'
));
$pharmacy
=
PharmacyModel
::
find
(
$form
->
input
(
'pharmacy_id'
));
// 根据身份证计算年龄和性别
if
(
$patient
)
{
$form
->
patient_name
=
$patient
->
name
;
$form
->
patient_age
=
getAgeByIdCard
(
$patient
->
id_card
);
$form
->
patient_gender
=
$patient
->
gender
;
}
if
(
$diagnosis
)
{
$form
->
diagnosis_name
=
$diagnosis
->
name
;
// 假设有诊断名称字段
}
if
(
$doctor
)
{
$form
->
doctor_name
=
$doctor
->
name
;
$form
->
doctor_online_hospital_name
=
$doctor
->
online_hospital_name
;
// 假设有在线医院名称字段
$form
->
doctor_department
=
$doctor
->
department
;
$form
->
doctor_title
=
$doctor
->
doctor_title
;
$form
->
doctor_license_no
=
$doctor
->
license_no
;
$form
->
doctor_signed_pic
=
$doctor
->
signed_pic
;
}
if
(
$pharmacist
)
{
$form
->
pharmacist_name
=
$pharmacist
->
name
;
$form
->
pharmacist_license_number
=
$pharmacist
->
license_number
;
$form
->
pharmacist_signed_pic
=
$pharmacist
->
signed_pic
;
}
if
(
$pharmacy
)
{
$form
->
pharmacy_name
=
$pharmacy
->
name
;
}
});
// 右上角按钮控制
$form
->
disableDeleteButton
();
// 去掉删除按钮
});
}
// 计算年龄的辅助方法
private
function
calculateAge
(
$id_card
)
{
// 根据身份证计算年龄的逻辑
// 返回计算出的年龄
}
}
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