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
049c606c
Commit
049c606c
authored
Mar 15, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sheet格式第二版
parent
72ac1d44
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
40 deletions
+71
-40
performance/Performance.DtoModels/Response/SheetExportResponse.cs
+2
-13
performance/Performance.Repository/BaseRepository.cs
+7
-19
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeEconomic.cs
+12
-2
performance/Performance.Services/SheetSevice.cs
+50
-6
No files found.
performance/Performance.DtoModels/Response/SheetExportResponse.cs
View file @
049c606c
...
...
@@ -27,7 +27,7 @@ public class SheetExportResponse
/// <summary>
/// sheet数据
/// </summary>
public
List
<
Row
Data
>
Row
{
get
;
set
;
}
public
List
<
Row
>
Row
{
get
;
set
;
}
public
SheetExportResponse
()
{
}
...
...
@@ -37,7 +37,7 @@ public SheetExportResponse(int sheetID, string sheetName, int sheetType)
SheetName
=
sheetName
;
SheetType
=
sheetType
;
Header
=
new
List
<
Row
>();
Row
=
new
List
<
Row
Data
>();
Row
=
new
List
<
Row
>();
}
}
...
...
@@ -54,17 +54,6 @@ public Row(int rownumber)
}
}
public
class
RowData
:
Row
{
public
string
AccountingUnit
{
get
;
set
;
}
public
RowData
(
int
rownumber
,
string
accountingUnit
)
{
Rownumber
=
rownumber
;
AccountingUnit
=
accountingUnit
;
Data
=
new
List
<
Cell
>();
}
}
public
class
Cell
{
public
int
PointCell
{
get
;
set
;
}
...
...
performance/Performance.Repository/BaseRepository.cs
View file @
049c606c
...
...
@@ -69,36 +69,24 @@ public bool Update(TEntity entity)
return
context
.
SaveChanges
()
>
0
;
}
public
IEnumerable
<
TEntity
>
GetEntities
()
public
List
<
TEntity
>
GetEntities
()
{
return
context
.
Set
<
TEntity
>();
return
context
.
Set
<
TEntity
>()
.
ToList
()
;
}
public
IEnumerable
<
TEntity
>
GetEntities
(
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
public
List
<
TEntity
>
GetEntities
(
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
{
return
CompileQuery
(
exp
);
return
context
.
Set
<
TEntity
>().
Where
(
exp
).
ToList
(
);
}
public
IEnumerable
<
TEntity
>
GetEntitiesForPaging
(
int
Page
,
int
pageSize
,
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
public
List
<
TEntity
>
GetEntitiesForPaging
(
int
Page
,
int
pageSize
,
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
{
return
CompileQuery
(
exp
).
Skip
((
Page
-
1
)
*
pageSize
).
Take
(
pageSize
);
return
context
.
Set
<
TEntity
>().
Where
(
exp
).
Skip
((
Page
-
1
)
*
pageSize
).
Take
(
pageSize
).
ToList
(
);
}
public
TEntity
GetEntity
(
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
{
return
CompileQuerySingle
(
exp
);
}
private
IEnumerable
<
TEntity
>
CompileQuery
(
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
{
var
func
=
EF
.
CompileQuery
((
DbContext
context
,
Expression
<
Func
<
TEntity
,
bool
>>
exps
)
=>
context
.
Set
<
TEntity
>().
Where
(
exp
));
return
func
(
context
,
exp
);
}
private
TEntity
CompileQuerySingle
(
Expression
<
Func
<
TEntity
,
bool
>>
exp
)
{
var
func
=
EF
.
CompileQuery
((
DbContext
context
,
Expression
<
Func
<
TEntity
,
bool
>>
exps
)
=>
context
.
Set
<
TEntity
>().
FirstOrDefault
(
exp
));
return
func
(
context
,
exp
);
return
context
.
Set
<
TEntity
>().
FirstOrDefault
(
exp
);
}
}
}
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeEconomic.cs
View file @
049c606c
...
...
@@ -28,6 +28,7 @@ public PerSheet ProcessCompute(PerExcel excel)
PerData
=
new
List
<
IPerData
>()
};
List
<
PerData
>
perDataList
=
new
List
<
PerData
>();
//初始核算单元列头
compSheet
.
PerHeader
.
Add
(
new
PerHeader
{
CellValue
=
"核算单元"
,
Level
=
0
,
MergeCell
=
1
,
MergeRow
=
2
,
PointCell
=
0
,
PointRow
=
0
});
//起始列
...
...
@@ -49,7 +50,8 @@ public PerSheet ProcessCompute(PerExcel excel)
foreach
(
var
group
in
dataList
.
GroupBy
(
t
=>
t
.
UnitType
))
{
var
typeName
=
$"
{
GetCleanSheetName
(
sheet
.
SheetName
)}
(
{
group
.
Key
}
)"
;
var
ds
=
group
.
GroupBy
(
t
=>
t
.
AccountingUnit
).
Select
(
t
=>
new
PerData
var
ds
=
group
.
Where
(
t
=>
t
.
CellValue
.
HasValue
&&
t
.
CellValue
.
Value
>
0
)
.
GroupBy
(
t
=>
t
.
AccountingUnit
).
Select
(
t
=>
new
PerData
{
UnitType
=
group
.
Key
,
AccountingUnit
=
t
.
Key
,
...
...
@@ -58,7 +60,7 @@ public PerSheet ProcessCompute(PerExcel excel)
RowNumber
=
dataList
.
FirstOrDefault
(
s
=>
s
.
AccountingUnit
==
t
.
Key
&&
s
.
UnitType
==
group
.
Key
)?.
RowNumber
??
0
});
compSheet
.
PerData
.
AddRange
(
ds
);
perDataList
.
AddRange
(
ds
);
//创建子集头部信息
PerHeader
childHeader
=
new
PerHeader
(
1
,
childPointCell
,
typeName
,
1
,
1
,
1
,
null
);
headList
.
Add
(
childHeader
);
...
...
@@ -71,6 +73,14 @@ public PerSheet ProcessCompute(PerExcel excel)
pointCell
=
pointCell
+
headList
.
Count
;
}
}
int
number
=
0
;
foreach
(
var
accountingUnit
in
perDataList
.
OrderBy
(
t
=>
t
.
RowNumber
).
Select
(
t
=>
t
.
AccountingUnit
).
Distinct
())
{
perDataList
.
Where
(
t
=>
t
.
AccountingUnit
==
accountingUnit
).
ToList
().
ForEach
(
item
=>
item
.
RowNumber
=
number
);
number
++;
}
compSheet
.
PerData
.
AddRange
(
perDataList
);
return
compSheet
;
}
...
...
performance/Performance.Services/SheetSevice.cs
View file @
049c606c
using
AutoMapper
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -128,17 +129,60 @@ public SheetExportResponse SheetExport(int sheetID)
rowhead2
.
Data
.
Add
(
new
Cell
(
header
.
PointCell
.
Value
,
header
.
CellValue
,
header
.
MergeRow
.
Value
,
header
.
MergeCell
.
Value
));
}
}
List
<
im_header
>
headers
=
new
List
<
im_header
>();
foreach
(
var
head
in
headList
)
{
if
(!
headList
.
Any
(
t
=>
t
.
ParentID
==
head
.
ID
))
headers
.
Add
(
head
);
}
//创建数据行
Row
Data
rowbody
=
null
;
foreach
(
var
data
in
dataList
.
OrderBy
(
t
=>
t
.
RowNumber
))
Row
rowbody
=
null
;
foreach
(
var
rowNumber
in
dataList
.
Select
(
t
=>
t
.
RowNumber
).
OrderBy
(
t
=>
t
).
Distinct
(
))
{
var
header
=
headList
.
Where
(
t
=>
t
.
CellValue
==
data
.
TypeName
).
OrderByDescending
(
t
=>
t
.
ParentID
).
FirstOrDefault
();
if
(
rowbody
==
null
||
rowbody
.
Rownumber
!=
data
.
RowNumber
)
foreach
(
var
head
in
headers
)
{
rowbody
=
new
RowData
(
data
.
RowNumber
.
Value
,
data
.
AccountingUnit
);
if
(
rowbody
==
null
||
rowbody
.
Rownumber
!=
rowNumber
)
{
rowbody
=
new
Row
(
rowNumber
??
0
);
response
.
Row
.
Add
(
rowbody
);
}
rowbody
.
Data
.
Add
(
new
Cell
(
header
.
PointCell
.
Value
,
data
.
CellValue
,
1
,
1
));
if
(
head
.
CellValue
.
Contains
(
"核算单元"
))
{
if
(
head
.
CellValue
.
Contains
(
"医生组"
))
{
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
&&
t
.
UnitType
==
1
).
AccountingUnit
;
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
else
if
(
head
.
CellValue
.
Contains
(
"护理组"
))
{
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
&&
t
.
UnitType
==
2
).
AccountingUnit
;
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
else
{
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
).
AccountingUnit
;
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
}
else
if
(
head
.
CellValue
.
Contains
(
"科室名称"
))
{
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
).
Department
;
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
else
if
(
head
.
CellValue
.
Contains
(
"备注"
))
{
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
).
Remark
;
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
else
if
(!
rowbody
.
Data
.
Any
(
t
=>
t
.
PointCell
==
head
.
PointCell
))
{
var
accountingUnit
=
dataList
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
).
AccountingUnit
;
var
value
=
dataList
.
FirstOrDefault
(
t
=>
t
.
AccountingUnit
==
accountingUnit
&&
t
.
TypeName
==
head
.
CellValue
)?.
CellValue
;
if
(
value
.
HasValue
&&
value
.
Value
>
0
)
rowbody
.
Data
.
Add
(
new
Cell
(
head
.
PointCell
.
Value
,
value
,
1
,
1
));
}
}
}
}
...
...
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