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
2b7fd3a6
Commit
2b7fd3a6
authored
Dec 03, 2020
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义提取完善
parent
34af787e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
performance/Performance.Services/CustomExtractService.cs
+9
-6
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
+10
-7
No files found.
performance/Performance.Services/CustomExtractService.cs
View file @
2b7fd3a6
...
...
@@ -171,7 +171,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
if
(
deptIndex
>
-
1
)
{
string
atDepartment
=
temp
.
ElementAt
(
deptIndex
).
Value
?.
ToString
()
??
""
;
// 当前行“科室名称”
string
atUnitType
=
(
unitIndex
>
-
1
)
?
headers
.
ElementAt
(
unitIndex
)
:
""
;
// 当前行“核算单元类别”
string
atUnitType
=
(
unitIndex
>
-
1
)
?
temp
.
ElementAt
(
unitIndex
).
Value
?.
ToString
(
)
:
""
;
// 当前行“核算单元类别”
// 如果是科主任护士长 则取角色的 核算单元类别
// 如果是核算办 则取数据中 核算单元类别
...
...
@@ -180,22 +180,25 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
atUnitTypeList
=
unitType
;
else
if
(
unitIndex
>
-
1
)
atUnitTypeList
=
new
string
[]
{
atUnitType
};
// 替换原始科室名称
if
(
atUnitTypeList
.
Any
()
&&
!
string
.
IsNullOrEmpty
(
atDepartment
))
{
var
tempDepts
=
depts
.
Where
(
w
=>
atUnitTypeList
.
Contains
(
w
.
UnitType
)
&&
w
.
HISDeptName
==
atDepartment
);
string
atSource
=
headers
.
ElementAt
(
sourceIndex
);
// 当前行“来源”
if
(
isSecondAdmin
&&
unitType
.
Any
(
w
=>
w
==
UnitType
.
特殊核算组
.
ToString
()
||
w
==
UnitType
.
行政后勤
.
ToString
()))
{
accountUnit
=
tempDepts
.
FirstOrDefault
()?.
AccountingUnit
??
""
;
}
else
{
string
atSource
=
temp
.
ElementAt
(
sourceIndex
).
Value
?.
ToString
()
??
""
;
// 当前行“来源”
accountUnit
=
tempDepts
.
FirstOrDefault
(
w
=>
w
.
Source
==
atSource
)?.
AccountingUnit
??
""
;
}
}
// 跳过写入EXCEL逻辑
if
(
isSecondAdmin
)
{
if
(
!
string
.
IsNullOrEmpty
(
accountUnit
)
&&
accountUnit
!=
department
)
continue
;
if
(
!
string
.
IsNullOrEmpty
(
atUnitType
)
&&
!
atUnitTypeList
.
Contains
(
atUnitType
))
continue
;
if
(
string
.
IsNullOrEmpty
(
accountUnit
)
||
accountUnit
!=
department
)
continue
;
if
(
string
.
IsNullOrEmpty
(
atUnitType
)
||
!
atUnitTypeList
.
Contains
(
atUnitType
))
continue
;
}
}
#
endregion
...
...
@@ -309,7 +312,7 @@ private bool IsSecondAdmin(int userId, out string[] unitType)
var
user
=
_userService
.
GetUser
(
userId
)
??
throw
new
PerformanceException
(
"当前用户信息无效"
);
var
isSecondAdmin
=
IsSecondAdmin
(
userId
,
out
string
[]
unitType
);
var
department
=
isSecondAdmin
?
string
.
Empty
:
(
user
.
Department
??
""
)
;
var
department
=
isSecondAdmin
?
(
user
.
Department
??
""
)
:
string
.
Empty
;
return
(
isSecondAdmin
,
department
,
unitType
);
}
}
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
View file @
2b7fd3a6
...
...
@@ -90,14 +90,17 @@ public static void SetCellValue<T>(this ICell cell, object value, T defaultValue
public
static
void
SetValue
(
this
ISheet
sheet
,
int
row
,
int
column
,
object
value
)
{
var
icell
=
sheet
.
GetOrCreate
(
row
).
GetOrCreate
(
column
);
switch
(
value
)
if
(
value
!=
null
&&
!
string
.
IsNullOrEmpty
(
value
.
ToString
())
)
{
case
string
reg
when
Regex
.
IsMatch
(
reg
,
@"^[+-]?\d*[.]?\d*$"
):
value
=
ConvertHelper
.
To
<
double
>(
value
);
break
;
case
string
reg
when
Regex
.
IsMatch
(
reg
,
@"^[+-]?\d*$"
):
value
=
ConvertHelper
.
To
<
int
>(
value
);
break
;
switch
(
value
)
{
case
string
reg
when
Regex
.
IsMatch
(
reg
,
@"^[+-]?\d*[.]?\d*$"
):
value
=
ConvertHelper
.
To
<
double
>(
value
);
break
;
case
string
reg
when
Regex
.
IsMatch
(
reg
,
@"^[+-]?\d*$"
):
value
=
ConvertHelper
.
To
<
int
>(
value
);
break
;
}
}
SetCellOValue
(
icell
,
value
);
...
...
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