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
0a9cf520
Commit
0a9cf520
authored
Jan 14, 2021
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微调
parent
392c418e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
performance/Performance.Api/Controllers/ReportController.cs
+6
-6
performance/Performance.Services/ReportDataService.cs
+3
-3
No files found.
performance/Performance.Api/Controllers/ReportController.cs
View file @
0a9cf520
...
@@ -70,12 +70,12 @@ public ApiResponse Search([FromBody] SearchReportRequest report)
...
@@ -70,12 +70,12 @@ public ApiResponse Search([FromBody] SearchReportRequest report)
if
(
report
.
Values
==
null
||
!
report
.
Values
.
Any
())
if
(
report
.
Values
==
null
||
!
report
.
Values
.
Any
())
return
new
ApiResponse
(
ResponseType
.
OK
,
new
List
<
ReportData
>());
return
new
ApiResponse
(
ResponseType
.
OK
,
new
List
<
ReportData
>());
string
[]
keys
=
new
string
[]
{
"year"
,
"month"
,
};
//
string[] keys = new string[] { "year", "month", };
foreach
(
var
item
in
report
.
Values
.
Where
(
t
=>
keys
.
Contains
(
t
.
Title
)))
//
foreach (var item in report.Values.Where(t => keys.Contains(t.Title)))
{
//
{
if
(
item
.
Values
==
null
||
!
item
.
Values
.
Any
(
t
=>
!
string
.
IsNullOrEmpty
(
t
)))
//
if (item.Values == null || !item.Values.Any(t => !string.IsNullOrEmpty(t)))
return
new
ApiResponse
(
ResponseType
.
OK
,
new
List
<
ReportData
>());
//
return new ApiResponse(ResponseType.OK, new List<ReportData>());
}
//
}
var
userId
=
claimService
.
GetUserId
();
var
userId
=
claimService
.
GetUserId
();
var
result
=
reportDataService
.
GetReportData
(
report
.
HospitalId
,
report
.
GroupId
,
report
.
ReportId
,
report
.
Values
??
new
List
<
SelectionValues
>(),
userId
);
var
result
=
reportDataService
.
GetReportData
(
report
.
HospitalId
,
report
.
GroupId
,
report
.
ReportId
,
report
.
Values
??
new
List
<
SelectionValues
>(),
userId
);
...
...
performance/Performance.Services/ReportDataService.cs
View file @
0a9cf520
...
@@ -142,8 +142,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
...
@@ -142,8 +142,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
List
<
ReportData
>
result
=
new
List
<
ReportData
>();
List
<
ReportData
>
result
=
new
List
<
ReportData
>();
foreach
(
var
report
in
reports
)
foreach
(
var
report
in
reports
)
{
{
var
sql
=
report
.
Content
.
ToLower
();
var
sql
=
report
.
Content
;
//不重复条件,动态拼接WHERE条件
//不重复条件,动态拼接WHERE条件
string
@where
=
""
;
string
@where
=
""
;
if
(
selections
!=
null
&&
selections
.
Any
())
if
(
selections
!=
null
&&
selections
.
Any
())
...
@@ -168,6 +167,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
...
@@ -168,6 +167,7 @@ public List<ReportData> GetReportData(int hospitalId, int groupId, int reportId,
{
{
sql
=
Regex
.
Replace
(
sql
,
item
.
Key
,
item
.
Value
.
ToString
(),
RegexOptions
.
IgnoreCase
);
sql
=
Regex
.
Replace
(
sql
,
item
.
Key
,
item
.
Value
.
ToString
(),
RegexOptions
.
IgnoreCase
);
}
}
logger
.
LogInformation
(
$"报表SQL语句:
{
sql
}
"
);
// 执行SQL
// 执行SQL
var
chartData
=
reportRepository
.
DapperQuery
<
ChartData
>(
sql
,
null
);
var
chartData
=
reportRepository
.
DapperQuery
<
ChartData
>(
sql
,
null
);
...
@@ -307,7 +307,7 @@ private string AddSelectionToReportTitle(List<rep_selection> selections, List<Se
...
@@ -307,7 +307,7 @@ private string AddSelectionToReportTitle(List<rep_selection> selections, List<Se
foreach
(
var
key
in
keys1
)
foreach
(
var
key
in
keys1
)
{
{
var
list
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
.
ToLower
()
==
key
)?.
Values
;
var
list
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
.
ToLower
()
==
key
)?.
Values
;
if
(
list
!=
null
&&
list
.
Any
())
if
(
list
!=
null
&&
list
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
)
))
{
{
var
arr
=
Array
.
ConvertAll
(
list
.
ToArray
(),
input
=>
int
.
Parse
(
input
));
var
arr
=
Array
.
ConvertAll
(
list
.
ToArray
(),
input
=>
int
.
Parse
(
input
));
pairs
.
Add
(
key
,
arr
.
Max
());
pairs
.
Add
(
key
,
arr
.
Max
());
...
...
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