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
057fcc9e
Commit
057fcc9e
authored
Jul 01, 2021
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/自定义模板抽取' into develop
parents
907b19fb
52915361
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
154 additions
and
16 deletions
+154
-16
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+3
-0
performance/Performance.DtoModels/PerExcel/ExcelEnum.cs
+8
-0
performance/Performance.Services/CustomExtractService.cs
+1
-1
performance/Performance.Services/ExConfigService.cs
+2
-1
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+1
-1
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+17
-11
performance/Performance.Services/ExtractExcelService/QueryService.cs
+1
-1
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CustomDataWrite.cs
+120
-0
performance/Performance.Services/ExtractIncomeService.cs
+1
-1
No files found.
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
057fcc9e
...
...
@@ -836,6 +836,9 @@
<member
name=
"F:Performance.DtoModels.SheetType.Assess"
>
<summary>
考核
</summary>
</member>
<member
name=
"F:Performance.DtoModels.SheetType.Custom"
>
<summary>
自定义抽取模板
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AccountUnitType"
>
<summary>
核算单元类型
...
...
performance/Performance.DtoModels/PerExcel/ExcelEnum.cs
View file @
057fcc9e
...
...
@@ -187,6 +187,14 @@ public enum SheetType
/// <summary> 考核 </summary>
[
Description
(
"考核"
)]
Assess
=
38
,
//该参数作用类似于 其他工作量
/// <summary> 医生收入 </summary>
[
Description
(
"医生收入"
)]
DoctorIncome
=
100
,
/// <summary> 自定义抽取模板 </summary>
[
Description
(
"自定义抽取模板"
)]
Custom
=
101
,
}
/// <summary>
...
...
performance/Performance.Services/CustomExtractService.cs
View file @
057fcc9e
...
...
@@ -267,7 +267,7 @@ public IEnumerable<dynamic> QueryData(sys_hospitalconfig config, string execsql,
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
p
rivate
Dictionary
<
string
,
string
>
GetParameters
(
per_allot
allot
)
p
ublic
Dictionary
<
string
,
string
>
GetParameters
(
per_allot
allot
)
{
DateTime
beginTime
=
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
);
...
...
performance/Performance.Services/ExConfigService.cs
View file @
057fcc9e
...
...
@@ -552,7 +552,8 @@ public List<TitleValue> FeeType()
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
,
(
int
)
SheetType
.
OtherWorkload
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Custom
}.
Contains
(
t
.
Value
));
if
(
type
!=
null
&&
type
.
Any
())
{
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
057fcc9e
...
...
@@ -150,7 +150,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
var
notWrite
=
!
value
.
HasValue
&&
!
string
.
IsNullOrEmpty
(
cell
.
ToString
());
if
(
cell
.
CellType
!=
CellType
.
Formula
&&
!
notWrite
)
if
(
/*cell.CellType != CellType.Formula && */
!
notWrite
)
{
cell
.
SetCellValue
<
decimal
>(
value
);
if
(
headers
!=
null
&&
headers
.
Contains
(
column
))
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
057fcc9e
...
...
@@ -4,6 +4,7 @@
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
Performance.Services.ExtractExcelService.SheetDataWrite
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
...
...
@@ -19,6 +20,7 @@ public class ExtractService : IAutoInjection
private
readonly
PersonService
personService
;
private
readonly
PerSheetService
perSheetService
;
private
readonly
DictionaryService
dictionaryService
;
private
readonly
CustomDataWrite
customDataWrite
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforCollectdataRepository
collectdataRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
...
...
@@ -31,6 +33,7 @@ public class ExtractService : IAutoInjection
PersonService
personService
,
PerSheetService
perSheetService
,
DictionaryService
dictionaryService
,
CustomDataWrite
customDataWrite
,
PerforPerallotRepository
perallotRepository
,
PerforCollectdataRepository
collectdataRepository
,
PerforPeremployeeRepository
peremployeeRepository
,
...
...
@@ -43,6 +46,7 @@ PerforPerdeptdicRepository perdeptdicRepository
this
.
personService
=
personService
;
this
.
perSheetService
=
perSheetService
;
this
.
dictionaryService
=
dictionaryService
;
this
.
customDataWrite
=
customDataWrite
;
this
.
perallotRepository
=
perallotRepository
;
this
.
collectdataRepository
=
collectdataRepository
;
this
.
peremployeeRepository
=
peremployeeRepository
;
...
...
@@ -142,19 +146,19 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
var
types
=
new
List
<
SheetType
>
{
SheetType
.
OtherIncome
,
SheetType
.
Income
,
SheetType
.
Expend
,
SheetType
.
Workload
,
SheetType
.
OtherWorkload
/*, SheetType.AccountBasic*/
};
decimal
ratio
=
60
m
;
string
accountBasicSheetName
=
""
;
for
(
int
sheetIndex
=
0
;
sheetIndex
<
workbook
.
NumberOfSheets
;
sheetIndex
++)
{
var
sheetName
=
workbook
.
GetSheetAt
(
sheetIndex
).
SheetName
;
if
(!
sheetName
.
StartsWith
(
"4.1"
))
continue
;
//
string accountBasicSheetName = "";
//
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
//
{
//
var sheetName = workbook.GetSheetAt(sheetIndex).SheetName;
//
if (!sheetName.StartsWith("4.1"))
//
continue;
accountBasicSheetName
=
sheetName
;
break
;
}
//
accountBasicSheetName = sheetName;
//
break;
//
}
var
accountBasicSheet
=
workbook
.
GetSheet
(
accountBasicSheetName
);
HandleSheet
(
workbook
,
allot
,
exdict
,
extractDto
,
groupName
,
isSingle
,
accountBasicSheet
,
ratio
,
types
,
factory
,
style
,
employeeDict
,
collectData
);
//
var accountBasicSheet = workbook.GetSheet(accountBasicSheetName);
//
HandleSheet(workbook, allot, exdict, extractDto, groupName, isSingle, accountBasicSheet, ratio, types, factory, style, employeeDict, collectData);
for
(
int
sheetIndex
=
0
;
sheetIndex
<
workbook
.
NumberOfSheets
;
sheetIndex
++)
{
...
...
@@ -162,6 +166,8 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
HandleSheet
(
workbook
,
allot
,
exdict
,
extractDto
,
groupName
,
isSingle
,
sheet
,
ratio
,
types
,
factory
,
style
,
employeeDict
,
collectData
);
}
customDataWrite
.
WriteDataToCustom
(
workbook
,
allot
,
style
);
}
private
void
HandleSheet
(
IWorkbook
workbook
,
per_allot
allot
,
Dictionary
<
ExDataDict
,
object
>
exdict
,
List
<
ExtractTransDto
>
extractDto
,
string
groupName
,
bool
isSingle
,
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
057fcc9e
...
...
@@ -125,7 +125,7 @@ private List<int> GetQueryScriptIds(int hospitalId, ref Dictionary<ExDataDict, o
{
var
extypeIds
=
new
List
<
int
>();
var
modules
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
modules
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
SheetType
!=
(
int
)
SheetType
.
Custom
);
var
items
=
new
List
<
ex_item
>();
if
(
modules
!=
null
&&
modules
.
Any
())
{
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CustomDataWrite.cs
0 → 100644
View file @
057fcc9e
using
Microsoft.Extensions.Logging
;
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Performance.Services.ExtractExcelService.SheetDataWrite
{
public
class
CustomDataWrite
:
IAutoInjection
{
private
readonly
ILogger
<
CustomDataWrite
>
logger
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforExmoduleRepository
exmoduleRepository
;
private
readonly
PerforExscriptRepository
exscriptRepository
;
private
readonly
CustomExtractService
customExtractService
;
public
CustomDataWrite
(
ILogger
<
CustomDataWrite
>
logger
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforExmoduleRepository
exmoduleRepository
,
PerforExscriptRepository
exscriptRepository
,
CustomExtractService
customExtractService
)
{
this
.
logger
=
logger
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
exmoduleRepository
=
exmoduleRepository
;
this
.
exscriptRepository
=
exscriptRepository
;
this
.
customExtractService
=
customExtractService
;
}
public
PerSheetPoint
Point
=>
new
PerSheetPoint
{
HeaderFirstRowNum
=
1
,
HeaderFirstCellNum
=
6
,
DataFirstRowNum
=
2
,
DataFirstCellNum
=
6
,
};
public
void
WriteDataToCustom
(
IWorkbook
workbook
,
per_allot
allot
,
ExcelStyle
style
)
{
var
modules
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Custom
)?.
OrderBy
(
t
=>
t
.
ModuleName
);
if
(
modules
==
null
||
!
modules
.
Any
())
return
;
var
exscripts
=
exscriptRepository
.
GetEntities
(
t
=>
modules
.
Select
(
s
=>
s
.
TypeId
).
Contains
(
t
.
TypeId
));
if
(
exscripts
==
null
||
!
exscripts
.
Any
())
return
;
var
configs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
);
if
(
configs
==
null
||
!
configs
.
Any
())
throw
new
Exception
(
"医院未配置绩效抽取信息"
);
var
parameters
=
customExtractService
.
GetParameters
(
allot
);
var
headerStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
列头
);
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
foreach
(
var
module
in
modules
)
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
if
(
sheet
==
null
)
{
sheet
=
workbook
.
CreateSheet
(
module
.
ModuleName
);
workbook
.
SetSheetOrder
(
sheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
}
var
exscript
=
exscripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
module
.
TypeId
);
if
(
exscript
==
null
)
continue
;
var
conf
=
configs
.
FirstOrDefault
(
w
=>
w
.
Id
==
(
module
.
ConfigId
??
exscript
.
ConfigId
));
if
(
conf
==
null
)
continue
;
var
execsql
=
exscript
.
ExecScript
;
var
dynamics
=
customExtractService
.
QueryData
(
conf
,
execsql
,
parameters
);
try
{
// 没数据跳过
if
(
dynamics
==
null
||
dynamics
.
Count
()
==
0
)
continue
;
var
first
=
(
IDictionary
<
string
,
object
>)
dynamics
.
ElementAt
(
0
);
var
header
=
sheet
.
GetOrCreate
(
Point
.
HeaderFirstRowNum
.
Value
);
if
(
header
!=
null
)
{
var
cellindex
=
Point
.
HeaderFirstCellNum
.
Value
;
foreach
(
var
item
in
first
)
{
var
cell
=
header
.
GetOrCreate
(
cellindex
);
cell
.
SetCellOValue
(
item
.
Key
);
cell
.
CellStyle
=
headerStyle
;
cellindex
++;
}
}
var
rowindex
=
Point
.
DataFirstRowNum
.
Value
;
for
(
int
r
=
0
;
r
<
dynamics
.
Count
();
r
++)
{
var
temp
=
(
IDictionary
<
string
,
object
>)
dynamics
.
ElementAt
(
r
);
// 行数据
var
row
=
sheet
.
GetOrCreate
(
rowindex
);
var
cellindex
=
Point
.
DataFirstCellNum
.
Value
;
foreach
(
var
item
in
temp
)
{
var
cell
=
row
.
GetOrCreate
(
cellindex
);
cell
.
SetCellOValue
(
item
.
Value
);
cell
.
CellStyle
=
cellStyle
;
cellindex
++;
}
rowindex
++;
}
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
$"自定义模板 -
{
sheet
.
SheetName
}
抽取异常:"
+
ex
);
}
}
}
}
}
performance/Performance.Services/ExtractIncomeService.cs
View file @
057fcc9e
...
...
@@ -71,7 +71,7 @@ public string Execture(int allotId)
var
configs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
);
if
(
configs
==
null
||
!
configs
.
Any
())
throw
new
PerformanceException
(
"未添加医院提取配置"
);
var
types
=
extypeRepository
.
GetEntities
(
t
=>
t
.
Source
==
100
);
var
types
=
extypeRepository
.
GetEntities
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
DoctorIncome
);
if
(
types
==
null
||
!
types
.
Any
())
throw
new
PerformanceException
(
"未配置数据提取内容"
);
Dictionary
<
string
,
List
<
IncomeDataDto
>>
pairs
=
new
Dictionary
<
string
,
List
<
IncomeDataDto
>>();
...
...
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