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
d66b10dc
Commit
d66b10dc
authored
Sep 26, 2022
by
纪旭 韦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
其他绩效/不公示绩效统计下载
parent
fed050ac
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
222 additions
and
10 deletions
+222
-10
performance/Performance.Api/Controllers/EmployeeController.cs
+68
-4
performance/Performance.Api/wwwroot/Performance.Api.xml
+14
-0
performance/Performance.DtoModels/ExcelDownloadHeads.cs
+1
-0
performance/Performance.Services/DownloadService.cs
+84
-3
performance/Performance.Services/EmployeeService.cs
+55
-3
No files found.
performance/Performance.Api/Controllers/EmployeeController.cs
View file @
d66b10dc
...
...
@@ -3,6 +3,7 @@
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Newtonsoft.Json
;
using
Performance.DtoModels
;
using
Performance.DtoModels.Response
;
using
Performance.EntityModels
;
...
...
@@ -26,8 +27,11 @@ public class EmployeeController : Controller
private
readonly
RoleService
roleService
;
private
readonly
UserService
userService
;
public
EmployeeController
(
EmployeeService
employeeService
,
AllotService
allotService
,
ClaimService
claim
,
IWebHostEnvironment
evn
,
RoleService
roleService
,
public
EmployeeController
(
EmployeeService
employeeService
,
AllotService
allotService
,
ClaimService
claim
,
IWebHostEnvironment
evn
,
RoleService
roleService
,
UserService
userService
)
{
this
.
employeeService
=
employeeService
;
...
...
@@ -291,7 +295,7 @@ public ApiResponse GetAprGroupList([FromRoute] int isAudit, [FromBody] AllotIdRe
if
(
request
.
AllotId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数AllotId无效!"
);
var
result
=
employeeService
.
GetAprList
(
request
.
AllotId
,
claim
.
GetUserId
(),
isAudit
);
var
result
=
employeeService
.
GetAprList
(
request
.
AllotId
,
claim
.
GetUserId
(),
isAudit
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
result
);
}
...
...
@@ -513,7 +517,6 @@ public ApiResponse AprOverview(int allotId)
// result = employeeService.GetOtherPerStats(allotId);
//return new ApiResponse(ResponseType.OK, result);
if
(
allotId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数AllotId无效!"
);
...
...
@@ -546,6 +549,38 @@ public ApiResponse AprOverview(int allotId)
});
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
result
);
}
/// <summary>
/// 医院其他绩效统计下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[
Route
(
"apr/overview/download/{allotId}"
)]
[
HttpPost
]
public
IActionResult
AprOverviewDownload
(
int
allotId
)
{
if
(
allotId
==
0
)
return
Ok
(
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数AllotId无效!"
));
var
userid
=
claim
.
GetUserId
();
var
amounts
=
employeeService
.
GetAprList
(
allotId
,
""
,
3
)
??
new
List
<
view_per_apr_amount
>();
if
(!
amounts
?.
Any
()
==
true
)
{
return
Ok
(
new
ApiResponse
(
ResponseType
.
Fail
,
"数据为空"
));
}
var
filepath
=
employeeService
.
AprListDownload
(
"医院其他绩效统计下载"
,
userid
,
amounts
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
filepath
,
FileMode
.
Open
))
{
stream
.
CopyToAsync
(
memoryStream
).
Wait
();
}
memoryStream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
var
provider
=
new
FileExtensionContentTypeProvider
();
FileInfo
fileInfo
=
new
FileInfo
(
filepath
);
var
memi
=
provider
.
Mappings
[
".xlsx"
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
/// <summary>
/// 清理该科室录入数据
...
...
@@ -876,7 +911,36 @@ public ApiResponse AprHideOverview(int allotId)
});
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
result
);
}
/// <summary>
/// 不公示其他绩效统计下载
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[
Route
(
"apr/hide/overview/download/{allotId}"
)]
[
HttpPost
]
public
IActionResult
AprHideOverviewDownload
(
int
allotId
)
{
var
userid
=
claim
.
GetUserId
();
if
(
allotId
==
0
)
return
Ok
(
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数AllotId无效!"
));
var
amounts
=
employeeService
.
GetAprHideList
(
allotId
,
""
,
3
);
if
(!
amounts
?.
Any
()
==
true
)
return
Ok
(
new
ApiResponse
(
ResponseType
.
Fail
,
"数据为空"
));
var
filepath
=
employeeService
.
AprListDownload
(
"不公示其他绩效统计表下载"
,
userid
,
amounts
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
filepath
,
FileMode
.
Open
))
{
stream
.
CopyToAsync
(
memoryStream
).
Wait
();
}
memoryStream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
var
provider
=
new
FileExtensionContentTypeProvider
();
FileInfo
fileInfo
=
new
FileInfo
(
filepath
);
var
memi
=
provider
.
Mappings
[
".xlsx"
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
/// <summary>
/// 清理该科室录入不公示数据
/// </summary>
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
d66b10dc
...
...
@@ -1225,6 +1225,13 @@
<param
name=
"allotId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.AprOverviewDownload(System.Int32)"
>
<summary>
医院其他绩效统计下载
</summary>
<param
name=
"allotId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.ClearAprData(Performance.DtoModels.AprAmountAuditRequest)"
>
<summary>
清理该科室录入数据
...
...
@@ -1344,6 +1351,13 @@
<param
name=
"allotId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.AprHideOverviewDownload(System.Int32)"
>
<summary>
不公示其他绩效统计下载
</summary>
<param
name=
"allotId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.ClearAprHideData(Performance.DtoModels.AprAmountAuditRequest)"
>
<summary>
清理该科室录入不公示数据
...
...
performance/Performance.DtoModels/ExcelDownloadHeads.cs
View file @
d66b10dc
...
...
@@ -10,5 +10,6 @@ public class ExcelDownloadHeads
{
public
string
Alias
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
decimal
Sort
{
get
;
set
;
}
}
}
performance/Performance.Services/DownloadService.cs
View file @
d66b10dc
...
...
@@ -191,7 +191,7 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
/// <param name="allData"></param>
/// <param name="isAll"></param>
/// <returns></returns>
public
string
AllComputerViewReportByDate
(
int
hospitalId
,
List
<
dynamic
>
dynamics
,
string
route
,
string
name
,
DateTime
beginTime
,
DateTime
endTime
,
params
string
[]
headlist
)
public
string
AllComputerViewReportByDate
(
int
hospitalId
,
List
<
dynamic
>
dynamics
,
string
route
,
string
name
,
DateTime
beginTime
,
DateTime
endTime
,
params
string
[]
headlist
)
{
var
hospital
=
perforHospital
.
GetEntity
(
t
=>
t
.
ID
==
hospitalId
);
...
...
@@ -216,9 +216,9 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str
}
data
.
Add
(
nobj
);
}
var
headList
=
_computeService
.
CustomColumnHeaders
(
hospital
.
ID
,
route
,
headlist
).
Where
(
w
=>
w
.
States
==
1
).
ToList
();
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
,
"Files"
,
"PerformanceRelease"
,
$"
{
hospital
.
ID
}
"
);
FileHelper
.
CreateDirectory
(
dpath
);
string
filepath
=
Path
.
Combine
(
dpath
,
$"
{
hospital
.
HosName
}
-
{
name
}
-
{
DateTime
.
Now
:
yyyy
年
MM
月
dd
日
}
"
);
...
...
@@ -286,7 +286,88 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str
}
return
filepath
;
}
public
string
ExcelDownload
(
List
<
Dictionary
<
string
,
object
>>
rows
,
string
name
,
List
<
ExcelDownloadHeads
>
excelDownloadHeads
,
string
[]
notSum
,
string
[]
ignoreColumns
)
{
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
,
"Files"
,
"PerformanceRelease"
);
FileHelper
.
CreateDirectory
(
dpath
);
string
filepath
=
Path
.
Combine
(
dpath
,
$"医院其他绩效统计下载-
{
DateTime
.
Now
:
yyyy
年
MM
月
dd
日
}
"
);
FileHelper
.
DeleteFile
(
filepath
);
var
data
=
new
List
<
Dictionary
<
string
,
object
>>();
foreach
(
var
obj
in
rows
)
{
Dictionary
<
string
,
object
>
nobj
=
new
Dictionary
<
string
,
object
>();
foreach
(
var
item
in
obj
)
{
nobj
[
item
.
Key
.
ToLower
()]
=
item
.
Value
;
}
data
.
Add
(
nobj
);
}
excelDownloadHeads
=
excelDownloadHeads
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
();
if
(
ignoreColumns
?.
Any
()
==
true
)
excelDownloadHeads
=
excelDownloadHeads
.
Where
(
w
=>
!
ignoreColumns
.
Contains
(
w
.
Alias
)
&&
!
ignoreColumns
.
Contains
(
w
.
Name
)).
ToList
();
using
(
FileStream
fs
=
new
FileStream
(
filepath
,
FileMode
.
OpenOrCreate
))
using
(
ExcelPackage
package
=
new
ExcelPackage
(
fs
))
{
var
worksheet
=
package
.
Workbook
.
Worksheets
.
Add
(
name
);
if
(
rows
!=
null
&&
rows
.
Count
()
>
0
)
{
worksheet
.
SetValue
(
1
,
1
,
name
);
for
(
int
col
=
0
;
col
<
excelDownloadHeads
.
Count
;
col
++)
{
worksheet
.
SetValue
(
2
,
col
+
1
,
excelDownloadHeads
[
col
].
Alias
);
}
for
(
int
col
=
0
;
col
<
excelDownloadHeads
.
Count
;
col
++)
{
for
(
int
row
=
0
;
row
<
data
.
Count
();
row
++)
{
var
temp
=
data
.
ElementAt
(
row
);
var
low
=
temp
.
Keys
.
ToString
().
ToLower
();
var
value
=
temp
[
excelDownloadHeads
[
col
].
Name
.
ToLower
()];
worksheet
.
Cells
[
row
+
3
,
col
+
1
].
Value
=
value
;
}
if
(
col
==
0
)
worksheet
.
SetValue
(
rows
.
Count
()
+
3
,
col
+
1
,
"合计"
);
else
if
(
notSum
?.
Any
()
==
true
&&
!
notSum
.
Contains
(
excelDownloadHeads
[
col
].
Name
.
ToLower
()))
worksheet
.
Cells
[
rows
.
Count
()
+
3
,
col
+
1
].
Formula
=
string
.
Format
(
"SUM({0})"
,
new
ExcelAddress
(
3
,
col
+
1
,
rows
.
Count
()
+
2
,
col
+
1
).
Address
);
}
#
region
样式设置
for
(
int
row
=
worksheet
.
Dimension
.
Start
.
Row
;
row
<=
worksheet
.
Dimension
.
End
.
Row
;
row
++)
{
worksheet
.
Row
(
row
).
Height
=
20
;
for
(
int
col
=
worksheet
.
Dimension
.
Start
.
Column
;
col
<=
worksheet
.
Dimension
.
End
.
Column
;
col
++)
{
if
(
excelDownloadHeads
.
Count
<
col
&&
!
notSum
.
Contains
(
excelDownloadHeads
[
col
-
1
].
Name
.
ToLower
()))
worksheet
.
Cells
[
row
,
col
].
Style
.
Numberformat
.
Format
=
"#,##0.00"
;
worksheet
.
Cells
[
row
,
col
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
row
,
col
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
}
}
worksheet
.
Cells
[
1
,
1
,
1
,
excelDownloadHeads
.
Count
].
Merge
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
excelDownloadHeads
.
Count
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
excelDownloadHeads
.
Count
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
excelDownloadHeads
.
Count
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
excelDownloadHeads
.
Count
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Row
(
1
).
Height
=
24
;
worksheet
.
Cells
[
2
,
1
,
2
,
excelDownloadHeads
.
Count
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
View
.
FreezePanes
(
3
,
1
);
worksheet
.
Cells
.
AutoFitColumns
();
for
(
int
col
=
worksheet
.
Dimension
.
Start
.
Column
;
col
<=
worksheet
.
Dimension
.
End
.
Column
;
col
++)
{
worksheet
.
Column
(
col
).
Width
=
worksheet
.
Column
(
col
).
Width
>
20
?
20
:
worksheet
.
Column
(
col
).
Width
;
}
#
endregion
}
package
.
Save
();
}
return
filepath
;
}
public
static
List
<(
string
,
Func
<
ComputeResponse
,
object
>,
Func
<
List
<
ComputeResponse
>,
decimal
>)>
AllCompute
{
get
;
}
=
new
List
<(
string
,
Func
<
ComputeResponse
,
object
>,
Func
<
List
<
ComputeResponse
>,
decimal
>)>
{
...
...
performance/Performance.Services/EmployeeService.cs
View file @
d66b10dc
...
...
@@ -45,6 +45,9 @@ public class EmployeeService : IAutoInjection
private
readonly
PerforExresultRepository
exresultRepository
;
private
readonly
PerforCollectpermissionRepository
perforcollectpermissionRepository
;
private
ILogger
<
EmployeeService
>
logger
;
private
readonly
RoleService
roleService
;
private
readonly
UserService
userService
;
private
readonly
DownloadService
downloadService
;
public
EmployeeService
(
IMapper
mapper
,
...
...
@@ -71,7 +74,10 @@ public class EmployeeService : IAutoInjection
PerforExspecialRepository
exspecialRepository
,
PerforExresultRepository
exresultRepository
,
PerforCollectpermissionRepository
perforcollectpermissionRepository
,
ILogger
<
EmployeeService
>
logger
)
ILogger
<
EmployeeService
>
logger
,
RoleService
roleService
,
UserService
userService
,
DownloadService
downloadService
)
{
_mapper
=
mapper
;
_service
=
service
;
...
...
@@ -98,6 +104,9 @@ public class EmployeeService : IAutoInjection
this
.
exresultRepository
=
exresultRepository
;
this
.
perforcollectpermissionRepository
=
perforcollectpermissionRepository
;
this
.
logger
=
logger
;
this
.
roleService
=
roleService
;
this
.
userService
=
userService
;
this
.
downloadService
=
downloadService
;
}
#
region
行政人员
...
...
@@ -857,7 +866,6 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
return
others
;
}
#
endregion
/// <summary>
/// 根据人员工号获取人员信息
/// </summary>
...
...
@@ -2083,8 +2091,52 @@ public List<per_apr_amount_hide> GetAprHideByTypeInDepartment(int allotId, strin
var
data
=
_hideRepository
.
GetEntities
(
exp
);
return
data
;
}
}
/// <summary>
/// 医院其他绩效/不公示其他绩效统计下载
/// </summary>
/// <param name="filepath"></param>
/// <param name="userId"></param>
/// <param name="amounts"></param>
/// <returns></returns>
public
string
AprListDownload
(
string
name
,
int
userId
,
List
<
view_per_apr_amount
>
amounts
)
{
var
roleType
=
new
[]
{
(
int
)
Role
.
护士长
,
(
int
)
Role
.
科主任
,
(
int
)
Role
.
特殊科室
,
(
int
)
Role
.
行政科室
,
};
var
user
=
userService
.
GetUser
(
userId
);
var
role
=
roleService
.
GetUserRole
(
user
.
UserID
);
if
(
role
.
Any
(
t
=>
roleType
.
Contains
(
t
.
Type
.
Value
)))
amounts
=
amounts
.
Where
(
w
=>
w
.
AccountingUnit
==
user
.
Department
).
ToList
();
var
allTypes
=
amounts
.
Select
(
w
=>
w
.
PerforType
).
Distinct
().
ToList
();
List
<
Dictionary
<
string
,
object
>>
dics
=
new
List
<
Dictionary
<
string
,
object
>>();
foreach
(
var
item
in
amounts
.
GroupBy
(
t
=>
new
{
t
.
AccountingUnit
,
t
.
PersonnelNumber
,
t
.
DoctorName
}))
{
var
x
=
new
Dictionary
<
string
,
object
>()
{
{
"核算单元"
,
item
.
Key
.
AccountingUnit
},
{
"人员工号"
,
item
.
Key
.
PersonnelNumber
},
{
"姓名"
,
item
.
Key
.
DoctorName
},
};
allTypes
.
ForEach
(
w
=>
x
.
Add
(
w
,
""
));
foreach
(
var
type
in
item
.
GroupBy
(
group
=>
group
.
PerforType
))
{
x
.
AddOrUpdate
(
string
.
IsNullOrEmpty
(
type
.
Key
)
?
"未知"
:
type
.
Key
,
type
.
Sum
(
sum
=>
sum
.
Amount
??
0
));
}
x
.
Add
(
"状态"
,
"审核通过"
);
x
.
Add
(
"合计"
,
item
.
Sum
(
t
=>
t
.
Amount
));
dics
.
Add
(
x
);
}
var
headers
=
((
IDictionary
<
string
,
object
>)
dics
.
ElementAt
(
0
)).
Keys
;
var
excelDownloadHeads
=
headers
.
Select
((
value
,
index
)
=>
new
ExcelDownloadHeads
{
Name
=
value
,
Alias
=
value
,
Sort
=
index
}).
ToList
();
var
noSum
=
new
[]
{
"核算单元"
,
"人员工号"
,
"姓名"
,
"状态"
};
return
downloadService
.
ExcelDownload
(
dics
,
name
,
excelDownloadHeads
,
noSum
,
null
);
}
}
public
class
ComparisonConfig
{
public
static
List
<
Heads
>
DeptHeads
{
get
;
}
=
new
List
<
Heads
>
...
...
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