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
15138d91
Commit
15138d91
authored
Apr 28, 2022
by
1391696987
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复手工录入bug
parent
497fb866
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
198 additions
and
141 deletions
+198
-141
performance/Performance.Api/Controllers/AttendanceController.cs
+0
-1
performance/Performance.Api/Controllers/EmployeeController.cs
+4
-6
performance/Performance.Api/wwwroot/Performance.Api.xml
+1
-2
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.DtoModels/Enum.cs
+1
-1
performance/Performance.DtoModels/PerExcel/PerSheetHeader.cs
+1
-1
performance/Performance.DtoModels/Response/GatherResponse.cs
+0
-2
performance/Performance.EntityModels/Entity/per_dept_dic.cs
+4
-0
performance/Performance.Services/EmployeeService.cs
+182
-128
No files found.
performance/Performance.Api/Controllers/AttendanceController.cs
View file @
15138d91
...
...
@@ -148,7 +148,6 @@ public ApiResponse GetAttendanceVacationHandsonTable(int allotId)
/// 查询考勤记录
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"Vacation/{allotId},{hospitalId}"
)]
public
ApiResponse
<
List
<
RecordAttendcance
>>
GetAttendanceVacation
(
int
allotId
)
...
...
performance/Performance.Api/Controllers/EmployeeController.cs
View file @
15138d91
...
...
@@ -899,10 +899,8 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
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
);
;
return
employeeService
.
SaveGatherHands
(
allotId
,
request
);
}
/// <summary>
...
...
@@ -965,9 +963,9 @@ public ApiResponse DeleteGather([FromBody] Gather gather)
/// <returns></returns>
[
Route
(
"auditGather"
)]
[
HttpPost
]
public
ApiResponse
a
uditGather
([
FromBody
]
List
<
Gather
>
gather
)
public
ApiResponse
A
uditGather
([
FromBody
]
List
<
Gather
>
gather
)
{
employeeService
.
a
uditGather
(
gather
);
employeeService
.
A
uditGather
(
gather
);
return
new
ApiResponse
(
ResponseType
.
OK
,
""
);
}
#
endregion
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
15138d91
...
...
@@ -384,7 +384,6 @@
查询考勤记录
</summary>
<param
name=
"allotId"
></param>
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.AttendanceBatch(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)"
>
...
...
@@ -1400,7 +1399,7 @@
<param
name=
"gather"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.
a
uditGather(System.Collections.Generic.List{Performance.DtoModels.Gather})"
>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.
A
uditGather(System.Collections.Generic.List{Performance.DtoModels.Gather})"
>
<summary>
批量审核
</summary>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
15138d91
...
...
@@ -6605,6 +6605,11 @@
</summary>
</member>
<member
name=
"P:Performance.EntityModels.per_dept_dic.AllotId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.per_dept_dic.HISDeptName"
>
<summary>
his系统科室名称
...
...
performance/Performance.DtoModels/Enum.cs
View file @
15138d91
...
...
@@ -172,7 +172,7 @@ public enum Deduction
}
public
enum
AuditGather
public
enum
AuditGather
Enum
{
未审核
=
0
,
未通过
=
1
,
...
...
performance/Performance.DtoModels/PerExcel/PerSheetHeader.cs
View file @
15138d91
...
...
@@ -104,7 +104,7 @@ public class ColumnHeadsConfig
public
static
List
<
Heads
>
GatherTotal
{
get
;
}
=
new
List
<
Heads
>
{
new
Heads
{
Column
=
"
核算组别
"
,
Name
=
nameof
(
GatherTotalRequest
.
Department
)},
new
Heads
{
Column
=
"
His科室
"
,
Name
=
nameof
(
GatherTotalRequest
.
Department
)},
new
Heads
{
Column
=
"来源"
,
Name
=
nameof
(
GatherTotalRequest
.
Source
)},
new
Heads
{
Column
=
"核算项目"
,
Name
=
nameof
(
GatherTotalRequest
.
Category
)},
new
Heads
{
Column
=
"提交人"
,
Name
=
nameof
(
UserRequest
.
Login
)},
...
...
performance/Performance.DtoModels/Response/GatherResponse.cs
View file @
15138d91
...
...
@@ -27,8 +27,6 @@ public class GatherInfo
public
class
GatherDropResponse
{
public
string
Label
{
get
;
set
;
}
public
string
Value
{
get
;
set
;
}
public
List
<
GatherDropResponse
>
Children
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/per_dept_dic.cs
View file @
15138d91
...
...
@@ -20,6 +20,10 @@ public class per_dept_dic
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
AllotId
{
get
;
set
;
}
/// <summary>
/// his系统科室名称
...
...
performance/Performance.Services/EmployeeService.cs
View file @
15138d91
...
...
@@ -1253,67 +1253,59 @@ public ComparisonResponse<DtoModels.Comparison<DeptComparisonTotal>> GetDeptComp
public
List
<
GatherDropResponse
>
GetGatherDrop
(
Gather
gather
)
{
var
collectPermission
=
perforcollectpermissionRepository
.
GetEntities
(
t
=>
t
.
UserId
==
gather
.
UserId
).
Select
(
t
=>
Regex
.
Replace
(
t
.
SheetName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)).
Distinct
();
List
<
GatherDropResponse
>
result
=
new
List
<
GatherDropResponse
>
();
var
perSheets
=
perforPersheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
gather
.
AllotId
&&
new
[]
{
3
,
4
,
7
}.
Contains
(
t
.
SheetType
.
Value
)).
Select
(
s
=>
new
{
s
.
ID
,
SheetName
=
Regex
.
Replace
(
s
.
SheetName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
});
var
username
=
userRepository
.
GetEntity
(
t
=>
t
.
ID
==
gather
.
UserId
).
Login
;
if
(
username
!=
"admin"
)
perSheets
=
perSheets
.
Where
(
w
=>
collectPermission
.
Contains
(
w
.
SheetName
));
//if (perSheets == null || !perSheets.Any())
//{
// var allot = perallotRepository.GetEntity(t => t.ID == gather.AllotId);
// var list = perallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
// if (list == null || !list.Any(t => t.ID == allot.ID)) return new List<GatherDropResponse>();
// list = list.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
// var index = list.IndexOf(list.First(t => t.ID == allot.ID));
// // 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
// gather.AllotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
// if (gather.AllotId == allot.ID) return new List<GatherDropResponse>();
//}
var
username
=
userRepository
.
GetEntity
(
t
=>
t
.
ID
==
gather
.
UserId
);
if
(
username
.
Login
==
"admin"
)
{
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
var
sheets
=
exmoduleRepository
.
GetEntities
(
w
=>
types
.
Contains
(
w
.
SheetType
??
0
));
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName }
);
var
specials
=
exspecialRepository
.
GetEntities
(
);
var
imHeaders
=
imheaderRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
gather
.
AllotId
);
var
headers
=
exitemRepository
.
GetEntities
(
w
=>
sheets
.
Select
(
m
=>
m
.
Id
).
Contains
(
w
.
ModuleId
??
0
))
??
new
List
<
ex_item
>(
);
var
exresultgather
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
gather
.
AllotId
);
if
(
specials
!=
null
&&
specials
.
Any
())
{
sheets
.
Add
(
new
ex_module
{
SheetType
=
(
int
)
SheetType
.
SpecialUnit
,
ModuleName
=
"4.2 特殊核算单元绩效测算表"
,
Id
=
0
,
});
headers
.
AddRange
(
specials
.
Select
(
t
=>
new
ex_item
{
ItemName
=
t
.
Target
,
ModuleId
=
0
}));
}
// 查询sheet和列头对应
var
sheetHeads
=
from
sheet
in
sheets
join
head
in
headers
on
sheet
.
Id
equals
head
.
ModuleId
select
new
{
sheet
.
ModuleName
,
sheet
.
SheetType
,
HeadName
=
head
.
ItemName
};
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
result
=
sheetHeads
.
GroupBy
(
t
=>
t
.
ModuleName
).
Select
(
s
=>
new
GatherDropResponse
{
Value
=
Regex
.
Replace
(
s
.
Key
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
),
Children
=
sheetHeads
.
Where
(
t
=>
t
.
ModuleName
==
s
.
Key
).
Select
(
t
=>
new
GatherDropResponse
()
{
SheetID
=
id
,
CellValue
=
item
.
Category
}
);
Value
=
Regex
.
Replace
(
t
.
HeadName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
}).
ToList
()
}).
ToList
();
}
var
result
=
new
List
<
GatherDropResponse
>();
var
cellValue
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
};
foreach
(
var
sheet
in
perSheets
)
else
{
var
drop
=
new
GatherDropResponse
();
var
header
=
imHeaders
.
Where
(
t
=>
!
cellValue
.
Contains
(
t
.
CellValue
)).
Select
(
t
=>
t
.
CellValue
).
Distinct
();
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
);
}
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
w
.
UserId
==
gather
.
UserId
);
result
=
permissions
.
GroupBy
(
t
=>
t
.
SheetName
).
Select
(
s
=>
new
GatherDropResponse
{
Value
=
Regex
.
Replace
(
s
.
Key
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
),
Children
=
permissions
.
Where
(
t
=>
t
.
SheetName
==
s
.
Key
).
Select
(
t
=>
new
GatherDropResponse
()
{
Value
=
Regex
.
Replace
(
t
.
HeadName
.
Replace
(
" "
,
""
).
Replace
(
"."
,
""
),
"[0-9]"
,
""
)
}).
ToList
()
}).
ToList
();
}
return
result
;
}
...
...
@@ -1365,34 +1357,6 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
return
result
;
}
public
void
SaveGatherHands
(
int
allotId
,
SaveGatherData
request
)
{
var
dicData
=
CreateDataRow
(
0
,
allotId
,
request
,
Gather
);
List
<
ex_result_gather
>
depts
=
new
List
<
ex_result_gather
>();
List
<
string
>
deptData
=
new
List
<
string
>();
DateTime
timeNow
=
DateTime
.
Now
;
foreach
(
var
item
in
dicData
)
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
ex_result_gather
>(
json
);
if
(!
string
.
IsNullOrEmpty
(
data
.
Department
)
&&
!
string
.
IsNullOrEmpty
(
data
.
Fee
.
ToString
()))
{
data
.
Source
=
request
.
Source
;
data
.
Category
=
request
.
Category
;
data
.
AllotId
=
allotId
;
data
.
Submitter
=
request
.
UserId
;
data
.
CreateTime
=
timeNow
;
depts
.
Add
(
data
);
}
deptData
.
Add
(
data
.
Department
);
}
var
delete
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
&&
deptData
.
Contains
(
t
.
Department
)
&&
t
.
Source
==
request
.
Source
&&
t
.
Category
==
request
.
Category
);
//exresultgatherRepository.Execute($@"delete from ex_result_gather where allotid = @allotid and department like '%{request.Department}%'and source like '%{request.Source}%' and category like '%{request.Category}%' ", new { allotId });
exresultgatherRepository
.
RemoveRange
(
delete
.
ToArray
());
exresultgatherRepository
.
AddRange
(
depts
.
ToArray
());
}
public
bool
DeleteGather
(
Gather
gather
)
{
var
delete
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
gather
.
AllotId
&&
t
.
Department
==
gather
.
Department
&&
t
.
Source
==
gather
.
Source
&&
t
.
Category
==
gather
.
Category
);
...
...
@@ -1406,7 +1370,7 @@ public GatherInfo GetGather(Gather gather)
if
(
gather
!=
null
&&
!
string
.
IsNullOrEmpty
(
gather
.
SearchQuery
))
exp
=
exp
.
And
(
t
=>
t
.
DoctorName
.
Contains
(
gather
.
SearchQuery
)
||
t
.
PersonnelNumber
.
Contains
(
gather
.
SearchQuery
));
var
datas
=
exresultgatherRepository
.
GetEntities
(
exp
).
OrderByDescending
(
t
=>
t
.
CreateTime
);
var
datas
=
exresultgatherRepository
.
GetEntities
(
exp
).
OrderByDescending
(
t
=>
t
.
CreateTime
);
var
result
=
datas
.
Select
(
t
=>
new
GatherInfoRequest
{
...
...
@@ -1443,7 +1407,7 @@ public GatherResponse GetGatherTotal(Gather gather)
if
(
gather
!=
null
&&
!
string
.
IsNullOrEmpty
(
gather
.
SearchQuery
))
{
exp
=
exp
.
And
(
t
=>
t
.
Category
.
Contains
(
gather
.
SearchQuery
));
exp
=
exp
.
And
(
t
=>
t
.
Category
.
Contains
(
gather
.
SearchQuery
)
||
t
.
Source
.
Contains
(
gather
.
SearchQuery
)
);
}
var
username
=
userRepository
.
GetEntities
();
...
...
@@ -1456,7 +1420,7 @@ public GatherResponse GetGatherTotal(Gather gather)
}
var
datas
=
exresultgatherRepository
.
GetEntities
(
exp
)
.
GroupBy
(
t
=>
new
{
t
.
Department
,
t
.
Source
,
t
.
Category
,
t
.
Submitter
})
...
...
@@ -1469,9 +1433,9 @@ public GatherResponse GetGatherTotal(Gather gather)
Login
=
username
.
FirstOrDefault
(
t
=>
t
.
ID
==
s
.
Key
.
Submitter
).
Login
,
CreateTime
=
s
.
Max
(
t
=>
t
.
CreateTime
).
ToString
(
"d"
),
AuditTime
=
s
.
Max
(
t
=>
t
.
AuditTime
)?.
ToString
(
"d"
),
States
=
s
.
Any
(
w
=>
w
.
States
==
(
int
)
AuditGather
.
未通过
)
?
"未通过"
:
s
.
Count
()
==
s
.
Where
(
w
=>
w
.
States
==
(
int
)
AuditGather
.
已通过
).
Count
()
?
"已通过"
:
s
.
Count
()
==
s
.
Where
(
w
=>
w
.
States
==
(
int
)
AuditGather
.
未审核
).
Count
()
?
"未审核"
:
"未知"
,
States
=
s
.
Any
(
w
=>
w
.
States
==
(
int
)
AuditGather
Enum
.
未通过
)
?
"未通过"
:
s
.
Count
()
==
s
.
Where
(
w
=>
w
.
States
==
(
int
)
AuditGather
Enum
.
已通过
).
Count
()
?
"已通过"
:
s
.
Count
()
==
s
.
Where
(
w
=>
w
.
States
==
(
int
)
AuditGather
Enum
.
未审核
).
Count
()
?
"未审核"
:
"未知"
,
Remark
=
s
.
FirstOrDefault
()?.
Remark
,
});
...
...
@@ -1558,33 +1522,16 @@ public GatherResponse GetGatherTotal(Gather gather)
#
endregion
#
region
录入校验
public
void
CheckGatherData
(
int
allotId
,
SaveGatherData
saveGather
)
public
ApiResponse
SaveGatherHands
(
int
allotId
,
SaveGatherData
saveGather
)
{
var
allot
=
perallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在"
);
var
data
=
saveGather
.
Data
;
var
departments
=
perdeptdicRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
);
if
(
departments
==
null
||
!
departments
.
Any
())
throw
new
PerformanceException
(
"未配置科室字典"
);
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
())}
]"
);
var
employees
=
peremployeeRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
);
if
(
employees
==
null
||
!
employees
.
Any
())
throw
new
PerformanceException
(
"未配置人员字典"
);
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
())}
]"
);
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
())}
]"
);
var
departments
=
perdeptdicRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
);
if
(
departments
==
null
||
!
departments
.
Any
())
throw
new
PerformanceException
(
"未配置科室字典"
);
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allotId
);
if
(
sheets
!=
null
&&
sheets
.
Any
())
...
...
@@ -1592,34 +1539,142 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather)
if
(!
sheets
.
Select
(
t
=>
t
.
SheetName
).
Any
(
t
=>
t
.
Contains
(
saveGather
.
Source
)))
throw
new
PerformanceException
(
$"来源错误[
{
saveGather
.
Source
}
]"
);
}
var
accountingUnit
=
userRepository
.
GetEntity
(
t
=>
t
.
ID
==
saveGather
.
UserId
).
Login
;
if
(
accountingUnit
!=
"admin"
)
{
var
hasDept
=
perdeptdicRepository
.
GetEntities
(
d
=>
d
.
AccountingUnit
==
accountingUnit
).
Select
(
s
=>
s
.
HISDeptName
);
var
otherDept
=
data
.
Where
(
w
=>
!
hasDept
.
Contains
(
w
[
0
])
&&
!
string
.
IsNullOrEmpty
(
w
[
0
]));
if
(
otherDept
!=
null
&&
otherDept
.
Any
())
throw
new
PerformanceException
(
$"[
{
string
.
Join
(
","
,
otherDept
.
Select
(
t
=>
t
[
0
]).
Distinct
())}
]科室不属于[
{
accountingUnit
}
]核算单元,[
{
accountingUnit
}
]核算单元有[
{
string
.
Join
(
","
,
hasDept
)}
]科室"
);
var
accountingUnit
=
userRepository
.
GetEntity
(
t
=>
t
.
ID
==
saveGather
.
UserId
);
if
(
accountingUnit
==
null
)
throw
new
PerformanceException
(
$"核算单元不存在"
);
var
depts
=
new
List
<
string
>();
for
(
int
i
=
0
;
i
<
saveGather
.
Data
.
Length
;
i
++)
{
depts
.
Add
(
saveGather
.
Data
[
i
][
0
]);
}
var
dict
=
new
Dictionary
<
string
,
string
>();
Gather
.
ToList
().
ForEach
(
t
=>
dict
.
Add
(
t
.
Key
,
t
.
Value
));
}
var
dicData
=
CreateDataRow
(
0
,
allotId
,
saveGather
,
dict
);
if
(
dicData
==
null
||
dicData
.
Count
==
0
)
return
new
ApiResponse
(
ResponseType
.
Error
,
"空数据,无效操作"
);
var
jsons
=
JsonHelper
.
Serialize
(
dicData
);
var
newGather
=
JsonHelper
.
Deserialize
<
List
<
ex_result_gather
>>(
jsons
);
var
oldGather
=
exresultgatherRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
&&
t
.
Source
==
saveGather
.
Source
&&
t
.
Category
==
saveGather
.
Category
&&
depts
.
Distinct
().
Contains
(
t
.
Department
));
var
perdeptdic
=
perdeptdicRepository
.
GetEntities
(
d
=>
d
.
AccountingUnit
==
accountingUnit
.
Department
);
var
hasDepartment
=
perdeptdic
.
Select
(
s
=>
s
.
Department
).
Union
(
perdeptdic
.
Select
(
s
=>
s
.
HISDeptName
));
List
<
Dictionary
<
string
,
string
>>
error
=
new
List
<
Dictionary
<
string
,
string
>>();
for
(
int
i
=
0
;
i
<
newGather
.
Count
;
i
++)
{
if
(
string
.
IsNullOrEmpty
(
newGather
[
i
].
Department
)
||
string
.
IsNullOrEmpty
(
newGather
[
i
].
PersonnelNumber
)
||
string
.
IsNullOrEmpty
(
newGather
[
i
].
DoctorName
)
)
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
"关键信息缺失”请补全或删除"
},
});
var
ExistsDeptData
=
departments
.
FirstOrDefault
(
w
=>
w
.
AllotId
==
allotId
&&
(
w
.
Department
.
Contains
(
newGather
[
i
].
Department
)
||
w
.
HISDeptName
.
Contains
(
newGather
[
i
].
Department
)));
if
(
ExistsDeptData
==
null
)
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
$"科室字典中不存在科室[
{
newGather
[
i
].
Department
}
]"
},
});
var
ExistNameData
=
employees
.
FirstOrDefault
(
w
=>
w
.
AllotId
==
allotId
&&
w
.
DoctorName
==
newGather
[
i
].
DoctorName
);
if
(
ExistNameData
==
null
)
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
$"人员字典中不存在医生姓名[
{
newGather
[
i
].
DoctorName
}
]"
},
});
var
ExistNumberData
=
employees
.
FirstOrDefault
(
w
=>
w
.
AllotId
==
allotId
&&
w
.
PersonnelNumber
==
newGather
[
i
].
PersonnelNumber
);
if
(
ExistNumberData
==
null
)
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
$"人员字典中不存在工号[
{
newGather
[
i
].
PersonnelNumber
}
]"
},
});
if
((
ExistNumberData
==
null
||
ExistNumberData
.
DoctorName
!=
newGather
[
i
].
DoctorName
)
||
(
ExistNameData
==
null
||
ExistNameData
.
PersonnelNumber
!=
newGather
[
i
].
PersonnelNumber
))
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
$"该人员姓名和工号与人员字典中不匹配"
},
});
if
(
accountingUnit
.
Login
!=
"admin"
)
{
if
(!
hasDepartment
.
Contains
(
newGather
[
i
].
Department
))
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
i
+
1
}
行"
},
{
"科室"
,
newGather
[
i
].
Department
??
""
},
{
"医生姓名"
,
newGather
[
i
].
DoctorName
??
""
},
{
"人员工号"
,
newGather
[
i
].
PersonnelNumber
??
""
},
{
"数值"
,
newGather
[
i
].
Fee
.
ToString
()
},
{
"来源"
,
"粘贴数据"
},
{
"错误原因"
,
$"[
{
newGather
[
i
].
Department
}
]科室不属于[
{
accountingUnit
.
Department
}
]核算单元,[
{
accountingUnit
.
Department
}
]核算单元有【
{
string
.
Join
(
"】【"
,
hasDepartment
)}
】科室"
},
});
}
}
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
//private static void SetDataStatesAndRemark(IEnumerable<ex_result_gather> data, int states, string remark, Func<ex_result_gather, string> func = null)
//{
// if (new int[] { 1, 2 }.Contains(states)) return;
newGather
.
ForEach
(
t
=>
{
t
.
AllotId
=
allotId
;
t
.
States
=
0
;
t
.
Source
=
saveGather
.
Source
;
t
.
Category
=
saveGather
.
Category
;
t
.
Submitter
=
saveGather
.
UserId
;
t
.
CreateTime
=
DateTime
.
Now
;
});
// if (data == null || !data.Any()) return;
exresultgatherRepository
.
RemoveRange
(
oldGather
.
ToArray
());
if
(
newGather
!=
null
&&
newGather
.
Any
())
exresultgatherRepository
.
AddRange
(
newGather
.
ToArray
());
// foreach (var item in data)
// {
// if (func != null)
// remark = string.Format(remark, func.Invoke(item));
AddCategoryToConfig
(
allotId
);
// //item.States = states;
// item.Remark = (!string.IsNullOrEmpty(item.Remark) && item.Remark.Length > 0) ? item.Remark + ", " + remark : remark;
// }
//}
return
new
ApiResponse
(
ResponseType
.
OK
,
""
);
}
public
void
AddCategoryToConfig
(
int
allotId
)
{
...
...
@@ -1704,7 +1759,7 @@ public void SyncDataToResult(int allotId)
exresultRepository
.
AddRange
(
syncData
.
ToArray
());
}
public
void
a
uditGather
(
List
<
Gather
>
gather
)
public
void
A
uditGather
(
List
<
Gather
>
gather
)
{
List
<
ex_result_gather
>
ex_Result_Gathers
=
new
List
<
ex_result_gather
>();
...
...
@@ -1739,19 +1794,17 @@ public void auditGather(List<Gather> gather)
datas
.
ForEach
(
d
=>
{
d
.
AuditTime
=
DateTime
.
Now
;
d
.
States
=
(
int
)
AuditGather
.
已通过
;
d
.
States
=
(
int
)
AuditGather
Enum
.
已通过
;
});
else
if
(
gatherFirst
.
Status
==
"失败"
)
datas
.
ForEach
(
d
=>
{
d
.
AuditTime
=
DateTime
.
Now
;
d
.
States
=
(
int
)
AuditGather
.
未通过
;
d
.
States
=
(
int
)
AuditGather
Enum
.
未通过
;
d
.
Remark
=
gatherFirst
.
Remark
;
});
exresultgatherRepository
.
UpdateRange
(
datas
.
ToArray
());
}
#
endregion
}
public
class
ComparisonConfig
...
...
@@ -1782,5 +1835,6 @@ public class ComparisonConfig
new
Heads
{
Column
=
"实发不一致"
,
Name
=
"Count"
},
new
Heads
{
Column
=
"总额"
,
Name
=
"SumFee"
},
};
}
}
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