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
157f5009
Commit
157f5009
authored
Oct 22, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取测试修改
parent
eea7bc11
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
31 deletions
+49
-31
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
+11
-1
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+4
-4
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+9
-5
performance/Performance.Services/ExtractExcelService/QueryService.cs
+10
-6
performance/Performance.Services/ExtractExcelService/SheetDataWrite/IncomeDataWrite.cs
+1
-1
performance/Performance.Services/ExtractExcelService/SheetDataWrite/OtherIncomeDataWrite.cs
+1
-1
performance/Performance.Services/ExtractExcelService/SheetDataWrite/WorkloadDataWrite.cs
+1
-1
performance/Performance.Services/ExtractExcelService/WriteDataFactory.cs
+12
-12
No files found.
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
View file @
157f5009
...
...
@@ -44,11 +44,14 @@ public static void SetCellOValue(this ICell cell, object value)
if
(
cell
==
null
)
return
;
if
(
value
==
null
||
string
.
IsNullOrWhiteSpace
(
value
.
ToString
()))
{
cell
.
SetCellValue
(
""
);
return
;
}
try
{
string
stringV
=
value
.
ToString
();
string
stringV
=
value
.
ToString
()
.
Trim
()
;
var
type
=
value
.
GetType
();
switch
(
type
.
ToString
())
{
...
...
@@ -135,6 +138,13 @@ public static string GetDecodeEscapes(this ICell cell)
}
}
public
static
string
NoBlank
(
this
string
@string
)
{
if
(
string
.
IsNullOrEmpty
(
@string
))
return
""
;
return
@string
.
Replace
(
"\n"
,
""
).
Replace
(
" "
,
""
).
Trim
();
}
public
static
IWorkbook
GetWorkbook
(
string
filePath
)
{
IWorkbook
workbook
=
null
;
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
157f5009
...
...
@@ -23,9 +23,9 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
var
columns
=
headers
.
Select
(
t
=>
t
).
ToList
();
// 收入支出系数
var
nurseFactor
=
sheet
.
GetOrCreate
(
point
.
AccountingUnit
.
First
(
t
=>
t
.
UnitType
==
UnitType
.
护理组
.
ToString
()).
FactorRow
.
Value
);
var
doctorFactor
=
sheet
.
Get
Row
(
point
.
AccountingUnit
.
First
(
t
=>
t
.
UnitType
==
UnitType
.
医生组
.
ToString
()).
FactorRow
.
Value
);
var
technicianFactor
=
sheet
.
Get
Row
(
point
.
AccountingUnit
.
First
(
t
=>
t
.
UnitType
==
UnitType
.
医技组
.
ToString
()).
FactorRow
.
Value
);
var
nurseFactor
=
sheet
.
GetOrCreate
(
point
.
AccountingUnit
.
First
OrDefault
(
t
=>
t
.
UnitType
==
UnitType
.
护理组
.
ToString
())?.
FactorRow
.
Value
??
0
);
var
doctorFactor
=
sheet
.
Get
OrCreate
(
point
.
AccountingUnit
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
UnitType
.
医生组
.
ToString
())?.
FactorRow
.
Value
??
0
);
var
technicianFactor
=
sheet
.
Get
OrCreate
(
point
.
AccountingUnit
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
UnitType
.
医技组
.
ToString
())?.
FactorRow
.
Value
??
0
);
// 费用类型
var
columnHeader
=
sheet
.
GetOrCreate
(
point
.
HeaderFirstRowNum
.
Value
);
// 工作量系数
...
...
@@ -152,7 +152,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
row
=
sheet
.
GetOrCreate
(
dataFirstRowNum
);
for
(
int
cellIndex
=
point
.
HeaderFirstCellNum
.
Value
;
cellIndex
<
columnHeader
.
LastCellNum
;
cellIndex
++)
{
var
column
=
row
.
GetCell
(
cellIndex
).
GetDecodeEscapes
();
var
column
=
columnHeader
.
GetCell
(
cellIndex
).
GetDecodeEscapes
();
var
cell
=
row
.
CreateCell
(
cellIndex
);
if
(
filed
.
ContainsKey
(
column
))
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
157f5009
...
...
@@ -74,7 +74,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName =
var
templateFilePath
=
ExtractHelper
.
GetExtractFile
(
hospitalId
,
ref
extractFilePath
,
filePath
);
WriteDataToFile
(
templateFilePath
,
extractFilePath
,
dict
);
WriteDataToFile
(
templateFilePath
,
extractFilePath
,
dict
,
standData
);
return
templateFilePath
;
}
...
...
@@ -90,9 +90,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName =
return
extractFilePath
;
}
private
void
WriteDataToFile
(
string
templateFile
,
string
extractFile
,
Dictionary
<
ExDataDict
,
object
>
exdict
)
private
void
WriteDataToFile
(
string
templateFile
,
string
extractFile
,
Dictionary
<
ExDataDict
,
object
>
exdict
,
List
<
ExtractTransDto
>
extractDto
)
{
if
(!
FileHelper
.
IsExistFile
(
templateFile
)
||
!
FileHelper
.
IsExistFile
(
extractFile
)
)
if
(!
FileHelper
.
IsExistFile
(
templateFile
))
throw
new
PerformanceException
(
""
);
var
workbook
=
ExcelHelper
.
GetWorkbook
(
templateFile
);
...
...
@@ -111,7 +111,11 @@ private void WriteDataToFile(string templateFile, string extractFile, Dictionary
var
point
=
PerSheetDataFactory
.
GetDataRead
(
sheetType
)?.
Point
;
var
customer
=
factory
.
GetWriteData
(
sheetType
);
customer
.
WriteSheetData
(
sheet
,
point
,
sheetType
,
exdict
);
if
(
customer
!=
null
)
{
var
data
=
extractDto
.
Where
(
t
=>
t
.
SheetName
.
NoBlank
()
==
sheet
.
SheetName
.
NoBlank
())?.
ToList
();
customer
.
WriteSheetData
(
sheet
,
point
,
sheetType
,
data
,
exdict
);
}
}
using
(
FileStream
file
=
new
FileStream
(
extractFile
,
FileMode
.
OpenOrCreate
))
...
...
@@ -139,7 +143,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
PersonnelNumber
=
t
.
PersonnelNumber
,
Department
=
t
.
Department
,
Category
=
t
.
Category
,
Value
=
(
t
.
Fee
??
0
)
==
0
?
null
:
t
.
Fee
Value
=
t
.
Fee
??
0
}).
ToList
();
dict
.
ForEach
(
t
=>
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
157f5009
...
...
@@ -65,7 +65,12 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, ref Dictionary<E
var
configs
=
hosconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
configs
==
null
||
!
configs
.
Any
())
throw
new
Exception
(
"医院未配置绩效抽取信息"
);
dict
=
new
Dictionary
<
ExDataDict
,
object
>();
dict
=
new
Dictionary
<
ExDataDict
,
object
>
{
{
ExDataDict
.
ExModule
,
new
List
<
ex_module
>()
},
{
ExDataDict
.
ExItem
,
new
List
<
ex_item
>()
},
{
ExDataDict
.
ExSpecial
,
new
List
<
ex_script
>()
}
};
var
extypeIds
=
GetQueryScriptIds
(
hospitalId
,
ref
dict
);
ClearHistoryData
(
allot
.
ID
);
...
...
@@ -74,8 +79,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, ref Dictionary<E
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
extypeIds
.
Contains
(
t
.
TypeId
));
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
var
allmodules
=
new
List
<
ex_module
>();
if
(
dict
.
ContainsKey
(
ExDataDict
.
ExModule
))
allmodules
=
dict
[
ExDataDict
.
ExModule
]
as
List
<
ex_module
>;
var
allmodules
=
dict
[
ExDataDict
.
ExModule
]
as
List
<
ex_module
>;
foreach
(
var
pair
in
dict
)
{
...
...
@@ -116,13 +120,13 @@ private List<int> GetQueryScriptIds(int hospitalId, ref Dictionary<ExDataDict, o
var
items
=
new
List
<
ex_item
>();
if
(
modules
!=
null
&&
modules
.
Any
())
{
dict
.
Add
(
ExDataDict
.
ExModule
,
modules
)
;
dict
[
ExDataDict
.
ExModule
]
=
modules
;
extypeIds
.
AddRange
(
modules
.
Select
(
t
=>
t
.
TypeId
??
0
));
items
=
exitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
.
HasValue
&&
modules
.
Select
(
m
=>
m
.
Id
).
Contains
(
t
.
ModuleId
.
Value
));
if
(
items
!=
null
&&
items
.
Any
(
t
=>
t
.
TypeId
.
HasValue
))
{
dict
.
Add
(
ExDataDict
.
ExItem
,
items
)
;
dict
[
ExDataDict
.
ExItem
]
=
items
;
extypeIds
.
AddRange
(
items
.
Select
(
t
=>
t
.
TypeId
??
0
));
}
}
...
...
@@ -130,7 +134,7 @@ private List<int> GetQueryScriptIds(int hospitalId, ref Dictionary<ExDataDict, o
var
specials
=
exspecialRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
specials
!=
null
&&
specials
.
Any
())
{
dict
.
Add
(
ExDataDict
.
ExSpecial
,
specials
)
;
dict
[
ExDataDict
.
ExSpecial
]
=
specials
;
extypeIds
.
AddRange
(
specials
.
Select
(
t
=>
t
.
TypeId
??
0
));
}
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/IncomeDataWrite.cs
View file @
157f5009
...
...
@@ -13,7 +13,7 @@ public class IncomeDataWrite : ISheetDataWrite
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
object
data
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
{
var
modules
=
exdict
[
ExDataDict
.
ExModule
]
as
List
<
ex_module
>;
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
);
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
&&
t
.
ModuleName
.
NoBlank
()
==
sheet
.
SheetName
.
NoBlank
()
);
if
(
module
==
null
)
return
;
var
items
=
exdict
[
ExDataDict
.
ExItem
]
as
List
<
ex_item
>;
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/OtherIncomeDataWrite.cs
View file @
157f5009
...
...
@@ -13,7 +13,7 @@ public class OtherIncomeDataWrite : ISheetDataWrite
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
object
data
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
{
var
modules
=
exdict
[
ExDataDict
.
ExModule
]
as
List
<
ex_module
>;
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
);
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
&&
t
.
ModuleName
.
NoBlank
()
==
sheet
.
SheetName
.
NoBlank
()
);
if
(
module
==
null
)
return
;
var
items
=
exdict
[
ExDataDict
.
ExItem
]
as
List
<
ex_item
>;
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/WorkloadDataWrite.cs
View file @
157f5009
...
...
@@ -13,7 +13,7 @@ public class WorkloadDataWrite : ISheetDataWrite
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
object
data
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
{
var
modules
=
exdict
[
ExDataDict
.
ExModule
]
as
List
<
ex_module
>;
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
);
var
module
=
modules
?.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
sheetType
&&
t
.
ModuleName
.
NoBlank
()
==
sheet
.
SheetName
.
NoBlank
()
);
if
(
module
==
null
)
return
;
var
items
=
exdict
[
ExDataDict
.
ExItem
]
as
List
<
ex_item
>;
...
...
performance/Performance.Services/ExtractExcelService/WriteDataFactory.cs
View file @
157f5009
...
...
@@ -13,12 +13,12 @@ public ISheetDataWrite GetWriteData(SheetType sheetType)
ISheetDataWrite
factory
;
switch
(
sheetType
)
{
case
SheetType
.
Employee
:
factory
=
new
EmployeeDataWrite
();
break
;
case
SheetType
.
ClinicEmployee
:
factory
=
new
ClinicEmployeeDataWrite
();
break
;
//
case SheetType.Employee:
//
factory = new EmployeeDataWrite();
//
break;
//
case SheetType.ClinicEmployee:
//
factory = new ClinicEmployeeDataWrite();
//
break;
case
SheetType
.
OtherIncome
:
case
SheetType
.
Expend
:
factory
=
new
OtherIncomeDataWrite
();
...
...
@@ -29,12 +29,12 @@ public ISheetDataWrite GetWriteData(SheetType sheetType)
case
SheetType
.
Workload
:
factory
=
new
WorkloadDataWrite
();
break
;
case
SheetType
.
AccountBasic
:
factory
=
new
AccountBasicDataWrite
();
break
;
case
SheetType
.
SpecialUnit
:
factory
=
new
SpecialUnitDataWrite
();
break
;
//
case SheetType.AccountBasic:
//
factory = new AccountBasicDataWrite();
//
break;
//
case SheetType.SpecialUnit:
//
factory = new SpecialUnitDataWrite();
//
break;
default
:
return
null
;
}
...
...
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