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
cf96e1ed
Commit
cf96e1ed
authored
Jun 22, 2021
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
读取速度
parent
eabaaaf8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
32 deletions
+64
-32
performance/Performance.Infrastructure/Extensions/Extensions.Dictionary.cs
+40
-6
performance/Performance.Services/RedistributionService.cs
+24
-26
No files found.
performance/Performance.Infrastructure/Extensions/Extensions.Dictionary.cs
View file @
cf96e1ed
...
...
@@ -18,9 +18,10 @@ public static partial class UtilExtensions
/// <returns></returns>
public
static
T
GetValue
<
T
>(
this
Dictionary
<
string
,
object
>
keyValues
,
string
key
,
T
defaultValue
=
default
(
T
))
{
var
pair
=
keyValues
.
FirstOrDefault
(
w
=>
w
.
Key
.
Equals
(
key
,
StringComparison
.
OrdinalIgnoreCase
));
if
(!
default
(
KeyValuePair
<
string
,
object
>).
Equals
(
pair
))
return
ConvertHelper
.
To
<
T
>(
pair
.
Value
,
defaultValue
);
if
(
keyValues
.
TryGetValue
(
key
,
out
object
value
))
return
ConvertHelper
.
To
<
T
>(
value
,
defaultValue
);
else
if
(
keyValues
.
TryGetValue
(
key
.
ToLower
(),
out
value
))
return
ConvertHelper
.
To
<
T
>(
value
,
defaultValue
);
return
defaultValue
;
}
...
...
@@ -33,9 +34,10 @@ public static T GetValue<T>(this Dictionary<string, object> keyValues, string ke
/// <returns></returns>
public
static
T
GetValue
<
T
>(
this
SortedDictionary
<
string
,
object
>
keyValues
,
string
key
,
T
defaultValue
=
default
(
T
))
{
var
pair
=
keyValues
.
FirstOrDefault
(
w
=>
w
.
Key
.
Equals
(
key
,
StringComparison
.
OrdinalIgnoreCase
));
if
(!
default
(
KeyValuePair
<
string
,
object
>).
Equals
(
pair
))
return
ConvertHelper
.
To
<
T
>(
pair
.
Value
,
defaultValue
);
if
(
keyValues
.
TryGetValue
(
key
,
out
object
value
))
return
ConvertHelper
.
To
<
T
>(
value
,
defaultValue
);
else
if
(
keyValues
.
TryGetValue
(
key
.
ToLower
(),
out
value
))
return
ConvertHelper
.
To
<
T
>(
value
,
defaultValue
);
return
defaultValue
;
}
...
...
@@ -56,6 +58,38 @@ public static void AddOrUpdate(this Dictionary<string, object> keyValues, string
}
/// <summary>
/// 为了快速读取,忽略大小写,默认:0
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="keyValues"></param>
/// <param name="key"></param>
/// <returns></returns>
public
static
decimal
GetDecimal
(
this
Dictionary
<
string
,
object
>
keyValues
,
string
key
)
{
if
(
keyValues
.
TryGetValue
(
key
,
out
object
value
))
return
value
==
null
?
0
m
:
decimal
.
Parse
(
value
.
ToString
());
else
if
(
keyValues
.
TryGetValue
(
key
.
ToLower
(),
out
value
))
return
value
==
null
?
0
m
:
decimal
.
Parse
(
value
.
ToString
());
return
0
m
;
}
/// <summary>
/// 为了快速读取,忽略大小写,默认:空值
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="keyValues"></param>
/// <param name="key"></param>
/// <returns></returns>
public
static
string
GetString
(
this
Dictionary
<
string
,
object
>
keyValues
,
string
key
)
{
if
(
keyValues
.
TryGetValue
(
key
,
out
object
value
))
return
value
?.
ToString
()
??
""
;
else
if
(
keyValues
.
TryGetValue
(
key
.
ToLower
(),
out
value
))
return
value
?.
ToString
()
??
""
;
return
""
;
}
/// <summary>
/// form 转换 键值对
/// </summary>
/// <param name="pairs"></param>
...
...
performance/Performance.Services/RedistributionService.cs
View file @
cf96e1ed
...
...
@@ -11,6 +11,7 @@
using
Newtonsoft.Json
;
using
Performance.DtoModels.Second
;
using
Microsoft.Extensions.Logging
;
using
System.Diagnostics
;
namespace
Performance.Services
{
...
...
@@ -578,7 +579,7 @@ public void SupplementOtherPerfor(ag_secondallot second, List<Dictionary<string,
foreach
(
var
row
in
rows
)
{
var
personnelNumber
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
WorkNumber
),
""
);
var
personnelNumber
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
WorkNumber
)
);
var
amounts
=
perapramounts
.
Where
(
w
=>
w
.
PersonnelNumber
?.
Trim
()
==
personnelNumber
?.
Trim
());
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
OtherPerformance
),
amounts
.
Sum
(
w
=>
w
.
Amount
??
0
));
}
...
...
@@ -589,7 +590,7 @@ public void SupplementOtherPerfor(ag_secondallot second, List<Dictionary<string,
.
GroupBy
(
w
=>
new
{
PersonnelNumber
=
w
.
PersonnelNumber
,
DoctorName
=
w
.
DoctorName
,
AccountingUnit
=
w
.
AccountingUnit
,
UnitType
=
w
.
UnitType
,
});
foreach
(
var
item
in
groupDatas
)
{
if
(!
rows
.
Any
(
row
=>
row
.
Get
Value
(
nameof
(
ag_bodysource
.
WorkNumber
),
""
)
==
item
.
Key
.
PersonnelNumber
))
if
(!
rows
.
Any
(
row
=>
row
.
Get
String
(
nameof
(
ag_bodysource
.
WorkNumber
)
)
==
item
.
Key
.
PersonnelNumber
))
{
rows
.
Add
(
new
Dictionary
<
string
,
object
>
{
...
...
@@ -636,9 +637,9 @@ public void ResultCompute(ComputeMode computeMode, Dictionary<string, object> he
// 清空无效数据
clearPerformanceWorkload
(
rows
,
workloadGroups
);
// 行内可分配绩效
distPerformanceCalculate
(
head
,
rows
,
workloadGroup
s
);
distPerformanceCalculate
(
row
s
);
// 行内实发绩效
realAmountCalculate
(
head
,
rows
,
specialPostName
);
realAmountCalculate
(
rows
);
}
else
if
(
computeMode
==
ComputeMode
.
Horizontal
||
computeMode
==
ComputeMode
.
Vertical
)
{
...
...
@@ -657,11 +658,11 @@ public void ResultCompute(ComputeMode computeMode, Dictionary<string, object> he
// 行内工作量分组计算
workloadCalculate
(
head
,
rows
,
computeMode
,
loads
,
workloadGroups
,
specialPostName
);
// 行内可分配绩效
distPerformanceCalculate
(
head
,
rows
,
workloadGroup
s
);
distPerformanceCalculate
(
row
s
);
// 差额从主任或第一个人身上扣除
balanceTotalDistPerformance
(
head
,
rows
,
specialPostName
);
// 行内实发绩效
realAmountCalculate
(
head
,
rows
,
specialPostName
);
realAmountCalculate
(
rows
);
}
}
...
...
@@ -769,7 +770,7 @@ private void basisPerformanceCalculate(Dictionary<string, object> head, List<Dic
{
// 除 科主任/护士长 以外人员没有 主任基础绩效
// 当前行主任基础绩效 = 科室人均 * 当前行人员系数 * 当前行人员出勤/满勤天数
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
if
(
specialPostName
.
Contains
(
post
))
{
var
daysFullAttendance
=
GetDecimal2
(
head
,
nameof
(
ag_headsource
.
DaysFullAttendance
));
...
...
@@ -798,7 +799,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
var
total_titleCoefficient
=
0
m
;
foreach
(
var
row
in
rows
)
{
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
if
(!
specialPostName
.
Contains
(
post
))
total_titleCoefficient
+=
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
))
*
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
TitleCoefficient
));
}
...
...
@@ -806,7 +807,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
var
seniorityTitlesPerformance
=
GetDecimal2
(
head
,
nameof
(
ag_headsource
.
SeniorityTitlesPerformance
));
foreach
(
var
row
in
rows
)
{
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
// 科主任/护士长 不参与职称绩效考核
if
(
specialPostName
.
Contains
(
post
))
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
TitleCoefficient
),
0
m
);
...
...
@@ -848,21 +849,19 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
row
.
AddOrUpdate
(
gp
.
WorkloadScore
,
GetDecimal2
(
workload_score
));
}
}
// 工作量每分价格计算
foreach
(
var
gp
in
workloadGroups
)
{
// 汇总行内工作量总得分
var
total_score
=
rows
.
Sum
(
row
=>
GetDecimal2
(
row
,
gp
.
WorkloadScore
)
*
GetDecimal2
(
row
,
gp
.
AssessmentScore
));
// 计算每分价格
gp
.
Unit_Price
=
total_score
==
0
?
0
:
head
.
Get
Value
(
$"Workload_Amount_
{
gp
.
Name
}
"
,
0
m
)
/
total_score
;
gp
.
Unit_Price
=
total_score
==
0
?
0
:
head
.
Get
Decimal
(
$"Workload_Amount_
{
gp
.
Name
}
"
)
/
total_score
;
}
// 行内工作量绩效计算
foreach
(
var
row
in
rows
)
{
var
workPerformance
=
0
m
;
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
foreach
(
var
gp
in
workloadGroups
)
{
// 科主任/护士长 不参与工作量考核
...
...
@@ -872,7 +871,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
row
.
AddOrUpdate
(
gp
.
AssessmentScore
,
0
m
);
}
// 工作量绩效 = 工作量得分 * 每分价格 * 考核得分
var
workload_fee
=
GetDecimal2
(
row
.
Get
Value
(
gp
.
WorkloadScore
,
0
m
)
*
gp
.
Unit_Price
*
row
.
GetValue
(
gp
.
AssessmentScore
,
0
m
));
var
workload_fee
=
GetDecimal2
(
row
.
Get
Decimal
(
gp
.
WorkloadScore
)
*
gp
.
Unit_Price
*
row
.
GetDecimal
(
gp
.
AssessmentScore
));
row
.
AddOrUpdate
(
gp
.
WorkPerformance
,
workload_fee
);
workPerformance
+=
workload_fee
;
}
...
...
@@ -900,14 +899,13 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
/// <returns></returns>
decimal
ComputeMode_3
(
Dictionary
<
string
,
object
>
row
,
List
<
TitleValue
<
string
,
decimal
?>>
loads
,
SecondWorkLoadDto
gp
,
string
[]
specialPostName
)
{
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
var
workload_score
=
gp
.
Items
.
Sum
((
item
)
=>
{
// 科主任/护士长 不参与工作量考核
if
(
specialPostName
.
Contains
(
post
))
row
.
AddOrUpdate
(
item
,
0
);
return
GetDecimal2
(
row
.
GetValue
(
item
,
0
m
)
*
getFactorValue
(
loads
,
item
));
row
.
AddOrUpdate
(
item
.
ToLower
(),
0
);
return
GetDecimal2
(
row
.
GetDecimal
(
item
.
ToLower
())
*
getFactorValue
(
loads
,
item
));
});
return
workload_score
;
}
...
...
@@ -920,7 +918,7 @@ decimal ComputeMode_3(Dictionary<string, object> row, List<TitleValue<string, de
/// <returns></returns>
decimal
ComputeMode_2
(
Dictionary
<
string
,
object
>
row
,
SecondWorkLoadDto
gp
,
string
[]
specialPostName
)
{
var
post
=
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
);
var
post
=
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
);
var
workload_score
=
0
m
;
if
(
gp
.
Items
.
Count
%
2
==
0
)
{
...
...
@@ -932,7 +930,7 @@ decimal ComputeMode_2(Dictionary<string, object> row, SecondWorkLoadDto gp, stri
row
.
AddOrUpdate
(
gp
.
Items
[
i
],
0
m
);
row
.
AddOrUpdate
(
gp
.
Items
[
i
+
1
],
0
m
);
}
var
amount
=
row
.
Get
Value
(
gp
.
Items
[
i
],
0
m
)
*
row
.
GetValue
(
gp
.
Items
[
i
+
1
],
0
m
);
var
amount
=
row
.
Get
Decimal
(
gp
.
Items
[
i
])
*
row
.
GetDecimal
(
gp
.
Items
[
i
+
1
]
);
workload_score
+=
GetDecimal2
(
amount
);
}
}
...
...
@@ -946,7 +944,7 @@ decimal ComputeMode_2(Dictionary<string, object> row, SecondWorkLoadDto gp, stri
/// <param name="head"></param>
/// <param name="rows"></param>
/// <param name="workloadGroups"></param>
private
void
distPerformanceCalculate
(
Dictionary
<
string
,
object
>
head
,
List
<
Dictionary
<
string
,
object
>>
rows
,
List
<
SecondWorkLoadDto
>
workloadGroup
s
)
private
void
distPerformanceCalculate
(
List
<
Dictionary
<
string
,
object
>>
row
s
)
{
foreach
(
var
row
in
rows
)
{
...
...
@@ -973,7 +971,7 @@ private void balanceTotalDistPerformance(Dictionary<string, object> head, List<D
if
(
Math
.
Abs
(
difference
)
<=
1
)
{
var
atRow
=
rows
.
Where
(
row
=>
specialPostName
.
Contains
(
row
.
Get
Value
(
nameof
(
ag_bodysource
.
Post
),
""
)));
var
atRow
=
rows
.
Where
(
row
=>
specialPostName
.
Contains
(
row
.
Get
String
(
nameof
(
ag_bodysource
.
Post
)
)));
if
(
atRow
==
null
||
atRow
.
Count
()
==
0
)
atRow
=
rows
;
...
...
@@ -990,7 +988,7 @@ private void balanceTotalDistPerformance(Dictionary<string, object> head, List<D
/// <param name="head"></param>
/// <param name="rows"></param>
/// <param name="specialPostName"></param>
private
void
realAmountCalculate
(
Dictionary
<
string
,
object
>
head
,
List
<
Dictionary
<
string
,
object
>>
rows
,
string
[]
specialPostName
)
private
void
realAmountCalculate
(
List
<
Dictionary
<
string
,
object
>>
rows
)
{
foreach
(
var
row
in
rows
)
{
...
...
@@ -1012,7 +1010,7 @@ private void realAmountCalculate(Dictionary<string, object> head, List<Dictionar
/// <param name="pairs"></param>
/// <param name="key"></param>
/// <returns></returns>
private
decimal
GetDecimal2
(
Dictionary
<
string
,
object
>
pairs
,
string
key
)
=>
GetDecimal2
(
pairs
.
Get
Value
(
key
,
0
m
));
private
decimal
GetDecimal2
(
Dictionary
<
string
,
object
>
pairs
,
string
key
)
=>
GetDecimal2
(
pairs
.
Get
Decimal
(
key
));
/// <summary>
/// decimal?类型转换decimal 默认:0,保留2位小数
...
...
@@ -1078,8 +1076,8 @@ public List<SecondComputeCheckResultDto> CheckData(ag_secondallot second, List<D
var
item
=
body
[
i
];
if
(
item
.
Where
(
w
=>
w
.
Value
!=
null
&&
!
string
.
IsNullOrEmpty
(
w
.
Value
.
ToString
())).
Count
()
>
0
)
{
var
number
=
item
.
Get
Value
(
nameof
(
ag_bodysource
.
WorkNumber
),
""
);
var
name
=
item
.
Get
Value
(
nameof
(
ag_bodysource
.
Name
),
""
);
var
number
=
item
.
Get
String
(
nameof
(
ag_bodysource
.
WorkNumber
)
);
var
name
=
item
.
Get
String
(
nameof
(
ag_bodysource
.
Name
)
);
if
(
string
.
IsNullOrEmpty
(
number
)
||
string
.
IsNullOrEmpty
(
name
))
{
...
...
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