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
18968fad
Commit
18968fad
authored
Aug 05, 2019
by
799284587@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提取
parent
b0823f19
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
238 additions
and
127 deletions
+238
-127
performance/Performance.Api/Controllers/TemplateController.cs
+2
-0
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+15
-0
performance/Performance.DtoModels/Request/ExtractRequest.cs
+36
-0
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+31
-9
performance/Performance.Services/NewExtractService.cs
+153
-117
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
+1
-1
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
18968fad
...
...
@@ -131,6 +131,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
region
老版提取
/// <summary>
/// 提取绩效数据
/// </summary>
...
...
@@ -191,6 +192,7 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
throw
ex
;
}
}
#
endregion
/// <summary>
/// 从WebAPI下载文件
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
18968fad
...
...
@@ -1223,6 +1223,21 @@
发放系数
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ExtractRequest.AllotId"
>
<summary>
绩效ID
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ExtractRequest.HospitalId"
>
<summary>
医院ID
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ExtractRequest.UseScheme"
>
<summary>
使用方案
</summary>
</member>
<member
name=
"T:Performance.DtoModels.HospitalRequest"
>
<summary>
登录请求
...
...
performance/Performance.DtoModels/Request/ExtractRequest.cs
0 → 100644
View file @
18968fad
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
ExtractRequest
{
/// <summary>
/// 绩效ID
/// </summary>
public
int
AllotId
{
get
;
set
;
}
/// <summary>
/// 医院ID
/// </summary>
public
int
HospitalId
{
get
;
set
;
}
/// <summary>
/// 使用方案
/// </summary>
public
int
UseScheme
{
get
;
set
;
}
}
public
class
ExtractRequestValidator
:
AbstractValidator
<
ExtractRequest
>
{
public
ExtractRequestValidator
()
{
RuleFor
(
x
=>
x
.
AllotId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
UseScheme
).
NotNull
().
InclusiveBetween
(
1
,
2
);
}
}
}
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
18968fad
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
FluentValidation.AspNetCore
;
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
...
...
@@ -15,6 +10,11 @@
using
Performance.DtoModels.AppSettings
;
using
Performance.Infrastructure
;
using
Performance.Services
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Performance.Extract.Api.Controllers
{
...
...
@@ -22,15 +22,20 @@ namespace Performance.Extract.Api.Controllers
public
class
ExtractController
:
Controller
{
private
readonly
ExtractService
extractService
;
private
readonly
NewExtractService
newExtractService
;
private
readonly
HospitalService
hospitalService
;
private
readonly
WebapiUrl
url
;
private
readonly
ILogger
<
ExtractController
>
logger
;
private
IHostingEnvironment
evn
;
public
ExtractController
(
ExtractService
extractService
,
HospitalService
hospitalService
,
IOptions
<
WebapiUrl
>
url
,
ILogger
<
ExtractController
>
logger
,
private
readonly
IHostingEnvironment
evn
;
public
ExtractController
(
ExtractService
extractService
,
NewExtractService
newExtractService
,
HospitalService
hospitalService
,
IOptions
<
WebapiUrl
>
url
,
ILogger
<
ExtractController
>
logger
,
IHostingEnvironment
evn
)
{
this
.
extractService
=
extractService
;
this
.
newExtractService
=
newExtractService
;
this
.
hospitalService
=
hospitalService
;
this
.
url
=
url
.
Value
;
this
.
logger
=
logger
;
...
...
@@ -100,5 +105,21 @@ public void Index([FromBody]AllotRequest request)
}
logger
.
LogInformation
(
token
+
",提取结束,请求参数:"
+
JsonHelper
.
Serialize
(
request
));
}
#
region
新版提取
/// <summary>
/// 提取绩效数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"extract"
)]
[
HttpPost
]
public
void
ExtractData
([
CustomizeValidator
,
FromBody
]
ExtractRequest
request
)
{
newExtractService
.
ExtractData
(
request
.
AllotId
,
""
,
request
.
HospitalId
,
(
UseTemplate
)
request
.
UseScheme
);
}
#
endregion
}
}
\ No newline at end of file
performance/Performance.Services/NewExtractService.cs
View file @
18968fad
...
...
@@ -81,6 +81,10 @@ public class NewExtractService : IAutoInjection
public
string
ExtractData
(
int
allotId
,
string
email
,
int
hospitalId
,
UseTemplate
useTemplate
)
{
// 获取医院信息
var
allot
=
perforPerallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"AllotID错误"
);
// 获取医院信息
var
hospital
=
perforHospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
hospitalId
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院ID错误"
);
...
...
@@ -109,12 +113,10 @@ public string ExtractData(int allotId, string email, int hospitalId, UseTemplate
IWorkbook
workbook
=
null
;
FileStream
file
=
null
;
try
{
var
path
=
CopyOriginalFile
(
hospitalId
,
useTemplate
);
file
=
new
FileStream
(
path
,
FileMode
.
Open
);
workbook
=
new
XSSFWorkbook
(
file
);
var
(
tempPath
,
newPath
)
=
CopyOriginalFile
(
hospitalId
);
workbook
=
new
XSSFWorkbook
(
tempPath
);
CreateNotExistSheet
(
modulesList
,
workbook
);
...
...
@@ -137,7 +139,7 @@ public string ExtractData(int allotId, string email, int hospitalId, UseTemplate
WriteSpecialUnit
(
sheet
,
hospital
.
ID
,
allotLast
.
ID
,
sheetRead
);
break
;
case
SheetType
.
Income
:
WriteIncome
(
sheet
,
allotLast
.
ID
,
sheetRead
,
hospitalConfigList
);
WriteIncome
(
sheet
,
allotLast
.
ID
,
sheetRead
,
allot
,
modulesList
,
hospitalConfigList
);
break
;
case
SheetType
.
OtherIncome
:
WriteOtherIncome
(
sheet
,
sheetRead
);
...
...
@@ -146,14 +148,16 @@ public string ExtractData(int allotId, string email, int hospitalId, UseTemplate
WriteExpend
(
sheet
,
sheetRead
);
break
;
case
SheetType
.
Workload
:
WriteWorkload
(
sheet
,
allotLast
.
ID
,
sheetRead
,
hospitalConfigList
);
WriteWorkload
(
sheet
,
allotLast
.
ID
,
sheetRead
,
allot
,
modulesList
,
hospitalConfigList
);
break
;
}
}
using
(
FileStream
file
=
new
FileStream
(
newPath
,
FileMode
.
OpenOrCreate
))
{
workbook
.
Write
(
file
);
}
workbook
.
Write
(
file
);
return
path
;
return
newPath
;
}
catch
(
Exception
ex
)
{
...
...
@@ -163,8 +167,6 @@ public string ExtractData(int allotId, string email, int hospitalId, UseTemplate
finally
{
workbook
.
Close
();
file
.
Close
();
file
.
Dispose
();
GC
.
Collect
();
}
}
...
...
@@ -201,6 +203,7 @@ private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead)
{
var
module
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Expend
);
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
module
.
Id
);
if
(
itemList
==
null
||
!
itemList
.
Any
())
return
;
var
nurseFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
var
doctorFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
);
...
...
@@ -219,86 +222,110 @@ private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead)
}
}
private
void
WriteIncome
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
,
List
<
sys_hospitalconfig
>
hospitalConfigList
)
private
void
WriteIncome
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
,
per_allot
allot
,
List
<
mod_module
>
moduleList
,
List
<
sys_hospitalconfig
>
hospitalConfigList
)
{
var
moduleList
=
perforModmoduleRepository
.
GetEntities
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
foreach
(
var
module
in
moduleList
)
{
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
module
.
Id
);
var
module
=
moduleList
.
FirstOrDefault
(
t
=>
t
.
ModuleName
==
sheet
.
SheetName
);
if
(
module
==
null
)
return
;
var
nurseFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
var
doctorFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
);
var
technicianFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
3
);
var
head
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
4
);
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
module
.
Id
);
if
(
itemList
==
null
||
!
itemList
.
Any
())
return
;
//写入列头信息
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
3
;
foreach
(
var
item
in
itemList
)
{
head
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
doctorFactor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
nurseFactor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue2
?.
ToString
());
technicianFactor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue3
?.
ToString
());
cellStartIndex
++;
}
//查询数据
var
extractList
=
perforModextractRepository
.
GetEntities
(
t
=>
module
.
ExtractId
==
t
.
Id
);
var
nurseFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
0
);
var
doctorFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
var
technicianFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
);
var
head
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
3
);
List
<
ExtractDto
>
allExtract
=
new
List
<
ExtractDto
>();
foreach
(
var
item
in
extractList
)
{
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
}
//写入数据
var
importSheet
=
perforPersheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotLastId
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
var
importSheetId
=
importSheet
.
Select
(
t
=>
t
.
ID
).
ToList
();
var
importData
=
perforImdataRepository
.
GetEntities
(
t
=>
importSheetId
.
Contains
(
t
.
SheetID
.
Value
));
var
rowIndex
=
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
3
;
foreach
(
var
department
in
allExtract
.
Select
(
t
=>
t
.
Department
).
Distinct
())
//写入列头信息
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
3
;
foreach
(
var
item
in
itemList
)
{
GetOrCreate
(
head
,
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
GetOrCreate
(
doctorFactor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
GetOrCreate
(
nurseFactor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue2
?.
ToString
());
GetOrCreate
(
technicianFactor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue3
?.
ToString
());
cellStartIndex
++;
}
//查询数据
var
extractList
=
perforModextractRepository
.
GetEntities
(
t
=>
module
.
ExtractId
==
t
.
Id
);
List
<
ExtractDto
>
allExtract
=
new
List
<
ExtractDto
>();
foreach
(
var
item
in
extractList
)
{
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
,
allot
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
}
//写入数据
var
importSheet
=
perforPersheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotLastId
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
var
importSheetId
=
importSheet
.
Select
(
t
=>
t
.
ID
).
ToList
();
var
importData
=
perforImdataRepository
.
GetEntities
(
t
=>
importSheetId
.
Contains
(
t
.
SheetID
.
Value
));
var
rowIndex
=
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
3
;
foreach
(
var
department
in
allExtract
.
Select
(
t
=>
t
.
Department
).
Distinct
())
{
var
row
=
sheet
.
CreateRow
(
rowIndex
);
for
(
int
i
=
head
.
FirstCellNum
;
i
<
head
.
LastCellNum
;
i
++)
{
var
row
=
sheet
.
CreateRow
(
rowIndex
);
for
(
int
i
=
head
.
FirstCellNum
;
i
<
head
.
LastCellNum
;
i
++)
var
headName
=
head
.
GetCell
(
i
).
StringCellValue
;
var
newCell
=
row
.
CreateCell
(
i
);
if
(
headName
==
"核算单元(医生组)"
)
{
var
headName
=
head
.
GetCell
(
i
).
StringCellValue
;
var
newCell
=
row
.
CreateCell
(
i
);
if
(
headName
==
"核算单元(医生组)"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
1
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"核算单元(护理组)"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
2
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"核算单元(医技组)"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
3
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"科室名称"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
)?.
Department
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
{
var
value
=
allExtract
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
Category
==
headName
)?.
Value
;
newCell
.
SetCellValue
(
value
==
null
||
value
==
0
?
""
:
value
.
ToString
());
}
newCell
.
CellStyle
.
FillBackgroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
LightBlue
.
Index
;
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
1
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"核算单元(护理组)"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
2
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"核算单元(医技组)"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
UnitType
==
3
)?.
AccountingUnit
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
if
(
headName
==
"科室名称"
)
{
var
dept
=
importData
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
)?.
Department
;
newCell
.
SetCellValue
(
dept
??
""
);
}
else
{
var
value
=
allExtract
.
FirstOrDefault
(
t
=>
t
.
Department
==
department
&&
t
.
Category
==
headName
)?.
Value
;
newCell
.
SetCellValue
(
value
==
null
||
value
==
0
?
""
:
value
.
ToString
());
}
newCell
.
CellStyle
.
FillBackgroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
LightBlue
.
Index
;
}
}
}
private
void
WriteWorkload
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
,
List
<
sys_hospitalconfig
>
hospitalConfigList
)
private
ICell
GetOrCreate
(
IRow
row
,
int
index
)
{
var
cell
=
row
.
GetCell
(
index
);
if
(
cell
==
null
)
cell
=
row
.
CreateCell
(
index
);
cell
.
CellStyle
.
FillBackgroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
Orange
.
Index
;
return
cell
;
}
private
Dictionary
<
string
,
string
>
GetParameters
(
per_allot
allot
)
{
DateTime
beginTime
=
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
);
Dictionary
<
string
,
string
>
pairs
=
new
Dictionary
<
string
,
string
>
{
{
"@beginTime"
,
$"'
{
beginTime
.
ToString
(
"yyyy-MM-dd"
)}
'"
},
{
"@endTime"
,
$"'
{
beginTime
.
AddMonths
(
1
).
ToString
(
"yyyy-MM-dd"
)}
'"
},
};
return
pairs
;
}
private
void
WriteWorkload
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
,
per_allot
allot
,
List
<
mod_module
>
moduleList
,
List
<
sys_hospitalconfig
>
hospitalConfigList
)
{
var
module
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Workload
);
var
module
=
moduleList
.
FirstOrDefault
(
t
=>
t
.
ModuleName
==
sheet
.
SheetName
);
if
(
module
==
null
)
return
;
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
module
.
Id
);
if
(
itemList
==
null
||
!
itemList
.
Any
())
return
;
var
head
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
var
factor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
);
...
...
@@ -307,8 +334,8 @@ private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead shee
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
3
;
foreach
(
var
item
in
itemList
)
{
head
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
factor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
GetOrCreate
(
head
,
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
GetOrCreate
(
factor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
cellStartIndex
++;
}
//查询数据
...
...
@@ -318,7 +345,7 @@ private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead shee
List
<
ExtractDto
>
allExtract
=
new
List
<
ExtractDto
>();
foreach
(
var
item
in
extractList
)
{
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
);
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
,
allot
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
}
...
...
@@ -353,12 +380,18 @@ private void WriteWorkload(ISheet sheet, int allotLastId, IPerSheetDataRead shee
}
}
private
List
<
ExtractDto
>
QueryDatabase
(
List
<
sys_hospitalconfig
>
hospitalConfigList
,
mod_extract
extract
)
private
List
<
ExtractDto
>
QueryDatabase
(
List
<
sys_hospitalconfig
>
hospitalConfigList
,
mod_extract
extract
,
per_allot
allot
)
{
var
config
=
hospitalConfigList
.
FirstOrDefault
(
t
=>
t
.
Type
==
extract
.
SourceType
);
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
(
DatabaseType
.
SqlServer
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
{
var
result
=
connection
.
Query
<
ExtractDto
>(
extract
.
ExecuteScript
);
foreach
(
var
item
in
parameters
)
{
extract
.
ExecuteScript
=
Regex
.
Replace
(
extract
.
ExecuteScript
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
var
result
=
connection
.
Query
<
ExtractDto
>(
extract
.
ExecuteScript
,
commandTimeout
:
20000
);
if
(
result
!=
null
&&
result
.
Count
()
>
0
)
{
if
(
extract
.
ExecuteType
==
2
)
...
...
@@ -378,6 +411,7 @@ private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead)
{
var
module
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Expend
);
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
module
.
Id
);
if
(
itemList
==
null
||
!
itemList
.
Any
())
return
;
var
head
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
var
nurseFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
);
...
...
@@ -387,22 +421,23 @@ private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead)
//写入列头信息
foreach
(
var
item
in
itemList
)
{
head
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
doctorFactor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
nurseFactor
.
GetCell
(
cellStartIndex
).
SetCellValue
(
item
.
FactorValue2
?.
ToString
());
GetOrCreate
(
head
,
cellStartIndex
).
SetCellValue
(
item
.
ItemName
);
GetOrCreate
(
doctorFactor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue1
?.
ToString
());
GetOrCreate
(
nurseFactor
,
cellStartIndex
).
SetCellValue
(
item
.
FactorValue2
?.
ToString
());
cellStartIndex
++;
}
}
private
string
CopyOriginalFile
(
int
hospitalId
,
UseTemplate
useTemplate
)
private
(
string
TempPath
,
string
NewPath
)
CopyOriginalFile
(
int
hospitalId
)
{
string
originalPath
=
Path
.
Combine
(
environment
.
ContentRootPath
,
"Template"
,
"医院绩效模板.xlsx"
);
var
dpath
=
Path
.
Combine
(
environment
.
ContentRootPath
,
"Files"
,
$"
{
hospitalId
}
"
,
"autoextract"
);
string
originalPath
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"Template"
,
"医院绩效模板.xlsx"
);
var
dpath
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"Files"
,
$"
{
hospitalId
}
"
,
"autoextract"
);
FileHelper
.
CreateDirectory
(
dpath
);
string
path
=
Path
.
Combine
(
dpath
,
$"绩效提取数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
FileHelper
.
Copy
(
originalPath
,
path
);
return
path
;
string
tempPath
=
Path
.
Combine
(
dpath
,
$"Template
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
FileHelper
.
Copy
(
originalPath
,
tempPath
);
string
newPath
=
Path
.
Combine
(
dpath
,
$"绩效提取数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
return
(
tempPath
,
newPath
);
}
private
void
WriteEmployee
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
)
...
...
@@ -414,7 +449,7 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
{
"职称"
,
(
t
)
=>
t
.
JobTitle
},
{
"绩效基数核算参考对象"
,
(
t
)
=>
t
.
FitPeople
},
{
"绩效基数核算系数"
,
(
t
)
=>
t
.
FitPeopleRatio
},
{
"
核算单元
分类"
,
(
t
)
=>
t
.
AccountType
},
{
"
人员
分类"
,
(
t
)
=>
t
.
AccountType
},
{
"岗位系数"
,
(
t
)
=>
t
.
PostCoefficient
},
{
"参加工作时间"
,
(
t
)
=>
t
.
WorkTime
},
{
"考核得分率"
,
(
t
)
=>
t
.
ScoreAverageRate
},
...
...
@@ -467,11 +502,14 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, int allotLastId, IPe
foreach
(
var
cell
in
cellList
)
{
var
item
=
dictionary
.
FirstOrDefault
(
t
=>
t
.
Key
==
cell
.
StringCellValue
);
var
value
=
(
item
.
Value
.
Invoke
(
modDataList
[
i
],
allotDataList
)
??
""
).
ToString
();
var
newCell
=
importRow
.
CreateCell
(
cell
.
ColumnIndex
);
newCell
.
SetCellValue
(
Verify
(
value
));
newCell
.
CellStyle
.
FillBackgroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
LightBlue
.
Index
;
if
(
dictionary
.
ContainsKey
(
cell
.
StringCellValue
))
{
var
item
=
dictionary
.
First
(
t
=>
t
.
Key
==
cell
.
StringCellValue
);
var
value
=
(
item
.
Value
.
Invoke
(
modDataList
[
i
],
allotDataList
)
??
""
).
ToString
();
var
newCell
=
importRow
.
CreateCell
(
cell
.
ColumnIndex
);
newCell
.
SetCellValue
(
Verify
(
value
));
newCell
.
CellStyle
.
FillBackgroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
LightBlue
.
Index
;
}
}
}
}
...
...
@@ -480,25 +518,23 @@ private void WriteAccountBasic(ISheet sheet, int allotLastId, IPerSheetDataRead
{
var
dictionary
=
new
Dictionary
<
string
,
Func
<
im_accountbasic
,
object
>>
{
{
"核算单元
(医生组)"
,
(
t
)
=>
t
.
DoctorAccountingUnit
},
{
"核算单元
(护理组)"
,
(
t
)
=>
t
.
Nurse
AccountingUnit
},
{
"核算单元
类型"
,
(
t
)
=>
t
.
UnitType
},
{
"核算单元
"
,
(
t
)
=>
t
.
Doctor
AccountingUnit
},
{
"科室名称"
,
(
t
)
=>
t
.
Department
},
{
"医生组核算单元医生数量"
,
(
t
)
=>
t
.
DoctorNumber
},
{
"医生组基础系数"
,
(
t
)
=>
t
.
DoctorBasicFactor
},
{
"医生组倾斜系数"
,
(
t
)
=>
t
.
DoctorSlopeFactor
},
{
"医生组其他绩效1"
,
(
t
)
=>
t
.
DoctorOtherPerfor1
},
{
"医生组考核得分率"
,
(
t
)
=>
t
.
DoctorScoringAverage
},
{
"医生组医院奖罚"
,
(
t
)
=>
t
.
DoctorExtra
},
{
"医生组其他绩效2"
,
(
t
)
=>
t
.
DoctorOtherPerfor2
},
{
"医生组调节系数"
,
(
t
)
=>
t
.
DoctorAdjustFactor
},
{
"护理组核算单元护士数量"
,
(
t
)
=>
t
.
NurseNumber
},
{
"护理组基础系数"
,
(
t
)
=>
t
.
NurseBasicFactor
},
{
"护理组倾斜系数"
,
(
t
)
=>
t
.
NurseSlopeFactor
},
{
"护理组其他绩效1"
,
(
t
)
=>
t
.
NurseOtherPerfor1
},
{
"护理组考核得分率"
,
(
t
)
=>
t
.
NurseScoringAverage
},
{
"护理组医院奖罚"
,
(
t
)
=>
t
.
NurseExtra
},
{
"护理组其他绩效2"
,
(
t
)
=>
t
.
NurseOtherPerfor2
},
{
"护理组调节系数"
,
(
t
)
=>
t
.
NurseAdjustFactor
},
{
"科主任/护士长人数"
,
(
t
)
=>
t
.
DoctorDirectorNumber
},
{
"核算单元人员数量"
,
(
t
)
=>
t
.
DoctorNumber
},
{
"预算比例"
,
(
t
)
=>
t
.
DoctorBasicFactor
},
{
"倾斜系数"
,
(
t
)
=>
t
.
DoctorSlopeFactor
},
{
"效率绩效系数"
,
(
t
)
=>
t
.
DoctorEffic
},
{
"规模绩效系数"
,
(
t
)
=>
t
.
DoctorScale
},
{
"管理绩效发放系数"
,
(
t
)
=>
t
.
DoctorGrant
},
{
"保底绩效参考标准"
,
(
t
)
=>
t
.
MinimumReference
},
{
"保底绩效系数"
,
(
t
)
=>
t
.
MinimumFactor
},
{
"其他绩效1"
,
(
t
)
=>
t
.
DoctorOtherPerfor1
},
{
"考核得分率"
,
(
t
)
=>
t
.
DoctorScoringAverage
},
{
"医院奖罚"
,
(
t
)
=>
t
.
DoctorExtra
},
{
"其他绩效2"
,
(
t
)
=>
t
.
DoctorOtherPerfor2
},
{
"调节系数"
,
(
t
)
=>
t
.
DoctorAdjustFactor
},
};
var
dataList
=
perforImaccountbasicRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotLastId
);
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
View file @
18968fad
...
...
@@ -15,7 +15,7 @@ public class PerSheetDataReadIncome : IPerSheetDataRead
{
public
PerSheetPoint
Point
=>
new
PerSheetPoint
{
HeaderFirstRowNum
=
4
,
HeaderFirstRowNum
=
1
,
HeaderLastRowNum
=
4
,
HeaderFirstCellNum
=
0
,
DataFirstRowNum
=
5
,
...
...
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