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
fae1b083
Commit
fae1b083
authored
Dec 28, 2021
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '手工录入_' into feature/v22.1.7
# Conflicts: # performance/Performance.Api/wwwroot/Performance.Api.xml
parents
10e4a442
d4c9a2da
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
286 additions
and
100 deletions
+286
-100
performance/Performance.Api/Controllers/EmployeeController.cs
+26
-12
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.DtoModels/PerExcel/PerSheetHeader.cs
+13
-6
performance/Performance.DtoModels/Response/GatherResponse.cs
+35
-2
performance/Performance.EntityModels/Entity/ex_result_gather.cs
+1
-1
performance/Performance.Repository/PerforExresultgatherRepository.cs
+23
-0
performance/Performance.Repository/PerforPeremployeeRepository.cs
+0
-7
performance/Performance.Services/ConfigService.cs
+1
-0
performance/Performance.Services/EmployeeService.cs
+182
-72
No files found.
performance/Performance.Api/Controllers/EmployeeController.cs
View file @
fae1b083
...
...
@@ -3,6 +3,7 @@
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Performance.DtoModels
;
using
Performance.DtoModels.Request
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Services
;
...
...
@@ -318,6 +319,8 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if
(
employee
==
null
||
!
employee
.
Any
())
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
employee
);
var
result
=
employee
.
GroupBy
(
t
=>
new
{
t
.
AccountingUnit
,
t
.
PersonnelNumber
,
t
.
DoctorName
}).
Select
(
t
=>
new
{
PersonnelNumber
=
t
.
Key
.
PersonnelNumber
,
...
...
@@ -767,7 +770,6 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
var
relust
=
employeeService
.
GetGatherHands
(
allotId
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
relust
);
}
...
...
@@ -780,14 +782,19 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ
/// <returns></returns>
[
Route
(
"savegatherhands/{allotId}"
)]
[
HttpPost
]
public
ApiResponse
SaveGatherHands
(
int
allotId
,
[
FromBody
]
SaveGatherData
request
)
public
ApiResponse
SaveGatherHands
(
[
FromRoute
]
int
allotId
,
[
FromBody
]
SaveGatherData
request
)
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
if
(
string
.
IsNullOrEmpty
(
request
.
Source
)
||
string
.
IsNullOrEmpty
(
request
.
Category
))
return
new
ApiResponse
(
ResponseType
.
OK
);
return
new
ApiResponse
(
ResponseType
.
Fail
);
if
(
request
.
Data
==
null
||
!
request
.
Data
.
Any
())
return
new
ApiResponse
(
ResponseType
.
Fail
,
"用户提交数据为空"
);
employeeService
.
CheckGatherData
(
allotId
,
request
);
employeeService
.
SaveGatherHands
(
allotId
,
request
);
employeeService
.
AddCategoryToConfig
(
allotId
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
...
...
@@ -795,33 +802,40 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques
/// 手工录入列表 - 明细
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <param name="department">科室</param>
/// <param name="source">来源</param>
/// <param name="request">分页</param>
/// <returns></returns>
[
Route
(
"getgather/{allotId}"
)]
[
Route
(
"getgather/{allotId}
,{department},{source}
"
)]
[
HttpPost
]
public
ApiResponse
GetGather
([
FromRoute
]
int
allotId
,
[
FromBody
]
PersonParamsRequest
request
)
public
ApiResponse
GetGather
([
FromRoute
]
int
allotId
,
string
department
,
string
source
,
[
FromBody
]
PersonParamsRequest
request
)
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"
allotid无效
"
);
if
(
allotId
<=
0
||
string
.
IsNullOrEmpty
(
department
)
||
string
.
IsNullOrEmpty
(
source
)
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"
请检查allotId,department,source是否正确
"
);
var
result
=
employeeService
.
GetGather
(
allotId
,
request
);
var
result
=
employeeService
.
GetGather
(
allotId
,
department
,
source
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 手工录入列表 - 汇总
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <param name="request">
分页
</param>
/// <returns></returns>
[
Route
(
"getgathertotal/{allotId}"
)]
[
HttpPost
]
public
ApiResponse
GetGatherTotal
([
FromRoute
]
int
allotId
,
[
FromBody
]
PersonParamsRequest
request
)
{
return
new
ApiResponse
(
ResponseType
.
OK
);
}
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
var
result
=
employeeService
.
GetGatherTotal
(
allotId
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
#
endregion
}
}
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
fae1b083
...
...
@@ -3619,6 +3619,11 @@
创建时间
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ex_result_gather.Remark"
>
<summary>
备注
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ex_script"
>
<summary>
...
...
performance/Performance.DtoModels/PerExcel/PerSheetHeader.cs
View file @
fae1b083
...
...
@@ -94,12 +94,19 @@ public class ColumnHeadsConfig
{
public
static
List
<
Heads
>
GatherHeads
{
get
;
}
=
new
List
<
Heads
>
{
new
Heads
{
Column
=
"科室"
,
Name
=
nameof
(
ex_result_gather
.
Department
)},
new
Heads
{
Column
=
"医生姓名"
,
Name
=
nameof
(
ex_result_gather
.
DoctorName
)},
new
Heads
{
Column
=
"人员工号"
,
Name
=
nameof
(
ex_result_gather
.
PersonnelNumber
)},
new
Heads
{
Column
=
"费用类型"
,
Name
=
nameof
(
ex_result_gather
.
Category
)},
new
Heads
{
Column
=
"费用"
,
Name
=
nameof
(
ex_result_gather
.
Fee
)},
new
Heads
{
Column
=
"来源"
,
Name
=
nameof
(
ex_result_gather
.
Source
)}
new
Heads
{
Column
=
"来源"
,
Name
=
nameof
(
GatherInfoRequest
.
Source
)},
new
Heads
{
Column
=
"科室"
,
Name
=
nameof
(
GatherInfoRequest
.
Department
)},
new
Heads
{
Column
=
"医生姓名"
,
Name
=
nameof
(
GatherInfoRequest
.
DoctorName
)},
new
Heads
{
Column
=
"人员工号"
,
Name
=
nameof
(
GatherInfoRequest
.
PersonnelNumber
)},
new
Heads
{
Column
=
"费用类型"
,
Name
=
nameof
(
GatherInfoFee
.
Category
)},
new
Heads
{
Column
=
"费用"
,
Name
=
nameof
(
GatherInfoFee
.
Fee
)},
};
public
static
List
<
Heads
>
GatherTotal
{
get
;
}
=
new
List
<
Heads
>
{
new
Heads
{
Column
=
"科室"
,
Name
=
nameof
(
GatherTotalRequest
.
Department
)},
new
Heads
{
Column
=
"来源"
,
Name
=
nameof
(
GatherTotalRequest
.
Source
)},
new
Heads
{
Column
=
"费用"
,
Name
=
nameof
(
GatherTotalRequest
.
Fee
)}
};
}
...
...
performance/Performance.DtoModels/Response/GatherResponse.cs
View file @
fae1b083
using
Performance.EntityModels
;
using
Performance.DtoModels.Request
;
using
Performance.EntityModels
;
using
Performance.Infrastructure.Models
;
using
System.Collections.Generic
;
...
...
@@ -7,7 +8,16 @@ namespace Performance.DtoModels
public
class
GatherResponse
{
public
List
<
Heads
>
Heads
{
get
;
set
;
}
public
PageList
<
ex_result_gather
>
Datas
{
get
;
set
;
}
public
List
<
GatherTotalRequest
>
Datas
{
get
;
set
;
}
public
int
CurrentPage
{
get
;
set
;
}
public
int
TotalPages
{
get
;
set
;
}
public
int
PageSize
{
get
;
set
;
}
public
int
TotalCount
{
get
;
set
;
}
}
public
class
GatherInfo
{
public
List
<
Heads
>
Heads
{
get
;
set
;
}
public
List
<
GatherInfoRequest
>
Datas
{
get
;
set
;
}
public
int
CurrentPage
{
get
;
set
;
}
public
int
TotalPages
{
get
;
set
;
}
public
int
PageSize
{
get
;
set
;
}
...
...
@@ -28,4 +38,27 @@ public class GatherRequest
public
string
Source
{
get
;
set
;
}
public
string
Category
{
get
;
set
;
}
}
public
class
GatherTotalRequest
{
public
int
ID
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
Source
{
get
;
set
;
}
public
decimal
Fee
{
get
;
set
;
}
}
public
class
GatherInfoRequest
{
public
string
Source
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
DoctorName
{
get
;
set
;
}
public
string
PersonnelNumber
{
get
;
set
;
}
public
List
<
GatherInfoFee
>
Detail
{
get
;
set
;
}
}
public
class
GatherInfoFee
{
public
string
Category
{
get
;
set
;
}
public
decimal
?
Fee
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ex_result_gather.cs
View file @
fae1b083
...
...
@@ -49,6 +49,6 @@ public class ex_result_gather
/// <summary>
/// 1 未通过 2 通过
/// </summary>
public
int
States
{
get
;
set
;
}
//
public int States { get; set; }
}
}
performance/Performance.Repository/PerforExresultgatherRepository.cs
0 → 100644
View file @
fae1b083
using
Performance.EntityModels
;
using
Performance.Infrastructure.Models
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
namespace
Performance.Repository
{
public
partial
class
PerforExresultgatherRepository
:
PerforRepository
<
ex_result_gather
>
{
public
PageList
<
ex_result_gather
>
GetGatherForPaging
(
int
pageNumber
,
int
pageSize
,
Expression
<
Func
<
ex_result_gather
,
bool
>>
exp
)
{
IQueryable
<
ex_result_gather
>
queryableAuthors
=
context
.
Set
<
ex_result_gather
>()
.
Where
(
exp
)
.
OrderBy
(
w
=>
w
.
Department
)
.
ThenBy
(
t
=>
t
.
PersonnelNumber
);
return
PageList
<
ex_result_gather
>.
Create
(
queryableAuthors
,
pageNumber
,
pageSize
);
}
}
}
performance/Performance.Repository/PerforPeremployeeRepository.cs
View file @
fae1b083
...
...
@@ -30,13 +30,6 @@ public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageS
}
public
PageList
<
ex_result_gather
>
GetGatherForPaging
(
int
pageNumber
,
int
pageSize
,
Expression
<
Func
<
ex_result_gather
,
bool
>>
exp
)
{
IQueryable
<
ex_result_gather
>
queryableAuthors
=
context
.
Set
<
ex_result_gather
>().
Where
(
exp
).
OrderBy
(
w
=>
w
.
Department
).
ThenBy
(
t
=>
t
.
PersonnelNumber
);
return
PageList
<
ex_result_gather
>.
Create
(
queryableAuthors
,
pageNumber
,
pageSize
);
}
//public Comparison GetComparison(ComparisonPagingRequest request)
//{
// var search = "";
...
...
performance/Performance.Services/ConfigService.cs
View file @
fae1b083
...
...
@@ -869,6 +869,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request)
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
cof_accounting
>(
json
);
data
.
AllotId
=
allotId
;
if
(!
unitType
.
Contains
(
data
?.
UnitType
)
&&
!
string
.
IsNullOrEmpty
(
data
?.
UnitType
))
return
false
;
if
(
getAccounts
!=
null
)
if
(
getAccounts
.
Any
(
t
=>
t
.
AccountingUnit
==
data
?.
AccountingUnit
&&
t
.
UnitType
==
data
?.
UnitType
))
continue
;
...
...
performance/Performance.Services/EmployeeService.cs
View file @
fae1b083
...
...
@@ -6,8 +6,10 @@
using
NPOI.SS.Util
;
using
NPOI.XSSF.UserModel
;
using
Performance.DtoModels
;
using
Performance.DtoModels.Request
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure.Models
;
using
Performance.Repository
;
using
Performance.Services.AllotCompute
;
using
System
;
...
...
@@ -15,6 +17,7 @@
using
System.IO
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text.RegularExpressions
;
namespace
Performance.Services
{
...
...
@@ -1149,7 +1152,6 @@ public ComparisonResponse GetComparison(ComparisonPagingRequest request)
public
List
<
GatherDropResponse
>
GetGatherDrop
(
int
allotId
)
{
again
:
var
perSheets
=
perforPersheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
new
[]
{
3
,
4
,
7
}.
Contains
(
t
.
SheetType
.
Value
));
if
(
perSheets
==
null
||
!
perSheets
.
Any
())
{
...
...
@@ -1165,21 +1167,37 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
allotId
=
index
+
1
<
list
.
Count
?
list
[
index
+
1
].
ID
:
list
.
First
().
ID
;
if
(
allotId
==
allot
.
ID
)
return
new
List
<
GatherDropResponse
>();
goto
again
;
}
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName });
var
imHeaders
=
imheaderRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
var
exresultgather
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
);
foreach
(
var
item
in
exresultgather
.
Select
(
t
=>
new
{
t
.
Category
,
t
.
Source
}).
Distinct
())
{
int
id
=
perSheets
.
Where
(
t
=>
t
.
SheetName
.
Contains
(
item
.
Source
)).
Select
(
t
=>
new
{
t
.
ID
}).
ToList
()[
0
].
ID
;
imHeaders
.
Add
(
new
im_header
{
SheetID
=
id
,
CellValue
=
item
.
Category
}
);
}
var
result
=
new
List
<
GatherDropResponse
>();
var
cellValue
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
};
foreach
(
var
sheet
in
perSheets
)
{
var
drop
=
new
GatherDropResponse
();
var
header
=
imHeaders
.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
&&
!
cellValue
.
Contains
(
t
.
CellValue
)).
Select
(
t
=>
t
.
CellValue
).
Distinct
();
drop
.
Label
=
sheet
.
SheetName
.
Split
(
' '
)[
1
]
;
drop
.
Value
=
sheet
.
SheetName
.
Split
(
' '
)[
1
]
;
drop
.
Label
=
Regex
.
Replace
(
sheet
.
SheetName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
/*sheet.SheetName.Split(' ')[1]*/
;
drop
.
Value
=
Regex
.
Replace
(
sheet
.
SheetName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
/*sheet.SheetName.Split(' ')[1]*/
;
drop
.
Children
=
header
.
Select
(
t
=>
new
GatherDropResponse
()
{
Label
=
t
,
Value
=
t
}).
ToList
();
result
.
Add
(
drop
);
}
...
...
@@ -1196,6 +1214,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
Visible
=
1
}).
ToList
());
if
(
result
.
Columns
!=
null
&&
result
.
Columns
.
Any
())
{
foreach
(
var
column
in
result
.
Columns
)
...
...
@@ -1209,8 +1228,12 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
column
.
Type
=
"text"
;
}
}
List
<
ex_result_gather
>
data
=
new
List
<
ex_result_gather
>();
if
(!
string
.
IsNullOrEmpty
(
request
.
Source
)
&&
!
string
.
IsNullOrEmpty
(
request
.
Category
))
{
data
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
AllotId
&&
t
.
Source
.
Contains
(
request
.
Source
)
&&
t
.
Category
.
Contains
(
request
.
Category
));
}
var
data
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
AllotId
&&
t
.
Source
.
Contains
(
request
.
Source
)
&&
t
.
Category
.
Contains
(
request
.
Category
));
if
(
data
==
null
)
return
result
;
...
...
@@ -1254,30 +1277,120 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository
.
AddRange
(
depts
.
ToArray
());
}
public
Gather
Response
GetGather
(
int
allotId
,
PersonParamsRequest
request
)
public
Gather
Info
GetGather
(
int
allotId
,
string
department
,
string
source
,
PersonParamsRequest
request
)
{
Expression
<
Func
<
ex_result_gather
,
bool
>>
exp
=
t
=>
t
.
AllotId
==
allotId
&&
t
.
Department
.
Contains
(
department
)
&&
t
.
Source
.
Contains
(
source
);
if
(
request
!=
null
&&
!
string
.
IsNullOrEmpty
(
request
.
SearchQuery
))
exp
=
exp
.
And
(
t
=>
t
.
AllotId
==
allotId
&&
t
.
Department
.
Contains
(
department
)
&&
t
.
Source
.
Contains
(
source
)
&&
t
.
DoctorName
.
Contains
(
request
.
SearchQuery
)
||
t
.
PersonnelNumber
.
Contains
(
request
.
SearchQuery
));
var
datas
=
exresultgatherRepository
.
GetEntities
(
exp
);
var
result
=
datas
.
GroupBy
(
a
=>
new
{
a
.
Source
,
a
.
Department
,
a
.
DoctorName
,
a
.
PersonnelNumber
}).
Select
(
t
=>
new
{
Source
=
t
.
Key
.
Source
,
Department
=
t
.
Key
.
Department
,
DoctorName
=
t
.
Key
.
DoctorName
,
PersonnelNumber
=
t
.
Key
.
PersonnelNumber
,
Detail
=
t
.
GroupBy
(
group
=>
group
.
Category
).
Select
(
s
=>
new
TitleValue
<
decimal
>
{
Title
=
string
.
IsNullOrEmpty
(
s
.
Key
)
?
"未知"
:
s
.
Key
,
Value
=
s
.
Sum
(
sum
=>
sum
.
Fee
)
})
});
List
<
GatherInfoRequest
>
gatherInfoRequests
=
new
List
<
GatherInfoRequest
>();
foreach
(
var
item
in
result
.
ToList
())
{
GatherInfoRequest
gatherInfoRequest
=
new
GatherInfoRequest
()
{
Source
=
Regex
.
Replace
(
item
.
Source
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
),
Department
=
item
.
Department
,
DoctorName
=
item
.
DoctorName
,
PersonnelNumber
=
item
.
PersonnelNumber
,
Detail
=
new
List
<
GatherInfoFee
>()
};
foreach
(
var
item2
in
item
.
Detail
)
{
GatherInfoFee
gatherInfoFee
=
new
GatherInfoFee
()
{
Category
=
item2
.
Title
,
Fee
=
item2
.
Value
};
gatherInfoRequest
.
Detail
.
Add
(
gatherInfoFee
);
}
gatherInfoRequests
.
Add
(
gatherInfoRequest
);
}
var
head
=
ColumnHeadsConfig
.
GatherHeads
;
head
.
ForEach
(
t
=>
{
t
.
Name
=
t
.
Name
.
ToLower
();
});
GatherInfo
gatherInfo
=
new
GatherInfo
()
{
Heads
=
head
,
Datas
=
gatherInfoRequests
.
Skip
((
request
.
PageNumber
-
1
)
*
request
.
PageSize
).
Take
(
request
.
PageSize
).
ToList
(),
CurrentPage
=
request
.
PageNumber
,
TotalCount
=
gatherInfoRequests
.
Count
(),
PageSize
=
request
.
PageSize
,
TotalPages
=
(
int
)
Math
.
Ceiling
((
double
)
gatherInfoRequests
.
Count
()
/
request
.
PageSize
)
};
return
gatherInfo
;
}
public
GatherResponse
GetGatherTotal
(
int
allotId
,
PersonParamsRequest
request
)
{
List
<
GatherTotalRequest
>
gatherTotalRequests
=
new
List
<
GatherTotalRequest
>();
Expression
<
Func
<
ex_result_gather
,
bool
>>
exp
=
t
=>
t
.
AllotId
==
allotId
;
if
(
request
!=
null
&&
!
string
.
IsNullOrEmpty
(
request
.
SearchQuery
))
exp
=
exp
.
And
(
t
=>
t
.
Department
.
Contains
(
request
.
SearchQuery
)
||
t
.
DoctorName
.
Contains
(
request
.
SearchQuery
)
||
t
.
PersonnelNumber
.
Contains
(
request
.
SearchQuery
)
||
t
.
Category
.
Contains
(
request
.
SearchQuery
)
||
t
.
Source
.
Contains
(
request
.
SearchQuery
));
{
exp
=
exp
.
And
(
t
=>
t
.
Department
.
Contains
(
request
.
SearchQuery
)
||
t
.
Source
.
Contains
(
request
.
SearchQuery
));
}
var
data
=
peremployeeRepository
.
GetGatherForPaging
(
request
.
PageNumber
,
request
.
PageSize
,
exp
);
var
datas
=
exresultgatherRepository
.
GetEntities
(
exp
);
if
(
datas
!=
null
&&
datas
.
Any
())
{
var
result
=
datas
.
GroupBy
(
a
=>
new
{
a
.
AllotId
,
a
.
Department
,
a
.
Source
}).
Select
(
t
=>
new
{
ID
=
t
.
Key
.
AllotId
,
Department
=
t
.
Key
.
Department
,
Source
=
t
.
Key
.
Source
,
Fee
=
t
.
Sum
(
a
=>
a
.
Fee
)
});
return
new
GatherResponse
()
foreach
(
var
item
in
result
.
ToList
())
{
GatherTotalRequest
gatherTotalRequest
=
new
GatherTotalRequest
()
{
ID
=
item
.
ID
,
Department
=
item
.
Department
,
Source
=
Regex
.
Replace
(
item
.
Source
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
/*item.Source.Split(' ')[1]*/
,
Fee
=
item
.
Fee
};
gatherTotalRequests
.
Add
(
gatherTotalRequest
);
}
}
var
head
=
ColumnHeadsConfig
.
GatherTotal
;
head
.
ForEach
(
t
=>
{
t
.
Name
=
t
.
Name
.
ToLower
();
});
GatherResponse
gatherResponse
=
new
GatherResponse
()
{
Heads
=
head
,
Datas
=
data
,
CurrentPage
=
data
.
CurrentPage
,
TotalCount
=
data
.
TotalCount
,
PageSize
=
data
.
PageSize
,
TotalPages
=
data
.
TotalPages
Datas
=
gatherTotalRequests
.
Skip
((
request
.
PageNumber
-
1
)
*
request
.
PageSize
).
Take
(
request
.
PageSize
).
ToList
()
,
CurrentPage
=
request
.
PageNumber
,
TotalCount
=
gatherTotalRequests
.
Count
()
,
PageSize
=
request
.
PageSize
,
TotalPages
=
(
int
)
Math
.
Ceiling
((
double
)
gatherTotalRequests
.
Count
()
/
request
.
PageSize
)
};
return
gatherResponse
;
}
public
static
Dictionary
<
string
,
string
>
Gather
{
get
;
}
=
new
Dictionary
<
string
,
string
>
...
...
@@ -1323,60 +1436,44 @@ public GatherResponse GetGather(int allotId, PersonParamsRequest request)
return
result
;
}
#
endregion
#
region
录入校验
public
bool
CheckGatherData
(
int
allotId
)
public
void
CheckGatherData
(
int
allotId
,
SaveGatherData
saveGather
)
{
try
{
var
allot
=
perallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在"
);
var
data
=
exresultgatherRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
data
==
null
||
!
data
.
Any
())
throw
new
PerformanceException
(
"录入数据为空"
);
SetDataStatesAndRemark
(
data
,
2
,
string
.
Empty
);
var
departments
=
perdeptdicRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
);
if
(
departments
!=
null
&&
departments
.
Any
())
{
var
notExistsDeptData
=
data
.
Where
(
w
=>
!
departments
.
Select
(
t
=>
t
.
Department
).
Contains
(
w
.
Department
));
if
(
notExistsDeptData
!=
null
&&
notExistsDeptData
.
Any
())
SetDataStatesAndRemark
(
notExistsDeptData
,
1
,
"科室字典中不存在科室[{0}]"
,
t
=>
t
.
Department
);
}
var
employees
=
peremployeeRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
employees
!=
null
&&
employees
.
Any
())
{
var
notExistNameData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
DoctorName
).
Contains
(
w
.
DoctorName
)
&&
!
string
.
IsNullOrEmpty
(
w
.
DoctorName
));
if
(
notExistNameData
!=
null
&&
notExistNameData
.
Any
())
SetDataStatesAndRemark
(
notExistNameData
,
1
,
"人员字典中不存在医生名称[{0}]"
,
t
=>
t
.
DoctorName
);
var
notExistNumberData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
)
&&
!
string
.
IsNullOrEmpty
(
w
.
PersonnelNumber
));
if
(
notExistNumberData
!=
null
&&
notExistNumberData
.
Any
())
SetDataStatesAndRemark
(
notExistNumberData
,
1
,
"人员字典中不存在工号[{0}]"
,
t
=>
t
.
PersonnelNumber
);
}
var
allot
=
perallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在"
);
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allotId
);
if
(
sheets
!=
null
&&
sheets
.
Any
())
{
var
notExistsSourceData
=
data
.
Where
(
w
=>
!
sheets
.
Select
(
t
=>
t
.
SheetName
).
Contains
(
w
.
Source
));
if
(
notExistsSourceData
!=
null
&&
notExistsSourceData
.
Any
())
SetDataStatesAndRemark
(
notExistsSourceData
,
1
,
"来源中不存在名称[{0}]"
,
t
=>
t
.
Source
);
}
var
data
=
saveGather
.
Data
;
exresultgatherRepository
.
UpdateRange
(
data
.
ToArray
());
var
departments
=
perdeptdicRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
);
if
(
departments
!=
null
&&
departments
.
Any
())
{
var
notExistsDeptData
=
data
.
Where
(
w
=>
!
departments
.
Select
(
t
=>
t
.
Department
).
Contains
(
w
[
0
]));
if
(
notExistsDeptData
!=
null
&&
notExistsDeptData
.
Any
())
throw
new
PerformanceException
(
$"科室字典中不存在科室[
{
string
.
Join
(
","
,
notExistsDeptData
.
Select
(
t
=>
t
[
0
]).
Distinct
())}
]"
);
}
AddCategoryToConfig
(
data
,
allot
.
HospitalId
);
var
employees
=
peremployeeRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
employees
!=
null
&&
employees
.
Any
())
{
var
notExistNameData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
DoctorName
).
Contains
(
w
[
1
])
&&
!
string
.
IsNullOrEmpty
(
w
[
1
]));
if
(
notExistNameData
!=
null
&&
notExistNameData
.
Any
())
throw
new
PerformanceException
(
$"人员字典中不存在医生姓名[
{
string
.
Join
(
","
,
notExistNameData
.
Select
(
t
=>
t
[
1
]).
Distinct
())}
]"
);
return
data
.
Any
(
w
=>
w
.
States
==
1
);
var
notExistNumberData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
[
2
])
&&
!
string
.
IsNullOrEmpty
(
w
[
2
]));
if
(
notExistNumberData
!=
null
&&
notExistNumberData
.
Any
())
throw
new
PerformanceException
(
$"人员字典中不存在工号[
{
string
.
Join
(
","
,
notExistNumberData
.
Select
(
t
=>
t
[
2
]).
Distinct
())}
]"
);
}
catch
(
Exception
ex
)
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allotId
);
if
(
sheets
!=
null
&&
sheets
.
Any
())
{
logger
.
LogError
(
ex
.
Message
);
throw
new
PerformanceException
(
"校验失败
"
);
if
(!
sheets
.
Select
(
t
=>
t
.
SheetName
).
Any
(
t
=>
t
.
Contains
(
saveGather
.
Source
)))
throw
new
PerformanceException
(
$"来源错误[
{
saveGather
.
Source
}
]
"
);
}
}
...
...
@@ -1391,18 +1488,19 @@ private static void SetDataStatesAndRemark(IEnumerable<ex_result_gather> data, i
if
(
func
!=
null
)
remark
=
string
.
Format
(
remark
,
func
.
Invoke
(
item
));
item
.
States
=
states
;
//
item.States = states;
item
.
Remark
=
(!
string
.
IsNullOrEmpty
(
item
.
Remark
)
&&
item
.
Remark
.
Length
>
0
)
?
item
.
Remark
+
", "
+
remark
:
remark
;
}
}
p
rivate
void
AddCategoryToConfig
(
List
<
ex_result_gather
>
data
,
int
hospital
Id
)
p
ublic
void
AddCategoryToConfig
(
int
allot
Id
)
{
if
(
data
==
null
||
!
data
.
Any
(
w
=>
w
.
States
==
2
))
return
;
var
allot
=
perallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
)
;
data
=
data
.
Where
(
w
=>
w
.
States
==
2
).
ToList
();
var
data
=
exresultgatherRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
modules
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
h
ospitalId
&&
w
.
SheetType
!=
(
int
)
SheetType
.
Income
);
var
modules
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
H
ospitalId
&&
w
.
SheetType
!=
(
int
)
SheetType
.
Income
);
if
(
modules
==
null
||
!
modules
.
Any
())
return
;
var
items
=
exitemRepository
.
GetEntities
(
w
=>
modules
.
Select
(
t
=>
t
.
Id
).
Distinct
().
Contains
(
w
.
ModuleId
??
0
));
...
...
@@ -1413,16 +1511,16 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
var
insertList
=
new
List
<
ex_item
>();
foreach
(
var
module
in
modules
)
{
var
categories
=
data
.
Where
(
t
=>
t
.
Source
==
module
.
ModuleName
)?.
Select
(
t
=>
t
.
Category
).
Distinct
();
var
categories
=
data
.
Where
(
t
=>
module
.
ModuleName
.
Contains
(
t
.
Source
)
)?.
Select
(
t
=>
t
.
Category
).
Distinct
();
if
(
categories
==
null
||
!
categories
.
Any
())
continue
;
var
moduleItems
=
items
.
Where
(
w
=>
w
.
ModuleId
==
module
.
Id
)?.
Select
(
t
=>
t
.
ItemName
).
Distinct
();
if
(
moduleItems
==
null
||
!
moduleItems
.
Any
())
continue
;
if
(
moduleItems
!=
null
&&
moduleItems
.
Any
())
categories
=
categories
.
Except
(
moduleItems
);
var
exceptCategories
=
categories
.
Except
(
moduleItems
);
if
(
exceptCategories
==
null
||
!
exceptCategories
.
Any
())
continue
;
if
(
categories
==
null
||
!
categories
.
Any
())
continue
;
insertList
.
AddRange
(
exceptC
ategories
.
Select
(
t
=>
new
ex_item
insertList
.
AddRange
(
c
ategories
.
Select
(
t
=>
new
ex_item
{
ModuleId
=
module
.
Id
,
ItemName
=
t
,
...
...
@@ -1438,15 +1536,18 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
var
speacialCategories
=
data
.
Where
(
t
=>
t
.
Source
.
Contains
(
"特殊核算单元"
))?.
Select
(
t
=>
new
{
t
.
Category
,
t
.
Department
}).
Distinct
();
if
(
speacialCategories
==
null
||
!
speacialCategories
.
Any
())
return
;
var
specials
=
exspecialRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
h
ospitalId
);
var
specials
=
exspecialRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
H
ospitalId
);
if
(
specials
==
null
||
!
specials
.
Any
())
return
;
var
list
=
speacialCategories
.
Where
(
w
=>
!
specials
.
Select
(
t
=>
t
.
Target
+
t
.
Department
).
Contains
(
w
.
Category
+
w
.
Department
));
var
list
=
(
specials
==
null
||
!
specials
.
Any
())
?
speacialCategories
:
speacialCategories
.
Where
(
w
=>
!
specials
.
Select
(
t
=>
t
.
Target
+
t
.
Department
).
Contains
(
w
.
Category
+
w
.
Department
));
if
(
list
==
null
||
!
list
.
Any
())
return
;
exspecialRepository
.
AddRange
(
list
.
Select
(
t
=>
new
ex_special
{
HospitalId
=
h
ospitalId
,
HospitalId
=
allot
.
H
ospitalId
,
Department
=
t
.
Department
,
Target
=
t
.
Category
}).
ToArray
());
...
...
@@ -1459,10 +1560,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
public
void
SyncDataToResult
(
int
allotId
)
{
var
sheets
=
perforPersheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
new
[]
{
3
,
4
,
7
}.
Contains
(
t
.
SheetType
.
Value
));
if
(
sheets
==
null
||
!
sheets
.
Any
())
return
;
var
data
=
exresultgatherRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
data
==
null
||
!
data
.
Any
()
||
data
.
Any
(
w
=>
w
.
States
==
1
))
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
syncData
=
_mapper
.
Map
<
List
<
ex_result
>>(
data
);
var
syncData
=
_mapper
.
Map
<
List
<
ex_result
>>(
data
);
syncData
.
ForEach
(
x
=>
{
x
.
Id
=
0
;
x
.
Source
=
sheets
.
FirstOrDefault
(
t
=>
t
.
SheetName
.
Contains
(
x
.
Source
))?.
SheetName
??
x
.
Source
;
});
exresultRepository
.
AddRange
(
syncData
.
ToArray
());
}
...
...
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