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