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
235e54d3
Commit
235e54d3
authored
Dec 16, 2021
by
纪旭 韦
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/绩效发放
# Conflicts: # performance/Performance.Services/ComputeService.cs
parents
439f4778
a19c74c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
54 deletions
+67
-54
performance/Performance.Api/Controllers/TemplateController.cs
+2
-4
performance/Performance.Services/ComputeService.cs
+14
-15
performance/Performance.Services/DownloadService.cs
+23
-10
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+27
-24
performance/Performance.Services/ExtractExcelService/SheetDataWrite/IncomeDataWrite.cs
+1
-1
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
235e54d3
...
@@ -38,7 +38,6 @@ public class TemplateController : Controller
...
@@ -38,7 +38,6 @@ public class TemplateController : Controller
private
readonly
AllotService
allotService
;
private
readonly
AllotService
allotService
;
private
readonly
LogManageService
logService
;
private
readonly
LogManageService
logService
;
private
readonly
IServiceScopeFactory
serviceScopeFactory
;
private
readonly
IServiceScopeFactory
serviceScopeFactory
;
private
readonly
IBackgroundTaskQueue
_backgroundTaskQueue
;
private
readonly
ExtractService
extractService
;
private
readonly
ExtractService
extractService
;
public
TemplateController
(
public
TemplateController
(
...
@@ -53,7 +52,6 @@ public class TemplateController : Controller
...
@@ -53,7 +52,6 @@ public class TemplateController : Controller
HospitalService
hospitalService
,
HospitalService
hospitalService
,
AllotService
allotService
,
AllotService
allotService
,
LogManageService
logService
,
LogManageService
logService
,
IBackgroundTaskQueue
backgroundTaskQueue
,
IServiceScopeFactory
serviceScopeFactory
,
IServiceScopeFactory
serviceScopeFactory
,
ExtractService
extractService
)
ExtractService
extractService
)
{
{
...
@@ -69,7 +67,6 @@ public class TemplateController : Controller
...
@@ -69,7 +67,6 @@ public class TemplateController : Controller
this
.
allotService
=
allotService
;
this
.
allotService
=
allotService
;
this
.
logService
=
logService
;
this
.
logService
=
logService
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
_backgroundTaskQueue
=
backgroundTaskQueue
;
this
.
extractService
=
extractService
;
this
.
extractService
=
extractService
;
}
}
...
@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -240,8 +237,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
{
{
logger
.
LogInformation
(
"同一项目中进行提取"
);
logger
.
LogInformation
(
"同一项目中进行提取"
);
_backgroundTaskQueue
.
QueueBackgroundWorkItem
(
async
token
=>
Task
.
Run
(()
=>
{
{
Thread
.
Sleep
(
1000
);
using
(
var
scope
=
serviceScopeFactory
.
CreateScope
())
using
(
var
scope
=
serviceScopeFactory
.
CreateScope
())
{
{
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
ExtractService
>();
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
ExtractService
>();
...
...
performance/Performance.Services/ComputeService.cs
View file @
235e54d3
...
@@ -2001,24 +2001,23 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
...
@@ -2001,24 +2001,23 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
/// <returns></returns>
/// <returns></returns>
public
List
<
cof_alias
>
CustomColumnHeaders
(
int
hospitalId
,
string
route
)
public
List
<
cof_alias
>
CustomColumnHeaders
(
int
hospitalId
,
string
route
)
{
{
var
alias
=
cofaliasRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
Route
.
Equals
(
route
,
StringComparison
.
OrdinalIgnoreCase
));
var
init
=
new
List
<
cof_alias
>();
var
alias
=
cofaliasRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
)
??
new
List
<
cof_alias
>();
alias
=
alias
.
Where
(
t
=>
t
.
Route
.
Equals
(
route
,
StringComparison
.
OrdinalIgnoreCase
)).
OrderBy
(
w
=>
w
.
Id
).
ToList
()
??
new
List
<
cof_alias
>();
var
pairs
=
new
Dictionary
<
string
,
List
<
cof_alias
>>
if
(
alias
==
null
||
alias
.
Count
==
0
)
{
{
{
"/result/compute"
,
ComputeConfig
.
AllComputeView
},
var
pairs
=
new
Dictionary
<
string
,
List
<
cof_alias
>>
{
"/result/wholehospital"
,
ComputeConfig
.
AllComputePersonView
},
{
{
"/result/print/compute"
,
ComputeConfig
.
AllComputeDepartmentView
},
{
"/result/compute"
,
ComputeConfig
.
AllComputeView
},
{
"/result/wholehospital"
,
ComputeConfig
.
AllComputePersonView
},
{
"/result/print/compute"
,
ComputeConfig
.
AllComputeDepartmentView
},
{
"/report/wholehospital_grant"
,
ComputeConfig
.
AllComputeViewByDate
},
{
"/report/wholehospital_grant"
,
ComputeConfig
.
AllComputeViewByDate
},
{
"/report/wholehospital_accounting_grant"
,
ComputeConfig
.
AllComputeDepartmentViewByDate
},
{
"/report/wholehospital_accounting_grant"
,
ComputeConfig
.
AllComputeDepartmentViewByDate
},
{
"/report/wholehospital_finance_grant"
,
ComputeConfig
.
AllComputePersonViewByDate
},
{
"/report/wholehospital_finance_grant"
,
ComputeConfig
.
AllComputePersonViewByDate
},
};
};
var
init
=
pairs
.
ContainsKey
(
route
.
ToLower
())
?
pairs
[
route
.
ToLower
()]
:
new
List
<
cof_alias
>();
init
=
pairs
.
ContainsKey
(
route
.
ToLower
())
?
pairs
[
route
.
ToLower
()]
:
new
List
<
cof_alias
>();
foreach
(
var
item
in
init
)
{
item
.
HospitalId
=
hospitalId
;
item
.
Route
=
route
;
item
.
OriginalName
=
item
.
Alias
;
}
}
if
(
alias
!=
null
&&
alias
.
Count
>
0
)
if
(
alias
!=
null
&&
alias
.
Count
>
0
)
...
...
performance/Performance.Services/DownloadService.cs
View file @
235e54d3
...
@@ -209,11 +209,12 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
...
@@ -209,11 +209,12 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
if
(
dynamics
!=
null
&&
dynamics
.
Count
()
>
0
)
if
(
dynamics
!=
null
&&
dynamics
.
Count
()
>
0
)
{
{
worksheet
.
SetValue
(
1
,
1
,
$"
{
allot
.
Year
}
年
{
allot
.
Month
}
月
{
hospital
.
HosName
}
医院 ---
{
name
}
"
);
var
headers
=
((
IDictionary
<
string
,
object
>)
dynamics
.
ElementAt
(
0
)).
Keys
;
var
headers
=
((
IDictionary
<
string
,
object
>)
dynamics
.
ElementAt
(
0
)).
Keys
;
for
(
int
col
=
0
;
col
<
headList
.
Count
;
col
++)
for
(
int
col
=
0
;
col
<
headList
.
Count
;
col
++)
{
{
worksheet
.
SetValue
(
1
,
col
+
1
,
headList
[
col
].
Alias
);
worksheet
.
SetValue
(
2
,
col
+
1
,
headList
[
col
].
Alias
);
}
}
for
(
int
col
=
0
;
col
<
headList
.
Count
;
col
++)
for
(
int
col
=
0
;
col
<
headList
.
Count
;
col
++)
{
{
...
@@ -223,23 +224,35 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
...
@@ -223,23 +224,35 @@ public string AllComputerDown(sys_hospital hospital,List<dynamic> dynamics, stri
var
temp
=
(
IDictionary
<
string
,
object
>)
data
;
var
temp
=
(
IDictionary
<
string
,
object
>)
data
;
var
value
=
temp
[
headList
[
col
].
Name
];
var
value
=
temp
[
headList
[
col
].
Name
];
worksheet
.
Cells
[
row
+
2
,
col
+
1
].
Value
=
value
;
worksheet
.
Cells
[
row
+
3
,
col
+
1
].
Value
=
value
;
}
}
if
(
col
==
0
)
if
(
col
==
0
)
worksheet
.
SetValue
(
dynamics
.
Count
()
+
2
,
col
+
1
,
"合计"
);
worksheet
.
SetValue
(
dynamics
.
Count
()
+
2
,
col
+
1
,
"合计"
);
else
else
worksheet
.
Cells
[
dynamics
.
Count
()
+
2
,
col
+
1
].
Formula
=
string
.
Format
(
"SUM({0})"
,
new
ExcelAddress
(
2
,
col
+
1
,
dynamics
.
Count
()
+
1
,
col
+
1
).
Address
);
worksheet
.
Cells
[
dynamics
.
Count
()
+
2
,
col
+
1
].
Formula
=
string
.
Format
(
"SUM({0})"
,
new
ExcelAddress
(
2
,
col
+
1
,
dynamics
.
Count
()
+
1
,
col
+
1
).
Address
);
}
}
}
worksheet
.
View
.
FreezePanes
(
2
,
1
);
#
region
样式设置
for
(
int
row
=
worksheet
.
Dimension
.
Start
.
Row
;
row
<=
worksheet
.
Dimension
.
End
.
Row
;
row
++)
for
(
int
row
=
worksheet
.
Dimension
.
Start
.
Row
;
row
<=
worksheet
.
Dimension
.
End
.
Row
;
row
++)
{
for
(
int
col
=
worksheet
.
Dimension
.
Start
.
Column
;
col
<=
worksheet
.
Dimension
.
End
.
Column
;
col
++)
{
{
worksheet
.
Cells
[
row
,
col
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Row
(
row
).
Height
=
20
;
worksheet
.
Cells
[
row
,
col
].
Style
.
Numberformat
.
Format
=
"#,##0.00"
;
for
(
int
col
=
worksheet
.
Dimension
.
Start
.
Column
;
col
<=
worksheet
.
Dimension
.
End
.
Column
;
col
++)
{
worksheet
.
Cells
[
row
,
col
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
row
,
col
].
Style
.
Numberformat
.
Format
=
"#,##0.00"
;
worksheet
.
Cells
[
row
,
col
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
}
}
}
worksheet
.
Cells
[
1
,
1
,
1
,
headList
.
Count
].
Merge
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
headList
.
Count
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
headList
.
Count
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
headList
.
Count
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
headList
.
Count
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Row
(
1
).
Height
=
24
;
worksheet
.
Cells
[
2
,
1
,
2
,
headList
.
Count
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
View
.
FreezePanes
(
3
,
1
);
worksheet
.
Cells
.
AutoFitColumns
();
#
endregion
}
}
package
.
Save
();
package
.
Save
();
}
}
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
235e54d3
...
@@ -52,40 +52,43 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -52,40 +52,43 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
pairs
.
Add
(
workbook
.
GetSheetAt
(
i
).
SheetName
,
i
);
pairs
.
Add
(
workbook
.
GetSheetAt
(
i
).
SheetName
,
i
);
}
}
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
OrderBy
(
t
=>
t
.
ModuleName
))
try
{
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
OrderBy
(
t
=>
t
.
ModuleName
))
if
(
sheet
==
null
)
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
if
(
sheet
==
null
)
{
string
[]
keyArray
=
new
string
[]
{
"开单"
,
"就诊"
,
"执行"
};
if
(
keyArray
.
Any
(
key
=>
module
.
ModuleName
.
Contains
(
key
)))
{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
().
StartsWith
(
"1."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
if
(
copysheet
==
null
)
continue
;
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
}
}
}
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
string
[]
keyArray
=
new
string
[]
{
"开单"
,
"就诊"
,
"执行"
}
;
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
())
;
if
(
keyArray
.
Any
(
key
=>
module
.
ModuleName
.
Contains
(
key
))
)
if
(
sheet
==
null
)
{
{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
StartsWith
(
"1
."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
().
StartsWith
(
"3
."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
if
(
copysheet
==
null
)
continue
;
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
var
point
=
PerSheetDataFactory
.
GetDataRead
(
SheetType
.
Workload
)?.
Point
;
ClearSheetTemplate
(
newSheet
,
point
,
(
SheetType
)
module
.
SheetType
);
}
}
}
}
}
}
catch
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}
.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
if
(
sheet
==
null
)
{
//string key = "工作量";
//if (module.ModuleName.Contains(key))
//{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
StartsWith
(
"3."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
var
point
=
PerSheetDataFactory
.
GetDataRead
(
SheetType
.
Workload
)?.
Point
;
ClearSheetTemplate
(
newSheet
,
point
,
(
SheetType
)
module
.
SheetType
);
//}
}
}
}
}
}
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/IncomeDataWrite.cs
View file @
235e54d3
...
@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
...
@@ -49,7 +49,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if
(
exdict
.
ContainsKey
(
ExDataDict
.
IncomeFactor
)
&&
exdict
[
ExDataDict
.
IncomeFactor
]
is
List
<
cof_drugtype_factor
>
factors
&&
factors
.
Any
(
t
=>
t
.
ExModuleId
==
module
.
Id
))
if
(
exdict
.
ContainsKey
(
ExDataDict
.
IncomeFactor
)
&&
exdict
[
ExDataDict
.
IncomeFactor
]
is
List
<
cof_drugtype_factor
>
factors
&&
factors
.
Any
(
t
=>
t
.
ExModuleId
==
module
.
Id
))
{
{
factors
=
factors
.
Where
(
t
=>
t
.
ExModuleId
==
module
.
Id
).
ToList
();
factors
=
factors
.
Where
(
t
=>
t
.
ExModuleId
==
module
.
Id
).
ToList
();
categories
=
categories
.
Union
(
factors
.
Select
(
t
=>
t
.
Charge
)).
Distinct
();
//
categories = categories.Union(factors.Select(t => t.Charge)).Distinct();
headers
=
categories
.
GroupJoin
(
factors
,
inner
=>
new
{
category
=
inner
.
NoBlank
()
},
outer
=>
new
{
category
=
outer
.
Charge
.
NoBlank
()
},
(
inner
,
outer
)
=>
new
{
inner
,
outer
})
headers
=
categories
.
GroupJoin
(
factors
,
inner
=>
new
{
category
=
inner
.
NoBlank
()
},
outer
=>
new
{
category
=
outer
.
Charge
.
NoBlank
()
},
(
inner
,
outer
)
=>
new
{
inner
,
outer
})
.
Select
(
t
=>
new
ExcelHeader
.
Select
(
t
=>
new
ExcelHeader
{
{
...
...
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