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
e6ad023d
Commit
e6ad023d
authored
Jun 21, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
划拨写入
parent
986568cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
4 deletions
+62
-4
performance/Performance.EntityModels/Entity/cost_transfer_item.cs
+5
-0
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CostTransferDataWrite.cs
+57
-4
No files found.
performance/Performance.EntityModels/Entity/cost_transfer_item.cs
View file @
e6ad023d
...
...
@@ -67,6 +67,11 @@ public class cost_transfer_item
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 绩效办审核状态 0 默认 1 通过 2 驳回 3 下发驳回
/// </summary>
public
int
AdminStatus
{
get
;
set
;
}
/// <summary>
/// 数据是否被写入
/// </summary>
public
int
IsWrited
{
get
;
set
;
}
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CostTransferDataWrite.cs
View file @
e6ad023d
using
Microsoft.Extensions.Logging
;
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -35,17 +36,42 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
var
costTransfers
=
costtransferRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
);
if
(
costTransfers
==
null
||
!
costTransfers
.
Any
())
return
;
var
costTransferItems
=
costtransferitemRepository
.
GetEntities
(
t
=>
costTransfers
.
Select
(
c
=>
c
.
Id
).
Contains
(
t
.
TransferId
));
var
costTransferItems
=
costtransferitemRepository
.
GetEntities
(
t
=>
costTransfers
.
Select
(
c
=>
c
.
Id
).
Contains
(
t
.
TransferId
)
&&
t
.
Status
==
1
&&
t
.
AdminStatus
==
1
);
if
(
costTransferItems
==
null
||
!
costTransferItems
.
Any
())
return
;
var
columns
=
SupplySheetHeader
(
sheet
,
point
);
if
(
columns
==
null
||
!
columns
.
Any
())
return
;
var
departments
=
costTransfers
.
Select
(
t
=>
t
.
AdoptedDepartment
??
""
).
Union
(
costTransfers
.
Select
(
t
=>
t
.
ApplicantDepartment
??
""
)).
Distinct
();
var
standardDict
=
perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
)
??
new
List
<
EntityModels
.
per_dept_dic
>();
var
departments
=
costTransfers
.
Select
(
t
=>
t
.
AdoptedDepartment
??
""
).
Union
(
costTransfers
.
Select
(
t
=>
t
.
ApplicantDepartment
??
""
)).
Distinct
()
.
ToList
()
;
var
standardDict
=
perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
)
??
new
List
<
per_dept_dic
>();
var
unittypes
=
new
string
[]
{
UnitType
.
护理组
.
ToString
(),
UnitType
.
医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
()
};
for
(
int
i
=
point
.
DataFirstRowNum
.
Value
;
i
<
sheet
.
LastRowNum
+
1
;
i
++)
{
var
row
=
sheet
.
GetOrCreate
(
i
);
var
department
=
row
.
GetOrCreate
(
point
.
DataFirstCellNum
.
Value
-
1
).
GetDecodeEscapes
();
foreach
(
var
unittype
in
unittypes
)
{
var
key
=
columns
.
Keys
.
FirstOrDefault
(
t
=>
t
.
Contains
(
unittype
.
Replace
(
"组"
,
""
)));
if
(
string
.
IsNullOrEmpty
(
key
))
continue
;
var
index
=
columns
[
key
];
var
cell
=
row
.
GetOrCreate
(
index
);
var
score
=
GetTransfersByDeptAndUnittype
(
costTransfers
,
costTransferItems
,
department
,
unittype
);
cell
.
SetCellOValue
(
score
);
}
departments
.
Remove
(
department
);
}
if
(
departments
==
null
||
!
departments
.
Any
())
return
;
foreach
(
var
department
in
departments
)
{
}
}
catch
(
Exception
ex
)
{
...
...
@@ -59,7 +85,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
var
header
=
sheet
.
GetRow
(
point
.
HeaderFirstRowNum
.
Value
);
if
(
header
==
null
)
return
pairs
;
List
<
string
>
fixedColumns
=
new
List
<
string
>
{
"划拨
(出)收入"
,
"划拨(入)收入"
,
"划拨
收入(医技)"
,
"划拨收入(医生)"
,
"划拨收入(护理)"
};
List
<
string
>
fixedColumns
=
new
List
<
string
>
{
"划拨收入(医技)"
,
"划拨收入(医生)"
,
"划拨收入(护理)"
};
for
(
int
i
=
point
.
HeaderFirstCellNum
.
Value
;
i
<
header
.
LastCellNum
;
i
++)
{
...
...
@@ -89,5 +115,32 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
return
pairs
;
}
private
decimal
GetTransfersByDeptAndUnittype
(
List
<
cost_transfer
>
costTransfers
,
List
<
cost_transfer_item
>
costTransferItems
,
string
department
,
string
unittype
)
{
if
(
costTransfers
==
null
||
!
costTransfers
.
Any
())
return
0
;
var
isApplications
=
new
bool
[]
{
true
,
false
};
var
scores
=
new
List
<
decimal
>();
foreach
(
var
isApplication
in
isApplications
)
{
var
data
=
isApplication
?
costTransfers
.
Where
(
t
=>
t
.
ApplicantDepartment
==
department
&&
t
.
ApplicantUnitType
==
unittype
)?.
ToList
()
:
costTransfers
.
Where
(
t
=>
t
.
AdoptedDepartment
==
department
&&
t
.
AdoptedUnitType
==
unittype
)?.
ToList
();
if
(
data
==
null
||
!
data
.
Any
())
return
0
;
var
items
=
costTransferItems
.
Where
(
t
=>
data
.
Select
(
s
=>
s
.
Id
).
Contains
(
t
.
TransferId
))?.
ToList
();
if
(
items
==
null
||
!
items
.
Any
())
return
0
;
items
.
ForEach
(
t
=>
t
.
IsWrited
=
1
);
costtransferitemRepository
.
UpdateRange
(
items
.
ToArray
());
int
sign
=
isApplication
?
1
:
-
1
;
var
value
=
items
.
Sum
(
t
=>
(
t
.
CalculationAmount
??
0
)
*
sign
);
scores
.
Add
(
value
);
}
return
scores
.
Sum
(
t
=>
t
);
}
}
}
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