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
c02a7144
Commit
c02a7144
authored
Mar 19, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据为null过滤
parent
ebbfab54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
performance/Performance.Api/Controllers/ReportController.cs
+1
-1
performance/Performance.Services/ReportDataService.cs
+12
-5
No files found.
performance/Performance.Api/Controllers/ReportController.cs
View file @
c02a7144
...
...
@@ -48,7 +48,7 @@ public ApiResponse Info([FromBody]SelectionRequest report)
[
HttpPost
]
public
ApiResponse
Search
([
FromBody
]
SearchReportRequest
report
)
{
var
result
=
reportDataService
.
GetReportData
(
report
.
HospitalId
,
report
.
GroupId
,
report
.
ReportId
,
report
.
Values
);
var
result
=
reportDataService
.
GetReportData
(
report
.
HospitalId
,
report
.
GroupId
,
report
.
ReportId
,
report
.
Values
??
new
List
<
SelectionValues
>()
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
...
...
performance/Performance.Services/ReportDataService.cs
View file @
c02a7144
...
...
@@ -104,10 +104,11 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
var
formats
=
GetParameterFormats
();
var
groupSelections
=
groupselectionRepository
.
GetEntities
(
w
=>
w
.
GroupId
==
groupId
);
var
arr2
=
groupSelections
.
Select
(
w
=>
w
.
SelectionId
);
var
arr2
=
groupSelections
?.
Select
(
w
=>
w
.
SelectionId
)
??
new
List
<
int
?>(
);
var
dispaly
=
new
int
[]
{
(
int
)
SelectionState
.
UsableAndDispaly
,
(
int
)
SelectionState
.
UsableAndNotDispaly
};
var
selections
=
selectionRepository
.
GetEntities
(
w
=>
arr2
.
Contains
(
w
.
ID
)
&&
w
.
State
.
HasValue
&&
dispaly
.
Contains
(
w
.
State
.
Value
));
var
selections
=
selectionRepository
.
GetEntities
(
w
=>
arr2
.
Contains
(
w
.
ID
)
&&
w
.
State
.
HasValue
&&
dispaly
.
Contains
(
w
.
State
.
Value
))
??
new
List
<
rep_selection
>();
List
<
ReportData
>
result
=
new
List
<
ReportData
>();
foreach
(
var
report
in
reports
)
...
...
@@ -115,8 +116,12 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
var
sql
=
report
.
Content
.
ToLower
();
//不重复条件,动态拼接WHERE条件
selections
=
GetNoRepeatSelections
(
sql
,
formats
,
selections
);
string
@where
=
GetFilterSelection
(
selections
,
values
);
string
@where
=
""
;
if
(
selections
!=
null
&&
selections
.
Any
())
{
selections
=
GetNoRepeatSelections
(
sql
,
formats
,
selections
);
@where
=
GetFilterSelection
(
selections
,
values
);
}
@where
+=
$" and hospitalid=
{
hospitalId
}
"
;
// 固定占位符
var
pairs
=
PredefinePlaceholder
(
values
);
...
...
@@ -152,6 +157,8 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
private
string
GetFilterSelection
(
List
<
rep_selection
>
selections
,
List
<
SelectionValues
>
values
)
{
string
where
=
""
;
if
(
values
==
null
||
!
values
.
Any
())
return
where
;
foreach
(
var
selection
in
selections
)
{
var
value
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
==
selection
.
InputName
)?.
Values
;
...
...
@@ -302,7 +309,7 @@ private string ReplacePlaceholder(List<rep_selection> selections, List<Selection
{
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
())
continue
;
foreach
(
var
pattern
in
formats
)
...
...
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