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
164745ef
Commit
164745ef
authored
Sep 11, 2020
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
行政后勤二次分配
parent
1a969928
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
285 additions
and
240 deletions
+285
-240
performance/Performance.Api/Controllers/AccountController.cs
+2
-2
performance/Performance.Api/Controllers/AgainAllotController.cs
+41
-41
performance/Performance.Api/appsettings.json
+2
-0
performance/Performance.Api/wwwroot/Performance.Api.xml
+0
-14
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+5
-0
performance/Performance.DtoModels/AppSettings/Application.cs
+4
-0
performance/Performance.DtoModels/PerExcel/ExcelEnum.cs
+2
-2
performance/Performance.Services/AgainAllotService.cs
+164
-164
performance/Performance.Services/AllotService.cs
+3
-1
performance/Performance.Services/ComputeService.cs
+1
-1
performance/Performance.Services/PersonService.cs
+2
-1
performance/Performance.Services/ReportDataService.cs
+2
-1
performance/Performance.Services/SecondAllotService.cs
+30
-8
performance/Performance.Services/UserService.cs
+27
-5
No files found.
performance/Performance.Api/Controllers/AccountController.cs
View file @
164745ef
...
...
@@ -110,7 +110,7 @@ public ApiResponse SelfInfo()
user
.
Role
=
_roleService
.
GetUserRole
(
user
.
UserID
);
user
.
Hospital
=
_hospitalService
.
GetUserHopital
(
user
.
UserID
);
int
[]
roleArray
=
new
int
[]
{
_options
.
NurseRole
,
_options
.
DirectorRole
,
_options
.
SpecialRole
};
int
[]
roleArray
=
new
int
[]
{
_options
.
NurseRole
,
_options
.
DirectorRole
,
_options
.
SpecialRole
,
_options
.
OfficeRole
};
user
.
IsAgainAdmin
=
user
.
Role
!=
null
?
roleArray
.
Contains
(
user
.
Role
.
First
().
Type
??
0
)
:
false
;
return
new
ApiResponse
(
ResponseType
.
OK
,
user
);
}
...
...
@@ -179,7 +179,7 @@ public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"),
{
var
userId
=
_claim
.
GetUserId
();
int
[]
roleArray
=
new
int
[]
{
_options
.
NurseRole
,
_options
.
DirectorRole
};
int
[]
roleArray
=
new
int
[]
{
_options
.
NurseRole
,
_options
.
DirectorRole
,
_options
.
SpecialRole
,
_options
.
OfficeRole
};
var
roles
=
_roleService
.
GetUserRole
(
userId
);
var
isAgainAdmin
=
roles
!=
null
?
roleArray
.
Contains
(
roles
.
First
().
Type
??
0
)
:
false
;
...
...
performance/Performance.Api/Controllers/AgainAllotController.cs
View file @
164745ef
...
...
@@ -116,49 +116,49 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
OK
);
}
/// <summary>
/// 查看科室绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"departmentdetail"
)]
[
HttpPost
]
public
ApiResponse
DepartmentDetail
([
CustomizeValidator
(
RuleSet
=
"Generate"
),
FromBody
]
AgainAllotRequest
request
)
{
var
userId
=
claimService
.
GetUserId
();
var
roles
=
roleService
.
GetUserRole
(
userId
);
var
department
=
claimService
.
GetUserClaim
(
JwtClaimTypes
.
Department
);
///
//
<summary>
///
//
查看科室绩效
///
//
</summary>
///
//
<param name="request"></param>
///
//
<returns></returns>
//
[Route("departmentdetail")]
//
[HttpPost]
//
public ApiResponse DepartmentDetail([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request)
//
{
//
var userId = claimService.GetUserId();
//
var roles = roleService.GetUserRole(userId);
//
var department = claimService.GetUserClaim(JwtClaimTypes.Department);
var
again
=
againAllotService
.
GetAgainallot
(
request
.
AgainAllotID
);
if
(
again
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"当前二次绩效ID无效"
);
if
(
roles
.
First
().
Type
==
application
.
DirectorRole
)
{
var
detail
=
computeService
.
GetDepartmentDetail
(
again
.
AllotID
.
Value
,
department
,
1
);
return
new
ApiResponse
(
ResponseType
.
OK
,
detail
);
}
else
if
(
roles
.
First
().
Type
==
application
.
NurseRole
)
{
var
detail
=
computeService
.
GetDepartmentDetail
(
again
.
AllotID
.
Value
,
department
,
2
);
return
new
ApiResponse
(
ResponseType
.
OK
,
detail
);
}
return
new
ApiResponse
(
ResponseType
.
Fail
,
"当前用户角色无法识别"
);
}
//
var again = againAllotService.GetAgainallot(request.AgainAllotID);
//
if (again == null)
//
return new ApiResponse(ResponseType.Fail, "当前二次绩效ID无效");
//
if (roles.First().Type == application.DirectorRole)
//
{
//
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 1);
//
return new ApiResponse(ResponseType.OK, detail);
//
}
//
else if (roles.First().Type == application.NurseRole)
//
{
//
var detail = computeService.GetDepartmentDetail(again.AllotID.Value, department, 2);
//
return new ApiResponse(ResponseType.OK, detail);
//
}
//
return new ApiResponse(ResponseType.Fail, "当前用户角色无法识别");
//
}
/// <summary>
/// 生成绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"generate"
)]
[
HttpPost
]
public
ApiResponse
Generate
([
CustomizeValidator
(
RuleSet
=
"Generate"
),
FromBody
]
AgainAllotRequest
request
)
{
var
userId
=
claimService
.
GetUserId
();
var
department
=
claimService
.
GetUserClaim
(
JwtClaimTypes
.
Department
);
var
result
=
againAllotService
.
Generate
(
request
,
userId
,
department
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
///
//
<summary>
///
//
生成绩效
///
//
</summary>
///
//
<param name="request"></param>
///
//
<returns></returns>
//
[Route("generate")]
//
[HttpPost]
//
public ApiResponse Generate([CustomizeValidator(RuleSet = "Generate"), FromBody]AgainAllotRequest request)
//
{
//
var userId = claimService.GetUserId();
//
var department = claimService.GetUserClaim(JwtClaimTypes.Department);
//
var result = againAllotService.Generate(request, userId, department);
//
return new ApiResponse(ResponseType.OK);
//
}
/// <summary>
/// 查看绩效详情
...
...
performance/Performance.Api/appsettings.json
View file @
164745ef
...
...
@@ -36,6 +36,8 @@
"DirectorRole"
:
"4"
,
//特殊科室二次绩效管理员
"SpecialRole"
:
"9"
,
//行政科室二次绩效管理员
"OfficeRole"
:
"10"
,
//邮件指定接收人
"Receiver"
:
[
"chengxiang.li@suvalue.com"
,
"486035085@qq.com"
],
//
抽取结果Excel文件保存地址
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
164745ef
...
...
@@ -115,20 +115,6 @@
<param
name=
"form"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AgainAllotController.DepartmentDetail(Performance.DtoModels.AgainAllotRequest)"
>
<summary>
查看科室绩效
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AgainAllotController.Generate(Performance.DtoModels.AgainAllotRequest)"
>
<summary>
生成绩效
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AgainAllotController.Detail(Performance.DtoModels.AgainAllotRequest)"
>
<summary>
查看绩效详情
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
164745ef
...
...
@@ -49,6 +49,11 @@
特殊科室二次绩效管理员
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.Application.OfficeRole"
>
<summary>
行政科室二次绩效管理员
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.Application.Receiver"
>
<summary>
邮件指定接收人
...
...
performance/Performance.DtoModels/AppSettings/Application.cs
View file @
164745ef
...
...
@@ -31,6 +31,10 @@ public class Application
/// </summary>
public
int
SpecialRole
{
get
;
set
;
}
/// <summary>
/// 行政科室二次绩效管理员
/// </summary>
public
int
OfficeRole
{
get
;
set
;
}
/// <summary>
/// 邮件指定接收人
/// </summary>
public
string
[]
Receiver
{
get
;
set
;
}
...
...
performance/Performance.DtoModels/PerExcel/ExcelEnum.cs
View file @
164745ef
...
...
@@ -37,8 +37,8 @@ public enum UnitType
行政高层
=
10
,
[
Description
(
"行政中层"
)]
行政中层
=
11
,
[
Description
(
"行政
工
勤"
)]
行政
工
勤
=
12
,
[
Description
(
"行政
后
勤"
)]
行政
后
勤
=
12
,
}
public
enum
SheetType
...
...
performance/Performance.Services/AgainAllotService.cs
View file @
164745ef
...
...
@@ -64,170 +64,170 @@ public class AgainAllotService : IAutoInjection
this
.
configService
=
configService
;
}
/// <summary>
/// 生成二次绩效
/// </summary>
/// <param name="request"></param>
public
bool
Generate
(
AgainAllotRequest
request
,
int
userId
,
string
department
)
{
var
againAllot
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
request
.
AgainAllotID
);
if
(
againAllot
==
null
||
againAllot
.
ID
==
0
)
throw
new
PerformanceException
(
"绩效二次分配不存在"
);
var
roles
=
roleService
.
GetRole
(
userId
);
perforPeragainallotRepository
.
Update
(
againAllot
,
p
=>
{
p
.
States
=
2
;
});
//清理二次绩效无用数据
configService
.
ClearAgain
(
againAllot
.
ID
);
try
{
#
region
基础信息
//获取基础配置信息
var
config
=
perforCofagainRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
againAllot
.
AllotID
);
var
jobfactor
=
config
.
FirstOrDefault
(
t
=>
t
.
Type
==
1
)?.
Value
;
var
workfactor
=
config
.
FirstOrDefault
(
t
=>
t
.
Type
==
2
)?.
Value
;
var
days
=
config
.
FirstOrDefault
(
t
=>
t
.
Type
==
3
)?.
Value
;
decimal
?
basicnumber
=
0
m
;
//获取科室实发绩效
if
(
roles
!=
null
)
{
var
role
=
roles
.
FirstOrDefault
();
if
(
role
!=
null
)
{
if
(
application
.
NurseRole
==
role
.
Type
)
basicnumber
=
perforResaccountRepository
.
GetEntity
(
t
=>
t
.
UnitType
==
(
int
)
UnitType
.
护理组
&&
t
.
AllotID
==
againAllot
.
AllotID
&&
t
.
AccountingUnit
==
department
)?.
RealGiveFee
;
else
if
(
application
.
DirectorRole
==
role
.
Type
)
basicnumber
=
perforResaccountRepository
.
GetEntity
(
t
=>
t
.
UnitType
!=
(
int
)
UnitType
.
护理组
&&
t
.
AllotID
==
againAllot
.
AllotID
&&
t
.
AccountingUnit
==
department
)?.
RealGiveFee
;
}
}
#
endregion
#
region
计算
//读取二次计算excel数据
var
perAgainExcel
=
againService
.
ReadData
(
againAllot
);
//护士长或科主任出勤
var
bossAttendance
=
perAgainExcel
.
AgainEmployee
.
FirstOrDefault
(
t
=>
t
.
JobTitle
==
"护士长"
)?.
Attendance
;
//计算职称出勤系数、年资出勤系数
foreach
(
var
item
in
perAgainExcel
.
AgainEmployee
)
{
item
.
JobAttendanceFactor
=
item
.
JobFactor
*
item
.
Attendance
/
days
;
item
.
YearAttendanceFactor
=
item
.
Attendance
*
item
.
YearFactor
/
days
;
}
//计算 科室系数人均
var
departmentFactorAvg
=
basicnumber
/
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
YearAttendanceFactor
);
//二次分配科室概览
PerAgainSituation
situation
=
new
PerAgainSituation
{
NightShift
=
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
NightShift
),
DepartmentTotal
=
basicnumber
,
BossPerfor
=
departmentFactorAvg
*
bossAttendance
/
days
,
Award
=
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
Award
),
Allowance
=
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
Allowance
),
AlonePerfor
=
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
AlonePerfor
),
Attendance
=
days
,
DepartmentFactorAvg
=
departmentFactorAvg
};
//业绩二次分配科室概览:业绩分配绩效、职称绩效、工作量绩效
situation
.
AllotPerfor
=
situation
.
DepartmentTotal
-
situation
.
BossPerfor
-
situation
.
Award
-
situation
.
Allowance
-
situation
.
AlonePerfor
;
situation
.
JobPerfor
=
situation
.
AllotPerfor
*
jobfactor
;
situation
.
WorkloadPerfor
=
situation
.
AllotPerfor
*
workfactor
;
var
rowList
=
perAgainExcel
.
AgainData
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
ToList
();
//业绩二次分配科室动态数据:工作量得分
foreach
(
var
rowNumber
in
rowList
)
{
var
againEmployee
=
perAgainExcel
.
AgainEmployee
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
);
var
atRowList
=
perAgainExcel
.
AgainData
.
Where
(
t
=>
t
.
RowNumber
==
rowNumber
);
decimal
?
sumValue
=
0
m
;
foreach
(
var
atRow
in
atRowList
)
sumValue
+=
atRow
.
IsFactor
==
1
?
atRow
.
IsFactor
*
atRow
.
CellValue
:
atRow
.
CellValue
;
sumValue
=
sumValue
*
againEmployee
?.
YearFactor
;
var
head
=
perAgainExcel
.
Header
.
Children
.
FirstOrDefault
(
t
=>
t
.
CellValue
==
"工作量得分"
);
if
(
head
==
null
)
{
perAgainExcel
.
Header
.
MergeCell
++;
var
pointrow
=
perAgainExcel
.
Header
.
Children
.
Max
(
t
=>
t
.
PointRow
);
var
pointcell
=
perAgainExcel
.
Header
.
Children
.
Max
(
t
=>
t
.
PointCell
);
head
=
new
PerHeader
(
pointrow
,
pointcell
,
"工作量得分"
,
1
,
1
,
1
,
null
,
1
);
perAgainExcel
.
Header
.
Children
.
Add
(
head
);
}
perAgainExcel
.
AgainData
.
Add
(
new
PerAgainData
(
rowNumber
.
Value
,
"工作量得分"
,
sumValue
,
1
,
2
,
null
,
""
,
""
,
head
.
SignID
));
}
//业绩二次分配科室动态数据:绩效工资
foreach
(
var
rowNumber
in
rowList
)
{
var
workvalue
=
perAgainExcel
.
AgainData
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
rowNumber
&&
t
.
TypeName
==
"工作量得分"
)?.
CellValue
;
var
sumvalue
=
perAgainExcel
.
AgainData
.
Where
(
t
=>
t
.
TypeName
==
"工作量得分"
).
Sum
(
t
=>
t
.
CellValue
);
var
perforValue
=
workvalue
/
sumvalue
*
situation
.
WorkloadPerfor
;
var
head
=
perAgainExcel
.
Header
.
Children
.
FirstOrDefault
(
t
=>
t
.
CellValue
==
"绩效工资"
);
if
(
head
==
null
)
{
perAgainExcel
.
Header
.
MergeCell
++;
var
pointrow
=
perAgainExcel
.
Header
.
Children
.
Max
(
t
=>
t
.
PointRow
);
var
pointcell
=
perAgainExcel
.
Header
.
Children
.
Max
(
t
=>
t
.
PointCell
);
head
=
new
PerHeader
(
pointrow
,
pointcell
,
"绩效工资"
,
1
,
1
,
1
,
null
,
1
);
perAgainExcel
.
Header
.
Children
.
Add
(
head
);
}
perAgainExcel
.
AgainData
.
Add
(
new
PerAgainData
(
rowNumber
.
Value
,
"绩效工资"
,
perforValue
,
1
,
2
,
null
,
""
,
""
,
head
.
SignID
));
}
//业绩二次分配科室:应发绩效、实发绩效
string
[]
jobArray
=
new
string
[]
{
"护士长"
,
"科主任"
};
foreach
(
var
employee
in
perAgainExcel
.
AgainEmployee
)
{
if
(
jobArray
.
Contains
(
employee
.
JobTitle
))
{
employee
.
GiveFee
=
situation
.
BossPerfor
;
employee
.
RealGiveFee
=
situation
.
BossPerfor
;
}
else
{
employee
.
JobAttendancePerfor
=
situation
.
JobPerfor
*
employee
.
JobAttendanceFactor
/
perAgainExcel
.
AgainEmployee
.
Sum
(
t
=>
t
.
JobAttendanceFactor
);
var
value
=
perAgainExcel
.
AgainData
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
employee
.
RowNumber
&&
t
.
TypeName
==
"绩效工资"
)?.
CellValue
;
employee
.
GiveFee
=
(
employee
.
JobAttendancePerfor
??
0
)
+
(
value
??
0
)
+
(
employee
.
Award
??
0
)
+
(
employee
.
Allowance
??
0
)
+
(
employee
.
AlonePerfor
??
0
);
employee
.
RealGiveFee
=
(
employee
.
GiveFee
??
0
)
+
(
employee
.
NightShift
??
0
);
}
}
#
endregion
#
region
保存
var
againsituation
=
Mapper
.
Map
<
ag_againsituation
>(
situation
);
againsituation
.
AllotID
=
againAllot
.
AllotID
;
againsituation
.
AgainAllotID
=
againAllot
.
ID
;
perforAgagainsituationRepository
.
Add
(
againsituation
);
var
employeeList
=
Mapper
.
Map
<
List
<
ag_employee
>>(
perAgainExcel
.
AgainEmployee
);
employeeList
.
ForEach
(
item
=>
{
item
.
AllotID
=
againAllot
.
AllotID
;
item
.
AgainAllotID
=
againAllot
.
ID
;
});
perforAgemployeeRepository
.
AddRange
(
employeeList
.
ToArray
());
var
pHeader
=
Mapper
.
Map
<
ag_header
>(
perAgainExcel
.
Header
);
pHeader
.
AllotID
=
againAllot
.
AllotID
;
pHeader
.
AgainAllotID
=
againAllot
.
ID
;
var
cHeaderList
=
Mapper
.
Map
<
List
<
ag_header
>>(
perAgainExcel
.
Header
.
Children
);
cHeaderList
.
ForEach
(
item
=>
{
item
.
AllotID
=
againAllot
.
AllotID
;
item
.
AgainAllotID
=
againAllot
.
ID
;
});
perforAgheaderRepository
.
Add
(
pHeader
);
perforAgheaderRepository
.
AddRange
(
cHeaderList
.
ToArray
());
var
dataList
=
Mapper
.
Map
<
List
<
ag_data
>>(
perAgainExcel
.
AgainData
);
dataList
.
ForEach
(
item
=>
{
item
.
AllotID
=
againAllot
.
AllotID
;
item
.
AgainAllotID
=
againAllot
.
ID
;
});
perforAgdataRepository
.
AddRange
(
dataList
.
ToArray
());
#
endregion
}
catch
(
Exception
ex
)
{
perforPeragainallotRepository
.
Update
(
againAllot
,
p
=>
{
p
.
States
=
4
;
p
.
Remark
=
ex
.
ToString
();
});
}
perforPeragainallotRepository
.
Update
(
againAllot
,
p
=>
{
p
.
States
=
3
;
});
return
true
;
//return SheetFormat(perAgainExcel, situation);
}
///
//
<summary>
///
//
生成二次绩效
///
//
</summary>
///
//
<param name="request"></param>
//
public bool Generate(AgainAllotRequest request, int userId, string department)
//
{
//
var againAllot = perforPeragainallotRepository.GetEntity(t => t.ID == request.AgainAllotID);
//
if (againAllot == null || againAllot.ID == 0)
//
throw new PerformanceException("绩效二次分配不存在");
//
var roles = roleService.GetRole(userId);
//
perforPeragainallotRepository.Update(againAllot, p => { p.States = 2; });
//
//清理二次绩效无用数据
//
configService.ClearAgain(againAllot.ID);
//
try
//
{
//
#region 基础信息
//
//获取基础配置信息
//
var config = perforCofagainRepository.GetEntities(t => t.AllotID == againAllot.AllotID);
//
var jobfactor = config.FirstOrDefault(t => t.Type == 1)?.Value;
//
var workfactor = config.FirstOrDefault(t => t.Type == 2)?.Value;
//
var days = config.FirstOrDefault(t => t.Type == 3)?.Value;
//
decimal? basicnumber = 0m;
//
//获取科室实发绩效
//
if (roles != null)
//
{
//
var role = roles.FirstOrDefault();
//
if (role != null)
//
{
//
if (application.NurseRole == role.Type)
//
basicnumber = perforResaccountRepository.GetEntity(t => t.UnitType == (int)UnitType.护理组 && t.AllotID == againAllot.AllotID && t.AccountingUnit == department)?.RealGiveFee;
//
else if (application.DirectorRole == role.Type)
//
basicnumber = perforResaccountRepository.GetEntity(t => t.UnitType != (int)UnitType.护理组 && t.AllotID == againAllot.AllotID && t.AccountingUnit == department)?.RealGiveFee;
//
}
//
}
//
#endregion
//
#region 计算
//
//读取二次计算excel数据
//
var perAgainExcel = againService.ReadData(againAllot);
//
//护士长或科主任出勤
//
var bossAttendance = perAgainExcel.AgainEmployee.FirstOrDefault(t => t.JobTitle == "护士长")?.Attendance;
//
//计算职称出勤系数、年资出勤系数
//
foreach (var item in perAgainExcel.AgainEmployee)
//
{
//
item.JobAttendanceFactor = item.JobFactor * item.Attendance / days;
//
item.YearAttendanceFactor = item.Attendance * item.YearFactor / days;
//
}
//
//计算 科室系数人均
//
var departmentFactorAvg = basicnumber / perAgainExcel.AgainEmployee.Sum(t => t.YearAttendanceFactor);
//
//二次分配科室概览
//
PerAgainSituation situation = new PerAgainSituation
//
{
//
NightShift = perAgainExcel.AgainEmployee.Sum(t => t.NightShift),
//
DepartmentTotal = basicnumber,
//
BossPerfor = departmentFactorAvg * bossAttendance / days,
//
Award = perAgainExcel.AgainEmployee.Sum(t => t.Award),
//
Allowance = perAgainExcel.AgainEmployee.Sum(t => t.Allowance),
//
AlonePerfor = perAgainExcel.AgainEmployee.Sum(t => t.AlonePerfor),
//
Attendance = days,
//
DepartmentFactorAvg = departmentFactorAvg
//
};
//
//业绩二次分配科室概览:业绩分配绩效、职称绩效、工作量绩效
//
situation.AllotPerfor = situation.DepartmentTotal - situation.BossPerfor - situation.Award - situation.Allowance - situation.AlonePerfor;
//
situation.JobPerfor = situation.AllotPerfor * jobfactor;
//
situation.WorkloadPerfor = situation.AllotPerfor * workfactor;
//
var rowList = perAgainExcel.AgainData.Select(t => t.RowNumber).Distinct().ToList();
//
//业绩二次分配科室动态数据:工作量得分
//
foreach (var rowNumber in rowList)
//
{
//
var againEmployee = perAgainExcel.AgainEmployee.FirstOrDefault(t => t.RowNumber == rowNumber);
//
var atRowList = perAgainExcel.AgainData.Where(t => t.RowNumber == rowNumber);
//
decimal? sumValue = 0m;
//
foreach (var atRow in atRowList)
//
sumValue += atRow.IsFactor == 1 ? atRow.IsFactor * atRow.CellValue : atRow.CellValue;
//
sumValue = sumValue * againEmployee?.YearFactor;
//
var head = perAgainExcel.Header.Children.FirstOrDefault(t => t.CellValue == "工作量得分");
//
if (head == null)
//
{
//
perAgainExcel.Header.MergeCell++;
//
var pointrow = perAgainExcel.Header.Children.Max(t => t.PointRow);
//
var pointcell = perAgainExcel.Header.Children.Max(t => t.PointCell);
//
head = new PerHeader(pointrow, pointcell, "工作量得分", 1, 1, 1, null, 1);
//
perAgainExcel.Header.Children.Add(head);
//
}
//
perAgainExcel.AgainData.Add(new PerAgainData(rowNumber.Value, "工作量得分", sumValue, 1, 2, null, "", "", head.SignID));
//
}
//
//业绩二次分配科室动态数据:绩效工资
//
foreach (var rowNumber in rowList)
//
{
//
var workvalue = perAgainExcel.AgainData.FirstOrDefault(t => t.RowNumber == rowNumber && t.TypeName == "工作量得分")?.CellValue;
//
var sumvalue = perAgainExcel.AgainData.Where(t => t.TypeName == "工作量得分").Sum(t => t.CellValue);
//
var perforValue = workvalue / sumvalue * situation.WorkloadPerfor;
//
var head = perAgainExcel.Header.Children.FirstOrDefault(t => t.CellValue == "绩效工资");
//
if (head == null)
//
{
//
perAgainExcel.Header.MergeCell++;
//
var pointrow = perAgainExcel.Header.Children.Max(t => t.PointRow);
//
var pointcell = perAgainExcel.Header.Children.Max(t => t.PointCell);
//
head = new PerHeader(pointrow, pointcell, "绩效工资", 1, 1, 1, null, 1);
//
perAgainExcel.Header.Children.Add(head);
//
}
//
perAgainExcel.AgainData.Add(new PerAgainData(rowNumber.Value, "绩效工资", perforValue, 1, 2, null, "", "", head.SignID));
//
}
//
//业绩二次分配科室:应发绩效、实发绩效
//
string[] jobArray = new string[] { "护士长", "科主任" };
//
foreach (var employee in perAgainExcel.AgainEmployee)
//
{
//
if (jobArray.Contains(employee.JobTitle))
//
{
//
employee.GiveFee = situation.BossPerfor;
//
employee.RealGiveFee = situation.BossPerfor;
//
}
//
else
//
{
//
employee.JobAttendancePerfor = situation.JobPerfor * employee.JobAttendanceFactor / perAgainExcel.AgainEmployee.Sum(t => t.JobAttendanceFactor);
//
var value = perAgainExcel.AgainData.FirstOrDefault(t => t.RowNumber == employee.RowNumber && t.TypeName == "绩效工资")?.CellValue;
//
employee.GiveFee = (employee.JobAttendancePerfor ?? 0) + (value ?? 0) + (employee.Award ?? 0) + (employee.Allowance ?? 0) + (employee.AlonePerfor ?? 0);
//
employee.RealGiveFee = (employee.GiveFee ?? 0) + (employee.NightShift ?? 0);
//
}
//
}
//
#endregion
//
#region 保存
//
var againsituation = Mapper.Map<ag_againsituation>(situation);
//
againsituation.AllotID = againAllot.AllotID;
//
againsituation.AgainAllotID = againAllot.ID;
//
perforAgagainsituationRepository.Add(againsituation);
//
var employeeList = Mapper.Map<List<ag_employee>>(perAgainExcel.AgainEmployee);
//
employeeList.ForEach(item => { item.AllotID = againAllot.AllotID; item.AgainAllotID = againAllot.ID; });
//
perforAgemployeeRepository.AddRange(employeeList.ToArray());
//
var pHeader = Mapper.Map<ag_header>(perAgainExcel.Header);
//
pHeader.AllotID = againAllot.AllotID;
//
pHeader.AgainAllotID = againAllot.ID;
//
var cHeaderList = Mapper.Map<List<ag_header>>(perAgainExcel.Header.Children);
//
cHeaderList.ForEach(item => { item.AllotID = againAllot.AllotID; item.AgainAllotID = againAllot.ID; });
//
perforAgheaderRepository.Add(pHeader);
//
perforAgheaderRepository.AddRange(cHeaderList.ToArray());
//
var dataList = Mapper.Map<List<ag_data>>(perAgainExcel.AgainData);
//
dataList.ForEach(item => { item.AllotID = againAllot.AllotID; item.AgainAllotID = againAllot.ID; });
//
perforAgdataRepository.AddRange(dataList.ToArray());
//
#endregion
//
}
//
catch (Exception ex)
//
{
//
perforPeragainallotRepository.Update(againAllot, p => { p.States = 4; p.Remark = ex.ToString(); });
//
}
//
perforPeragainallotRepository.Update(againAllot, p => { p.States = 3; });
//
return true;
//
//return SheetFormat(perAgainExcel, situation);
//
}
/// <summary>
/// 绩效详情表格转换
...
...
performance/Performance.Services/AllotService.cs
View file @
164745ef
...
...
@@ -535,7 +535,7 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid)
if
(!
role
.
HasValue
)
throw
new
PerformanceException
(
"用户信息错误"
);
var
roleTypes
=
new
[]
{
options
.
Value
.
NurseRole
,
options
.
Value
.
DirectorRole
,
options
.
Value
.
SpecialRole
};
var
roleTypes
=
new
[]
{
options
.
Value
.
NurseRole
,
options
.
Value
.
DirectorRole
,
options
.
Value
.
SpecialRole
,
options
.
Value
.
OfficeRole
};
var
reserveds
=
perforresreservedRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
w
.
Year
==
year
);
...
...
@@ -547,6 +547,8 @@ public List<res_reserved> GetReserved(int hospitalId, int year, int userid)
reserveds
=
reserveds
.
Where
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
UnitType
)
&&
(
w
.
UnitType
.
Contains
(
UnitType
.
医生组
.
ToString
())
||
w
.
UnitType
.
Contains
(
UnitType
.
医技组
.
ToString
()))
&&
w
.
AccountingUnit
==
user
.
Department
)?.
ToList
();
else
if
(
role
.
Value
==
options
.
Value
.
SpecialRole
)
reserveds
=
reserveds
.
Where
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
UnitType
)
&&
w
.
UnitType
.
Contains
(
UnitType
.
特殊核算组
.
ToString
())
&&
w
.
AccountingUnit
==
user
.
Department
)?.
ToList
();
else
if
(
role
.
Value
==
options
.
Value
.
OfficeRole
)
reserveds
=
reserveds
.
Where
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
UnitType
)
&&
(
w
.
UnitType
.
Contains
(
UnitType
.
行政中层
.
ToString
())
||
w
.
UnitType
.
Contains
(
UnitType
.
行政后勤
.
ToString
()))
&&
w
.
AccountingUnit
==
user
.
Department
)?.
ToList
();
}
return
reserveds
;
...
...
performance/Performance.Services/ComputeService.cs
View file @
164745ef
...
...
@@ -272,7 +272,7 @@ public List<DeptResponse> GetOtherPerformance(int allotId)
/// <returns></returns>
public
List
<
DeptResponse
>
GetOfficePerformance
(
int
allotId
)
{
var
unitType
=
new
List
<
int
>
{
(
int
)
UnitType
.
行政
工
勤
};
var
unitType
=
new
List
<
int
>
{
(
int
)
UnitType
.
行政
后
勤
};
var
list
=
perforResaccountRepository
.
GetEntities
(
t
=>
unitType
.
Contains
(
t
.
UnitType
.
Value
)
&&
t
.
AllotID
==
allotId
)
?.
OrderBy
(
t
=>
t
.
UnitType
)
...
...
performance/Performance.Services/PersonService.cs
View file @
164745ef
...
...
@@ -302,9 +302,10 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
Dictionary
<
int
,
string
[
]>
dict
=
new
Dictionary
<
int
,
string
[
]>
{
{
application
.
DirectorRole
,
new
string
[]{
UnitType
.
医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
()
}
},
{
application
.
DirectorRole
,
new
string
[]{
UnitType
.
医生组
.
ToString
(),
UnitType
.
其他医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
(),
UnitType
.
其他
医技组
.
ToString
()
}
},
{
application
.
NurseRole
,
new
string
[]{
UnitType
.
护理组
.
ToString
()
}
},
{
application
.
SpecialRole
,
new
string
[]{
UnitType
.
特殊核算组
.
ToString
()
}
},
{
application
.
OfficeRole
,
new
string
[]{
UnitType
.
行政中层
.
ToString
(),
UnitType
.
行政后勤
.
ToString
()}
},
};
if
(
dict
.
Keys
.
Contains
(
role
.
Type
.
Value
))
...
...
performance/Performance.Services/ReportDataService.cs
View file @
164745ef
...
...
@@ -358,7 +358,8 @@ private bool IsMedical(int userId)
{
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
var
role
=
roleRepository
.
GetEntity
(
t
=>
t
.
ID
==
userrole
.
RoleID
);
if
(
role
.
Type
==
application
.
DirectorRole
||
role
.
Type
==
application
.
NurseRole
)
var
roleTypes
=
new
[]
{
application
.
NurseRole
,
application
.
DirectorRole
,
application
.
SpecialRole
,
application
.
OfficeRole
};
if
(
role
.
Type
.
HasValue
&&
roleTypes
.
Contains
(
role
.
Type
.
Value
))
return
true
;
else
return
false
;
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
164745ef
...
...
@@ -113,6 +113,8 @@ public List<SecondListResponse> GetSecondList(int userId)
exp
=
exp
.
And
(
t
=>
t
.
UnitType
==
UnitType
.
护理组
.
ToString
());
else
if
(
role
.
Type
==
application
.
SpecialRole
)
exp
=
exp
.
And
(
t
=>
t
.
UnitType
==
UnitType
.
特殊核算组
.
ToString
());
else
if
(
role
.
Type
==
application
.
OfficeRole
)
exp
=
exp
.
And
(
t
=>
t
.
UnitType
==
UnitType
.
行政后勤
.
ToString
());
var
secondList
=
perforAgsecondallotRepository
.
GetEntities
(
exp
);
//各科室绩效分配结果
...
...
@@ -137,6 +139,8 @@ public List<SecondListResponse> GetSecondList(int userId)
account
=
accountList
?.
FirstOrDefault
(
t
=>
t
.
AllotID
==
item
&&
t
.
UnitType
==
(
int
)
UnitType
.
护理组
);
else
if
(
role
.
Type
==
application
.
SpecialRole
)
special
=
specialList
?.
FirstOrDefault
(
t
=>
t
.
AllotID
==
item
);
else
if
(
role
.
Type
==
application
.
OfficeRole
)
account
=
accountList
?.
FirstOrDefault
(
t
=>
t
.
AllotID
==
item
&&
t
.
UnitType
==
(
int
)
UnitType
.
行政后勤
);
if
(
account
==
null
&&
special
==
null
)
continue
;
...
...
@@ -798,11 +802,18 @@ public List<SecondTempResponse> GetTemp(int hospitalid, string department, int u
{
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
var
role
=
roleRepository
.
GetEntity
(
t
=>
t
.
ID
==
userrole
.
RoleID
);
Dictionary
<
int
,
string
[
]>
dic
=
new
Dictionary
<
int
,
string
[
]>
{
{
application
.
DirectorRole
,
new
[]{
UnitType
.
医生组
.
ToString
(),
UnitType
.
其他医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
(),
UnitType
.
其他医技组
.
ToString
()
}
},
{
application
.
NurseRole
,
new
[]{
UnitType
.
护理组
.
ToString
(),
UnitType
.
其他护理组
.
ToString
()}
},
{
application
.
SpecialRole
,
new
[]{
UnitType
.
特殊核算组
.
ToString
()
}},
{
application
.
OfficeRole
,
new
[]{
UnitType
.
行政后勤
.
ToString
()
}
},
};
Expression
<
Func
<
ag_usetemp
,
bool
>>
exp
=
t
=>
t
.
HospitalId
==
hospitalid
&&
t
.
Department
==
department
;
if
(
role
.
Type
==
application
.
DirectorRole
)
exp
=
exp
.
And
(
t
=>
new
List
<
string
>
{
UnitType
.
医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
()
}.
Contains
(
t
.
UnitType
));
else
if
(
role
.
Type
==
application
.
NurseRole
)
exp
=
exp
.
And
(
t
=>
t
.
UnitType
==
UnitType
.
护理组
.
ToString
());
if
(
role
.
Type
.
HasValue
&&
dic
.
ContainsKey
(
role
.
Type
.
Value
))
exp
=
exp
.
And
(
t
=>
dic
[
role
.
Type
.
Value
].
Contains
(
t
.
UnitType
));
var
useTemp
=
perforAgusetempRepository
.
GetEntity
(
exp
);
var
secondTemps
=
Mapper
.
Map
<
List
<
SecondTempResponse
>>(
temps
);
...
...
@@ -1130,6 +1141,10 @@ public bool DeleteWorkType(WorkloadRequest request)
return
(
UnitType
.
医生组
.
ToString
(),
user
.
Department
);
else
if
(
role
.
Type
==
application
.
NurseRole
)
return
(
UnitType
.
护理组
.
ToString
(),
user
.
Department
);
if
(
role
.
Type
==
application
.
SpecialRole
)
return
(
UnitType
.
特殊核算组
.
ToString
(),
user
.
Department
);
if
(
role
.
Type
==
application
.
OfficeRole
)
return
(
UnitType
.
行政后勤
.
ToString
(),
user
.
Department
);
else
return
(
""
,
user
.
Department
);
}
...
...
@@ -1174,11 +1189,17 @@ public bool AuditSubmit(ag_secondallot second, int userId)
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
var
role
=
roleRepository
.
GetEntity
(
t
=>
t
.
ID
==
userrole
.
RoleID
);
Dictionary
<
int
,
string
[
]>
dic
=
new
Dictionary
<
int
,
string
[
]>
{
{
application
.
DirectorRole
,
new
[]{
UnitType
.
医生组
.
ToString
(),
UnitType
.
其他医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
(),
UnitType
.
其他医技组
.
ToString
()
}
},
{
application
.
NurseRole
,
new
[]{
UnitType
.
护理组
.
ToString
(),
UnitType
.
其他护理组
.
ToString
()}
},
{
application
.
SpecialRole
,
new
[]{
UnitType
.
特殊核算组
.
ToString
()
}},
{
application
.
OfficeRole
,
new
[]{
UnitType
.
行政后勤
.
ToString
()
}
},
};
Expression
<
Func
<
ag_usetemp
,
bool
>>
exp
=
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Department
==
second
.
Department
;
if
(
role
.
Type
==
application
.
DirectorRole
)
exp
=
exp
.
And
(
t
=>
new
List
<
string
>
{
UnitType
.
医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
()
}.
Contains
(
t
.
UnitType
));
else
if
(
role
.
Type
==
application
.
NurseRole
)
exp
=
exp
.
And
(
t
=>
t
.
UnitType
==
UnitType
.
护理组
.
ToString
());
if
(
role
.
Type
.
HasValue
&&
dic
.
ContainsKey
(
role
.
Type
.
Value
))
exp
=
exp
.
And
(
t
=>
dic
[
role
.
Type
.
Value
].
Contains
(
t
.
UnitType
));
var
temp
=
perforAgusetempRepository
.
GetEntity
(
exp
);
if
(
temp
==
null
)
...
...
@@ -1538,6 +1559,7 @@ public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId)
{
{
application
.
DirectorRole
,
AccountUnitType
.
科主任
.
ToString
()
},
{
application
.
NurseRole
,
AccountUnitType
.
护士长
.
ToString
()
},
{
application
.
OfficeRole
,
AccountUnitType
.
行政中层
.
ToString
()
},
};
if
(!
dict
.
Keys
.
Contains
(
role
.
Type
.
Value
))
return
new
List
<
SecondPerforResponse
>();
...
...
performance/Performance.Services/UserService.cs
View file @
164745ef
...
...
@@ -27,6 +27,8 @@ public class UserService : IAutoInjection
private
PerforPerallotRepository
_perforPerallotRepository
;
private
PerforImaccountbasicRepository
_imaccountbasicRepository
;
private
PerforImspecialunitRepository
_imspecialunitRepository
;
private
PerforResaccountRepository
_resaccountRepository
;
private
PerforPerallotRepository
_perallotRepository
;
private
PerforPerdeptdicRepository
_perdeptdicRepository
;
public
UserService
(
IOptions
<
Application
>
application
,
PerforSmsRepository
smsRepository
,
...
...
@@ -39,6 +41,8 @@ public class UserService : IAutoInjection
PerforPerallotRepository
perforPerallotRepository
,
PerforImaccountbasicRepository
imaccountbasicRepository
,
PerforImspecialunitRepository
imspecialunitRepository
,
PerforResaccountRepository
resaccountRepository
,
PerforPerallotRepository
perallotRepository
,
PerforPerdeptdicRepository
perdeptdicRepository
)
{
this
.
application
=
application
.
Value
;
...
...
@@ -52,6 +56,8 @@ public class UserService : IAutoInjection
this
.
_perforPerallotRepository
=
perforPerallotRepository
;
this
.
_imaccountbasicRepository
=
imaccountbasicRepository
;
this
.
_imspecialunitRepository
=
imspecialunitRepository
;
this
.
_resaccountRepository
=
resaccountRepository
;
this
.
_perallotRepository
=
perallotRepository
;
this
.
_perdeptdicRepository
=
perdeptdicRepository
;
}
...
...
@@ -148,16 +154,15 @@ public ApiResponse Delete(int iD)
/// <param name="request"></param>
public
UserResponse
Insert
(
UserRequest
request
,
int
userid
)
{
var
isAgainAdmin
=
new
int
[]
{
application
.
DirectorRole
,
application
.
NurseRole
}.
Contains
(
request
.
Role
);
if
(
null
!=
_userRepository
.
GetEntity
(
t
=>
t
.
Login
==
request
.
Login
&&
t
.
IsDelete
==
1
))
throw
new
PerformanceException
(
"登录名重复"
);
//if (null != _userRepository.GetEntity(t => t.Mobile == request.Mobile && t.IsDelete == 1))
// throw new PerformanceException("手机号重复");
if
(
request
.
Role
==
3
&&
string
.
IsNullOrEmpty
(
request
.
Department
))
throw
new
PerformanceException
(
"请选择科室"
);
if
(
isAgainAdmin
&&
request
.
HosIDArray
.
Length
>
1
)
if
(
request
.
HosIDArray
.
Length
>
1
)
throw
new
PerformanceException
(
"二次绩效管理员只支持单家医院"
);
if
(
isAgainAdmin
&&
string
.
IsNullOrEmpty
(
request
.
Department
))
if
(
string
.
IsNullOrEmpty
(
request
.
Department
))
throw
new
PerformanceException
(
"二次绩效管理员科室不能为空"
);
var
user
=
Mapper
.
Map
<
sys_user
>(
request
);
...
...
@@ -326,7 +331,7 @@ public List<sys_role> RoleList(int userId)
List
<
sys_role
>
result
=
new
List
<
sys_role
>()
{
role
};
GetChildrenRole
(
roles
,
role
.
ID
,
result
);
return
result
?.
Distinct
().
ToList
();
return
result
?.
OrderBy
(
w
=>
w
.
Sort
)?.
Distinct
().
ToList
();
}
/// <summary>
...
...
@@ -362,7 +367,24 @@ public List<TitleValue> Department(int hospitalId)
var
list
=
_perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
list
==
null
||
!
list
.
Any
())
return
new
List
<
TitleValue
>();
var
result
=
list
.
Select
(
t
=>
t
.
AccountingUnit
).
Distinct
().
OrderBy
(
t
=>
t
);
var
result
=
list
.
Select
(
t
=>
t
.
AccountingUnit
).
Distinct
().
OrderBy
(
t
=>
t
).
ToList
();
// 补充行政科室
var
states
=
new
int
[]
{
(
int
)
AllotStates
.
Archive
,
(
int
)
AllotStates
.
GenerateAccomplish
};
var
allots
=
_perallotRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
states
.
Contains
(
w
.
States
));
if
(
allots
!=
null
&&
allots
.
Any
())
{
var
allot
=
allots
.
OrderByDescending
(
w
=>
w
.
Year
).
ThenByDescending
(
w
=>
w
.
Month
).
FirstOrDefault
();
if
(
allot
!=
null
)
{
var
types
=
new
int
[]
{
(
int
)
UnitType
.
行政中层
,
(
int
)
UnitType
.
行政后勤
};
var
accounts
=
_resaccountRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
w
.
UnitType
.
HasValue
&&
types
.
Contains
(
w
.
UnitType
.
Value
));
if
(
accounts
!=
null
&&
accounts
.
Any
())
{
result
.
AddRange
(
accounts
.
Select
(
w
=>
w
.
AccountingUnit
));
}
}
}
return
result
?.
Select
(
t
=>
new
TitleValue
{
Title
=
t
,
Value
=
t
}).
ToList
();
}
...
...
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