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
97a487e5
Commit
97a487e5
authored
Jun 08, 2022
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Plain Diff
合并梧州版
parents
6b1dd702
32fb6cdd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
53 deletions
+103
-53
performance/Performance.Services/ExConfigService.cs
+7
-4
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+52
-13
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+44
-36
No files found.
performance/Performance.Services/ExConfigService.cs
View file @
97a487e5
...
@@ -112,14 +112,14 @@ public void DefaultModules(int hospitalId)
...
@@ -112,14 +112,14 @@ public void DefaultModules(int hospitalId)
public
ex_module
AddModule
(
ModModuleRequest
request
)
public
ex_module
AddModule
(
ModModuleRequest
request
)
{
{
if
(!
new
int
[]
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}.
Contains
(
request
.
SheetType
.
Value
))
if
(!
new
int
[]
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
Other
Income
,
(
int
)
SheetType
.
Other
Workload
,
(
int
)
SheetType
.
Assess
}.
Contains
(
request
.
SheetType
.
Value
))
throw
new
PerformanceException
(
"模块类型错误,只支持收入模板配置"
);
throw
new
PerformanceException
(
"模块类型错误,只支持收入模板配置"
);
string
addname
=
""
;
string
addname
=
""
;
if
(
request
.
SheetType
==
(
int
)
SheetType
.
Income
)
if
(
request
.
SheetType
==
(
int
)
SheetType
.
Income
)
{
{
if
(
request
.
ModuleName
.
IndexOf
(
"开单收入"
)
==
-
1
&&
request
.
ModuleName
.
IndexOf
(
"就诊收入"
)
==
-
1
&&
request
.
ModuleName
.
IndexOf
(
"执行收入"
)
==
-
1
)
//
if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
throw
new
PerformanceException
(
"模块名称规则错误"
);
//
throw new PerformanceException("模块名称规则错误");
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
// throw new PerformanceException("模块名称规则错误,请使用全中文命名");
// throw new PerformanceException("模块名称规则错误,请使用全中文命名");
...
@@ -172,7 +172,10 @@ public ex_module AddModule(ModModuleRequest request)
...
@@ -172,7 +172,10 @@ public ex_module AddModule(ModModuleRequest request)
sort
[
1
]
+=
1
;
sort
[
1
]
+=
1
;
addname
=
$"
{
sort
[
0
]}
.
{
sort
[
1
]}
"
+
request
.
ModuleName
;
addname
=
$"
{
sort
[
0
]}
.
{
sort
[
1
]}
"
+
request
.
ModuleName
;
}
}
else
{
addname
=
request
.
ModuleName
;
}
ex_module
entity
=
new
ex_module
ex_module
entity
=
new
ex_module
{
{
ModuleName
=
addname
,
ModuleName
=
addname
,
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
97a487e5
...
@@ -54,8 +54,30 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -54,8 +54,30 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
try
try
{
{
var
sheetNames
=
workbook
.
GetAllNames
().
Select
(
w
=>
w
.
SheetName
);
//foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
OrderBy
(
t
=>
t
.
ModuleName
))
//{
// 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;
// try
// {
// var newSheet = copysheet.CopySheet(module.ModuleName, true);
// workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
// }
// catch (Exception)
// {
// }
// }
// }
//}
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
no
=
module
.
ModuleName
.
GetNo
();
var
no
=
module
.
ModuleName
.
GetNo
();
var
name
=
sheetNames
.
FirstOrDefault
(
name
=>
name
.
StartsWith
(
no
))
??
module
.
ModuleName
;
var
name
=
sheetNames
.
FirstOrDefault
(
name
=>
name
.
StartsWith
(
no
))
??
module
.
ModuleName
;
...
@@ -63,18 +85,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -63,18 +85,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
if
(
sheet
==
null
)
if
(
sheet
==
null
)
{
{
string
[]
keyArray
=
new
string
[]
{
"开单"
,
"就诊"
,
"执行"
};
ExcelStyle
style
=
new
ExcelStyle
(
workbook
);
if
(
keyArray
.
Any
(
key
=>
name
.
Contains
(
key
)))
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
列头
,
CellFormat
.
默认
);
{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
().
StartsWith
(
"1."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
().
StartsWith
(
"1.0."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
var
newSheet
=
workbook
.
CreateSheet
(
module
.
ModuleName
);
if
(
copysheet
==
null
)
continue
;
newSheet
.
GetOrCreate
(
1
).
GetOrCreate
(
6
).
SetCellValue
(
"护理组分割比例:"
);
var
newSheet
=
copysheet
.
CopySheet
(
name
,
true
);
newSheet
.
GetOrCreate
(
1
).
GetOrCreate
(
6
).
CellStyle
=
cellStyle
;
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
newSheet
.
GetOrCreate
(
2
).
GetOrCreate
(
6
).
SetCellValue
(
"医生组分割比例:"
);
}
newSheet
.
GetOrCreate
(
2
).
GetOrCreate
(
6
).
CellStyle
=
cellStyle
;
newSheet
.
GetOrCreate
(
3
).
GetOrCreate
(
6
).
SetCellValue
(
"医技组分割比例:"
);
newSheet
.
GetOrCreate
(
3
).
GetOrCreate
(
6
).
CellStyle
=
cellStyle
;
var
r5
=
newSheet
.
GetOrCreate
(
4
);
r5
.
GetOrCreate
(
0
).
SetCellValue
(
"核算收入(医技组)"
);
r5
.
GetOrCreate
(
1
).
SetCellValue
(
"核算收入(医生组)"
);
r5
.
GetOrCreate
(
2
).
SetCellValue
(
"核算收入(护理组)"
);
r5
.
GetOrCreate
(
3
).
SetCellValue
(
"核算单元(医技组)"
);
r5
.
GetOrCreate
(
4
).
SetCellValue
(
"核算单元(医生组)"
);
r5
.
GetOrCreate
(
5
).
SetCellValue
(
"核算单元(护理组)"
);
r5
.
GetOrCreate
(
6
).
SetCellValue
(
"科室名称"
);
r5
.
GetOrCreate
(
0
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
1
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
2
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
3
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
4
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
5
).
CellStyle
=
cellStyle
;
r5
.
GetOrCreate
(
6
).
CellStyle
=
cellStyle
;
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
))
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
no
=
module
.
ModuleName
.
GetNo
();
var
no
=
module
.
ModuleName
.
GetNo
();
...
@@ -93,7 +132,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -93,7 +132,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
}
}
}
}
}
}
catch
catch
(
Exception
ex
)
{
{
}
}
}
}
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
97a487e5
...
@@ -131,8 +131,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -131,8 +131,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{
{
dataFirstRowNum
=
point
.
DataFirstRowNum
.
Value
;
dataFirstRowNum
=
point
.
DataFirstRowNum
.
Value
;
RemoveIncomeRow
(
sheet
,
point
);
RemoveIncomeRow
(
sheet
,
point
);
WriteSheetIncomeData
(
sheet
,
columnHeader
,
point
,
style
,
headers
,
data
,
rows
,
dataFirstRowNum
);
var
endRowNum
=
WriteSheetIncomeData
(
sheet
,
columnHeader
,
point
,
style
,
headers
,
data
,
rows
,
dataFirstRowNum
);
dataFirstRowNum
=
point
.
DataFirstRowNum
.
Value
+
rows
.
Count
;
dataFirstRowNum
=
endRowNum
;
}
}
if
(
data
==
null
||
!
data
.
Any
())
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
...
@@ -180,10 +180,10 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -180,10 +180,10 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if
(
string
.
IsNullOrEmpty
(
column
))
continue
;
if
(
string
.
IsNullOrEmpty
(
column
))
continue
;
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
//数据为空,且单元格值不为空,不写入数据(保留原始值)
if
(
value
.
HasValue
&&
value
!=
0
)
// 22.3.29 ry 只要是提取的列头全部覆盖数据
if
(
headers
!=
null
&&
headers
.
Contains
(
column
)
&&
value
.
HasValue
&&
value
!=
0
)
{
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
SetCellValue
<
decimal
>(
value
);
if
(
headers
!=
null
&&
headers
.
Contains
(
column
))
cell
.
CellStyle
=
cellStyle
;
cell
.
CellStyle
=
cellStyle
;
}
}
...
@@ -223,33 +223,33 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -223,33 +223,33 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
foreach
(
string
department
in
departments
)
foreach
(
string
department
in
departments
)
{
{
var
deptData
=
data
.
Where
(
t
=>
(
t
.
Department
??
""
)
==
department
);
var
deptData
=
data
.
Where
(
t
=>
(
t
.
Department
??
""
)
==
department
);
if
(
deptData
!=
null
&&
deptData
.
Any
())
var
row
=
sheet
.
GetOrCreate
(
dataFirstRowNum
);
for
(
int
cellIndex
=
point
.
HeaderFirstCellNum
.
Value
;
cellIndex
<
columnHeader
.
LastCellNum
;
cellIndex
++)
{
{
var
column
=
columnHeader
.
GetCell
(
cellIndex
).
GetDecodeEscapes
()?.
Replace
(
"("
,
"("
).
Replace
(
")"
,
")"
);
var
row
=
sheet
.
GetOrCreate
(
dataFirstRowNum
);
var
cell
=
row
.
CreateCell
(
cellIndex
);
for
(
int
cellIndex
=
point
.
HeaderFirstCellNum
.
Value
;
cellIndex
<
columnHeader
.
LastCellNum
;
cellIndex
++)
if
(
filed
.
ContainsKey
(
column
))
{
{
var
value
=
(
deptData
!=
null
&&
deptData
.
Any
())
?
filed
[
column
]?.
Invoke
(
deptData
.
First
())
:
""
;
var
column
=
columnHeader
.
GetCell
(
cellIndex
).
GetDecodeEscapes
()?.
Replace
(
"("
,
"("
).
Replace
(
")"
,
")"
);
cell
.
SetCellOValue
(
value
);
var
cell
=
row
.
CreateCell
(
cellIndex
);
cell
.
CellStyle
=
cellStyle
;
}
if
(
filed
.
ContainsKey
(
column
))
else
if
(
sheetType
==
SheetType
.
Income
||
(
headers
!=
null
&&
headers
.
Contains
(
column
)))
{
{
var
value
=
filed
[
column
]?.
Invoke
(
deptData
.
First
());
var
value
=
(
deptData
!=
null
&&
deptData
.
Any
())
cell
.
SetCellOValue
(
value
);
?
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
cell
.
CellStyle
=
cellStyle
;
:
0
;
}
cell
.
SetCellValue
<
decimal
>(
value
);
else
if
(
sheetType
==
SheetType
.
Income
||
(
headers
!=
null
&&
headers
.
Contains
(
column
)))
cell
.
CellStyle
=
cellStyle
;
{
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
CellStyle
=
cellStyle
;
}
}
}
dataFirstRowNum
++;
}
}
dataFirstRowNum
++;
}
}
}
}
private
static
void
WriteSheetIncomeData
(
ISheet
sheet
,
IRow
columnHeader
,
PerSheetPoint
point
,
ExcelStyle
style
,
List
<
string
>
headers
,
private
static
int
WriteSheetIncomeData
(
ISheet
sheet
,
IRow
columnHeader
,
PerSheetPoint
point
,
ExcelStyle
style
,
List
<
string
>
headers
,
List
<
ExtractTransDto
>
data
,
List
<
IncomeRow
>
incomes
,
int
dataFirstRowNum
)
List
<
ExtractTransDto
>
data
,
List
<
IncomeRow
>
incomes
,
int
dataFirstRowNum
)
{
{
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
...
@@ -286,22 +286,30 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -286,22 +286,30 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
cell
.
SetCellValue
(
content
.
Value
);
cell
.
SetCellValue
(
content
.
Value
);
cell
.
CellStyle
=
cellStyle
;
cell
.
CellStyle
=
cellStyle
;
}
}
}
for
(
int
cellIndex
=
dataFirstCellNum
;
cellIndex
<
columnHeader
.
LastCellNum
;
cellIndex
++)
{
for
(
int
cellIndex
=
dataFirstCellNum
;
cellIndex
<
columnHeader
.
LastCellNum
;
cellIndex
++)
var
column
=
columnHeader
.
GetOrCreate
(
cellIndex
).
GetDecodeEscapes
();
{
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
var
column
=
columnHeader
.
GetOrCreate
(
cellIndex
).
GetDecodeEscapes
();
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
if
(
value
.
HasValue
&&
value
!=
0
)
var
value
=
(
deptData
!=
null
&&
deptData
.
Any
())
?
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
:
0
;
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
CellStyle
=
cellStyle
;
cell
.
CellStyle
=
cellStyle
;
}
dataFirstRowNum
++;
data
.
RemoveAll
(
t
=>
t
.
Department
==
item
.
Department
);
}
}
dataFirstRowNum
++;
data
.
RemoveAll
(
t
=>
t
.
Department
==
item
.
Department
);
}
}
return
dataFirstRowNum
;
}
}
public
static
string
HasValue
(
params
string
[]
list
)
public
static
string
HasValue
(
params
string
[]
list
)
...
...
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