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
b3fc5681
Commit
b3fc5681
authored
Mar 19, 2020
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表
parent
464215c5
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1530 additions
and
15 deletions
+1530
-15
performance/Performance.Api/Controllers/ReportController.cs
+31
-2
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+240
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+218
-1
performance/Performance.DtoModels/ReportData.cs
+119
-0
performance/Performance.DtoModels/ReportEnum.cs
+84
-0
performance/Performance.DtoModels/Request/SelectionRequest.cs
+24
-0
performance/Performance.DtoModels/SelectionOptions.cs
+78
-0
performance/Performance.DtoModels/TitleValue.cs
+13
-1
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
+9
-1
performance/Performance.EntityModels/Entity/rep_group.cs
+34
-0
performance/Performance.EntityModels/Entity/rep_group_selection.cs
+34
-0
performance/Performance.EntityModels/Entity/rep_report.cs
+99
-0
performance/Performance.EntityModels/Entity/rep_selection.cs
+94
-0
performance/Performance.EntityModels/Entity/sys_role.cs
+1
-1
performance/Performance.EntityModels/Performance.EntityModels.csproj
+0
-4
performance/Performance.Repository/Repository/PerforModdicRepository.cs
+5
-5
performance/Performance.Repository/Repository/PerforRepgroupRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforRepgroupselectionRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforRepreportRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforRepselectionRepository.cs
+20
-0
performance/Performance.Services/ReportDataService.cs
+367
-0
No files found.
performance/Performance.Api/Controllers/ReportController.cs
View file @
b3fc5681
...
...
@@ -12,17 +12,46 @@ namespace Performance.Api.Controllers
/// <summary>
/// 报表
/// </summary>
[
Route
(
"api/
[controller]
"
)]
[
Route
(
"api/
report
"
)]
public
class
ReportController
:
Controller
{
private
ReportService
reportService
;
private
readonly
ReportDataService
reportDataService
;
private
ClaimService
claimService
;
public
ReportController
(
ReportService
reportService
,
ClaimService
claimService
)
public
ReportController
(
ClaimService
claimService
,
ReportService
reportService
,
ReportDataService
reportDataService
)
{
this
.
reportService
=
reportService
;
this
.
reportDataService
=
reportDataService
;
this
.
claimService
=
claimService
;
}
[
Route
(
"selection"
)]
[
HttpPost
]
public
ApiResponse
Selection
([
FromBody
]
SelectionRequest
report
)
{
var
result
=
reportDataService
.
GetReportSelection
(
report
.
GroupId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
[
Route
(
"info"
)]
[
HttpPost
]
public
ApiResponse
Info
([
FromBody
]
SelectionRequest
report
)
{
var
result
=
reportDataService
.
GetReportInfo
(
report
.
GroupId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
[
Route
(
"search"
)]
[
HttpPost
]
public
ApiResponse
Search
([
FromBody
]
SearchReportRequest
report
)
{
var
result
=
reportDataService
.
GetReportData
(
report
.
HospitalId
,
report
.
GroupId
,
report
.
Values
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 首页数据概况
/// </summary>
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
b3fc5681
...
...
@@ -1159,6 +1159,191 @@
核算单元类型
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.ChartType"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.Sort"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.Title"
>
<summary>
报表标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.XTitle"
>
<summary>
X轴标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.XUnit"
>
<summary>
X轴单位
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.YTitle"
>
<summary>
Y轴标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.YUnit"
>
<summary>
Y轴单位
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.VTitle"
>
<summary>
值标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.VUnit"
>
<summary>
值单位
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.NTitle"
>
<summary>
name标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.NUnit"
>
<summary>
name单位
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.Formula"
>
<summary>
图表说明
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.DataType"
>
<summary>
1表示需要进行小于百分2的类型进行合并
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.FilterValue"
>
<summary>
图标value过滤执值
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ReportData.ChartData"
>
<summary>
图表数据
</summary>
</member>
<member
name=
"T:Performance.DtoModels.ChartData"
>
<summary>
图表
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.X"
>
<summary>
X轴内容
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.Y"
>
<summary>
Y轴内容
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.Name"
>
<summary>
分类
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.Value"
>
<summary>
值
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.Total"
>
<summary>
总量
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ChartData.Type"
>
<summary>
ChartData 类型标签
</summary>
</member>
<member
name=
"T:Performance.DtoModels.SelectionState"
>
<summary>
菜单条件状态
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SelectionState.UsableAndDispaly"
>
<summary>
1 可用并显示
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SelectionState.UsableAndNotDispaly"
>
<summary>
2 可用但不显示
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SelectionState.NotUsableAndNotDispaly"
>
<summary>
3 不显示不可用
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SelectionState.NotUsableAndDispaly"
>
<summary>
4 显示不可用
</summary>
</member>
<member
name=
"T:Performance.DtoModels.LoadType"
>
<summary>
条件加载方式
</summary>
</member>
<member
name=
"F:Performance.DtoModels.LoadType.InstantLoad"
>
<summary>
1 立即加载
</summary>
</member>
<member
name=
"F:Performance.DtoModels.LoadType.LinkageLoad"
>
<summary>
2 联动加载
</summary>
</member>
<member
name=
"F:Performance.DtoModels.LoadType.AutoComplete"
>
<summary>
3 自动补全
</summary>
</member>
<member
name=
"T:Performance.DtoModels.SQLOperator"
>
<summary>
SQL操作符
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SQLOperator.Equal"
>
<summary>
Equal
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SQLOperator.Like"
>
<summary>
Like
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SQLOperator.In"
>
<summary>
In
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SQLOperator.NotLike"
>
<summary>
Not Like
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SQLOperator.NotIn"
>
<summary>
Not In
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AgainAllotRequest"
>
<summary>
二次分配请求
...
...
@@ -2414,6 +2599,61 @@
绩效系数
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.ID"
>
<summary>
ID
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.Sort"
>
<summary>
排序
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.Title"
>
<summary>
标题
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.InputType"
>
<summary>
类型
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.InputName"
>
<summary>
名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.ParentID"
>
<summary>
父控件名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.ParentName"
>
<summary>
父控件名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.LoadType"
>
<summary>
控件数据加载方式 1 立即加载 2 联动加载 3 自动补全
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.Required"
>
<summary>
是否必填
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.DefaultValue"
>
<summary>
默认值
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.Options"
>
<summary>
数据集合
</summary>
</member>
<member
name=
"T:Performance.DtoModels.TitleValue`1"
>
<summary>
title value
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
b3fc5681
...
...
@@ -142,6 +142,18 @@
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.per_sheet"
>
<summary>
上传数据解析
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.rep_report"
>
<summary>
报表配置表
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.rep_group"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.rep_group_selection"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.rep_selection"
>
<summary>
条件表
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.res_account"
>
<summary>
科室核算结果
</summary>
</member>
...
...
@@ -2493,6 +2505,211 @@
数据来源 1 excel 导入 2 计算
</summary>
</member>
<member
name=
"T:Performance.EntityModels.rep_group"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group.GroupId"
>
<summary>
分组ID
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group.ReportId"
>
<summary>
报表Id
</summary>
</member>
<member
name=
"T:Performance.EntityModels.rep_group_selection"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group_selection.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group_selection.GroupId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_group_selection.SelectionId"
>
<summary>
</summary>
</member>
<member
name=
"T:Performance.EntityModels.rep_report"
>
<summary>
报表配置表
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.ID"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.ChartType"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.Sort"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.Content"
>
<summary>
sql执行语句({wh}及{w}为占位符)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.Title"
>
<summary>
报表标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.XTitle"
>
<summary>
X轴标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.XUnit"
>
<summary>
X轴单位
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.YTitle"
>
<summary>
Y轴标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.YUnit"
>
<summary>
Y轴单位
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.VTitle"
>
<summary>
值标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.VUnit"
>
<summary>
值单位
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.NTitle"
>
<summary>
name标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.NUnit"
>
<summary>
name单位
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.Formula"
>
<summary>
图表说明
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.DataType"
>
<summary>
1表示需要进行小于百分2的类型进行合并
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_report.FilterValue"
>
<summary>
图标value过滤执值
</summary>
</member>
<member
name=
"T:Performance.EntityModels.rep_selection"
>
<summary>
条件表
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.ID"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Title"
>
<summary>
条件标题
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Sort"
>
<summary>
排序
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Content"
>
<summary>
条件SQL语句
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Type"
>
<summary>
条件类型(1固定条件,2需要通过语句获取)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.InputName"
>
<summary>
控件名称
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.InputType"
>
<summary>
控件类型(1:input框、2:radio单选、3:checkbox多选、4:select单选、5:select多选、6:自动补全单选、7:自动补全多选、10:日期区间)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Required"
>
<summary>
是否必填(1表示必填0表示非必填)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.LoadType"
>
<summary>
条件加载方式 1 立即加载 2 联动加载 3 自动补全
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.LoadParent"
>
<summary>
联动加载父InputID
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.DefaultType"
>
<summary>
默认值类型(1 固定文本 2 动态结果第一项)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.DefaultValue"
>
<summary>
默认值文本
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.Joint"
>
<summary>
SQL拼接条件
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.State"
>
<summary>
条件状态 1 正常 2 可用但不显示 3 不显示不可用 4 不可用但显示
</summary>
</member>
<member
name=
"P:Performance.EntityModels.rep_selection.AddTitle"
>
<summary>
是否条件内容附加到标题中,1 附加
</summary>
</member>
<member
name=
"T:Performance.EntityModels.res_account"
>
<summary>
科室核算结果
...
...
@@ -3355,7 +3572,7 @@
</member>
<member
name=
"P:Performance.EntityModels.sys_role.Type"
>
<summary>
角色类型
角色类型
3 护士长二次绩效管理员 4 科主任二次绩效管理员
</summary>
</member>
<member
name=
"P:Performance.EntityModels.sys_role.IndexUrl"
>
...
...
performance/Performance.DtoModels/ReportData.cs
0 → 100644
View file @
b3fc5681
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
ReportData
{
public
int
ReportID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
ChartType
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
Sort
{
get
;
set
;
}
/// <summary>
/// 报表标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// X轴标题
/// </summary>
public
string
XTitle
{
get
;
set
;
}
/// <summary>
/// X轴单位
/// </summary>
public
string
XUnit
{
get
;
set
;
}
/// <summary>
/// Y轴标题
/// </summary>
public
string
YTitle
{
get
;
set
;
}
/// <summary>
/// Y轴单位
/// </summary>
public
string
YUnit
{
get
;
set
;
}
/// <summary>
/// 值标题
/// </summary>
public
string
VTitle
{
get
;
set
;
}
/// <summary>
/// 值单位
/// </summary>
public
string
VUnit
{
get
;
set
;
}
/// <summary>
/// name标题
/// </summary>
public
string
NTitle
{
get
;
set
;
}
/// <summary>
/// name单位
/// </summary>
public
string
NUnit
{
get
;
set
;
}
/// <summary>
/// 图表说明
/// </summary>
public
string
Formula
{
get
;
set
;
}
/// <summary>
/// 1表示需要进行小于百分2的类型进行合并
/// </summary>
public
Nullable
<
int
>
DataType
{
get
;
set
;
}
/// <summary>
/// 图标value过滤执值
/// </summary>
public
Nullable
<
decimal
>
FilterValue
{
get
;
set
;
}
/// <summary>
/// 图表数据
/// </summary>
public
List
<
ChartData
>
ChartData
{
get
;
set
;
}
}
/// <summary>
/// 图表
/// </summary>
public
class
ChartData
{
/// <summary>
/// X轴内容
/// </summary>
public
string
X
{
get
;
set
;
}
/// <summary>
/// Y轴内容
/// </summary>
public
string
Y
{
get
;
set
;
}
/// <summary>
/// 分类
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 值
/// </summary>
public
Double
Value
{
get
;
set
;
}
/// <summary>
/// 总量
/// </summary>
public
Double
?
Total
{
get
;
set
;
}
/// <summary>
/// ChartData 类型标签
/// </summary>
public
string
Type
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/ReportEnum.cs
0 → 100644
View file @
b3fc5681
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Text
;
namespace
Performance.DtoModels
{
/// <summary>
/// 菜单条件状态
/// </summary>
public
enum
SelectionState
{
/// <summary>
/// 1 可用并显示
/// </summary>
[
Description
(
"可用并显示"
)]
UsableAndDispaly
=
1
,
/// <summary>
/// 2 可用但不显示
/// </summary>
[
Description
(
"可用但不显示"
)]
UsableAndNotDispaly
=
2
,
/// <summary>
/// 3 不显示不可用
/// </summary>
[
Description
(
"不显示不可用"
)]
NotUsableAndNotDispaly
=
3
,
/// <summary>
/// 4 显示不可用
/// </summary>
[
Description
(
"显示但不可用"
)]
NotUsableAndDispaly
=
4
}
/// <summary>
/// 条件加载方式
/// </summary>
public
enum
LoadType
{
/// <summary>
/// 1 立即加载
/// </summary>
InstantLoad
=
1
,
/// <summary>
/// 2 联动加载
/// </summary>
LinkageLoad
=
2
,
/// <summary>
/// 3 自动补全
/// </summary>
AutoComplete
=
3
,
}
/// <summary>
/// SQL操作符
/// </summary>
public
enum
SQLOperator
{
/// <summary>
/// Equal
/// </summary>
[
Description
(
"Equal"
)]
Equal
=
1
,
/// <summary>
/// Like
/// </summary>
[
Description
(
"Like"
)]
Like
=
2
,
/// <summary>
/// In
/// </summary>
[
Description
(
"In"
)]
In
=
3
,
/// <summary>
/// Not Like
/// </summary>
[
Description
(
"Not Like"
)]
NotLike
=
4
,
/// <summary>
/// Not In
/// </summary>
[
Description
(
"Not In"
)]
NotIn
=
5
,
}
}
performance/Performance.DtoModels/Request/SelectionRequest.cs
0 → 100644
View file @
b3fc5681
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
SelectionRequest
{
public
int
HospitalId
{
get
;
set
;
}
public
int
GroupId
{
get
;
set
;
}
}
public
class
SearchReportRequest
{
public
int
HospitalId
{
get
;
set
;
}
public
int
GroupId
{
get
;
set
;
}
public
List
<
SelectionValues
>
Values
{
get
;
set
;
}
}
public
class
SelectionValues
{
public
string
Title
{
get
;
set
;
}
public
List
<
string
>
Values
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/SelectionOptions.cs
0 → 100644
View file @
b3fc5681
using
Performance.EntityModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
SelectionOptions
{
public
SelectionOptions
(
rep_selection
item
)
{
ID
=
item
.
ID
;
Title
=
item
.
Title
;
InputType
=
item
.
InputType
;
InputName
=
item
.
InputName
;
Required
=
item
.
Required
??
0
;
Sort
=
item
.
Sort
??
0
m
;
LoadType
=
item
.
LoadType
;
Options
=
new
List
<
TitleValue
>();
ParentItems
=
new
List
<
TitleValue
>();
}
/// <summary>
/// ID
/// </summary>
public
int
ID
{
get
;
}
/// <summary>
/// 排序
/// </summary>
public
decimal
Sort
{
get
;
set
;
}
/// <summary>
/// 标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 类型
/// </summary>
public
string
InputType
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
InputName
{
get
;
set
;
}
/// <summary>
/// 父控件名称
/// </summary>
public
int
ParentID
{
get
;
set
;
}
/// <summary>
/// 父控件名称
/// </summary>
public
string
ParentName
{
get
;
set
;
}
public
List
<
TitleValue
>
ParentItems
{
get
;
set
;
}
/// <summary>
/// 控件数据加载方式 1 立即加载 2 联动加载 3 自动补全
/// </summary>
public
int
LoadType
{
get
;
set
;
}
/// <summary>
/// 是否必填
/// </summary>
public
int
Required
{
get
;
set
;
}
/// <summary>
/// 默认值
/// </summary>
public
string
DefaultValue
{
get
;
set
;
}
/// <summary>
/// 数据集合
/// </summary>
public
List
<
TitleValue
>
Options
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/TitleValue.cs
View file @
b3fc5681
...
...
@@ -27,6 +27,18 @@ public class TitleValue<T>
/// </summary>
public
class
TitleValue
:
TitleValue
<
string
>
{
public
TitleValue
()
{
}
public
TitleValue
(
string
title
,
string
value
)
:
this
(
title
,
value
,
2
)
{
}
public
TitleValue
(
string
title
,
string
value
,
int
state
)
{
this
.
Title
=
title
;
this
.
Value
=
value
;
this
.
State
=
state
;
}
}
}
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
View file @
b3fc5681
...
...
@@ -104,7 +104,15 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public
virtual
DbSet
<
per_first
>
per_first
{
get
;
set
;
}
/// <summary> 上传数据解析 </summary>
public
virtual
DbSet
<
per_sheet
>
per_sheet
{
get
;
set
;
}
/// <summary> 科室核算结果 </summary>
/// <summary> 报表配置表 </summary>
public
virtual
DbSet
<
rep_report
>
rep_report
{
get
;
set
;
}
/// <summary> </summary>
public
virtual
DbSet
<
rep_group
>
rep_group
{
get
;
set
;
}
/// <summary> </summary>
public
virtual
DbSet
<
rep_group_selection
>
rep_group_selection
{
get
;
set
;
}
/// <summary> 条件表 </summary>
public
virtual
DbSet
<
rep_selection
>
rep_selection
{
get
;
set
;
}
/// <summary> 科室核算结果 </summary>
public
virtual
DbSet
<
res_account
>
res_account
{
get
;
set
;
}
/// <summary> 医生科室核算结果 </summary>
public
virtual
DbSet
<
res_accountdoctor
>
res_accountdoctor
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/rep_group.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_group.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
///
/// </summary>
[
Table
(
"rep_group"
)]
public
class
rep_group
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 分组ID
/// </summary>
public
Nullable
<
int
>
GroupId
{
get
;
set
;
}
/// <summary>
/// 报表Id
/// </summary>
public
Nullable
<
int
>
ReportId
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/rep_group_selection.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_group_selection.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
///
/// </summary>
[
Table
(
"rep_group_selection"
)]
public
class
rep_group_selection
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
GroupId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
SelectionId
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/rep_report.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_report.cs">
// * FileName: 报表配置表.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
/// 报表配置表
/// </summary>
[
Table
(
"rep_report"
)]
public
class
rep_report
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
ID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
ChartType
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
Sort
{
get
;
set
;
}
/// <summary>
/// sql执行语句({wh}及{w}为占位符)
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 报表标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// X轴标题
/// </summary>
public
string
XTitle
{
get
;
set
;
}
/// <summary>
/// X轴单位
/// </summary>
public
string
XUnit
{
get
;
set
;
}
/// <summary>
/// Y轴标题
/// </summary>
public
string
YTitle
{
get
;
set
;
}
/// <summary>
/// Y轴单位
/// </summary>
public
string
YUnit
{
get
;
set
;
}
/// <summary>
/// 值标题
/// </summary>
public
string
VTitle
{
get
;
set
;
}
/// <summary>
/// 值单位
/// </summary>
public
string
VUnit
{
get
;
set
;
}
/// <summary>
/// name标题
/// </summary>
public
string
NTitle
{
get
;
set
;
}
/// <summary>
/// name单位
/// </summary>
public
string
NUnit
{
get
;
set
;
}
/// <summary>
/// 图表说明
/// </summary>
public
string
Formula
{
get
;
set
;
}
/// <summary>
/// 1表示需要进行小于百分2的类型进行合并
/// </summary>
public
Nullable
<
int
>
DataType
{
get
;
set
;
}
/// <summary>
/// 图标value过滤执值
/// </summary>
public
Nullable
<
decimal
>
FilterValue
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/rep_selection.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_selection.cs">
// * FileName: 条件表.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
/// 条件表
/// </summary>
[
Table
(
"rep_selection"
)]
public
class
rep_selection
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 条件标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
Nullable
<
decimal
>
Sort
{
get
;
set
;
}
/// <summary>
/// 条件SQL语句
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 条件类型(1固定条件,2需要通过语句获取)
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 控件名称
/// </summary>
public
string
InputName
{
get
;
set
;
}
/// <summary>
/// 控件类型(1:input框、2:radio单选、3:checkbox多选、4:select单选、5:select多选、6:自动补全单选、7:自动补全多选、10:日期区间)
/// </summary>
public
string
InputType
{
get
;
set
;
}
/// <summary>
/// 是否必填(1表示必填0表示非必填)
/// </summary>
public
Nullable
<
int
>
Required
{
get
;
set
;
}
/// <summary>
/// 条件加载方式 1 立即加载 2 联动加载 3 自动补全
/// </summary>
public
int
LoadType
{
get
;
set
;
}
/// <summary>
/// 联动加载父InputID
/// </summary>
public
string
LoadParent
{
get
;
set
;
}
/// <summary>
/// 默认值类型(1 固定文本 2 动态结果第一项)
/// </summary>
public
Nullable
<
int
>
DefaultType
{
get
;
set
;
}
/// <summary>
/// 默认值文本
/// </summary>
public
string
DefaultValue
{
get
;
set
;
}
/// <summary>
/// SQL拼接条件
/// </summary>
public
string
Joint
{
get
;
set
;
}
/// <summary>
/// 条件状态 1 正常 2 可用但不显示 3 不显示不可用 4 不可用但显示
/// </summary>
public
Nullable
<
int
>
State
{
get
;
set
;
}
/// <summary>
/// 是否条件内容附加到标题中,1 附加
/// </summary>
public
Nullable
<
int
>
AddTitle
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/sys_role.cs
View file @
b3fc5681
...
...
@@ -27,7 +27,7 @@ public class sys_role
public
string
RoleName
{
get
;
set
;
}
/// <summary>
/// 角色类型
/// 角色类型
3 护士长二次绩效管理员 4 科主任二次绩效管理员
/// </summary>
public
Nullable
<
int
>
Type
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Performance.EntityModels.csproj
View file @
b3fc5681
...
...
@@ -70,8 +70,4 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Entity\" />
</ItemGroup>
</Project>
performance/Performance.Repository/Repository/PerforModdicRepository.cs
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" mod_
extract
.cs">
// * FileName: mod_
extract
.cs
// <copyright file=" mod_
dic
.cs">
// * FileName: mod_
dic
.cs
// </copyright>
//-----------------------------------------------------------------------
using
Performance.EntityModels
;
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// mod_
extract
Repository
/// mod_
dic
Repository
/// </summary>
public
partial
class
PerforModdicRepository
:
PerforRepository
<
mod_dic
>
{
public
PerforModdicRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
public
PerforModdicRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
...
...
performance/Performance.Repository/Repository/PerforRepgroupRepository.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_group.cs">
// * FileName: rep_group.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// rep_group Repository
/// </summary>
public
partial
class
PerforRepgroupRepository
:
PerforRepository
<
rep_group
>
{
public
PerforRepgroupRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforRepgroupselectionRepository.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_group_selection.cs">
// * FileName: rep_group_selection.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// rep_group_selection Repository
/// </summary>
public
partial
class
PerforRepgroupselectionRepository
:
PerforRepository
<
rep_group_selection
>
{
public
PerforRepgroupselectionRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforRepreportRepository.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_report.cs">
// * FileName: rep_report.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// rep_report Repository
/// </summary>
public
partial
class
PerforRepreportRepository
:
PerforRepository
<
rep_report
>
{
public
PerforRepreportRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforRepselectionRepository.cs
0 → 100644
View file @
b3fc5681
//-----------------------------------------------------------------------
// <copyright file=" rep_selection.cs">
// * FileName: rep_selection.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// rep_selection Repository
/// </summary>
public
partial
class
PerforRepselectionRepository
:
PerforRepository
<
rep_selection
>
{
public
PerforRepselectionRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Services/ReportDataService.cs
0 → 100644
View file @
b3fc5681
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.Services
{
public
class
ReportDataService
:
IAutoInjection
{
private
readonly
ILogger
<
ReportDataService
>
logger
;
private
readonly
PerforRepreportRepository
reportRepository
;
private
readonly
PerforRepselectionRepository
selectionRepository
;
private
readonly
PerforRepgroupRepository
groupRepository
;
private
readonly
PerforRepgroupselectionRepository
groupselectionRepository
;
public
ReportDataService
(
ILogger
<
ReportDataService
>
logger
,
PerforRepreportRepository
reportRepository
,
PerforRepselectionRepository
selectionRepository
,
PerforRepgroupRepository
groupRepository
,
PerforRepgroupselectionRepository
groupselectionRepository
)
{
this
.
logger
=
logger
;
this
.
reportRepository
=
reportRepository
;
this
.
selectionRepository
=
selectionRepository
;
this
.
groupRepository
=
groupRepository
;
this
.
groupselectionRepository
=
groupselectionRepository
;
}
/// <summary>
/// 查询一组报表条件
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
public
List
<
SelectionOptions
>
GetReportSelection
(
int
groupId
)
{
List
<
SelectionOptions
>
options
=
new
List
<
SelectionOptions
>();
var
groups
=
groupselectionRepository
.
GetEntities
(
w
=>
w
.
GroupId
==
groupId
);
var
arr
=
groups
.
Select
(
w
=>
w
.
SelectionId
);
var
selections
=
selectionRepository
.
GetEntities
(
w
=>
arr
.
Contains
(
w
.
ID
)
&&
w
.
State
==
1
);
var
dispaly
=
new
int
[]
{
(
int
)
SelectionState
.
UsableAndNotDispaly
,
(
int
)
SelectionState
.
NotUsableAndNotDispaly
};
foreach
(
var
item
in
selections
.
Where
(
t
=>
t
.
State
.
HasValue
&&
!
dispaly
.
Contains
(
t
.
State
.
Value
)))
{
SelectionOptionDefault
handle
=
new
SelectionOptionDefault
();
//if (item.LoadType == (int)LoadType.InstantLoad && item.Type == 2)
// handle = new SelectionOptionDynamic();
SelectionOptions
selection
=
new
SelectionOptions
(
item
);
selection
.
Options
=
handle
.
GetOptions
(
item
);
options
.
Add
(
selection
);
}
return
options
;
}
/// <summary>
/// 获取一组报表信息
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
public
object
GetReportInfo
(
int
groupId
)
{
var
groups
=
groupRepository
.
GetEntities
(
w
=>
w
.
GroupId
==
groupId
);
var
arr
=
groups
.
Select
(
w
=>
w
.
ReportId
);
var
reports
=
reportRepository
.
GetEntities
(
w
=>
arr
.
Contains
(
w
.
ID
));
return
groups
.
Select
(
w
=>
new
{
w
.
GroupId
,
w
.
ReportId
,
ReportName
=
reports
.
FirstOrDefault
(
r
=>
r
.
ID
==
w
.
ReportId
)?.
Title
});
}
/// <summary>
/// 查询报表数据
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="groupId"></param>
/// <param name="values"></param>
/// <returns></returns>
public
List
<
ReportData
>
GetReportData
(
int
hospitalId
,
int
groupId
,
List
<
SelectionValues
>
values
)
{
var
groups
=
groupRepository
.
GetEntities
(
w
=>
w
.
GroupId
==
groupId
);
var
arr1
=
groups
.
Select
(
w
=>
w
.
ReportId
);
var
reports
=
reportRepository
.
GetEntities
(
w
=>
arr1
.
Contains
(
w
.
ID
));
if
(
reports
==
null
||
!
reports
.
Any
())
throw
new
PerformanceException
(
"报表信息无效"
);
var
formats
=
GetParameterFormats
();
var
groupSelections
=
groupselectionRepository
.
GetEntities
(
w
=>
w
.
GroupId
==
groupId
);
var
arr2
=
groupSelections
.
Select
(
w
=>
w
.
SelectionId
);
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
));
List
<
ReportData
>
result
=
new
List
<
ReportData
>();
foreach
(
var
report
in
reports
)
{
var
sql
=
report
.
Content
.
ToLower
();
//不重复条件,动态拼接WHERE条件
selections
=
GetNoRepeatSelections
(
sql
,
formats
,
selections
);
string
@where
=
GetFilterSelection
(
selections
,
values
);
var
pairs
=
PredefinePlaceholder
(
values
);
pairs
.
Add
(
"wh"
,
@where
);
pairs
.
Add
(
"w"
,
$"where 1=1
{
@where
}
"
);
pairs
=
CopyToFormats
(
pairs
,
formats
);
// 替换占位符
sql
=
ReplacePlaceholder
(
selections
,
values
,
sql
,
formats
);
foreach
(
var
item
in
pairs
)
{
sql
=
Regex
.
Replace
(
sql
,
item
.
Key
,
item
.
Value
.
ToString
(),
RegexOptions
.
IgnoreCase
);
}
var
chartData
=
reportRepository
.
DapperQuery
<
ChartData
>(
sql
,
null
);
ReportData
reportData
=
new
ReportData
();
reportData
.
Title
=
AddSelectionToReportTitle
(
selections
,
values
,
report
.
Title
);
reportData
.
ChartData
=
chartData
!=
null
&&
chartData
.
Any
()
?
chartData
.
ToList
()
:
new
List
<
ChartData
>();
result
.
Add
(
reportData
);
}
return
result
;
}
/// <summary>
/// 拼接报表WHERE条件
/// </summary>
/// <param name="selections"></param>
/// <param name="values"></param>
/// <returns></returns>
private
string
GetFilterSelection
(
List
<
rep_selection
>
selections
,
List
<
SelectionValues
>
values
)
{
string
where
=
""
;
foreach
(
var
selection
in
selections
)
{
var
value
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
==
selection
.
InputName
)?.
Values
;
if
(
value
==
null
||
!
value
.
Any
())
continue
;
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Equal
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
='
{
value
.
First
()}
'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Like
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
like '%
{
value
.
First
()}
%'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotLike
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
not like '%
{
value
.
First
()}
%'"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
In
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
NotIn
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
where
+=
$" and
{
selection
.
InputName
}
not in (
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
)"
;
}
return
where
;
}
/// <summary>
/// 返回SQL中占位参数格式
/// </summary>
/// <returns></returns>
private
string
[]
GetParameterFormats
()
{
return
new
string
[]
{
"{{{0}}}"
,
"@{0}"
};
}
/// <summary>
/// 返回不会在SQL中已经占位的条件,防止条件中重复出现相同条件
/// </summary>
/// <param name="sql"></param>
/// <param name="formats"></param>
/// <param name="selections"></param>
/// <returns></returns>
private
List
<
rep_selection
>
GetNoRepeatSelections
(
string
sql
,
string
[]
formats
,
List
<
rep_selection
>
selections
)
{
Func
<
string
[],
string
,
bool
>
checkExist
=
(
patterns
,
inpatName
)
=>
{
foreach
(
var
pat
in
patterns
)
{
if
(
sql
.
IndexOf
(
string
.
Format
(
pat
,
inpatName
),
StringComparison
.
OrdinalIgnoreCase
)
>
0
)
return
true
;
}
return
false
;
};
List
<
rep_selection
>
result
=
new
List
<
rep_selection
>();
foreach
(
var
item
in
selections
)
{
if
(!
checkExist
.
Invoke
(
formats
,
item
.
InputName
))
{
result
.
Add
(
item
);
}
}
return
result
;
}
/// <summary>
/// 附加条件内容到报表标题
/// </summary>
/// <param name="selections"></param>
/// <param name="values"></param>
/// <param name="title"></param>
/// <returns></returns>
private
string
AddSelectionToReportTitle
(
List
<
rep_selection
>
selections
,
List
<
SelectionValues
>
values
,
string
title
)
{
if
(!
selections
.
Any
(
t
=>
t
.
AddTitle
==
1
))
return
title
;
string
addition
=
""
;
foreach
(
var
item
in
selections
.
Where
(
t
=>
t
.
AddTitle
==
1
))
{
if
(
values
.
Any
(
w
=>
w
.
Title
.
Equals
(
item
.
InputName
,
StringComparison
.
OrdinalIgnoreCase
)))
{
var
array
=
values
.
Any
(
w
=>
w
.
Title
.
Equals
(
item
.
InputName
,
StringComparison
.
OrdinalIgnoreCase
));
addition
+=
string
.
Join
(
","
,
array
);
}
}
return
$"
{
addition
}{
title
}
"
;
}
/// <summary>
/// 根据已经定义的SQL参数格式,生成占位及条件值
/// </summary>
/// <param name="pairs"></param>
/// <param name="formats"></param>
/// <returns></returns>
private
Dictionary
<
string
,
object
>
CopyToFormats
(
Dictionary
<
string
,
object
>
pairs
,
string
[]
formats
)
{
Dictionary
<
string
,
object
>
result
=
new
Dictionary
<
string
,
object
>();
foreach
(
var
item
in
pairs
)
{
foreach
(
var
patt
in
formats
)
{
result
.
Add
(
string
.
Format
(
patt
,
item
.
Key
),
item
.
Value
);
}
}
return
result
;
}
/// <summary>
/// 预先定义SQL中固定占位符
/// </summary>
/// <param name="values"></param>
/// <returns></returns>
private
Dictionary
<
string
,
object
>
PredefinePlaceholder
(
List
<
SelectionValues
>
values
)
{
Dictionary
<
string
,
object
>
pairs
=
new
Dictionary
<
string
,
object
>();
string
[]
keys1
=
new
string
[]
{
"year"
,
"month"
,
};
foreach
(
var
key
in
keys1
)
{
var
list
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
.
ToLower
()
==
key
)?.
Values
;
if
(
list
!=
null
&&
list
.
Any
())
{
var
arr
=
Array
.
ConvertAll
(
list
.
ToArray
(),
input
=>
int
.
Parse
(
input
));
pairs
.
Add
(
key
,
arr
.
Max
());
}
}
if
(
pairs
.
Keys
.
Contains
(
"year"
))
{
var
val
=
pairs
.
GetValue
<
int
>(
"year"
);
pairs
.
Add
(
"yesteryear"
,
val
-
1
);
}
if
(
pairs
.
Keys
.
Contains
(
"month"
))
{
var
val
=
pairs
.
GetValue
<
int
>(
"month"
);
pairs
.
Add
(
"lastmonth"
,
val
-
1
);
}
string
[]
keys3
=
new
string
[]
{
"hospitalid"
};
foreach
(
var
key
in
keys3
)
{
var
vals
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
.
ToLower
()
==
key
)?.
Values
;
if
(
vals
!=
null
&&
vals
.
Any
())
pairs
.
Add
(
key
,
string
.
Join
(
","
,
vals
));
}
return
pairs
;
}
/// <summary>
/// 替换报表占位
/// </summary>
/// <param name="selections"></param>
/// <param name="values"></param>
/// <param name="content"></param>
/// <param name="formats"></param>
/// <returns></returns>
private
string
ReplacePlaceholder
(
List
<
rep_selection
>
selections
,
List
<
SelectionValues
>
values
,
string
content
,
string
[]
formats
)
{
foreach
(
var
selection
in
selections
)
{
var
value
=
values
.
FirstOrDefault
(
w
=>
w
.
Title
==
selection
.
InputName
).
Values
;
if
(
value
==
null
||
!
value
.
Any
())
continue
;
foreach
(
var
pattern
in
formats
)
{
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Equal
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
content
=
Regex
.
Replace
(
content
,
string
.
Format
(
pattern
,
selection
.
InputName
),
$"'
{
value
.
First
()}
'"
,
RegexOptions
.
IgnoreCase
);
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
Like
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
)
||
selection
.
Joint
.
Equals
(
SQLOperator
.
NotLike
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
content
=
Regex
.
Replace
(
content
,
string
.
Format
(
pattern
,
selection
.
InputName
),
$"'%
{
value
.
First
()}
%'"
,
RegexOptions
.
IgnoreCase
);
else
if
(
selection
.
Joint
.
Equals
(
SQLOperator
.
In
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
)
||
selection
.
Joint
.
Equals
(
SQLOperator
.
NotIn
.
ToString
(),
StringComparison
.
OrdinalIgnoreCase
))
content
=
Regex
.
Replace
(
content
,
string
.
Format
(
pattern
,
selection
.
InputName
),
$"
{
string
.
Join
(
","
,
value
.
Select
(
t
=>
$"'
{
t
}
'"
))}
"
,
RegexOptions
.
IgnoreCase
);
}
}
return
content
;
}
}
public
class
SelectionOptionDefault
{
public
virtual
List
<
TitleValue
>
GetOptions
(
rep_selection
selection
)
{
List
<
TitleValue
>
values
=
new
List
<
TitleValue
>();
if
(
selection
.
Type
!=
1
)
return
values
;
if
(
string
.
IsNullOrEmpty
(
selection
.
Content
))
return
values
;
var
selectItem
=
selection
.
Content
.
Split
(
new
string
[]
{
","
},
StringSplitOptions
.
RemoveEmptyEntries
);
values
=
selectItem
.
Select
(
t
=>
{
string
[]
arr
=
t
.
Split
(
'|'
);
var
title
=
arr
[
0
];
var
value
=
arr
.
Length
>
1
?
arr
[
1
]
:
arr
[
0
];
var
state
=
value
==
selection
.
DefaultValue
?
1
:
2
;
return
new
TitleValue
(
title
,
value
,
state
);
}).
ToList
();
return
values
;
}
}
public
class
SelectionOptionDynamic
:
SelectionOptionDefault
{
public
override
List
<
TitleValue
>
GetOptions
(
rep_selection
selection
)
{
//List<TitleValue> values = new List<TitleValue>();
//if (selection.Type != 1)
// return values;
//if (string.IsNullOrEmpty(selection.Content))
// return values;
return
base
.
GetOptions
(
selection
);
}
}
}
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