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
765f1511
authored
Dec 03, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.imohe.com/zhaozengyu/tzt-admin
parents
92a21bb7
8023644c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
100 additions
and
24 deletions
+100
-24
app/Admin/Controllers/AuthController.php
+76
-0
app/Admin/Extensions/Form/SiteConfigForm.php
+1
-1
app/Api/Controllers/DrugController.php
+2
-2
app/Api/Controllers/PharmacistController.php
+3
-3
app/Api/Controllers/PrescriptionController.php
+1
-1
app/Api/Controllers/SiteConfigController.php
+8
-12
app/Api/Controllers/UserController.php
+1
-1
app/Console/Commands/PrescriptionCommand.php
+2
-2
app/Console/Kernel.php
+1
-1
app/Models/PharmacistModel.php
+4
-0
database/migrations/2024_11_10_233001_create_prescription_table.php
+1
-1
No files found.
app/Admin/Controllers/AuthController.php
View file @
765f1511
...
...
@@ -5,7 +5,9 @@
use
App\Models\AdminUsers
;
use
App\Services\SmsService
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Http\Controllers\AuthController
as
BaseAuthController
;
use
Dcat\Admin\Http\Repositories\Administrator
;
use
Dcat\Admin\Layout\Content
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Log
;
...
...
@@ -194,6 +196,80 @@ public function getLoginSmsCode(Request $request)
}
/**
* Model-form for user setting.
*
* @return Form
*/
protected
function
settingForm
()
{
return
new
Form
(
new
Administrator
(),
function
(
Form
$form
)
{
$form
->
action
(
admin_url
(
'auth/setting'
));
$form
->
disableCreatingCheck
();
$form
->
disableEditingCheck
();
$form
->
disableViewCheck
();
$form
->
tools
(
function
(
Form\Tools
$tools
)
{
$tools
->
disableView
();
$tools
->
disableDelete
();
});
$form
->
display
(
'username'
,
trans
(
'admin.username'
));
$form
->
text
(
'name'
,
trans
(
'admin.name'
))
->
required
();
$form
->
image
(
'avatar'
,
trans
(
'admin.avatar'
))
->
autoUpload
();
// $form->password('old_password', trans('admin.old_password'));
$form
->
password
(
'password'
,
trans
(
'admin.password'
))
->
minLength
(
5
)
->
maxLength
(
20
)
->
customFormat
(
function
(
$v
)
{
if
(
$v
==
$this
->
password
)
{
return
;
}
return
$v
;
});
$form
->
password
(
'password_confirmation'
,
trans
(
'admin.password_confirmation'
))
->
same
(
'password'
);
$form
->
ignore
([
'password_confirmation'
,
'old_password'
]);
$form
->
saving
(
function
(
Form
$form
)
{
if
(
$form
->
password
&&
$form
->
model
()
->
password
!=
$form
->
password
)
{
$form
->
password
=
bcrypt
(
$form
->
password
);
}
if
(
!
$form
->
password
)
{
$form
->
deleteInput
(
'password'
);
}
});
$form
->
saved
(
function
(
Form
$form
)
{
return
$form
->
response
()
->
success
(
trans
(
'admin.update_succeeded'
))
->
redirect
(
'auth/setting'
);
});
});
}
/**
* Update user setting.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
putSetting
()
{
$form
=
$this
->
settingForm
();
// if (! $this->validateCredentialsWhenUpdatingPassword()) {
// $form->responseValidationMessages('old_password', trans('admin.old_password_error'));
// }
return
$form
->
update
(
Admin
::
user
()
->
getKey
());
}
/**
* 验证短信验证码
*
* @param string $username
...
...
app/Admin/Extensions/Form/SiteConfigForm.php
View file @
765f1511
...
...
@@ -42,7 +42,7 @@ public function form()
$this
->
number
(
'drug_choose_limit'
,
'选择药品限制'
)
->
required
()
->
default
((
$data
[
'drug_choose_limit'
]
??
5
))
->
min
(
1
)
->
max
(
5
)
->
help
(
'药品目录选择数,最多可设置5'
);
// $this->switch('prescription_auto', '医师自动开方')->default(($data['prescription_auto'] ?? 0));
$this
->
text
(
'limit_keywords'
,
'限制关键词'
)
->
default
(
$data
[
'limit_keywords'
]
??
''
)
->
required
()
->
help
(
'多个关键词请用英文逗号分隔'
);
$this
->
text
(
'limit_keywords'
,
'限制关键词'
)
->
default
(
$data
[
'limit_keywords'
]
??
''
)
->
required
()
->
help
(
'多个关键词请用英文逗号分隔'
);
$this
->
disableResetButton
();
}
...
...
app/Api/Controllers/DrugController.php
View file @
765f1511
...
...
@@ -115,12 +115,12 @@ public function drugLimit(Request $request)
$patient_id
=
$request
->
input
(
'patient_id'
);
$pharmacy_id
=
$request
->
input
(
'pharmacy_id'
);
#
$sevenDaysAgo = Carbon::now()->subDays(7);
//
$sevenDaysAgo = Carbon::now()->subDays(7);
$oneDayAgo
=
Carbon
::
now
()
->
subDay
();
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
->
where
(
'is_voided'
,
PrescriptionModel
::
IS_VOIDED_FALSE
)
// 未作废的处方
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
#
->where('pharmacy_id', $pharmacy_id)
//
->where('pharmacy_id', $pharmacy_id)
->
where
(
'created_at'
,
'>='
,
$oneDayAgo
)
->
get
();
...
...
app/Api/Controllers/PharmacistController.php
View file @
765f1511
...
...
@@ -205,12 +205,12 @@ 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 @
765f1511
...
...
@@ -141,7 +141,7 @@ public function create(Request $request)
// 诊断信息
$prescription
->
diagnosis_id
=
$diagnosis_id
;
$diagnosis
=
DiagnosiModel
::
whereIn
(
'id'
,
explode
(
','
,
$diagnosis_id
))
->
pluck
(
'name'
)
->
toArray
();
$diagnosis
=
DiagnosiModel
::
whereIn
(
'id'
,
explode
(
','
,
$diagnosis_id
))
->
pluck
(
'name'
)
->
toArray
();
$diagnosis_name
=
implode
(
','
,
$diagnosis
);
$prescription
->
diagnosis_name
=
$diagnosis_name
;
// 问诊问题
...
...
app/Api/Controllers/SiteConfigController.php
View file @
765f1511
...
...
@@ -3,35 +3,32 @@
namespace
App\Api\Controllers
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\DoctorModel
;
use
App\Models\PharmacyModel
;
use
App\Models\User
;
use
App\Services\SmsService
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Log
;
use
Overtrue\EasySms\EasySms
;
class
SiteConfigController
extends
BaseApiController
{
public
function
test
()
{
public
function
test
()
{
$site_config
=
admin_setting_array
(
'site_config'
);
Log
::
info
(
'测试'
,
$site_config
);
$data
=
[
'diagnosis_limit'
=>
$site_config
[
'diagnosis_limit'
],
'drug_choose_limit'
=>
$site_config
[
'drug_choose_limit'
],
];
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
public
function
config
(
Request
$request
)
{
$site_config
=
admin_setting_array
(
'site_config'
);
#
Log::info('测试', $site_config);
//
Log::info('测试', $site_config);
$data
=
[
'diagnosis_limit'
=>
$site_config
[
'diagnosis_limit'
],
'drug_choose_limit'
=>
$site_config
[
'drug_choose_limit'
],
];
return
$this
->
success
(
$data
);
return
$this
->
success
(
$data
);
}
}
\ No newline at end of file
}
app/Api/Controllers/UserController.php
View file @
765f1511
...
...
@@ -42,7 +42,7 @@ public function login(Request $request)
return
$this
->
success
(
$data
);
}
else
{
return
$this
->
fail
(
'登录错误~'
);
return
$this
->
fail
ed
(
'登录错误~'
);
}
}
...
...
app/Console/Commands/PrescriptionCommand.php
View file @
765f1511
...
...
@@ -71,7 +71,7 @@ public function autoPrescriptionGen()
$prescriptionInfo
->
save
();
// 获取患者信息
$patient
=
PatientModel
::
where
(
'id'
,
$prescriptionInfo
->
patient_id
)
->
first
();
if
(
$patient
==
null
)
{
if
(
$patient
==
null
)
{
continue
;
}
// 生成审方日志
...
...
@@ -118,7 +118,7 @@ public function autoPrescriptionReview()
$prescriptionInfo
->
save
();
// 获取患者信息
$patient
=
PatientModel
::
where
(
'id'
,
$prescriptionInfo
->
patient_id
)
->
first
();
if
(
$patient
==
null
)
{
if
(
$patient
==
null
)
{
continue
;
}
// 生成审方日志
...
...
app/Console/Kernel.php
View file @
765f1511
...
...
@@ -13,7 +13,7 @@ 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 @
765f1511
...
...
@@ -31,13 +31,17 @@ class PharmacistModel extends Model
self
::
IS_DEFAULT_FALSE
=>
'gray'
,
self
::
IS_DEFAULT_TRUE
=>
'success'
,
];
// 是否启用[0=否,1=是]
const
IS_STATUS_FALSE
=
0
;
const
IS_STATUS_TRUE
=
1
;
const
IS_STATUS_MAP
=
[
self
::
IS_STATUS_FALSE
=>
'否'
,
self
::
IS_STATUS_TRUE
=>
'是'
,
];
// 药师关联的药店,多对一
public
function
pharmacy
()
{
...
...
database/migrations/2024_11_10_233001_create_prescription_table.php
View file @
765f1511
...
...
@@ -24,7 +24,7 @@ public function up(): void
$table
->
string
(
'patient_name'
,
32
)
->
comment
(
'问诊人姓名'
);
$table
->
integer
(
'patient_age'
)
->
default
(
0
)
->
comment
(
'问诊人年龄'
);
$table
->
tinyInteger
(
'patient_gender'
)
->
default
(
0
)
->
comment
(
'问诊人性别。[1=男性,2=女性,0=未知]'
);
$table
->
string
(
'diagnosis_id'
,
255
)
->
nullable
()
->
comment
(
'诊断表ID'
);
$table
->
string
(
'diagnosis_id'
,
255
)
->
nullable
()
->
comment
(
'诊断表ID'
);
$table
->
string
(
'diagnosis_name'
,
255
)
->
nullable
()
->
comment
(
'诊断'
);
$table
->
text
(
'inquiry_info'
)
->
comment
(
'问诊问题'
);
...
...
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