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
3fddbdd4
Commit
3fddbdd4
authored
Oct 13, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据录入权限
parent
e218731d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
12 deletions
+106
-12
performance/Performance.Api/Controllers/CollectController.cs
+5
-2
performance/Performance.Api/appsettings.Localhost.json
+2
-0
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+5
-0
performance/Performance.DtoModels/AppSettings/Application.cs
+4
-0
performance/Performance.Services/CollectService.cs
+90
-10
No files found.
performance/Performance.Api/Controllers/CollectController.cs
View file @
3fddbdd4
...
@@ -35,7 +35,7 @@ public class CollectController : ControllerBase
...
@@ -35,7 +35,7 @@ public class CollectController : ControllerBase
/// </summary>
/// </summary>
[
HttpPost
]
[
HttpPost
]
[
Route
(
"getcollectcontent"
)]
[
Route
(
"getcollectcontent"
)]
public
ApiResponse
GetCollectContent
([
FromQuery
]
int
hospitalId
,
[
FromQuery
]
int
userId
)
public
ApiResponse
GetCollectContent
([
FromQuery
]
int
hospitalId
,
[
FromQuery
]
int
userId
)
{
{
if
(
hospitalId
<=
0
)
if
(
hospitalId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
...
@@ -74,7 +74,10 @@ public ApiResponse GetCollectSheet(int hospitalId)
...
@@ -74,7 +74,10 @@ public ApiResponse GetCollectSheet(int hospitalId)
?.
Select
(
w
=>
new
{
w
.
SheetType
,
w
.
SheetName
})
?.
Select
(
w
=>
new
{
w
.
SheetType
,
w
.
SheetName
})
.
Distinct
()
.
Distinct
()
.
ToList
();
.
ToList
();
result
?.
Add
(
new
{
SheetType
=
-
1
,
SheetName
=
"预留比例"
});
//result?.Add(new { SheetType = -1, SheetName = "预留比例" });
if
(
result
==
null
||
!
result
.
Any
())
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
result
=
result
.
OrderBy
(
w
=>
regex
.
IsMatch
(
w
.
SheetName
)
?
w
.
SheetName
:
$"0
{
w
.
SheetName
}
"
)
result
=
result
.
OrderBy
(
w
=>
regex
.
IsMatch
(
w
.
SheetName
)
?
w
.
SheetName
:
$"0
{
w
.
SheetName
}
"
)
.
ThenBy
(
w
=>
w
.
SheetType
)
.
ThenBy
(
w
=>
w
.
SheetType
)
.
ToList
();
.
ToList
();
...
...
performance/Performance.Api/appsettings.Localhost.json
View file @
3fddbdd4
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
"DirectorRole"
:
"4"
,
"DirectorRole"
:
"4"
,
//特殊科室二次绩效管理员
//特殊科室二次绩效管理员
"SpecialRole"
:
"9"
,
"SpecialRole"
:
"9"
,
//数据收集角色(可查看所有)
"CollectRoles"
:
[
1
,
2
,
5
,
6
,
7
,
8
],
//
抽取结果Excel文件保存地址
//
抽取结果Excel文件保存地址
"AbsolutePath"
:
"E:
\\
wwwroot
\\
testjx.suvalue.com"
,
"AbsolutePath"
:
"E:
\\
wwwroot
\\
testjx.suvalue.com"
,
//
抽取结果Excel文件保存地址
更替的
网络地址
//
抽取结果Excel文件保存地址
更替的
网络地址
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
3fddbdd4
...
@@ -49,6 +49,11 @@
...
@@ -49,6 +49,11 @@
特殊科室二次绩效管理员
特殊科室二次绩效管理员
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.Application.CollectRoles"
>
<summary>
数据收集角色(可查看所有)
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.Application.Receiver"
>
<member
name=
"P:Performance.DtoModels.AppSettings.Application.Receiver"
>
<summary>
<summary>
邮件指定接收人
邮件指定接收人
...
...
performance/Performance.DtoModels/AppSettings/Application.cs
View file @
3fddbdd4
...
@@ -31,6 +31,10 @@ public class Application
...
@@ -31,6 +31,10 @@ public class Application
/// </summary>
/// </summary>
public
int
SpecialRole
{
get
;
set
;
}
public
int
SpecialRole
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 数据收集角色(可查看所有)
/// </summary>
public
int
[]
CollectRoles
{
get
;
set
;
}
/// <summary>
/// 邮件指定接收人
/// 邮件指定接收人
/// </summary>
/// </summary>
public
string
[]
Receiver
{
get
;
set
;
}
public
string
[]
Receiver
{
get
;
set
;
}
...
...
performance/Performance.Services/CollectService.cs
View file @
3fddbdd4
using
Performance.DtoModels
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.DtoModels.Response
;
using
Performance.DtoModels.Response
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
...
@@ -6,6 +8,7 @@
...
@@ -6,6 +8,7 @@
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Text
;
namespace
Performance.Services
namespace
Performance.Services
...
@@ -22,6 +25,8 @@ public class CollectService : IAutoInjection
...
@@ -22,6 +25,8 @@ public class CollectService : IAutoInjection
private
readonly
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
;
private
readonly
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
;
private
readonly
PerforcollectdataRepository
perforcollectdataRepository
;
private
readonly
PerforcollectdataRepository
perforcollectdataRepository
;
private
readonly
PerforcollectpermissionRepository
perforcollectpermissionRepository
;
private
readonly
PerforcollectpermissionRepository
perforcollectpermissionRepository
;
private
readonly
PerforUserroleRepository
userroleRepository
;
private
readonly
Application
options
;
public
CollectService
(
public
CollectService
(
PerforUserRepository
userRepository
,
PerforUserRepository
userRepository
,
...
@@ -33,7 +38,9 @@ public class CollectService : IAutoInjection
...
@@ -33,7 +38,9 @@ public class CollectService : IAutoInjection
PerforImemployeeclinicRepository
perforImemployeeclinicRepository
,
PerforImemployeeclinicRepository
perforImemployeeclinicRepository
,
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
,
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
,
PerforcollectdataRepository
perforcollectdataRepository
,
PerforcollectdataRepository
perforcollectdataRepository
,
PerforcollectpermissionRepository
perforcollectpermissionRepository
)
PerforcollectpermissionRepository
perforcollectpermissionRepository
,
PerforUserroleRepository
userroleRepository
,
IOptions
<
Application
>
options
)
{
{
this
.
userRepository
=
userRepository
;
this
.
userRepository
=
userRepository
;
this
.
perforPerallotRepository
=
perforPerallotRepository
;
this
.
perforPerallotRepository
=
perforPerallotRepository
;
...
@@ -45,8 +52,13 @@ public class CollectService : IAutoInjection
...
@@ -45,8 +52,13 @@ public class CollectService : IAutoInjection
this
.
perforImemployeelogisticsRepository
=
perforImemployeelogisticsRepository
;
this
.
perforImemployeelogisticsRepository
=
perforImemployeelogisticsRepository
;
this
.
perforcollectdataRepository
=
perforcollectdataRepository
;
this
.
perforcollectdataRepository
=
perforcollectdataRepository
;
this
.
perforcollectpermissionRepository
=
perforcollectpermissionRepository
;
this
.
perforcollectpermissionRepository
=
perforcollectpermissionRepository
;
this
.
userroleRepository
=
userroleRepository
;
this
.
options
=
options
.
Value
;
}
}
private
readonly
string
[]
retain
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
,
"核算单元"
,
"核算单元类型"
,
"人员工号"
,
"医生姓名"
,
"姓名"
,
"核算单元分类"
,
"人员分类"
};
/// <summary>
/// <summary>
/// 查询采集内容
/// 查询采集内容
/// </summary>
/// </summary>
...
@@ -64,7 +76,8 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
...
@@ -64,7 +76,8 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
var
allot
=
allotList
.
First
();
var
allot
=
allotList
.
First
();
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
};
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
);
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
);
...
@@ -73,6 +86,9 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
...
@@ -73,6 +86,9 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
if
(
sheets
==
null
||
!
sheets
.
Any
())
if
(
sheets
==
null
||
!
sheets
.
Any
())
return
null
;
return
null
;
if
(
headers
==
null
||
!
headers
.
Any
())
return
null
;
// 查询sheet和列头对应
// 查询sheet和列头对应
var
sheetHeads
=
from
sheet
in
sheets
var
sheetHeads
=
from
sheet
in
sheets
join
head
in
headers
on
sheet
.
ID
equals
head
.
SheetID
join
head
in
headers
on
sheet
.
ID
equals
head
.
SheetID
...
@@ -104,8 +120,6 @@ into emppmss
...
@@ -104,8 +120,6 @@ into emppmss
}
}
if
(
result
!=
null
&&
result
.
Any
())
if
(
result
!=
null
&&
result
.
Any
())
{
{
var
retain
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
,
"核算单元"
,
"核算单元类型"
,
"人员工号"
,
"医生姓名"
,
"姓名"
,
"核算单元分类"
,
"人员分类"
};
result
.
ForEach
(
w
=>
result
.
ForEach
(
w
=>
{
{
w
.
BanChange
=
retain
.
Any
(
r
=>
r
==
w
.
HeadName
);
w
.
BanChange
=
retain
.
Any
(
r
=>
r
==
w
.
HeadName
);
...
@@ -175,10 +189,76 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
...
@@ -175,10 +189,76 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
}
}
}
}
public
IEnumerable
<
collect_permission
>
GetCollectSheet
(
int
hospitalId
,
int
userId
,
string
sheetName
=
""
)
{
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
if
(
userrole
==
null
)
return
new
List
<
collect_permission
>();
public
IEnumerable
<
collect_permission
>
GetCollectSheet
(
int
hospitalId
,
int
userId
)
if
(!
options
.
CollectRoles
.
Contains
(
userrole
.
RoleID
))
{
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
return
perforcollectpermissionRepository
.
GetEntities
(
exp
);
}
var
result
=
GetCollectSheetByAllot
(
hospitalId
,
userId
);
return
result
;
}
private
IEnumerable
<
collect_permission
>
GetCollectSheetByAllot
(
int
hospitalId
,
int
userId
,
string
sheetName
=
""
)
{
{
return
perforcollectpermissionRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
);
var
states
=
new
[]
{
(
int
)
AllotStates
.
Archive
,
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
GenerateAccomplish
};
var
allotList
=
perforPerallotRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
states
.
Contains
(
w
.
States
))
?.
OrderByDescending
(
w
=>
w
.
Year
).
ThenByDescending
(
w
=>
w
.
Month
).
ToList
();
if
(
allotList
==
null
||
!
allotList
.
Any
())
return
null
;
var
allot
=
allotList
.
First
();
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
};
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
);
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
{
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
sheets
=
sheets
.
Where
(
w
=>
w
.
SheetName
==
sheetName
)?.
ToList
();
}
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
exp
);
// 查询列头和权限对应
if
(
permissions
==
null
)
{
if
(
sheets
==
null
||
!
sheets
.
Any
())
return
null
;
if
(
headers
==
null
||
!
headers
.
Any
())
return
null
;
// 查询sheet和列头对应
var
sheetHeads
=
from
sheet
in
sheets
join
head
in
headers
on
sheet
.
ID
equals
head
.
SheetID
select
new
{
sheet
.
SheetName
,
sheet
.
SheetType
,
HeadName
=
head
.
CellValue
};
var
result
=
sheetHeads
.
Select
(
sh
=>
new
collect_permission
{
HospitalId
=
hospitalId
,
SheetName
=
sh
.
SheetName
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
,
AttachLast
=
1
,
Visible
=
1
})?.
ToList
();
//if (result != null && result.Any())
//{
// result.ForEach(w =>
// {
// var criterion = retain.Any(r => r == w.HeadName);
// w.Readnoly = criterion ? 1 : w.Readnoly;
// });
return
result
;
//}
}
return
permissions
;
}
}
#
region
加载采集内容
#
region
加载采集内容
...
@@ -211,7 +291,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
...
@@ -211,7 +291,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
throw
new
PerformanceException
(
"当前医院没有录入项"
);
throw
new
PerformanceException
(
"当前医院没有录入项"
);
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
};
var
sheet
=
perforPersheetRepository
var
sheet
=
perforPersheetRepository
.
GetEntity
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
w
.
SheetName
==
sheetName
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
.
GetEntity
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
w
.
SheetName
==
sheetName
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
...
@@ -223,8 +304,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
...
@@ -223,8 +304,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
if
(
headers
==
null
||
!
headers
.
Any
())
if
(
headers
==
null
||
!
headers
.
Any
())
throw
new
PerformanceException
(
"SHEET页没有有效列头"
);
throw
new
PerformanceException
(
"SHEET页没有有效列头"
);
var
cols
=
headers
.
Select
(
w
=>
w
.
CellValue
).
ToArray
();
var
cols
=
headers
.
Select
(
w
=>
w
.
CellValue
).
ToArray
();
var
permissions
=
perforcollectpermissionRepository
var
permissions
=
GetCollectSheet
(
allot
.
HospitalId
,
userId
,
sheetName
)?.
ToList
();
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
&&
w
.
UserId
==
userId
&&
w
.
SheetName
==
sheetName
)?.
ToList
();
if
(
permissions
==
null
||
!
permissions
.
Any
())
if
(
permissions
==
null
||
!
permissions
.
Any
())
throw
new
PerformanceException
(
"用户没有权限编辑当前SHEET页"
);
throw
new
PerformanceException
(
"用户没有权限编辑当前SHEET页"
);
...
...
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