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
dcd1a493
authored
Dec 07, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加诊断类型
parent
2901fea1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
3 deletions
+44
-3
app/Admin/Controllers/DiagnosiController.php
+4
-2
app/Api/Controllers/DiagnosisController.php
+2
-1
app/Models/DiagnosiModel.php
+10
-0
database/migrations/2024_12_07_213450_add_type_to_diagnosis.php
+28
-0
No files found.
app/Admin/Controllers/DiagnosiController.php
View file @
dcd1a493
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Admin\Controllers
;
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\DiagnosiRepository
;
use
App\Admin\Repositories\DiagnosiRepository
;
use
App\Models\DiagnosiModel
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Http\Controllers\AdminController
;
...
@@ -25,7 +26,7 @@ protected function grid()
...
@@ -25,7 +26,7 @@ protected function grid()
$grid
->
column
(
'code'
);
$grid
->
column
(
'code'
);
$grid
->
column
(
'encoding'
);
$grid
->
column
(
'encoding'
);
$grid
->
column
(
'content'
);
$grid
->
column
(
'content'
);
$grid
->
column
(
'type'
,
'诊断类型'
)
->
using
(
DiagnosiModel
::
DIAGNOSI_TYPE_MAP
);
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
panel
();
// 更改为 panel 布局
$filter
->
panel
();
// 更改为 panel 布局
$filter
->
expand
();
// 默认展开搜索框
$filter
->
expand
();
// 默认展开搜索框
...
@@ -34,6 +35,7 @@ protected function grid()
...
@@ -34,6 +35,7 @@ protected function grid()
$filter
->
like
(
'code'
)
->
width
(
3
);
$filter
->
like
(
'code'
)
->
width
(
3
);
$filter
->
like
(
'encoding'
)
->
width
(
3
);
$filter
->
like
(
'encoding'
)
->
width
(
3
);
$filter
->
like
(
'content'
)
->
width
(
3
);
$filter
->
like
(
'content'
)
->
width
(
3
);
$filter
->
in
(
'is_auto'
,
'诊断类型'
)
->
checkbox
(
DiagnosiModel
::
DIAGNOSI_TYPE_MAP
)
->
width
(
3
);
});
});
$grid
->
setActionClass
(
Grid\Displayers\Actions
::
class
);
$grid
->
setActionClass
(
Grid\Displayers\Actions
::
class
);
...
@@ -81,7 +83,7 @@ protected function form()
...
@@ -81,7 +83,7 @@ protected function form()
$form
->
text
(
'content'
)
->
width
(
4
)
->
required
()
->
maxLength
(
255
,
'最多输入255个字符'
);
$form
->
text
(
'content'
)
->
width
(
4
)
->
required
()
->
maxLength
(
255
,
'最多输入255个字符'
);
$form
->
text
(
'encoding'
)
->
width
(
4
)
->
required
()
->
maxLength
(
128
);
$form
->
text
(
'encoding'
)
->
width
(
4
)
->
required
()
->
maxLength
(
128
);
$form
->
display
(
'code'
)
->
width
(
4
);
$form
->
display
(
'code'
)
->
width
(
4
);
$form
->
radio
(
'type'
,
'诊断类型'
)
->
options
(
DiagnosiModel
::
DIAGNOSI_TYPE_MAP
)
->
default
(
DiagnosiModel
::
DIAGNOSI_TYPE_WM
)
->
required
();
$form
->
display
(
'created_at'
)
->
width
(
4
);
$form
->
display
(
'created_at'
)
->
width
(
4
);
$form
->
display
(
'updated_at'
)
->
width
(
4
);
$form
->
display
(
'updated_at'
)
->
width
(
4
);
...
...
app/Api/Controllers/DiagnosisController.php
View file @
dcd1a493
...
@@ -18,7 +18,8 @@ public function test()
...
@@ -18,7 +18,8 @@ public function test()
public
function
diagnosisList
(
Request
$request
)
public
function
diagnosisList
(
Request
$request
)
{
{
$search_input
=
$request
->
input
(
'search_input'
);
$search_input
=
$request
->
input
(
'search_input'
);
$query
=
DiagnosiModel
::
query
();
$type
=
$request
->
input
(
'type'
,
0
);
$query
=
DiagnosiModel
::
query
()
->
where
(
'type'
,
$type
);
if
(
$search_input
)
{
if
(
$search_input
)
{
$query
->
where
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
)
$query
->
where
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'code'
,
'like'
,
"%
{
$search_input
}
%"
);
->
orWhere
(
'code'
,
'like'
,
"%
{
$search_input
}
%"
);
...
...
app/Models/DiagnosiModel.php
View file @
dcd1a493
...
@@ -13,6 +13,16 @@ class DiagnosiModel extends Model
...
@@ -13,6 +13,16 @@ class DiagnosiModel extends Model
use
HasDateTimeFormatter
;
use
HasDateTimeFormatter
;
use
SoftDeletes
;
use
SoftDeletes
;
const
DIAGNOSI_TYPE_WM
=
0
;
const
DIAGNOSI_TYPE_TCM
=
1
;
// 诊断类型-文字映射
const
DIAGNOSI_TYPE_MAP
=
[
self
::
DIAGNOSI_TYPE_WM
=>
'西医'
,
self
::
DIAGNOSI_TYPE_TCM
=>
'中医'
,
];
protected
$table
=
'diagnosis'
;
protected
$table
=
'diagnosis'
;
public
function
setNameAttribute
(
$value
)
public
function
setNameAttribute
(
$value
)
...
...
database/migrations/2024_12_07_213450_add_type_to_diagnosis.php
0 → 100644
View file @
dcd1a493
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*/
public
function
up
()
:
void
{
Schema
::
table
(
'diagnosis'
,
function
(
Blueprint
$table
)
{
$table
->
tinyInteger
(
'type'
)
->
default
(
0
)
->
comment
(
'诊断类型[0=西医,1=中医]'
);
});
}
/**
* Reverse the migrations.
*/
public
function
down
()
:
void
{
Schema
::
table
(
'diagnosis'
,
function
(
Blueprint
$table
)
{
//
});
}
};
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