Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
392c418e
Commit
392c418e
authored
Jan 13, 2021
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表动态条件
parent
abf8c570
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
26 deletions
+48
-26
performance/Performance.Api/Controllers/ReportController.cs
+1
-1
performance/Performance.DtoModels/Request/SelectionRequest.cs
+1
-1
performance/Performance.Services/ReportDataService.cs
+46
-24
No files found.
performance/Performance.Api/Controllers/ReportController.cs
View file @
392c418e
...
@@ -51,7 +51,7 @@ public ApiResponse Rank([FromBody] HospitalIdRequest request)
...
@@ -51,7 +51,7 @@ public ApiResponse Rank([FromBody] HospitalIdRequest request)
public
ApiResponse
Selection
([
FromBody
]
SelectionRequest
report
)
public
ApiResponse
Selection
([
FromBody
]
SelectionRequest
report
)
{
{
var
userId
=
claimService
.
GetUserId
();
var
userId
=
claimService
.
GetUserId
();
var
result
=
reportDataService
.
GetReportSelection
(
report
.
GroupId
,
userId
);
var
result
=
reportDataService
.
GetReportSelection
(
report
.
GroupId
,
userId
,
report
.
HospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
}
...
...
performance/Performance.DtoModels/Request/SelectionRequest.cs
View file @
392c418e
...
@@ -9,7 +9,7 @@ public class HospitalIdRequest
...
@@ -9,7 +9,7 @@ public class HospitalIdRequest
{
{
public
int
HospitalId
{
get
;
set
;
}
public
int
HospitalId
{
get
;
set
;
}
}
}
public
class
SelectionRequest
public
class
SelectionRequest
:
HospitalIdRequest
{
{
public
int
GroupId
{
get
;
set
;
}
public
int
GroupId
{
get
;
set
;
}
}
}
...
...
performance/Performance.Services/ReportDataService.cs
View file @
392c418e
...
@@ -53,7 +53,7 @@ public class ReportDataService : IAutoInjection
...
@@ -53,7 +53,7 @@ public class ReportDataService : IAutoInjection
/// </summary>
/// </summary>
/// <param name="groupId"></param>
/// <param name="groupId"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
SelectionOptions
>
GetReportSelection
(
int
groupId
,
int
userId
)
public
List
<
SelectionOptions
>
GetReportSelection
(
int
groupId
,
int
userId
,
int
hospitalId
)
{
{
List
<
SelectionOptions
>
options
=
new
List
<
SelectionOptions
>();
List
<
SelectionOptions
>
options
=
new
List
<
SelectionOptions
>();
...
@@ -71,10 +71,14 @@ public List<SelectionOptions> GetReportSelection(int groupId, int userId)
...
@@ -71,10 +71,14 @@ public List<SelectionOptions> GetReportSelection(int groupId, int userId)
foreach
(
var
item
in
selections
.
Where
(
t
=>
t
.
State
.
HasValue
&&
!
dispaly
.
Contains
(
t
.
State
.
Value
)))
foreach
(
var
item
in
selections
.
Where
(
t
=>
t
.
State
.
HasValue
&&
!
dispaly
.
Contains
(
t
.
State
.
Value
)))
{
{
SelectionOptionDefault
handle
=
new
SelectionOptionDefault
();
SelectionOptionDefault
handle
=
new
SelectionOptionDefault
();
//if (item.LoadType == (int)LoadType.InstantLoad && item.Type == 2)
// handle = new SelectionOptionDynamic();
if
(
item
.
LoadType
==
(
int
)
LoadType
.
InstantLoad
&&
item
.
Type
==
2
)
SelectionOptions
selection
=
new
SelectionOptions
(
item
);
handle
=
new
SelectionOptionDynamic
(
reportRepository
,
hospitalId
);
selection
.
Options
=
handle
.
GetOptions
(
item
);
SelectionOptions
selection
=
new
SelectionOptions
(
item
)
{
Options
=
handle
.
GetOptions
(
item
)
};
if
(
isMedical
)
if
(
isMedical
)
{
{
selection
.
Options
.
RemoveAll
(
t
=>
t
.
Title
==
"全院"
);
selection
.
Options
.
RemoveAll
(
t
=>
t
.
Title
==
"全院"
);
...
@@ -189,19 +193,19 @@ private string GetFilterSelection(List<rep_selection> selections, List<Selection
...
@@ -189,19 +193,19 @@ private string GetFilterSelection(List<rep_selection> selections, List<Selection
foreach
(
var
selection
in
selections
)
foreach
(
var
selection
in
selections
)
{
{
var
value
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
==
selection
.
InputName
)?.
Values
;
var
value
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
==
selection
.
InputName
)?.
Values
;
if
(
value
==
null
||
!
value
.
Any
(
))
if
(
value
!=
null
&&
value
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
)
))
continue
;
{
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Equal
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Equal
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
='
{
value
.
First
()}
'"
;
where
+=
$" and
{
selection
.
InputName
}
='
{
value
.
First
()}
'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Like
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Like
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
like '%
{
value
.
First
()}
%'"
;
where
+=
$" and
{
selection
.
InputName
}
like '%
{
value
.
First
()}
%'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotLike
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotLike
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
not like '%
{
value
.
First
()}
%'"
;
where
+=
$" and
{
selection
.
InputName
}
not like '%
{
value
.
First
()}
%'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
In
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
In
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
where
+=
$" and
{
selection
.
InputName
}
in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotIn
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotIn
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
not in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
where
+=
$" and
{
selection
.
InputName
}
not in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
}
}
}
return
where
;
return
where
;
}
}
...
@@ -400,16 +404,34 @@ public virtual List<TitleValue> GetOptions(rep_selection selection)
...
@@ -400,16 +404,34 @@ public virtual List<TitleValue> GetOptions(rep_selection selection)
}
}
public
class
SelectionOptionDynamic
:
SelectionOptionDefault
public
class
SelectionOptionDynamic
:
SelectionOptionDefault
{
{
private
PerforRepreportRepository
_reportRepository
;
private
readonly
int
_hospitalId
;
public
SelectionOptionDynamic
(
PerforRepreportRepository
reportRepository
,
int
hospitalId
)
{
_reportRepository
=
reportRepository
;
_hospitalId
=
hospitalId
;
}
public
override
List
<
TitleValue
>
GetOptions
(
rep_selection
selection
)
public
override
List
<
TitleValue
>
GetOptions
(
rep_selection
selection
)
{
{
//
List<TitleValue> values = new List<TitleValue>();
List
<
TitleValue
>
values
=
new
List
<
TitleValue
>();
//if (selection.Type != 1
)
if
(
selection
.
Type
!=
2
)
//
return values;
return
values
;
//if (string.IsNullOrEmpty(selection.Content))
if
(
string
.
IsNullOrEmpty
(
selection
.
Content
))
// return values;
return
values
;
SortedDictionary
<
string
,
object
>
dic
=
new
SortedDictionary
<
string
,
object
>
{
{
"@hospitalid"
,
_hospitalId
},
};
string
sql
=
selection
.
Content
;
if
(
sql
.
IndexOf
(
"@hospitalid"
,
StringComparison
.
OrdinalIgnoreCase
)
>
-
1
&&
dic
.
ContainsKey
(
"hospitalid"
))
sql
=
Regex
.
Replace
(
sql
,
"@hospitalid"
,
dic
.
GetValue
<
string
>(
"hospitalid"
),
RegexOptions
.
IgnoreCase
);
return
base
.
GetOptions
(
selection
);
// 执行SQL
var
selections
=
_reportRepository
.
DapperQuery
<
TitleValue
>(
sql
,
null
);
return
selections
==
null
?
new
List
<
TitleValue
>()
:
selections
.
ToList
();
}
}
}
}
}
}
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