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
038b01cd
Commit
038b01cd
authored
Aug 10, 2023
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/二次分配固定金额' into develop
parents
5295ed43
c804db8e
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
294 additions
and
90 deletions
+294
-90
performance/Performance.Api/Configurations/DatabaseConfig.cs
+4
-4
performance/Performance.Api/Controllers/SecondAllotController.cs
+1
-1
performance/Performance.Api/Job/BackgroundJob.cs
+1
-1
performance/Performance.Api/Performance.Api.csproj
+1
-0
performance/Performance.Api/Program.cs
+2
-2
performance/Performance.Api/wwwroot/Performance.Api.xml
+1
-1
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+25
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+20
-0
performance/Performance.DtoModels/Enum.cs
+10
-0
performance/Performance.DtoModels/Second/SecondWorkDto.cs
+27
-0
performance/Performance.DtoModels/Second/SecondWorkLoadDto.cs
+6
-1
performance/Performance.EntityModels/Entity/ag_workload.cs
+4
-0
performance/Performance.EntityModels/Entity/ag_workload_source.cs
+4
-0
performance/Performance.EntityModels/Entity/ag_workload_type.cs
+4
-0
performance/Performance.EntityModels/Entity/ag_worktype_source.cs
+4
-0
performance/Performance.Services/RedistributionService.cs
+89
-43
performance/Performance.Services/SecondAllot/SecondAllotService.cs
+7
-5
performance/Performance.Services/SecondAllotService.cs
+84
-32
No files found.
performance/Performance.Api/Configurations/DatabaseConfig.cs
View file @
038b01cd
...
...
@@ -17,14 +17,14 @@ public static void AddDatabaseConfiguration(this IServiceCollection services)
services
.
AddDbContext
<
PerformanceDbContext
>(
options
=>
{
options
.
UseMySql
(
connection
.
Value
.
PerformanceConnectionString
,
ServerVersion
.
AutoDetect
(
connection
.
Value
.
PerformanceConnectionString
),
optionBuilder
=>
var
connectionString
=
connection
.
Value
.
PerformanceConnectionString
;
var
serverVersion
=
ServerVersion
.
AutoDetect
(
connection
.
Value
.
PerformanceConnectionString
);
var
builder
=
options
.
UseMySql
(
connectionString
,
serverVersion
,
optionBuilder
=>
{
optionBuilder
.
EnableStringComparisonTranslations
(
true
);
optionBuilder
.
EnableRetryOnFailure
();
});
builder
.
EnableSensitiveDataLogging
().
EnableDetailedErrors
();
},
ServiceLifetime
.
Transient
);
}
}
...
...
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
038b01cd
...
...
@@ -321,7 +321,7 @@ public ApiResponse WorkloadMap(int secondId)
/// <returns></returns>
[
Route
(
"api/second/worktype/save/{secondId}"
)]
[
HttpPost
]
public
ApiResponse
SingleSave
([
FromBody
]
ag_workload_type
request
,
int
secondId
)
public
ApiResponse
SingleSave
([
FromBody
]
SecondWorkloadTypeDto
request
,
int
secondId
)
{
if
(
request
.
HospitalId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"医院信息无效"
);
...
...
performance/Performance.Api/Job/BackgroundJob.cs
View file @
038b01cd
...
...
@@ -369,7 +369,7 @@ private void Timeout(TaskService service, List<bg_task> tasks)
foreach
(
var
task
in
tasks
)
{
var
sett
=
_settings
.
FirstOrDefault
(
w
=>
(
int
)
w
.
JobType
==
task
.
JobType
);
if
(
task
.
Status
==
(
int
)
Background
.
Status
.
执行中
&&
task
.
CreateTime
.
AddMinutes
(
sett
.
Timeout
)
<
DateTime
.
Now
)
if
(
task
.
Status
==
(
int
)
Background
.
Status
.
执行中
&&
task
.
CreateTime
.
AddMinutes
(
sett
?.
Timeout
??
20
)
<
DateTime
.
Now
)
service
.
Update
(
task
.
ID
,
Background
.
Status
.
超时
);
}
}
...
...
performance/Performance.Api/Performance.Api.csproj
View file @
038b01cd
...
...
@@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
...
...
performance/Performance.Api/Program.cs
View file @
038b01cd
using
Microsoft.AspNetCore
;
using
System
;
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Logging
;
using
NLog.Web
;
using
System
;
namespace
Performance.Api
{
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
038b01cd
...
...
@@ -2891,7 +2891,7 @@
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.SingleSave(Performance.
EntityModels.ag_workload_type
,System.Int32)"
>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.SingleSave(Performance.
DtoModels.Second.SecondWorkloadTypeDto
,System.Int32)"
>
<summary>
保存二次绩效工作量类型
</summary>
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
038b01cd
...
...
@@ -150,6 +150,11 @@
工作量
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AgWorkPurpose"
>
<summary>
工作量金额计算规则
</summary>
</member>
<member
name=
"F:Performance.DtoModels.DataFormat.普通格式"
>
<summary>
普通格式
</summary>
</member>
...
...
@@ -5650,6 +5655,21 @@
纵向计算
</summary>
</member>
<member
name=
"P:Performance.DtoModels.Second.SecondWorkloadTypeDto.TypeName"
>
<summary>
工作量类型名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.Second.SecondWorkloadTypeDto.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"P:Performance.DtoModels.Second.SecondWorkDto.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondBaseDto.ComputeMode"
>
<summary>
计算方式:11 不计算 12 横向计算 13 纵向计算
...
...
@@ -5715,6 +5735,11 @@
数据加载方式:0 保存,1 上次,2 字典
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondWorkLoadDto.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.SelectionID"
>
<summary>
ID
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
038b01cd
...
...
@@ -1401,6 +1401,11 @@
工作量来源类型
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_workload_source"
>
<summary>
...
...
@@ -1451,6 +1456,11 @@
-1、单项奖励 0、工作量占比 ..(自定义占比)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_source.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_workload_type"
>
<summary>
二次绩效工作量绩效分类
...
...
@@ -1481,6 +1491,11 @@
科室类型
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_type.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_worktype_source"
>
<summary>
...
...
@@ -1516,6 +1531,11 @@
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.Purpose"
>
<summary>
工作量用途 0 工作量占比 1 固定金额
</summary>
</member>
<member
name=
"T:Performance.EntityModels.as_assess"
>
<summary>
考核类别
...
...
performance/Performance.DtoModels/Enum.cs
View file @
038b01cd
...
...
@@ -62,6 +62,16 @@ public enum AgWorkloadType
/// </summary>
Workload
=
0
,
}
/// <summary>
/// 工作量金额计算规则
/// </summary>
public
enum
AgWorkPurpose
{
工作量系数
=
0
,
工作量固定金额
=
1
,
}
public
enum
DataFormat
{
/// <summary> 普通格式 </summary>
...
...
performance/Performance.DtoModels/Second/SecondWorkDto.cs
0 → 100644
View file @
038b01cd
namespace
Performance.DtoModels.Second
{
public
class
SecondWorkloadTypeDto
{
public
int
Id
{
get
;
set
;
}
public
int
HospitalId
{
get
;
set
;
}
/// <summary>
/// 工作量类型名称
/// </summary>
public
string
TypeName
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
Purpose
{
get
;
set
;
}
}
public
class
SecondWorkDto
{
public
string
Title
{
get
;
set
;
}
public
string
Value
{
get
;
set
;
}
public
decimal
?
State
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
Purpose
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Second/SecondWorkLoadDto.cs
View file @
038b01cd
...
...
@@ -5,9 +5,10 @@ namespace Performance.DtoModels
{
public
class
SecondWorkLoadDto
{
public
SecondWorkLoadDto
(
string
name
)
public
SecondWorkLoadDto
(
string
name
,
int
purpose
)
{
Name
=
name
;
Purpose
=
purpose
;
Unit_Price
=
0
m
;
Items
=
new
List
<
string
>();
...
...
@@ -22,6 +23,10 @@ public SecondWorkLoadDto(string name)
public
decimal
Unit_Price
{
get
;
set
;
}
public
List
<
string
>
Items
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
Purpose
{
get
;
set
;
}
public
void
AddItem
(
string
name
)
{
...
...
performance/Performance.EntityModels/Entity/ag_workload.cs
View file @
038b01cd
...
...
@@ -65,5 +65,9 @@ public class ag_workload
/// 工作量来源类型
/// </summary>
public
string
SourceCategory
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
?
Purpose
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_workload_source.cs
View file @
038b01cd
...
...
@@ -60,5 +60,9 @@ public class ag_workload_source
/// -1、单项奖励 0、工作量占比 ..(自定义占比)
/// </summary>
public
Nullable
<
int
>
WorkTypeId
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
?
Purpose
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_workload_type.cs
View file @
038b01cd
...
...
@@ -39,5 +39,9 @@ public class ag_workload_type
/// 科室类型
/// </summary>
public
string
UnitType
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
?
Purpose
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_worktype_source.cs
View file @
038b01cd
...
...
@@ -45,5 +45,9 @@ public class ag_worktype_source
///
/// </summary>
public
Nullable
<
decimal
>
Value
{
get
;
set
;
}
/// <summary>
/// 工作量用途 0 工作量占比 1 固定金额
/// </summary>
public
int
?
Purpose
{
get
;
set
;
}
}
}
performance/Performance.Services/RedistributionService.cs
View file @
038b01cd
...
...
@@ -159,7 +159,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
/// <param name="computeMode"></param>
/// <param name="loads"></param>
/// <returns></returns>
public
HandsonTableBase
GetHandsonTable
(
per_allot
allot
,
ComputeMode
computeMode
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
)
public
HandsonTableBase
GetHandsonTable
(
per_allot
allot
,
ComputeMode
computeMode
,
List
<
SecondWorkDto
>
loads
)
{
var
(
colHeaderCustoms
,
columnCustoms
)
=
GetCustomColumns
(
computeMode
,
loads
);
HandsonTableBase
handson
=
new
HandsonTableBase
();
...
...
@@ -186,7 +186,7 @@ public HandsonTableBase GetHandsonTable(per_allot allot, ComputeMode computeMode
/// <param name="second"></param>
/// <param name="loads"></param>
/// <returns></returns>
public
List
<
SecondColumnDictionary
>
GetTableHeaderDictionary
(
ComputeMode
computeMode
,
per_allot
allot
,
ag_secondallot
second
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
=
null
,
bool
isAttachFactor
=
true
)
public
List
<
SecondColumnDictionary
>
GetTableHeaderDictionary
(
ComputeMode
computeMode
,
per_allot
allot
,
ag_secondallot
second
,
List
<
SecondWorkDto
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
=
null
,
bool
isAttachFactor
=
true
)
{
/*
此处数据需要额外注意,前端显示规则:通过isTrue=true显示,显示名称为label
...
...
@@ -523,12 +523,22 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
// 已提交
if
(
second
.
Status
.
HasValue
&&
status
.
Contains
(
second
.
Status
.
Value
))
{
var
groupDatas
=
headDynamic
.
Where
(
w
=>
w
.
FieldId
.
StartsWithIgnoreCase
(
"Workload_Ratio_"
))
var
group
Ratio
Datas
=
headDynamic
.
Where
(
w
=>
w
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量系数
&&
w
.
FieldId
.
StartsWithIgnoreCase
(
"Workload_Ratio_"
))
.
GroupBy
(
w
=>
new
{
w
.
WorkTypeId
,
w
.
SecondId
,
w
.
FieldId
,
w
.
FieldName
})
.
Select
(
w
=>
new
{
w
.
Key
.
FieldId
,
Value
=
w
.
OrderByDescending
(
w
=>
w
.
Id
).
FirstOrDefault
()?.
Value
??
0
});
foreach
(
var
item
in
groupDatas
)
foreach
(
var
item
in
groupRatioDatas
)
{
head
.
AddOrUpdate
(
item
.
FieldId
,
item
.
Value
);
}
var
groupAmountDatas
=
headDynamic
.
Where
(
w
=>
w
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量固定金额
&&
w
.
FieldId
.
StartsWithIgnoreCase
(
"Workload_Amount_"
))
.
GroupBy
(
w
=>
new
{
w
.
WorkTypeId
,
w
.
SecondId
,
w
.
FieldId
,
w
.
FieldName
})
.
Select
(
w
=>
new
{
w
.
Key
.
FieldId
,
Value
=
w
.
OrderByDescending
(
w
=>
w
.
Id
).
FirstOrDefault
()?.
Value
??
0
});
foreach
(
var
item
in
groupAmountDatas
)
{
head
.
AddOrUpdate
(
item
.
FieldId
,
item
.
Value
);
}
...
...
@@ -549,11 +559,22 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
}
foreach
(
var
workitem
in
workloadTypes
)
{
#
region
工作量增加固定金额
lcr
2023
-
08
-
07
if
(!
workitem
.
Purpose
.
HasValue
||
workitem
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量系数
)
{
var
name
=
$"Workload_Ratio_
{
workitem
.
Id
}
"
;
var
ratio
=
headDynamic
.
FirstOrDefault
(
w
=>
w
.
FieldId
.
EqualsIgnoreCase
(
name
))?.
Value
??
0
m
;
ratios
.
Add
(
ratio
);
head
.
AddOrUpdate
(
name
,
ratio
);
}
else
{
var
name
=
$"Workload_Amount_
{
workitem
.
Id
}
"
;
var
ratio
=
headDynamic
.
FirstOrDefault
(
w
=>
w
.
FieldId
.
EqualsIgnoreCase
(
name
))?.
Value
??
0
m
;
head
.
AddOrUpdate
(
name
,
ratio
);
}
#
endregion
}
// 强制年资系数及工作量系数合计 等于 1
var
seniorityTitlesAccountedPerformance
=
head
.
GetDecimal
(
nameof
(
ag_headsource
.
SeniorityTitlesAccountedPerformance
));
var
defaultWorkload
=
1
-
seniorityTitlesAccountedPerformance
-
ratios
.
Sum
();
...
...
@@ -773,7 +794,7 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
/// <param name="computeMode"></param>
/// <param name="loads"></param>
/// <returns></returns>
private
(
List
<
string
>
colHeaderCustoms
,
List
<
HandsonColumn
>
columnCustoms
)
GetCustomColumns
(
ComputeMode
computeMode
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
)
private
(
List
<
string
>
colHeaderCustoms
,
List
<
HandsonColumn
>
columnCustoms
)
GetCustomColumns
(
ComputeMode
computeMode
,
List
<
SecondWorkDto
>
loads
)
{
var
colHeaderCustoms
=
new
List
<
string
>();
var
columnCustoms
=
new
List
<
HandsonColumn
>();
...
...
@@ -817,7 +838,7 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
/// <param name="allot"></param>
/// <param name="second"></param>
/// <returns></returns>
public
List
<
TitleValue
<
string
,
decimal
?>
>
GetWorkLoads
(
per_allot
allot
,
ag_secondallot
second
)
public
List
<
SecondWorkDto
>
GetWorkLoads
(
per_allot
allot
,
ag_secondallot
second
)
{
var
status
=
(
new
int
[]
{
(
int
)
SecondAllotStatus
.
WaitReview
,
(
int
)
SecondAllotStatus
.
PassAudit
});
// 已提交
...
...
@@ -829,7 +850,7 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
var
loads
=
sources
.
OrderBy
(
t
=>
t
.
WorkTypeId
).
ThenBy
(
t
=>
t
.
Sort
)
.
GroupBy
(
w
=>
new
{
w
.
ItemId
,
w
.
ItemName
})
.
Select
(
t
=>
new
TitleValue
<
string
,
decimal
?>
{
Title
=
t
.
Key
.
ItemId
,
Value
=
t
.
Key
.
ItemName
,
State
=
t
.
FirstOrDefault
()?.
FactorValue
??
0
})
.
Select
(
t
=>
new
SecondWorkDto
{
Title
=
t
.
Key
.
ItemId
,
Value
=
t
.
Key
.
ItemName
,
State
=
t
.
FirstOrDefault
()?.
FactorValue
??
0
,
Purpose
=
t
.
FirstOrDefault
()?.
Purpose
??
(
int
)
AgWorkPurpose
.
工作量系数
})
.
ToList
();
return
loads
;
}
...
...
@@ -837,12 +858,12 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
{
var
temp
=
_agworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
)
??
new
List
<
ag_workload
>();
var
workloads
=
temp
.
Where
(
w
=>
UnitTypeUtil
.
Is
(
w
.
UnitType
,
second
.
UnitType
)
&&
w
.
Department
==
second
.
Department
)
??
new
List
<
ag_workload
>();
if
(
workloads
.
Count
()
==
0
)
if
(
!
workloads
.
Any
()
)
workloads
=
temp
?.
Where
(
w
=>
UnitTypeUtil
.
Is
(
w
.
UnitType
,
second
.
NewUnitType
)
&&
w
.
Department
==
second
.
NewAccountingUnit
)?.
ToList
()
??
new
List
<
ag_workload
>();
var
loads
=
workloads
.
OrderBy
(
t
=>
t
.
WorkTypeId
).
ThenBy
(
t
=>
t
.
Sort
)
.
Select
(
t
=>
new
TitleValue
<
string
,
decimal
?>
{
Title
=
t
.
ItemId
,
Value
=
t
.
ItemName
,
State
=
t
.
FactorValue
})
.
Select
(
t
=>
new
SecondWorkDto
{
Title
=
t
.
ItemId
,
Value
=
t
.
ItemName
,
State
=
t
.
FactorValue
,
Purpose
=
t
.
Purpose
??
(
int
)
AgWorkPurpose
.
工作量系数
})
.
ToList
();
return
loads
;
}
...
...
@@ -959,7 +980,7 @@ private HandsonTableBase ComputeMode_Format2(per_allot allot, List<string> colHe
/// <param name="columns"></param>
/// <param name="loads"></param>
/// <returns></returns>
private
HandsonTableBase
ComputeMode_Format3
(
per_allot
allot
,
List
<
string
>
colHeaders
,
List
<
HandsonColumn
>
columns
,
IEnumerable
<
TitleValue
<
string
,
decimal
?>
>
loads
)
private
HandsonTableBase
ComputeMode_Format3
(
per_allot
allot
,
List
<
string
>
colHeaders
,
List
<
HandsonColumn
>
columns
,
IEnumerable
<
SecondWorkDto
>
loads
)
{
HandsonTableBase
handson
=
ComputeMode_Format2
(
allot
,
colHeaders
,
columns
);
...
...
@@ -1049,7 +1070,7 @@ private void otherPerformance(Dictionary<string, object> head, List<Dictionary<s
/// <param name="rows"></param>
/// <param name="loads"></param>
/// <param name="workloadGroups"></param>
public
void
ResultCompute
(
ComputeMode
computeMode
,
Dictionary
<
string
,
object
>
head
,
List
<
Dictionary
<
string
,
object
>>
rows
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
,
sys_hospital
hospital
)
public
void
ResultCompute
(
ComputeMode
computeMode
,
Dictionary
<
string
,
object
>
head
,
List
<
Dictionary
<
string
,
object
>>
rows
,
List
<
SecondWorkDto
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
,
sys_hospital
hospital
)
{
var
specialPostName
=
new
string
[]
{
"科主任/护士长"
,
"主任"
,
"是"
,
};
...
...
@@ -1085,7 +1106,7 @@ public void ResultCompute(ComputeMode computeMode, Dictionary<string, object> he
// 计算顶部工作量
topWorkloadCalculate
(
head
,
workloadGroups
);
// 计算顶部年资系数
topSeniorityCalculate
(
head
);
topSeniorityCalculate
(
head
,
workloadGroups
);
// 行内职称绩效计算
titleCoefficientCalculate
(
head
,
rows
,
specialPostName
);
// 行内工作量分组计算
...
...
@@ -1189,19 +1210,37 @@ private void preDeptRewardCalculate(List<Dictionary<string, object>> rows)
/// <param name="workloadGroups"></param>
private
void
topWorkloadCalculate
(
Dictionary
<
string
,
object
>
head
,
List
<
SecondWorkLoadDto
>
workloadGroups
)
{
foreach
(
var
workload
in
workloadGroups
)
// 用户输入 不需要系数计算的工作量金额
decimal
workloadFixation
=
0
;
foreach
(
var
workloadName
in
workloadGroups
.
Where
(
w
=>
w
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量固定金额
).
Select
(
w
=>
w
.
Name
))
{
var
amount
=
GetDecimal2
(
head
.
GetDecimal
(
nameof
(
ag_headsource
.
TheTotalAllocationOfPerformanceResults
))
*
head
.
GetDecimal
(
$"Workload_Ratio_
{
workload
.
Name
}
"
));
head
.
AddOrUpdate
(
$"Workload_Amount_
{
workload
.
Name
}
"
,
amount
);
workloadFixation
+=
head
.
GetDecimal
(
$"Workload_Amount_
{
workloadName
}
"
);
}
// 业绩分配绩效总额
var
theTotalAllocationOfPerformanceResults
=
head
.
GetDecimal
(
nameof
(
ag_headsource
.
TheTotalAllocationOfPerformanceResults
))
-
workloadFixation
;
foreach
(
var
workloadName
in
workloadGroups
.
Where
(
w
=>
w
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量系数
).
Select
(
w
=>
w
.
Name
))
{
var
amount
=
GetDecimal2
(
theTotalAllocationOfPerformanceResults
*
head
.
GetDecimal
(
$"Workload_Ratio_
{
workloadName
}
"
));
head
.
AddOrUpdate
(
$"Workload_Amount_
{
workloadName
}
"
,
amount
);
}
}
/// <summary>
/// 计算顶部年资系数
/// </summary>
/// <param name="head"></param>
private
void
topSeniorityCalculate
(
Dictionary
<
string
,
object
>
head
)
private
void
topSeniorityCalculate
(
Dictionary
<
string
,
object
>
head
,
List
<
SecondWorkLoadDto
>
workloadGroups
)
{
// 用户输入 不需要系数计算的工作量金额
decimal
workloadFixation
=
0
;
foreach
(
var
workloadName
in
workloadGroups
.
Where
(
w
=>
w
.
Purpose
==
(
int
)
AgWorkPurpose
.
工作量固定金额
).
Select
(
w
=>
w
.
Name
))
{
var
amount
=
GetDecimal2
(
head
.
GetDecimal
(
nameof
(
ag_headsource
.
SeniorityTitlesAccountedPerformance
))
*
head
.
GetDecimal
(
nameof
(
ag_headsource
.
TheTotalAllocationOfPerformanceResults
)));
workloadFixation
+=
head
.
GetDecimal
(
$"Workload_Amount_
{
workloadName
}
"
);
}
// 业绩分配绩效总额
var
theTotalAllocationOfPerformanceResults
=
head
.
GetDecimal
(
nameof
(
ag_headsource
.
TheTotalAllocationOfPerformanceResults
))
-
workloadFixation
;
var
seniorityTitlesAccountedPerformance
=
head
.
GetDecimal
(
nameof
(
ag_headsource
.
SeniorityTitlesAccountedPerformance
));
var
amount
=
GetDecimal2
(
theTotalAllocationOfPerformanceResults
*
seniorityTitlesAccountedPerformance
);
head
.
AddOrUpdate
(
nameof
(
ag_headsource
.
SeniorityTitlesPerformance
),
amount
);
}
...
...
@@ -1314,7 +1353,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
/// <param name="workloadGroups"></param>
/// <param name="specialPostName"></param>
private
void
workloadCalculate
(
Dictionary
<
string
,
object
>
head
,
List
<
Dictionary
<
string
,
object
>>
rows
,
ComputeMode
computeMode
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
,
string
[]
specialPostName
)
List
<
SecondWorkDto
>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
,
string
[]
specialPostName
)
{
// 计算方式:1 不计算 2 横向计算 3 纵向计算
foreach
(
var
row
in
rows
)
...
...
@@ -1375,7 +1414,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
/// <param name="workloads"></param>
/// <param name="item"></param>
/// <returns></returns>
decimal
getFactorValue
(
List
<
TitleValue
<
string
,
decimal
?>
>
workloads
,
string
item
)
=>
workloads
.
FirstOrDefault
((
w
)
=>
w
.
Title
==
item
)?.
State
??
0
m
;
decimal
getFactorValue
(
List
<
SecondWorkDto
>
workloads
,
string
item
)
=>
workloads
.
FirstOrDefault
((
w
)
=>
w
.
Title
==
item
)?.
State
??
0
m
;
/// <summary>
/// 3 纵向计算
...
...
@@ -1385,7 +1424,7 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
/// <param name="gp"></param>
/// <param name="specialPostName"></param>
/// <returns></returns>
decimal
ComputeMode_3
(
Dictionary
<
string
,
object
>
row
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
,
SecondWorkLoadDto
gp
,
string
[]
specialPostName
)
decimal
ComputeMode_3
(
Dictionary
<
string
,
object
>
row
,
List
<
SecondWorkDto
>
loads
,
SecondWorkLoadDto
gp
,
string
[]
specialPostName
)
{
var
post
=
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
));
var
workload_score
=
gp
.
Items
.
Sum
((
item
)
=>
...
...
@@ -1475,13 +1514,25 @@ private void balanceTotalDistPerformance(Dictionary<string, object> head, List<D
var
difference
=
total_distPerformance
-
(
totalPerformance
+
totalPreAccountingReward
);
if
(
roundNumber
==
0
||
Math
.
Abs
(
difference
)
<=
1
)
{
var
atRow
=
rows
.
Where
(
row
=>
specialPostName
.
Contains
(
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
))));
if
(
atRow
==
null
||
atRow
.
Count
()
==
0
)
//var atRow = rows.Where(row => specialPostName.Contains(row.GetString(nameof(ag_bodysource.Post)))).ToList();
// 需要额外排除0的主任
List
<
Dictionary
<
string
,
object
>>
atRow
=
new
List
<
Dictionary
<
string
,
object
>>();
foreach
(
var
row
in
rows
)
{
var
post
=
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
));
var
distPerformance
=
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
DistPerformance
));
if
(
specialPostName
.
Contains
(
post
)
&&
distPerformance
>
0
)
{
atRow
.
Add
(
row
);
}
}
if
(
atRow
==
null
||
!
atRow
.
Any
())
atRow
=
rows
;
if
(
atRow
!=
null
&&
atRow
.
Count
()
>
0
)
if
(
atRow
!=
null
&&
atRow
.
Any
()
)
{
for
(
int
i
=
0
;
i
<
atRow
.
Count
()
;
i
++)
for
(
int
i
=
0
;
i
<
atRow
.
Count
;
i
++)
{
var
row
=
atRow
.
ElementAt
(
i
);
var
distPerformance
=
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
DistPerformance
));
...
...
@@ -1566,24 +1617,25 @@ private void realAmountCalculate(List<Dictionary<string, object>> rows)
/// </summary>
/// <param name="loads"></param>
/// <returns></returns>
public
List
<
SecondWorkLoadDto
>
GetTopWorkloadBodyGroups
(
List
<
TitleValue
<
string
,
decimal
?>
>
loads
)
public
List
<
SecondWorkLoadDto
>
GetTopWorkloadBodyGroups
(
List
<
SecondWorkDto
>
loads
)
{
List
<
SecondWorkLoadDto
>
result
=
new
List
<
SecondWorkLoadDto
>();
if
(
loads
!=
null
)
{
var
keys
=
loads
.
Where
(
w
=>
w
.
Title
.
StartsWithIgnoreCase
(
"AssessmentScore_"
))
.
Select
(
w
=>
w
.
Title
.
Replace
(
"AssessmentScore_"
,
""
))
.
Distinct
();
foreach
(
var
key
in
keys
)
foreach
(
var
load
in
loads
.
Where
(
w
=>
w
.
Title
.
StartsWithIgnoreCase
(
"AssessmentScore_"
)))
{
var
name
=
load
.
Title
.
Replace
(
"AssessmentScore_"
,
""
);
var
dto
=
result
.
FirstOrDefault
(
w
=>
w
.
Name
==
name
);
if
(
dto
==
null
)
{
SecondWorkLoadDto
dto
=
new
SecondWorkLoadDto
(
key
);
foreach
(
var
item
in
loads
.
Where
(
w
=>
w
.
Title
.
StartsWithIgnoreCase
(
$"Workload_
{
key
}
_"
)))
dto
=
new
SecondWorkLoadDto
(
name
,
load
.
Purpose
);
result
.
Add
(
dto
);
}
foreach
(
var
item
in
loads
.
Where
(
w
=>
w
.
Title
.
StartsWithIgnoreCase
(
$"Workload_
{
name
}
_"
)))
{
dto
.
AddItem
(
item
.
Title
);
}
result
.
Add
(
dto
);
}
}
return
result
;
...
...
@@ -1637,7 +1689,7 @@ public List<SecondComputeCheckResultDto> CheckFormat(Dictionary<string, object>
/// <param name="second"></param>
/// <param name="body"></param>
/// <returns></returns>
public
List
<
SecondComputeCheckResultDto
>
CheckData
(
per_allot
allot
,
ag_secondallot
second
,
ComputeMode
computeMode
,
List
<
Dictionary
<
string
,
object
>>
body
,
List
<
TitleValue
<
string
,
decimal
?>
>
loads
)
public
List
<
SecondComputeCheckResultDto
>
CheckData
(
per_allot
allot
,
ag_secondallot
second
,
ComputeMode
computeMode
,
List
<
Dictionary
<
string
,
object
>>
body
,
List
<
SecondWorkDto
>
loads
)
{
if
(
body
==
null
||
body
.
Count
==
0
)
throw
new
PerformanceException
(
"分配人员信息不存在!"
);
...
...
@@ -1648,12 +1700,6 @@ public List<SecondComputeCheckResultDto> CheckData(per_allot allot, ag_secondall
?.
Select
(
w
=>
new
{
w
.
PersonnelNumber
,
w
.
DoctorName
,
w
.
AccountingUnit
,
w
.
UnitType
,
w
.
ReservedRatio
});
var
handsonTable
=
GetHandsonTable
(
allot
,
computeMode
,
loads
);
var
fixat
=
new
string
[]
{
nameof
(
ag_bodysource
.
Id
).
ToLower
(),
nameof
(
ag_bodysource
.
SecondId
).
ToLower
(),
nameof
(
ag_bodysource
.
Department
).
ToLower
(),
nameof
(
ag_bodysource
.
AccountingUnit
).
ToLower
()
};
for
(
int
i
=
0
;
i
<
body
.
Count
;
i
++)
{
var
item
=
body
[
i
];
...
...
@@ -1707,7 +1753,7 @@ public List<SecondComputeCheckResultDto> CheckData(per_allot allot, ag_secondall
// 计算顶部工作量
topWorkloadCalculate
(
head
,
workloadGroups
);
// 计算顶部年资系数
topSeniorityCalculate
(
head
);
topSeniorityCalculate
(
head
,
workloadGroups
);
}
return
(
head
,
rows
);
...
...
performance/Performance.Services/SecondAllot/SecondAllotService.cs
View file @
038b01cd
...
...
@@ -522,8 +522,7 @@ public void SaveSecondAllotHeadData(int secondId, string json)
if
(!
Regex
.
IsMatch
(
value
,
@"^\d"
))
continue
;
workValue
.
Add
(
Convert
.
ToInt32
(
value
));
}
if
(
workValue
==
null
||
!
workValue
.
Any
())
return
;
if
(!
workValue
.
Any
())
return
;
foreach
(
var
value
in
workValue
.
Distinct
())
{
...
...
@@ -531,13 +530,15 @@ public void SaveSecondAllotHeadData(int secondId, string json)
{
var
fieldId
=
prefix
[
i
]
+
$"
{
value
}
"
;
var
typeName
=
workTypes
?.
FirstOrDefault
(
t
=>
t
.
Id
==
value
)?.
TypeName
;
var
purpose
=
workTypes
?.
FirstOrDefault
(
t
=>
t
.
Id
==
value
)?.
Purpose
??
(
int
)
AgWorkPurpose
.
工作量系数
;
var
source
=
new
ag_worktype_source
{
WorkTypeId
=
value
,
SecondId
=
secondId
,
FieldId
=
fieldId
,
FieldName
=
i
==
0
?
typeName
+
"占比"
:
typeName
+
"金额"
,
Value
=
prefix
[
i
].
StartsWith
(
prefix
[
0
])
?
ConvertHelper
.
ToDecimalOrNull
(
dict
[
fieldId
.
ToLower
()])
:
null
,
Value
=
prefix
[
i
].
StartsWith
(
prefix
[
0
])
&&
dict
.
ContainsKey
(
fieldId
.
ToLower
())
?
ConvertHelper
.
ToDecimalOrNull
(
dict
[
fieldId
.
ToLower
()])
:
null
,
Purpose
=
purpose
,
};
insertData
.
Add
(
source
);
...
...
@@ -589,7 +590,7 @@ public void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dynam
if
(
body
==
null
||
!((
IEnumerable
<
dynamic
>)
body
).
Any
())
return
;
var
temp
=
agworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
workloads
=
temp
?.
Where
(
w
=>
UnitTypeUtil
.
Is
(
w
.
UnitType
,
second
.
UnitType
)
&&
w
.
Department
==
second
.
Department
)?.
ToList
()
??
new
List
<
ag_workload
>();
if
(
workloads
.
Count
()
==
0
)
if
(
workloads
.
Count
==
0
)
workloads
=
temp
?.
Where
(
w
=>
UnitTypeUtil
.
Is
(
w
.
UnitType
,
second
.
NewUnitType
)
&&
w
.
Department
==
second
.
NewAccountingUnit
)?.
ToList
()
??
new
List
<
ag_workload
>();
string
[]
prefix
=
new
string
[]
{
"WorkloadScore_"
,
"AssessmentScore_"
,
"WorkPerformance_"
,
$"
{
AgWorkloadType
.
SingleAwards
}
_"
,
$"
{
AgWorkloadType
.
Workload
}
_"
,
$"
{
AgWorkloadType
.
PreAccountingReward
}
_"
};
...
...
@@ -620,7 +621,8 @@ public void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dynam
FactorValue
=
workload
.
FactorValue
,
Sort
=
workload
.
Sort
,
Value
=
ConvertHelper
.
To
<
decimal
>(
dict
[
key
]),
WorkTypeId
=
workload
.
WorkTypeId
WorkTypeId
=
workload
.
WorkTypeId
,
Purpose
=
workload
.
Purpose
??
(
int
)
AgWorkPurpose
.
工作量系数
,
});
}
}
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
038b01cd
...
...
@@ -7,6 +7,7 @@
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.DtoModels.Second
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
...
...
@@ -1098,7 +1099,7 @@ public void RefreshTemp(UseTempRequest request)
/// </summary>
/// <param name="secondId"></param>
/// <returns></returns>
public
List
<
TitleValue
<
int
>
>
WorkTypeList
(
WorkloadRequest
request
,
int
secondId
)
public
List
<
SecondWorkloadTypeDto
>
WorkTypeList
(
WorkloadRequest
request
,
int
secondId
)
{
var
second
=
agsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"参数错误"
);
...
...
@@ -1106,10 +1107,12 @@ public List<TitleValue<int>> WorkTypeList(WorkloadRequest request, int secondId)
var
worktypes
=
agworkloadtypeRepository
.
GetEntities
(
t
=>
request
.
HospitalId
.
Value
==
t
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
second
.
UnitType
);
if
(
worktypes
!=
null
&&
worktypes
.
Any
())
{
return
worktypes
.
Select
(
t
=>
new
TitleValue
<
int
>
return
worktypes
.
Select
(
t
=>
new
SecondWorkloadTypeDto
{
Title
=
t
.
TypeName
,
Value
=
t
.
Id
Id
=
t
.
Id
,
HospitalId
=
t
.
HospitalId
,
TypeName
=
t
.
TypeName
,
Purpose
=
t
.
Purpose
??
0
,
}).
ToList
();
}
return
null
;
...
...
@@ -1137,43 +1140,74 @@ public List<string> WorkloadMap(int secondId)
/// </summary>
/// <param name="secondId"></param>
/// <returns></returns>
public
ag_workload_type
SaveWorkType
(
ag_workload_type
request
,
int
secondId
)
public
ag_workload_type
SaveWorkType
(
SecondWorkloadTypeDto
request
,
int
secondId
)
{
var
second
=
agsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"参数错误"
);
var
second
=
agsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
)
??
throw
new
PerformanceException
(
"参数错误"
);
var
entity
=
agworkloadtypeRepository
.
GetEntity
(
t
=>
request
.
HospitalId
==
t
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
second
.
UnitType
&&
t
.
TypeName
==
request
.
TypeName
);
if
(
entity
==
null
)
var
entities
=
agworkloadtypeRepository
.
GetEntities
(
t
=>
request
.
HospitalId
==
t
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
TypeName
==
request
.
TypeName
)
?.
Where
(
w
=>
UnitTypeUtil
.
Is
(
w
.
UnitType
,
second
.
UnitType
)).
ToList
()
??
new
List
<
ag_workload_type
>();
if
(
request
.
Id
>
0
&&
entities
.
Any
(
w
=>
w
.
Id
!=
request
.
Id
))
{
throw
new
PerformanceException
(
"类型信息重复,已存在相同的工作量类型信息"
);
}
if
(
request
.
Id
>
0
)
{
entity
=
agworkloadtypeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Id
);
var
entity
=
entities
.
FirstOrDefault
(
t
=>
t
.
Id
==
request
.
Id
)
??
throw
new
PerformanceException
(
"类型信息错误,找不到对应的工作量类型信息"
);
var
chanagePurpose
=
entity
.
Purpose
!=
request
.
Purpose
;
entity
.
HospitalId
=
request
.
HospitalId
;
entity
.
TypeName
=
request
.
TypeName
;
entity
.
TypeName
=
request
.
TypeNam
e
;
entity
.
Purpose
=
request
.
Purpos
e
;
agworkloadtypeRepository
.
Update
(
entity
);
// 类型修改,则改变子项状态
if
(
chanagePurpose
)
{
var
workTypeSource
=
agworktypesourceRepository
.
GetEntities
(
w
=>
w
.
WorkTypeId
==
request
.
Id
);
if
(
workTypeSource
!=
null
&&
workTypeSource
.
Any
())
{
workTypeSource
.
ForEach
(
item
=>
item
.
Purpose
=
request
.
Purpose
);
agworktypesourceRepository
.
UpdateRange
(
workTypeSource
.
ToArray
());
}
var
workLoad
=
agworkloadRepository
.
GetEntities
(
w
=>
w
.
WorkTypeId
==
request
.
Id
);
if
(
workLoad
!=
null
&&
workLoad
.
Any
())
{
workLoad
.
ForEach
(
item
=>
item
.
Purpose
=
request
.
Purpose
);
agworkloadRepository
.
UpdateRange
(
workLoad
.
ToArray
());
}
var
workLoadSource
=
agworkloadsourceRepository
.
GetEntities
(
w
=>
w
.
WorkTypeId
==
request
.
Id
);
if
(
workLoadSource
!=
null
&&
workLoadSource
.
Any
())
{
workLoadSource
.
ForEach
(
item
=>
item
.
Purpose
=
request
.
Purpose
);
agworkloadsourceRepository
.
UpdateRange
(
workLoadSource
.
ToArray
());
}
}
AddWorkTypeDefaultHeadValue
(
request
.
HospitalId
,
entity
);
AddWorkTypeDefaultValues
(
entity
);
return
entity
;
}
else
{
entity
=
new
ag_workload_type
if
(
entities
.
Any
(
w
=>
w
.
TypeName
==
request
.
TypeName
))
throw
new
PerformanceException
(
"类型信息重复,已存在相同的工作量类型信息"
);
var
entity
=
new
ag_workload_type
{
HospitalId
=
request
.
HospitalId
,
TypeName
=
request
.
TypeName
,
Department
=
second
.
Department
,
UnitType
=
second
.
UnitType
,
Purpose
=
request
.
Purpose
,
};
agworkloadtypeRepository
.
Add
(
entity
);
}
AddWorkTypeDefaultHeadValue
(
request
.
HospitalId
,
entity
);
AddWorkTypeDefaultValues
(
entity
);
return
entity
;
}
else
if
(
request
.
Id
!=
entity
.
Id
)
throw
new
PerformanceException
(
"类型已存在"
);
else
return
request
;
}
/// <summary>
...
...
@@ -1194,7 +1228,9 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
}
}
else
{
addItems
=
defaultValues
;
}
if
(
addItems
==
null
||
!
addItems
.
Any
())
return
;
...
...
@@ -1207,7 +1243,8 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
ItemName
=
t
.
Item1
,
FactorValue
=
null
,
Sort
=
100
+
t
.
Item3
,
WorkTypeId
=
type
.
Id
WorkTypeId
=
type
.
Id
,
Purpose
=
type
.
Purpose
,
});
agworkloadRepository
.
AddRange
(
insertData
.
ToArray
());
}
...
...
@@ -1232,7 +1269,8 @@ private void AddWorkTypeDefaultHeadValue(int hospitalId, ag_workload_type type)
WorkTypeId
=
type
.
Id
,
SecondId
=
t
.
Id
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
}
_Ratio_
{
type
.
Id
}
"
,
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
,
Purpose
=
type
.
Purpose
,
}).
ToList
();
}
else
...
...
@@ -1246,7 +1284,8 @@ private void AddWorkTypeDefaultHeadValue(int hospitalId, ag_workload_type type)
WorkTypeId
=
type
.
Id
,
SecondId
=
t
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
}
_Ratio_
{
type
.
Id
}
"
,
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
,
Purpose
=
type
.
Purpose
,
}).
ToList
();
}
worktypeSources
.
ForEach
(
t
=>
...
...
@@ -1260,7 +1299,8 @@ private void AddWorkTypeDefaultHeadValue(int hospitalId, ag_workload_type type)
WorkTypeId
=
type
.
Id
,
SecondId
=
t
.
SecondId
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
.
ToString
()}
_Amount_
{
type
.
Id
}
"
,
FieldName
=
t
.
FieldName
.
Substring
(
0
,
t
.
FieldName
.
Length
-
2
)
+
"金额"
FieldName
=
t
.
FieldName
.
Substring
(
0
,
t
.
FieldName
.
Length
-
2
)
+
"金额"
,
Purpose
=
type
.
Purpose
,
}).
ToList
();
insertData
.
AddRange
(
amounts
);
agworktypesourceRepository
.
AddRange
(
insertData
.
OrderBy
(
t
=>
t
.
SecondId
).
ThenBy
(
t
=>
t
.
FieldName
).
ToArray
());
...
...
@@ -1422,10 +1462,16 @@ public List<ag_workload> GetWorkloadList(WorkloadRequest request)
/// <returns></returns>
public
bool
WorkloadAdd
(
WorkloadRequest
request
)
{
Expression
<
Func
<
ag_workload
,
bool
>>
exp
=
(
t
)
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
ItemId
.
StartsWith
(
$"
{
request
.
AgWorkloadType
}
_"
);
var
workloadList
=
agworkloadRepository
.
GetEntities
(
exp
);
if
(
workloadList
!=
null
&&
workloadList
.
Any
(
t
=>
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"项目名称重复"
);
var
workloadList
=
agworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
ItemId
.
StartsWith
(
$"
{
request
.
AgWorkloadType
}
_"
))
?.
Where
(
t
=>
UnitTypeUtil
.
Is
(
t
.
UnitType
,
request
.
UnitType
)).
ToList
()
??
new
List
<
ag_workload
>();
if
(
workloadList
.
Any
(
t
=>
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"工作量项目名称重复"
);
var
workloadType
=
agworkloadtypeRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
WorkTypeId
);
if
(
request
.
AgWorkloadType
!=
AgWorkloadType
.
Workload
)
throw
new
PerformanceException
(
"工作量类型信息错误,找不到对应的工作量类型信息"
);
ag_workload
workload
=
new
ag_workload
{
HospitalId
=
request
.
HospitalId
,
...
...
@@ -1435,7 +1481,8 @@ public bool WorkloadAdd(WorkloadRequest request)
ItemName
=
request
.
ItemName
,
Sort
=
request
.
Sort
??
1
,
SourceCategory
=
request
.
SourceCategory
,
WorkTypeId
=
request
.
AgWorkloadType
==
AgWorkloadType
.
Workload
?
request
.
WorkTypeId
:
(
int
)
request
.
AgWorkloadType
WorkTypeId
=
request
.
AgWorkloadType
==
AgWorkloadType
.
Workload
?
request
.
WorkTypeId
:
(
int
)
request
.
AgWorkloadType
,
Purpose
=
workloadType
?.
Purpose
??
0
,
};
var
result
=
agworkloadRepository
.
Add
(
workload
);
if
(
result
)
...
...
@@ -1454,12 +1501,16 @@ public bool WorkloadAdd(WorkloadRequest request)
/// <returns></returns>
public
bool
WorkloadUpdate
(
WorkloadRequest
request
)
{
Expression
<
Func
<
ag_workload
,
bool
>>
exp
=
(
t
)
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
ItemId
.
StartsWith
(
$"
{
request
.
AgWorkloadType
}
_"
);
var
workloadList
=
agworkloadRepository
.
GetEntities
(
exp
);
if
(
workloadList
!=
null
&&
workloadList
.
Any
(
t
=>
t
.
Id
!=
request
.
Id
&&
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"项目名称重复"
);
var
workloadList
=
agworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
ItemId
.
StartsWith
(
$"
{
request
.
AgWorkloadType
}
_"
))
?.
Where
(
t
=>
UnitTypeUtil
.
Is
(
t
.
UnitType
,
request
.
UnitType
)).
ToList
()
??
new
List
<
ag_workload
>();
if
(
workloadList
.
Any
(
t
=>
t
.
Id
!=
request
.
Id
&&
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"工作量项目名称重复"
);
var
workloadType
=
agworkloadtypeRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
WorkTypeId
)
??
throw
new
PerformanceException
(
"工作量类型信息错误,找不到对应的工作量类型信息"
);
var
workload
=
workloadList
.
FirstOrDefault
(
t
=>
t
.
Id
==
request
.
Id
)
??
throw
new
PerformanceException
(
"工作量项目信息错误,找不到对应的工作量类型信息"
);
var
workload
=
workloadList
.
FirstOrDefault
(
t
=>
t
.
Id
==
request
.
Id
);
workload
.
HospitalId
=
request
.
HospitalId
;
workload
.
Department
=
request
.
Department
;
workload
.
UnitType
=
request
.
UnitType
;
...
...
@@ -1469,6 +1520,7 @@ public bool WorkloadUpdate(WorkloadRequest request)
workload
.
Sort
=
request
.
Sort
;
workload
.
ItemId
=
getWorkloadItemId
.
Invoke
(
request
.
AgWorkloadType
,
request
.
WorkTypeId
,
workload
.
Id
);
workload
.
WorkTypeId
=
request
.
AgWorkloadType
==
AgWorkloadType
.
Workload
?
request
.
WorkTypeId
:
(
int
)
request
.
AgWorkloadType
;
workload
.
Purpose
=
workloadType
.
Purpose
;
return
agworkloadRepository
.
Update
(
workload
);
}
...
...
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