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
dbed92f6
Commit
dbed92f6
authored
Sep 29, 2021
by
钟博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop0926' into develop
parents
df352a43
588aaec0
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
752 additions
and
154 deletions
+752
-154
performance/Performance.Api/Controllers/CollectController.cs
+69
-1
performance/Performance.Api/Job/JobRegistry.cs
+1
-1
performance/Performance.Api/wwwroot/Performance.Api.xml
+25
-0
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+5
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+20
-0
performance/Performance.DtoModels/HandsonTable.cs
+13
-6
performance/Performance.DtoModels/Request/CollectAuditRequest.cs
+14
-0
performance/Performance.EntityModels/Entity/collect_data.cs
+21
-0
performance/Performance.Services/CollectService.cs
+572
-145
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+1
-1
performance/Performance.Services/ExtractExcelService/SheetDataWrite/SpecialUnitDataWrite.cs
+11
-0
No files found.
performance/Performance.Api/Controllers/CollectController.cs
View file @
dbed92f6
...
@@ -109,10 +109,78 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque
...
@@ -109,10 +109,78 @@ public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData reque
{
{
if
(
allotId
<=
0
)
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
collectService
.
SaveCollectData
(
allotId
,
request
);
collectService
.
SaveCollectData
(
allotId
,
request
,
claim
.
GetUserId
());
return
new
ApiResponse
(
ResponseType
.
OK
);
}
/// <summary>
/// 提交采集信息
/// </summary>
[
HttpPost
]
[
Route
(
"submitcollectdata/{allotId}"
)]
public
ApiResponse
SubmitCollectData
(
int
allotId
,
[
FromBody
]
SaveCollectData
request
)
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
collectService
.
SaveCollectData
(
allotId
,
request
,
claim
.
GetUserId
(),
2
);
return
new
ApiResponse
(
ResponseType
.
OK
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
/// <summary>
/// 数据录入显示列表
/// </summary>
[
HttpPost
]
[
Route
(
"collectdatalist/{hospitalId}"
)]
public
ApiResponse
CollectDataList
(
int
hospitalId
)
{
if
(
hospitalId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
var
data
=
collectService
.
CollectDataList
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
/// <summary>
/// 核算办显示列表
/// </summary>
[
HttpPost
]
[
Route
(
"performanceforlist/{allotId}"
)]
public
ApiResponse
PerformanceforList
(
int
allotId
)
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
var
data
=
collectService
.
PerformanceforList
(
allotId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
/// <summary>
/// 科室显示列表
/// </summary>
[
HttpPost
]
[
Route
(
"departmentlist/{allotId}"
)]
public
ApiResponse
DepartmentList
(
int
allotId
,
[
FromQuery
]
int
userId
)
{
if
(
allotId
<=
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
var
data
=
collectService
.
DepartmentList
(
allotId
,
userId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
}
/// <summary>
/// 提交数据审核
/// </summary>
[
HttpPost
]
[
Route
(
"collectdataaudit"
)]
public
ApiResponse
CollectDataAudit
([
FromBody
]
CollectAuditRequest
request
)
{
if
(
request
==
null
||
request
.
AllotId
<=
0
||
request
.
UserId
<=
0
||
!
new
int
[]
{
3
,
4
}.
Contains
(
request
.
Status
))
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数无效"
);
var
result
=
collectService
.
CollectDataAudit
(
request
.
AllotId
,
request
.
UserId
,
request
.
Status
);
string
remark
=
request
.
Status
==
3
?
"审核通过"
:
"驳回成功"
;
return
result
?
new
ApiResponse
(
ResponseType
.
OK
,
remark
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"操作失败"
);
}
}
}
}
performance/Performance.Api/Job/JobRegistry.cs
View file @
dbed92f6
...
@@ -8,7 +8,7 @@ public JobRegistry()
...
@@ -8,7 +8,7 @@ public JobRegistry()
{
{
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
Schedule
<
ExtractGenerateJob
>().
ToRunEvery
(
1
).
Days
().
At
(
14
,
00
);
Schedule
<
ExtractGenerateJob
>().
ToRunEvery
(
1
).
Days
().
At
(
23
,
00
);
}
}
}
}
}
}
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
dbed92f6
...
@@ -403,6 +403,31 @@
...
@@ -403,6 +403,31 @@
保存采集内容
保存采集内容
</summary>
</summary>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.CollectController.SubmitCollectData(System.Int32,Performance.DtoModels.SaveCollectData)"
>
<summary>
提交采集信息
</summary>
</member>
<member
name=
"M:Performance.Api.Controllers.CollectController.CollectDataList(System.Int32)"
>
<summary>
数据录入显示列表
</summary>
</member>
<member
name=
"M:Performance.Api.Controllers.CollectController.PerformanceforList(System.Int32)"
>
<summary>
核算办显示列表
</summary>
</member>
<member
name=
"M:Performance.Api.Controllers.CollectController.DepartmentList(System.Int32,System.Int32)"
>
<summary>
科室显示列表
</summary>
</member>
<member
name=
"M:Performance.Api.Controllers.CollectController.CollectDataAudit(Performance.DtoModels.CollectAuditRequest)"
>
<summary>
提交数据审核
</summary>
</member>
<member
name=
"M:Performance.Api.Controllers.ComputeController.GetCompute(Performance.DtoModels.ComputerRequest)"
>
<member
name=
"M:Performance.Api.Controllers.ComputeController.GetCompute(Performance.DtoModels.ComputerRequest)"
>
<summary>
<summary>
获取绩效发放列表
获取绩效发放列表
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
dbed92f6
...
@@ -1993,6 +1993,11 @@
...
@@ -1993,6 +1993,11 @@
参数值
参数值
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.CollectAuditRequest.Status"
>
<summary>
3 审核通过 4 驳回
</summary>
</member>
<member
name=
"P:Performance.DtoModels.ComputerRequest.ComputeId"
>
<member
name=
"P:Performance.DtoModels.ComputerRequest.ComputeId"
>
<summary>
<summary>
绩效数据id
绩效数据id
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
dbed92f6
...
@@ -2275,6 +2275,26 @@
...
@@ -2275,6 +2275,26 @@
单元格value
单元格value
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.collect_data.Status"
>
<summary>
1 保存 2 提交(等待审核) 3 审核通过 4 驳回
</summary>
</member>
<member
name=
"P:Performance.EntityModels.collect_data.SavedUser"
>
<summary>
保存数据的用户
</summary>
</member>
<member
name=
"P:Performance.EntityModels.collect_data.SavedTime"
>
<summary>
保存数据的时间
</summary>
</member>
<member
name=
"P:Performance.EntityModels.collect_data.SubmitUser"
>
<summary>
提交数据的用户
</summary>
</member>
<member
name=
"T:Performance.EntityModels.collect_permission"
>
<member
name=
"T:Performance.EntityModels.collect_permission"
>
<summary>
<summary>
...
...
performance/Performance.DtoModels/HandsonTable.cs
View file @
dbed92f6
...
@@ -26,6 +26,8 @@ public class HandsonTable : HandsonTableBase
...
@@ -26,6 +26,8 @@ public class HandsonTable : HandsonTableBase
{
{
private
IEnumerable
<
collect_permission
>
_permissions
;
private
IEnumerable
<
collect_permission
>
_permissions
;
public
bool
ReadOnly
{
get
;
set
;
}
=
false
;
public
HandsonTable
(
int
sheetType
,
string
[]
cols
,
List
<
collect_permission
>
permissions
)
public
HandsonTable
(
int
sheetType
,
string
[]
cols
,
List
<
collect_permission
>
permissions
)
:
base
()
:
base
()
{
{
...
@@ -48,11 +50,11 @@ public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein)
...
@@ -48,11 +50,11 @@ public void SetRowData(IEnumerable<HandsonRowData> datas, bool isTypein)
var
dic
=
CreateDataRow
(
"编号"
,
dt
.
Row
.
ToString
());
var
dic
=
CreateDataRow
(
"编号"
,
dt
.
Row
.
ToString
());
foreach
(
var
item
in
dt
.
CellData
)
foreach
(
var
item
in
dt
.
CellData
)
{
{
if
(
dic
.
ContainsKey
(
item
.
Name
.
ToLower
())
&&
isTypein
&&
_permissions
.
Any
(
w
=>
w
.
HeadName
.
ToLower
()
==
item
.
Name
.
ToLower
()))
//
if (dic.ContainsKey(item.Name.ToLower()) && isTypein && _permissions.Any(w => w.HeadName.ToLower() == item.Name.ToLower()))
dic
[
item
.
Name
.
ToLower
()]
=
item
.
Value
?.
ToString
()
??
""
;
//
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
else
if
(
dic
.
ContainsKey
(
item
.
Name
.
ToLower
())
&&
_permissions
.
Any
(
w
=>
w
.
HeadName
.
ToLower
()
==
item
.
Name
.
ToLower
()
&&
w
.
AttachLast
>
0
))
//
else if (dic.ContainsKey(item.Name.ToLower()) && _permissions.Any(w => w.HeadName.ToLower() == item.Name.ToLower() && w.AttachLast > 0))
dic
[
item
.
Name
.
ToLower
()]
=
item
.
Value
?.
ToString
()
??
""
;
//
dic[item.Name.ToLower()] = item.Value?.ToString() ?? "";
else
if
(
dic
.
ContainsKey
(
item
.
Name
.
ToLower
())
&&
_permissions
.
Any
(
w
=>
w
.
HeadName
.
ToLower
()
==
item
.
Name
.
ToLower
()))
//
else if (dic.ContainsKey(item.Name.ToLower()) && _permissions.Any(w => w.HeadName.ToLower() == item.Name.ToLower()))
dic
[
item
.
Name
.
ToLower
()]
=
item
.
Value
?.
ToString
()
??
""
;
dic
[
item
.
Name
.
ToLower
()]
=
item
.
Value
?.
ToString
()
??
""
;
}
}
Data
.
Add
(
dic
);
Data
.
Add
(
dic
);
...
@@ -66,6 +68,7 @@ private void InitColHeaders(int sheetType, string[] cols)
...
@@ -66,6 +68,7 @@ private void InitColHeaders(int sheetType, string[] cols)
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
OtherIncome
,
Necessity
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
OtherIncome
,
Necessity
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
Expend
,
Necessity
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
Expend
,
Necessity
=
new
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
Workload
,
Necessity
=
new
[]
{
"核算单元"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
Workload
,
Necessity
=
new
[]
{
"核算单元"
,
"科室名称"
}
},
new
DefalutHandsonHeader
{
SheetType
=
SheetType
.
SpecialUnit
,
Necessity
=
new
[]
{
"科室名称"
}
},
//new DefalutHandsonHeader{ SheetType = SheetType.AccountExtra, Necessity = new[] { "核算单元","科室名称" } },
//new DefalutHandsonHeader{ SheetType = SheetType.AccountExtra, Necessity = new[] { "核算单元","科室名称" } },
//new DefalutHandsonHeader{ SheetType = SheetType.PersonExtra, Necessity = new[] { "核算单元","科室名称" } },
//new DefalutHandsonHeader{ SheetType = SheetType.PersonExtra, Necessity = new[] { "核算单元","科室名称" } },
};
};
...
@@ -85,12 +88,16 @@ private void InitColHeaders(int sheetType, string[] cols)
...
@@ -85,12 +88,16 @@ private void InitColHeaders(int sheetType, string[] cols)
private
void
InitColumns
(
List
<
collect_permission
>
permissions
)
private
void
InitColumns
(
List
<
collect_permission
>
permissions
)
{
{
var
defaults
=
new
List
<
string
>
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"核算单元"
,
"科室名称"
};
List
<
HandsonColumn
>
columns
=
new
List
<
HandsonColumn
>();
List
<
HandsonColumn
>
columns
=
new
List
<
HandsonColumn
>();
foreach
(
var
col
in
ColHeaders
)
foreach
(
var
col
in
ColHeaders
)
{
{
var
item
=
col
.
ToLower
();
var
item
=
col
.
ToLower
();
var
readnoly
=
_permissions
.
FirstOrDefault
(
f
=>
f
.
HeadName
==
item
)?.
Readnoly
==
1
;
var
readnoly
=
_permissions
.
FirstOrDefault
(
f
=>
f
.
HeadName
==
item
)?.
Readnoly
==
1
;
columns
.
Add
(
new
HandsonColumn
(
item
.
ToLower
(),
readnoly
));
DataFormat
format
=
defaults
.
Contains
(
col
)
?
DataFormat
.
普通格式
:
DataFormat
.
小数
;
columns
.
Add
(
new
HandsonColumn
(
item
.
ToLower
(),
readnoly
,
format
));
}
}
Columns
=
columns
;
Columns
=
columns
;
}
}
...
...
performance/Performance.DtoModels/Request/CollectAuditRequest.cs
0 → 100644
View file @
dbed92f6
namespace
Performance.DtoModels
{
public
class
CollectAuditRequest
{
public
int
AllotId
{
get
;
set
;
}
public
int
UserId
{
get
;
set
;
}
/// <summary>
/// 3 审核通过 4 驳回
/// </summary>
public
int
Status
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/collect_data.cs
View file @
dbed92f6
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
// * FileName: .cs
// * FileName: .cs
// </copyright>
// </copyright>
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
using
System.ComponentModel.DataAnnotations.Schema
;
...
@@ -79,5 +80,25 @@ public class collect_data
...
@@ -79,5 +80,25 @@ public class collect_data
/// 单元格value
/// 单元格value
/// </summary>
/// </summary>
public
string
CellValue
{
get
;
set
;
}
public
string
CellValue
{
get
;
set
;
}
/// <summary>
/// 1 保存 2 提交(等待审核) 3 审核通过 4 驳回
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 保存数据的用户
/// </summary>
public
int
SavedUser
{
get
;
set
;
}
/// <summary>
/// 保存数据的时间
/// </summary>
public
Nullable
<
DateTime
>
SavedTime
{
get
;
set
;
}
/// <summary>
/// 提交数据的用户
/// </summary>
public
Nullable
<
int
>
SubmitUser
{
get
;
set
;
}
}
}
}
}
performance/Performance.Services/CollectService.cs
View file @
dbed92f6
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
using
System.Text
;
using
System.Text
;
using
Google.Protobuf.WellKnownTypes
;
using
Google.Protobuf.WellKnownTypes
;
using
HandsonRowData
=
Performance
.
DtoModels
.
HandsonRowData
;
using
HandsonRowData
=
Performance
.
DtoModels
.
HandsonRowData
;
using
Performance.Services.ExtractExcelService
;
namespace
Performance.Services
namespace
Performance.Services
{
{
...
@@ -31,6 +32,9 @@ public class CollectService : IAutoInjection
...
@@ -31,6 +32,9 @@ public class CollectService : IAutoInjection
private
readonly
PerforUserroleRepository
userroleRepository
;
private
readonly
PerforUserroleRepository
userroleRepository
;
private
readonly
PerforImaccountbasicRepository
perforImaccountbasicRepository
;
private
readonly
PerforImaccountbasicRepository
perforImaccountbasicRepository
;
private
readonly
PerforPerdeptdicRepository
perforPerdeptdicRepository
;
private
readonly
PerforPerdeptdicRepository
perforPerdeptdicRepository
;
private
readonly
PerforExmoduleRepository
exmoduleRepository
;
private
readonly
PerforExitemRepository
exitemRepository
;
private
readonly
PerforExspecialRepository
exspecialRepository
;
private
readonly
SheetSevice
sheetSevice
;
private
readonly
SheetSevice
sheetSevice
;
private
readonly
Application
options
;
private
readonly
Application
options
;
...
@@ -48,6 +52,9 @@ public class CollectService : IAutoInjection
...
@@ -48,6 +52,9 @@ public class CollectService : IAutoInjection
PerforUserroleRepository
userroleRepository
,
PerforUserroleRepository
userroleRepository
,
PerforImaccountbasicRepository
perforImaccountbasicRepository
,
PerforImaccountbasicRepository
perforImaccountbasicRepository
,
PerforPerdeptdicRepository
perforPerdeptdicRepository
,
PerforPerdeptdicRepository
perforPerdeptdicRepository
,
PerforExmoduleRepository
exmoduleRepository
,
PerforExitemRepository
exitemRepository
,
PerforExspecialRepository
exspecialRepository
,
SheetSevice
sheetSevice
,
SheetSevice
sheetSevice
,
IOptions
<
Application
>
options
)
IOptions
<
Application
>
options
)
{
{
...
@@ -64,6 +71,9 @@ public class CollectService : IAutoInjection
...
@@ -64,6 +71,9 @@ public class CollectService : IAutoInjection
this
.
userroleRepository
=
userroleRepository
;
this
.
userroleRepository
=
userroleRepository
;
this
.
perforImaccountbasicRepository
=
perforImaccountbasicRepository
;
this
.
perforImaccountbasicRepository
=
perforImaccountbasicRepository
;
this
.
perforPerdeptdicRepository
=
perforPerdeptdicRepository
;
this
.
perforPerdeptdicRepository
=
perforPerdeptdicRepository
;
this
.
exmoduleRepository
=
exmoduleRepository
;
this
.
exitemRepository
=
exitemRepository
;
this
.
exspecialRepository
=
exspecialRepository
;
this
.
sheetSevice
=
sheetSevice
;
this
.
sheetSevice
=
sheetSevice
;
this
.
options
=
options
.
Value
;
this
.
options
=
options
.
Value
;
}
}
...
@@ -87,42 +97,53 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
...
@@ -87,42 +97,53 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
var
allot
=
allotList
.
First
();
var
allot
=
allotList
.
First
();
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
,
(
int
)
SheetType
.
AccountScoreAverage
,
(
int
)
SheetType
.
BudgetRatio
,
(
int
)
SheetType
.
AssessBeforeOtherFee
};
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
var
sheets
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
types
.
Contains
(
w
.
SheetType
??
0
));
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
);
var
specials
=
exspecialRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
);
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
);
if
((
sheets
==
null
||
!
sheets
.
Any
())
&&
(
specials
==
null
||
!
specials
.
Any
()))
if
(
sheets
==
null
||
!
sheets
.
Any
())
return
null
;
return
null
;
if
(
headers
==
null
||
!
headers
.
Any
())
var
headers
=
exitemRepository
.
GetEntities
(
w
=>
sheets
.
Select
(
m
=>
m
.
Id
).
Contains
(
w
.
ModuleId
??
0
))
??
new
List
<
ex_item
>();
if
((
headers
==
null
||
!
headers
.
Any
())
&&
(
specials
==
null
||
!
specials
.
Any
()))
return
null
;
return
null
;
if
(
specials
!=
null
&&
specials
.
Any
())
{
sheets
.
Add
(
new
ex_module
{
HospitalId
=
allot
.
HospitalId
,
SheetType
=
(
int
)
SheetType
.
SpecialUnit
,
ModuleName
=
"4.2 特殊核算单元绩效测算表"
,
Id
=
0
,
});
headers
.
AddRange
(
specials
.
Select
(
t
=>
new
ex_item
{
ItemName
=
t
.
Target
,
ModuleId
=
0
}));
}
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
);
// 查询sheet和列头对应
// 查询sheet和列头对应
var
sheetHeads
=
from
sheet
in
sheets
var
sheetHeads
=
from
sheet
in
sheets
join
head
in
headers
on
sheet
.
I
D
equals
head
.
SheetID
join
head
in
headers
on
sheet
.
I
d
equals
head
.
ModuleId
select
new
{
sheet
.
SheetName
,
sheet
.
SheetType
,
HeadName
=
head
.
CellValu
e
};
select
new
{
sheet
.
ModuleName
,
sheet
.
SheetType
,
HeadName
=
head
.
ItemNam
e
};
List
<
CollectPermission
>
result
;
List
<
CollectPermission
>
result
;
// 查询列头和权限对应
// 查询列头和权限对应
if
(
permissions
==
null
)
if
(
permissions
==
null
)
{
{
result
=
sheetHeads
.
Select
(
sh
=>
new
CollectPermission
{
HospitalId
=
hospitalId
,
SheetName
=
sh
.
Sheet
Name
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
})?.
ToList
();
result
=
sheetHeads
.
Select
(
sh
=>
new
CollectPermission
{
HospitalId
=
hospitalId
,
SheetName
=
sh
.
Module
Name
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
})?.
ToList
();
}
}
else
else
{
{
result
=
(
from
sh
in
sheetHeads
result
=
(
from
sh
in
sheetHeads
join
pmss
in
permissions
on
new
{
sh
.
Sheet
Name
,
sh
.
HeadName
}
equals
new
{
pmss
.
SheetName
,
pmss
.
HeadName
}
join
pmss
in
permissions
on
new
{
SheetName
=
sh
.
Module
Name
,
sh
.
HeadName
}
equals
new
{
pmss
.
SheetName
,
pmss
.
HeadName
}
into
emppmss
into
emppmss
from
item
in
emppmss
.
DefaultIfEmpty
()
from
item
in
emppmss
.
DefaultIfEmpty
()
select
new
CollectPermission
select
new
CollectPermission
{
{
HospitalId
=
hospitalId
,
HospitalId
=
hospitalId
,
SheetName
=
sh
.
Sheet
Name
,
SheetName
=
sh
.
Module
Name
,
SheetType
=
sh
.
SheetType
.
Value
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
,
HeadName
=
sh
.
HeadName
,
PermissionId
=
item
?.
Id
,
PermissionId
=
item
?.
Id
,
...
@@ -155,32 +176,41 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
...
@@ -155,32 +176,41 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
var
user
=
userRepository
.
GetEntity
(
w
=>
w
.
ID
==
userid
);
var
user
=
userRepository
.
GetEntity
(
w
=>
w
.
ID
==
userid
);
if
(
user
==
null
)
if
(
user
==
null
)
throw
new
PerformanceException
(
"参数无效"
);
throw
new
PerformanceException
(
"参数无效"
);
// 删除
var
data3
=
collects
.
Where
(
w
=>
w
.
PermissionId
.
HasValue
&&
0
==
w
.
Visible
&&
0
==
w
.
AttachLast
&&
0
==
w
.
Readnoly
);
if
(
data3
!=
null
)
{
var
ids
=
data3
.
Select
(
t
=>
t
.
PermissionId
).
ToList
();
var
deletes
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
ids
.
Contains
(
w
.
Id
));
if
(
deletes
!=
null
)
perforcollectpermissionRepository
.
RemoveRange
(
deletes
.
ToArray
());
}
// 修改
//// 删除
var
data1
=
collects
.
Where
(
w
=>
w
.
PermissionId
.
HasValue
&&
(
w
.
Visible
>
0
||
w
.
AttachLast
>
0
||
w
.
Readnoly
>
0
));
//var data3 = collects.Where(w => w.PermissionId.HasValue && 0 == w.Visible && 0 == w.AttachLast && 0 == w.Readnoly);
if
(
data1
!=
null
)
//if (data3 != null)
{
//{
var
ids
=
data1
.
Select
(
t
=>
t
.
PermissionId
).
ToList
();
// var ids = data3.Select(t => t.PermissionId).ToList();
var
updates
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
ids
.
Contains
(
w
.
Id
));
// var deletes = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id));
if
(
updates
!=
null
)
// if (deletes != null)
{
// perforcollectpermissionRepository.RemoveRange(deletes.ToArray());
foreach
(
var
item
in
updates
)
//}
//// 修改
//var data1 = collects.Where(w => w.PermissionId.HasValue && (w.Visible > 0 || w.AttachLast > 0 || w.Readnoly > 0));
//if (data1 != null)
//{
// var ids = data1.Select(t => t.PermissionId).ToList();
// var updates = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id));
// if (updates != null)
// {
// foreach (var item in updates)
// {
// item.AttachLast = data1.FirstOrDefault(w => w.PermissionId == item.Id).AttachLast;
// item.Readnoly = data1.FirstOrDefault(w => w.PermissionId == item.Id).Readnoly;
// item.Visible = data1.FirstOrDefault(w => w.PermissionId == item.Id).Visible;
// }
// perforcollectpermissionRepository.UpdateRange(updates.ToArray());
// }
//}
var
hospitalid
=
collects
?.
FirstOrDefault
(
w
=>
w
.
HospitalId
>
0
)?.
HospitalId
;
if
(
hospitalid
.
HasValue
)
{
{
item
.
AttachLast
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
AttachLast
;
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalid
.
Value
&&
t
.
UserId
==
userid
);
item
.
Readnoly
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
Readnoly
;
if
(
permissions
!=
null
&&
permissions
.
Any
())
item
.
Visible
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
Visible
;
perforcollectpermissionRepository
.
RemoveRange
(
permissions
.
ToArray
());
}
perforcollectpermissionRepository
.
UpdateRange
(
updates
.
ToArray
());
}
}
}
// 新增
// 新增
...
@@ -188,7 +218,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
...
@@ -188,7 +218,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
var
children
=
userRepository
.
GetEntities
(
w
=>
w
.
ParentID
==
userid
);
var
children
=
userRepository
.
GetEntities
(
w
=>
w
.
ParentID
==
userid
);
if
(
children
!=
null
&&
children
.
Any
())
users
.
AddRange
(
children
);
if
(
children
!=
null
&&
children
.
Any
())
users
.
AddRange
(
children
);
var
data2
=
collects
.
Where
(
w
=>
!
w
.
PermissionId
.
HasValue
&&
(
w
.
Visible
>
0
||
w
.
AttachLast
>
0
||
w
.
Readnoly
>
0
)
);
var
data2
=
collects
.
Where
(
w
=>
w
.
Visible
>
0
);
foreach
(
var
item
in
users
)
foreach
(
var
item
in
users
)
{
{
var
inserts
=
data2
?.
Select
(
w
=>
new
collect_permission
var
inserts
=
data2
?.
Select
(
w
=>
new
collect_permission
...
@@ -216,7 +246,11 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
...
@@ -216,7 +246,11 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
if
(!
options
.
CollectRoles
.
Contains
(
userrole
.
RoleID
))
if
(!
options
.
CollectRoles
.
Contains
(
userrole
.
RoleID
))
{
{
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
var
sheetNames
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
types
.
Contains
(
w
.
SheetType
??
0
))?.
Select
(
t
=>
t
.
ModuleName
).
ToList
()
??
new
List
<
string
>();
sheetNames
.
Add
(
"4.2 特殊核算单元绩效测算表"
);
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
&&
sheetNames
.
Contains
(
w
.
SheetName
);
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
return
perforcollectpermissionRepository
.
GetEntities
(
exp
);
return
perforcollectpermissionRepository
.
GetEntities
(
exp
);
...
@@ -228,58 +262,66 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
...
@@ -228,58 +262,66 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
private
IEnumerable
<
collect_permission
>
GetCollectSheetByAllot
(
int
hospitalId
,
int
userId
,
string
sheetName
=
""
)
private
IEnumerable
<
collect_permission
>
GetCollectSheetByAllot
(
int
hospitalId
,
int
userId
,
string
sheetName
=
""
)
{
{
var
states
=
new
[]
{
(
int
)
AllotStates
.
Archive
,
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
GenerateAccomplish
};
//
var states = new[] { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed, (int)AllotStates.GenerateAccomplish };
var
allotList
=
perforPerallotRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
states
.
Contains
(
w
.
States
))
//
var allotList = perforPerallotRepository.GetEntities(w => w.HospitalId == hospitalId && states.Contains(w.States))
?.
OrderByDescending
(
w
=>
w
.
Year
).
ThenByDescending
(
w
=>
w
.
Month
).
ToList
();
//
?.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).ToList();
if
(
allotList
==
null
||
!
allotList
.
Any
())
//
if (allotList == null || !allotList.Any())
return
null
;
//
return null;
var
allot
=
allotList
.
First
();
//
var allot = allotList.First();
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
,
(
int
)
SheetType
.
AccountScoreAverage
,
(
int
)
SheetType
.
BudgetRatio
,
(
int
)
SheetType
.
AssessBeforeOtherFee
,(
int
)
SheetType
.
AccountBasic
};
var
sheets
=
perforPersheetRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
var
sheets
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
types
.
Contains
(
w
.
SheetType
??
0
))
??
new
List
<
ex_module
>();
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
);
var
headers
=
exitemRepository
.
GetEntities
(
w
=>
sheets
.
Select
(
t
=>
t
.
Id
).
Contains
(
w
.
ModuleId
??
0
))
??
new
List
<
ex_item
>();
var
specials
=
exspecialRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
{
{
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
sheets
=
sheets
.
Where
(
w
=>
w
.
Sheet
Name
==
sheetName
)?.
ToList
();
sheets
=
sheets
.
Where
(
w
=>
w
.
Module
Name
==
sheetName
)?.
ToList
();
}
}
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
exp
);
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
exp
);
// 查询列头和权限对应
if
(
permissions
==
null
)
{
if
(
sheets
==
null
||
!
sheets
.
Any
())
if
(
sheets
==
null
||
!
sheets
.
Any
())
return
null
;
return
null
;
if
(
headers
==
null
||
!
headers
.
Any
(
))
if
((
headers
==
null
||
!
headers
.
Any
())
&&
(
specials
==
null
||
!
specials
.
Any
()
))
return
null
;
return
null
;
if
(
specials
!=
null
&&
specials
.
Any
())
{
sheets
.
Add
(
new
ex_module
{
HospitalId
=
hospitalId
,
SheetType
=
(
int
)
SheetType
.
SpecialUnit
,
ModuleName
=
"4.2 特殊核算单元绩效测算表"
,
Id
=
0
,
});
headers
.
AddRange
(
specials
.
Select
(
t
=>
new
ex_item
{
ItemName
=
t
.
Target
,
ModuleId
=
0
}));
}
// 查询sheet和列头对应
// 查询sheet和列头对应
var
sheetHeads
=
from
sheet
in
sheets
var
sheetHeads
=
from
sheet
in
sheets
join
head
in
headers
on
sheet
.
ID
equals
head
.
SheetID
join
head
in
headers
on
sheet
.
Id
equals
head
.
ModuleId
select
new
{
sheet
.
SheetName
,
sheet
.
SheetType
,
HeadName
=
head
.
CellValu
e
};
select
new
{
sheet
.
ModuleName
,
sheet
.
SheetType
,
HeadName
=
head
.
ItemNam
e
};
var
result
=
sheetHeads
.
Select
(
sh
=>
new
collect_permission
{
HospitalId
=
hospitalId
,
SheetName
=
sh
.
Sheet
Name
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
,
AttachLast
=
0
,
Visible
=
1
})?.
ToList
();
var
result
=
sheetHeads
.
Select
(
sh
=>
new
collect_permission
{
HospitalId
=
hospitalId
,
SheetName
=
sh
.
Module
Name
,
SheetType
=
sh
.
SheetType
.
Value
,
HeadName
=
sh
.
HeadName
,
AttachLast
=
0
,
Visible
=
1
})?.
ToList
();
//
if (result != null && result.Any())
if
(
result
!=
null
&&
result
.
Any
())
//
{
{
// result.ForEach(w =>
foreach
(
var
item
in
result
)
//
{
{
// var criterion = retain.Any(r => r == w
.HeadName);
var
permission
=
permissions
?.
FirstOrDefault
(
t
=>
t
.
HospitalId
==
item
.
HospitalId
&&
t
.
SheetName
==
item
.
SheetName
&&
t
.
SheetType
==
item
.
SheetType
&&
t
.
HeadName
==
item
.
HeadName
);
// w.Readnoly = criterion ? 1 : w.Readnoly
;
if
(
permission
==
null
)
continue
;
// });
return
result
;
item
.
Visible
=
permission
.
Visible
;
//
}
}
}
}
return
permissions
;
return
result
;
}
}
#
region
加载采集内容
#
region
加载采集内容
...
@@ -312,46 +354,45 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
...
@@ -312,46 +354,45 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
if
(
allot
==
null
)
if
(
allot
==
null
)
throw
new
PerformanceException
(
"当前医院没有录入项"
);
throw
new
PerformanceException
(
"当前医院没有录入项"
);
var
types
=
new
[]
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
,
(
int
)
SheetType
.
AccountScoreAverage
,
(
int
)
SheetType
.
BudgetRatio
,
(
int
)
SheetType
.
AssessBeforeOtherFee
,(
int
)
SheetType
.
AccountBasic
};
var
sheet
=
perforPersheetRepository
var
sheet
=
new
ex_module
.
GetEntity
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
w
.
SheetName
==
sheetName
&&
types
.
Contains
((
w
.
SheetType
??
0
)));
{
HospitalId
=
allot
.
HospitalId
,
SheetType
=
(
int
)
SheetType
.
SpecialUnit
,
ModuleName
=
"4.2 特殊核算单元绩效测算表"
,
};
var
headers
=
new
List
<
ex_item
>();
if
(
sheetName
.
NoBlank
()
==
sheet
.
ModuleName
.
NoBlank
())
{
var
specials
=
exspecialRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
);
if
(
specials
==
null
||
!
specials
.
Any
())
throw
new
PerformanceException
(
"SHEET页没有有效列头"
);
headers
=
specials
.
Select
(
t
=>
new
ex_item
{
ItemName
=
t
.
Target
}).
ToList
();
}
else
{
sheet
=
exmoduleRepository
.
GetEntity
(
w
=>
w
.
HospitalId
==
allot
.
HospitalId
&&
w
.
ModuleName
.
NoBlank
()
==
sheetName
.
NoBlank
()
&&
types
.
Contains
(
w
.
SheetType
??
0
));
if
(
sheet
==
null
)
if
(
sheet
==
null
)
throw
new
PerformanceException
(
"找不到当前SHEET页信息"
);
throw
new
PerformanceException
(
"找不到当前SHEET页信息"
);
var
headers
=
perforImheaderRepository
.
GetEntities
(
w
=>
w
.
SheetID
==
sheet
.
ID
)?.
OrderBy
(
w
=>
w
.
PointCell
);
headers
=
exitemRepository
.
GetEntities
(
w
=>
w
.
ModuleId
==
sheet
.
Id
);
if
(
headers
==
null
||
!
headers
.
Any
())
if
(
headers
==
null
||
!
headers
.
Any
())
throw
new
PerformanceException
(
"SHEET页没有有效列头"
);
throw
new
PerformanceException
(
"SHEET页没有有效列头"
);
var
cols
=
headers
.
Select
(
w
=>
w
.
CellValue
).
ToArray
();
}
var
cols
=
headers
.
Select
(
w
=>
w
.
ItemName
).
ToArray
();
var
permissions
=
GetCollectSheet
(
allot
.
HospitalId
,
userId
,
sheetName
)?.
ToList
();
var
permissions
=
GetCollectSheet
(
allot
.
HospitalId
,
userId
,
sheetName
)?.
ToList
();
if
(
permissions
==
null
||
!
permissions
.
Any
())
if
(
permissions
==
null
||
!
permissions
.
Any
())
throw
new
PerformanceException
(
"用户没有权限编辑当前SHEET页"
);
throw
new
PerformanceException
(
"用户没有权限编辑当前SHEET页"
);
List
<
HandsonRowData
>
rowDatas
=
n
ull
;
List
<
HandsonRowData
>
rowDatas
=
n
ew
List
<
HandsonRowData
>()
;
var
collectdata
=
perforcollectdataRepository
.
GetEntities
(
w
=>
w
.
SheetName
==
sheet
.
Sheet
Name
&&
w
.
AllotID
==
allotId
);
var
collectdata
=
perforcollectdataRepository
.
GetEntities
(
w
=>
w
.
SheetName
==
sheet
.
Module
Name
&&
w
.
AllotID
==
allotId
);
if
(
collectdata
!=
null
)
if
(
collectdata
!=
null
)
{
{
Dictionary
<
string
,
string
>
config
=
null
;
Dictionary
<
string
,
string
>
config
=
CollectDataConfig
.
Default
;
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
Employee
)
config
=
CollectDataConfig
.
Employee
;
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
ClinicEmployee
)
config
=
CollectDataConfig
.
ClinicEmployee
;
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
LogisticsEmployee
)
config
=
CollectDataConfig
.
LogisticsEmployee
;
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
PersonExtra
)
config
=
CollectDataConfig
.
PersonExtra
;
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
AccountBasic
)
config
=
CollectDataConfig
.
AccountBasic
;
else
if
(
CollectDataConfig
.
AccountExrtaType
.
Contains
(
sheet
.
SheetType
.
Value
))
config
=
CollectDataConfig
.
AccountExtra
;
else
config
=
CollectDataConfig
.
Default
;
rowDatas
=
new
List
<
HandsonRowData
>();
foreach
(
var
rownumber
in
collectdata
.
Select
(
w
=>
w
.
RowNumber
).
Distinct
().
OrderBy
(
t
=>
t
))
foreach
(
var
rownumber
in
collectdata
.
Select
(
w
=>
w
.
RowNumber
).
Distinct
().
OrderBy
(
t
=>
t
))
{
{
var
first
=
collectdata
.
FirstOrDefault
(
w
=>
w
.
RowNumber
==
rownumber
);
var
first
=
collectdata
.
FirstOrDefault
(
w
=>
w
.
RowNumber
==
rownumber
);
...
@@ -369,38 +410,9 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
...
@@ -369,38 +410,9 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
rowDatas
.
Add
(
new
HandsonRowData
(
rownumber
,
cells
));
rowDatas
.
Add
(
new
HandsonRowData
(
rownumber
,
cells
));
}
}
}
}
else
{
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
Employee
)
rowDatas
=
GerEmployee
(
sheet
);
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
ClinicEmployee
)
rowDatas
=
GetClinicEmployee
(
sheet
);
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
LogisticsEmployee
)
rowDatas
=
GetLogisticsEmployee
(
sheet
);
else
if
(
sheet
.
SheetType
==
(
int
)
SheetType
.
AccountBasic
)
{
List
<
HandsonCellData
>
cells
=
new
List
<
HandsonCellData
>();
var
dept
=
perforPerdeptdicRepository
.
GetAccountBasicAccountingUnit
(
allot
.
HospitalId
);
rowDatas
=
GetAccountBasic
(
sheet
,
dept
,
cells
);
}
else
rowDatas
=
GetCommonData
(
sheet
);
}
//补全核算单元和类型
var
sTypes
=
new
[]
{
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
AccountDrugAssess
,
(
int
)
SheetType
.
AccountMaterialsAssess
};
var
sTypeName
=
new
[]
{
"6.1目标考核"
,
"6.6 科室预算比例"
};
if
(
sTypes
.
Contains
((
int
)
sheet
.
SheetType
)
||
sTypeName
.
Contains
(
sheet
.
SheetName
))
{
List
<
HandsonCellData
>
cells
=
new
List
<
HandsonCellData
>();
var
perSheet
=
perforPersheetRepository
.
GetEntity
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SheetName
==
"4.1 临床科室医护绩效测算表"
);
var
dept
=
perforPerdeptdicRepository
.
GetAccountBasicAccountingUnit
(
allot
.
HospitalId
);
GetAccountBasic
(
perSheet
,
dept
,
cells
);
UnitFit
(
rowDatas
,
cells
,
sheet
);
}
if
(
rowDatas
==
null
||
!
rowDatas
.
Any
())
if
(
rowDatas
==
null
||
!
rowDatas
.
Any
())
rowDatas
=
GetAccountExtra
(
allot
,
sheet
.
SheetType
.
Value
);
rowDatas
=
GetAccountExtra
(
allot
,
sheet
.
SheetType
.
Value
,
sheetName
);
rowDatas
?.
RemoveAll
(
t
=>
!
t
.
CellData
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
Value
?.
ToString
())));
rowDatas
?.
RemoveAll
(
t
=>
!
t
.
CellData
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
Value
?.
ToString
())));
if
(
rowDatas
!=
null
&&
rowDatas
.
Any
())
if
(
rowDatas
!=
null
&&
rowDatas
.
Any
())
...
@@ -408,6 +420,11 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
...
@@ -408,6 +420,11 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
HandsonTable
handson
=
new
HandsonTable
(
sheet
.
SheetType
.
Value
,
cols
,
permissions
);
HandsonTable
handson
=
new
HandsonTable
(
sheet
.
SheetType
.
Value
,
cols
,
permissions
);
handson
.
SetRowData
(
rowDatas
,
(
collectdata
!=
null
));
handson
.
SetRowData
(
rowDatas
,
(
collectdata
!=
null
));
if
(
collectdata
!=
null
&&
collectdata
.
Any
(
t
=>
new
int
[]
{
2
,
3
}.
Contains
(
t
.
Status
)))
{
handson
.
Columns
?.
ForEach
(
t
=>
t
.
ReadOnly
=
true
);
handson
.
ReadOnly
=
true
;
}
return
handson
;
return
handson
;
}
}
...
@@ -531,6 +548,113 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType)
...
@@ -531,6 +548,113 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType)
return
handsonRows
;
return
handsonRows
;
}
}
private
List
<
HandsonRowData
>
GetAccountExtra
(
per_allot
allot
,
int
sheetType
,
string
sheetName
)
{
List
<
HandsonRowData
>
handsonRows
=
new
List
<
HandsonRowData
>();
var
unitTypes
=
new
string
[]
{
UnitType
.
医生组
.
ToString
(),
UnitType
.
医技组
.
ToString
(),
UnitType
.
护理组
.
ToString
(),
UnitType
.
特殊核算组
.
ToString
()
};
var
departments
=
perforPerdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
unitTypes
.
Contains
(
t
.
UnitType
)
&&
!
string
.
IsNullOrEmpty
(
t
.
Department
)
&&
t
.
Department
.
Replace
(
"无"
,
""
).
Replace
(
"/"
,
""
).
Trim
()
!=
""
);
if
(
departments
==
null
||
!
departments
.
Any
())
return
handsonRows
;
var
data
=
departments
.
GroupBy
(
t
=>
t
.
Department
).
Select
(
t
=>
new
{
Department
=
t
.
Key
,
AccountingUnitDoctor
=
GetAccountingUnit
(
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"门诊"
&&
group
.
UnitType
==
UnitType
.
医生组
.
ToString
())?.
AccountingUnit
,
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"住院"
&&
group
.
UnitType
==
UnitType
.
医生组
.
ToString
())?.
AccountingUnit
),
AccountingUnitTechnician
=
GetAccountingUnit
(
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"门诊"
&&
group
.
UnitType
==
UnitType
.
医技组
.
ToString
())?.
AccountingUnit
,
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"住院"
&&
group
.
UnitType
==
UnitType
.
医技组
.
ToString
())?.
AccountingUnit
),
AccountingUnitNurse
=
GetAccountingUnit
(
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"门诊"
&&
group
.
UnitType
==
UnitType
.
护理组
.
ToString
())?.
AccountingUnit
,
t
.
FirstOrDefault
(
group
=>
group
.
Source
==
"住院"
&&
group
.
UnitType
==
UnitType
.
护理组
.
ToString
())?.
AccountingUnit
),
AccountingUnitSpecial
=
t
.
FirstOrDefault
(
group
=>
group
.
UnitType
==
UnitType
.
特殊核算组
.
ToString
())?.
Department
}).
OrderBy
(
t
=>
t
.
Department
).
ToList
();
int
rownumber
;
switch
(
sheetType
)
{
case
(
int
)
SheetType
.
OtherIncome
:
data
=
data
.
Where
(
t
=>
string
.
IsNullOrEmpty
(
t
.
AccountingUnitSpecial
))?.
ToList
();
if
(
data
!=
null
&&
data
.
Any
())
{
rownumber
=
0
;
foreach
(
var
item
in
data
)
{
List
<
HandsonCellData
>
handsonCells
=
new
List
<
HandsonCellData
>();
handsonCells
.
Add
(
new
HandsonCellData
(
"核算单元(医技组)"
,
item
.
AccountingUnitTechnician
));
handsonCells
.
Add
(
new
HandsonCellData
(
"核算单元(医生组)"
,
item
.
AccountingUnitDoctor
));
handsonCells
.
Add
(
new
HandsonCellData
(
"核算单元(护理组)"
,
item
.
AccountingUnitNurse
));
handsonCells
.
Add
(
new
HandsonCellData
(
"科室名称"
,
item
.
Department
));
handsonRows
.
Add
(
new
HandsonRowData
(
rownumber
,
handsonCells
));
rownumber
++;
}
}
break
;
case
(
int
)
SheetType
.
SpecialUnit
:
var
specials
=
data
.
Where
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
AccountingUnitSpecial
)).
Select
(
t
=>
t
.
AccountingUnitSpecial
);
if
(
specials
!=
null
&&
specials
.
Any
())
{
rownumber
=
0
;
foreach
(
var
item
in
specials
)
{
List
<
HandsonCellData
>
handsonCells
=
new
List
<
HandsonCellData
>();
handsonCells
.
Add
(
new
HandsonCellData
(
"科室名称"
,
item
));
handsonRows
.
Add
(
new
HandsonRowData
(
rownumber
,
handsonCells
));
rownumber
++;
}
}
break
;
case
int
type
when
type
==
(
int
)
SheetType
.
Workload
&&
sheetName
.
Contains
(
"医生"
):
data
=
data
.
Where
(
t
=>
string
.
IsNullOrEmpty
(
t
.
AccountingUnitSpecial
)
&&
(!
string
.
IsNullOrEmpty
(
t
.
AccountingUnitDoctor
)
||
!
string
.
IsNullOrEmpty
(
t
.
AccountingUnitTechnician
)))?.
ToList
();
if
(
data
!=
null
&&
data
.
Any
())
{
rownumber
=
0
;
foreach
(
var
item
in
data
)
{
List
<
HandsonCellData
>
handsonCells
=
new
List
<
HandsonCellData
>();
handsonCells
.
Add
(
new
HandsonCellData
(
"核算单元"
,
GetAccountingUnit
(
item
.
AccountingUnitDoctor
,
item
.
AccountingUnitTechnician
)));
handsonCells
.
Add
(
new
HandsonCellData
(
"科室名称"
,
item
.
Department
));
handsonRows
.
Add
(
new
HandsonRowData
(
rownumber
,
handsonCells
));
rownumber
++;
}
}
break
;
case
int
type
when
type
==
(
int
)
SheetType
.
Workload
&&
sheetName
.
Contains
(
"护理"
):
data
=
data
.
Where
(
t
=>
string
.
IsNullOrEmpty
(
t
.
AccountingUnitSpecial
)
&&
!
string
.
IsNullOrEmpty
(
t
.
AccountingUnitNurse
))?.
ToList
();
if
(
data
!=
null
&&
data
.
Any
())
{
rownumber
=
0
;
foreach
(
var
item
in
data
)
{
List
<
HandsonCellData
>
handsonCells
=
new
List
<
HandsonCellData
>();
handsonCells
.
Add
(
new
HandsonCellData
(
"核算单元"
,
item
.
AccountingUnitNurse
));
handsonCells
.
Add
(
new
HandsonCellData
(
"科室名称"
,
item
.
Department
));
handsonRows
.
Add
(
new
HandsonRowData
(
rownumber
,
handsonCells
));
rownumber
++;
}
}
break
;
}
return
handsonRows
;
}
private
string
GetAccountingUnit
(
params
string
[]
account
)
{
if
(
account
==
null
||
!
account
.
Any
())
return
""
;
return
account
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
?.
Trim
()));
}
private
HandsonRowData
CreateRowData
(
int
row
,
ColumnInfo
[]
columns
,
SortedDictionary
<
string
,
object
>
dic
)
private
HandsonRowData
CreateRowData
(
int
row
,
ColumnInfo
[]
columns
,
SortedDictionary
<
string
,
object
>
dic
)
{
{
var
setdata
=
from
cfg
in
columns
var
setdata
=
from
cfg
in
columns
...
@@ -615,12 +739,9 @@ private void GetUnitClassification(List<HandsonCellData> setdata, UnitType unitT
...
@@ -615,12 +739,9 @@ private void GetUnitClassification(List<HandsonCellData> setdata, UnitType unitT
#
endregion
加载采集内容
#
endregion
加载采集内容
public
void
SaveCollectData
(
int
allotId
,
SaveCollectData
request
)
public
void
SaveCollectData
(
int
allotId
,
SaveCollectData
request
,
int
userId
,
int
status
=
1
)
{
{
var
types
=
new
List
<
int
>
{
(
int
)
SheetType
.
Employee
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
var
types
=
new
List
<
int
>
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
(
int
)
SheetType
.
ClinicEmployee
,
(
int
)
SheetType
.
AccountExtra
,
(
int
)
SheetType
.
PersonExtra
,
(
int
)
SheetType
.
LogisticsEmployee
};
types
.
AddRange
(
CollectDataConfig
.
AccountExrtaType
);
if
(!
types
.
Contains
(
request
.
SheetType
))
if
(!
types
.
Contains
(
request
.
SheetType
))
throw
new
PerformanceException
(
"当前SHEET页信息错误"
);
throw
new
PerformanceException
(
"当前SHEET页信息错误"
);
...
@@ -631,20 +752,9 @@ public void SaveCollectData(int allotId, SaveCollectData request)
...
@@ -631,20 +752,9 @@ public void SaveCollectData(int allotId, SaveCollectData request)
if
(
request
.
Data
==
null
||
request
.
Data
.
Length
==
0
)
if
(
request
.
Data
==
null
||
request
.
Data
.
Length
==
0
)
throw
new
PerformanceException
(
"当前SHEET页列头信息错误"
);
throw
new
PerformanceException
(
"当前SHEET页列头信息错误"
);
Dictionary
<
string
,
string
>
config
=
null
;
Dictionary
<
string
,
string
>
config
=
CollectDataConfig
.
Default
;
if
(
request
.
SheetType
==
(
int
)
SheetType
.
Employee
)
config
=
CollectDataConfig
.
Employee
;
else
if
(
request
.
SheetType
==
(
int
)
SheetType
.
ClinicEmployee
)
config
=
CollectDataConfig
.
ClinicEmployee
;
else
if
(
request
.
SheetType
==
(
int
)
SheetType
.
LogisticsEmployee
)
config
=
CollectDataConfig
.
LogisticsEmployee
;
else
if
(
request
.
SheetType
==
(
int
)
SheetType
.
PersonExtra
)
config
=
CollectDataConfig
.
PersonExtra
;
else
if
(
CollectDataConfig
.
AccountExrtaType
.
Contains
(
request
.
SheetType
))
config
=
CollectDataConfig
.
AccountExtra
;
else
config
=
CollectDataConfig
.
Default
;
DateTime
date
=
DateTime
.
Now
;
var
dicData
=
CreateDataRow
(
allotId
,
request
,
config
);
var
dicData
=
CreateDataRow
(
allotId
,
request
,
config
);
List
<
collect_data
>
datas
=
new
List
<
collect_data
>();
List
<
collect_data
>
datas
=
new
List
<
collect_data
>();
foreach
(
var
item
in
dicData
)
foreach
(
var
item
in
dicData
)
...
@@ -655,8 +765,15 @@ public void SaveCollectData(int allotId, SaveCollectData request)
...
@@ -655,8 +765,15 @@ public void SaveCollectData(int allotId, SaveCollectData request)
||
!
string
.
IsNullOrEmpty
(
data
.
AccountingUnitNurse
)
||
!
string
.
IsNullOrEmpty
(
data
.
AccountingUnitNurse
)
||
!
string
.
IsNullOrEmpty
(
data
.
AccountingUnitDoctor
)
||
!
string
.
IsNullOrEmpty
(
data
.
AccountingUnitDoctor
)
||
!
string
.
IsNullOrEmpty
(
data
.
Department
))
||
!
string
.
IsNullOrEmpty
(
data
.
Department
))
{
data
.
Status
=
status
;
data
.
SavedUser
=
userId
;
data
.
SavedTime
=
date
;
if
(
status
==
2
)
data
.
SubmitUser
=
userId
;
datas
.
Add
(
data
);
datas
.
Add
(
data
);
}
}
}
perforcollectdataRepository
.
Execute
(
"delete from collect_data where allotid = @allotid and sheetname=@sheetname"
,
new
{
allotId
,
request
.
SheetName
});
perforcollectdataRepository
.
Execute
(
"delete from collect_data where allotid = @allotid and sheetname=@sheetname"
,
new
{
allotId
,
request
.
SheetName
});
perforcollectdataRepository
.
AddRange
(
datas
.
ToArray
());
perforcollectdataRepository
.
AddRange
(
datas
.
ToArray
());
}
}
...
@@ -699,6 +816,14 @@ public void SaveCollectData(int allotId, SaveCollectData request)
...
@@ -699,6 +816,14 @@ public void SaveCollectData(int allotId, SaveCollectData request)
for
(
int
c
=
0
;
c
<
request
.
ColHeaders
.
Length
;
c
++)
for
(
int
c
=
0
;
c
<
request
.
ColHeaders
.
Length
;
c
++)
{
{
var
header
=
request
.
ColHeaders
[
c
];
var
header
=
request
.
ColHeaders
[
c
];
if
(
request
.
SheetType
==
(
int
)
SheetType
.
Workload
&&
header
.
Contains
(
"核算单元"
))
{
if
(
request
.
SheetName
.
Contains
(
"医生"
))
header
=
CollectDataConfig
.
Default
[
nameof
(
collect_data
.
AccountingUnitDoctor
)];
else
if
(
request
.
SheetName
.
Contains
(
"护理"
))
header
=
CollectDataConfig
.
Default
[
nameof
(
collect_data
.
AccountingUnitNurse
)];
}
var
first
=
config
.
FirstOrDefault
(
w
=>
w
.
Value
==
header
);
var
first
=
config
.
FirstOrDefault
(
w
=>
w
.
Value
==
header
);
if
(!
default
(
KeyValuePair
<
string
,
string
>).
Equals
(
first
)
if
(!
default
(
KeyValuePair
<
string
,
string
>).
Equals
(
first
)
&&
!
result
.
ContainsKey
(
header
)
&&
!
result
.
ContainsKey
(
header
)
...
@@ -810,6 +935,308 @@ private void UnitFit(List<HandsonRowData> rowDatas, List<HandsonCellData> cellDa
...
@@ -810,6 +935,308 @@ private void UnitFit(List<HandsonRowData> rowDatas, List<HandsonCellData> cellDa
}
}
rowDatas
.
AddRange
(
suppRowDatas
);
rowDatas
.
AddRange
(
suppRowDatas
);
}
}
public
void
SubmitCollectData
(
int
allotId
,
string
sheetName
,
int
userId
)
{
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SheetName
==
sheetName
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
data
.
ForEach
(
t
=>
{
t
.
Status
=
2
;
t
.
SubmitUser
=
userId
;
});
perforcollectdataRepository
.
UpdateRange
(
data
.
ToArray
());
}
/// <summary>
/// 数据录入显示列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
public
object
CollectDataList
(
int
hospitalId
)
{
var
allots
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
allots
==
null
||
!
allots
.
Any
())
return
new
List
<
per_allot
>();
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
allots
.
Select
(
a
=>
a
.
ID
).
Contains
(
t
.
AllotID
));
allots
=
allots
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
return
allots
.
Select
(
t
=>
new
{
t
.
ID
,
t
.
Year
,
t
.
Month
,
Status
=
GetStatus
(
data
?.
Where
(
s
=>
s
.
AllotID
==
t
.
ID
))
});
}
private
int
GetStatus
(
IEnumerable
<
collect_data
>
data
)
{
if
(
data
==
null
||
!
data
.
Any
())
return
1
;
if
(
data
.
Count
(
t
=>
t
.
Status
==
3
)
==
data
.
Count
())
return
3
;
else
if
(
data
.
Any
(
t
=>
t
.
Status
==
4
))
return
4
;
else
if
(
data
.
Any
(
t
=>
t
.
Status
==
2
))
return
2
;
return
1
;
}
/// <summary>
/// 核算办显示列表
/// </summary>
/// <returns></returns>
public
dynamic
PerformanceforList
(
int
allotId
)
{
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SubmitUser
.
HasValue
);
if
(
data
==
null
||
!
data
.
Any
())
return
new
int
[]
{
};
var
users
=
userRepository
.
GetEntities
();
var
list
=
data
.
GroupBy
(
t
=>
new
{
t
.
SubmitUser
}).
Select
(
t
=>
new
{
UserId
=
t
.
Key
.
SubmitUser
,
User
=
users
.
FirstOrDefault
(
u
=>
u
.
ID
==
t
.
Key
.
SubmitUser
)?.
RealName
??
""
,
Total
=
t
.
Sum
(
s
=>
ConvertHelper
.
To
<
decimal
>(
s
.
CellValue
)),
Status
=
(
t
.
Where
(
g
=>
g
.
Status
==
3
)?.
Count
()
??
0
)
==
t
.
Count
()
?
3
:
(
t
.
Where
(
g
=>
g
.
Status
==
4
)?.
Count
()
??
0
)
==
t
.
Count
()
?
4
:
2
});
return
list
;
}
/// <summary>
/// 科室显示列表
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public
SheetExportResponse
DepartmentTable
(
int
allotId
,
int
userId
)
{
SheetExportResponse
sheet
=
new
SheetExportResponse
();
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SubmitUser
==
userId
);
if
(
data
==
null
||
!
data
.
Any
())
return
sheet
;
data
.
ForEach
(
t
=>
{
t
.
AccountingUnitDoctor
=
t
.
AccountingUnitDoctor
??
""
;
t
.
AccountingUnitNurse
=
t
.
AccountingUnitNurse
??
""
;
t
.
AccountingUnitTechnician
=
t
.
AccountingUnitTechnician
??
""
;
});
#
region
header
var
mergeCells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
1
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
2
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
3
,
MergeRow
=
1
,
MergeCell
=
1
},
};
var
cells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"header"
,
CellValue
=
"核算单元(医技组)"
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
"核算单元(医生组)"
,
PointCell
=
1
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
"核算单元(护理组)"
,
PointCell
=
2
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
"科室名称"
,
PointCell
=
3
,
MergeRow
=
1
,
MergeCell
=
1
},
};
int
index
=
4
;
var
sheetnames
=
data
.
Select
(
t
=>
t
.
SheetName
).
Distinct
().
OrderBy
(
t
=>
t
);
foreach
(
var
sheetname
in
sheetnames
)
{
var
sheetColumns
=
data
.
Where
(
t
=>
t
.
SheetName
==
sheetname
).
Select
(
t
=>
t
.
TypeName
).
Distinct
().
OrderBy
(
t
=>
t
);
mergeCells
.
Add
(
new
Cell
{
CellType
=
"header"
,
CellValue
=
sheetname
,
PointCell
=
index
,
MergeRow
=
1
,
MergeCell
=
sheetColumns
.
Count
()
});
int
i
=
0
;
cells
.
AddRange
(
sheetColumns
.
Select
(
t
=>
{
i
++;
return
new
Cell
{
CellType
=
"header"
,
CellValue
=
t
,
PointCell
=
index
+
i
,
MergeRow
=
1
,
MergeCell
=
1
};
}));
index
+=
sheetColumns
.
Count
();
}
sheet
.
Header
=
new
List
<
Row
>
{
new
Row
(
0
){
Data
=
mergeCells
},
new
Row
(
1
){
Data
=
cells
}
};
#
endregion
#
region
data
List
<
Row
>
rows
=
new
List
<
Row
>();
int
rownumber
=
0
;
var
groupData
=
data
.
GroupBy
(
t
=>
new
{
t
.
AccountingUnitTechnician
,
t
.
AccountingUnitDoctor
,
t
.
AccountingUnitNurse
,
t
.
Department
});
foreach
(
var
item
in
groupData
.
OrderBy
(
t
=>
t
.
Key
.
Department
))
{
var
rowcells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"body"
,
CellValue
=
item
.
Key
.
AccountingUnitTechnician
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"body"
,
CellValue
=
item
.
Key
.
AccountingUnitDoctor
,
PointCell
=
1
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"body"
,
CellValue
=
item
.
Key
.
AccountingUnitNurse
,
PointCell
=
2
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"body"
,
CellValue
=
item
.
Key
.
Department
,
PointCell
=
1
,
MergeRow
=
3
,
MergeCell
=
1
},
};
index
=
4
;
foreach
(
var
header
in
cells
.
Select
(
t
=>
t
.
CellValue
.
ToString
()))
{
var
value
=
item
.
FirstOrDefault
(
t
=>
t
.
CellValue
==
header
)?.
CellValue
;
rowcells
.
Add
(
new
Cell
{
CellType
=
"body"
,
CellValue
=
value
,
PointCell
=
index
,
MergeRow
=
1
,
MergeCell
=
1
});
index
++;
}
rows
.
Add
(
new
Row
(
rownumber
)
{
Data
=
rowcells
});
rownumber
++;
}
sheet
.
Row
=
rows
;
#
endregion
return
sheet
;
}
/// <summary>
/// 科室显示列表
/// </summary>
/// <returns></returns>
public
HandsonTableBase
DepartmentList
(
int
allotId
,
int
userId
)
{
HandsonTableBase
table
=
new
HandsonTableBase
();
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SubmitUser
==
userId
);
if
(
data
==
null
||
!
data
.
Any
())
return
table
;
data
.
ForEach
(
t
=>
{
t
.
AccountingUnitDoctor
=
t
.
AccountingUnitDoctor
??
""
;
t
.
AccountingUnitNurse
=
t
.
AccountingUnitNurse
??
""
;
t
.
AccountingUnitTechnician
=
t
.
AccountingUnitTechnician
??
""
;
});
#
region
headers
columns
var
sheets
=
data
.
Select
(
t
=>
t
.
SheetName
).
Distinct
().
OrderBy
(
t
=>
t
).
ToList
();
var
mergeCells
=
new
List
<
NestedHeader
>
{
new
NestedHeader
(
""
,
1
),
new
NestedHeader
(
""
,
1
),
new
NestedHeader
(
""
,
1
),
new
NestedHeader
(
""
,
1
),
};
var
cells
=
new
List
<
string
>
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
,
};
var
headers
=
new
List
<(
string
,
string
)>();
var
columns
=
new
List
<
HandsonColumn
>
{
new
HandsonColumn
(
"核算单元(医技组)"
,
true
),
new
HandsonColumn
(
"核算单元(医生组)"
,
true
),
new
HandsonColumn
(
"核算单元(护理组)"
,
true
),
new
HandsonColumn
(
"科室名称"
,
true
),
};
foreach
(
var
sheet
in
sheets
)
{
var
sheetColumns
=
data
.
Where
(
t
=>
t
.
SheetName
==
sheet
).
Select
(
t
=>
t
.
TypeName
).
Distinct
().
OrderBy
(
t
=>
t
).
ToList
();
if
(
new
string
[]
{
"3.1"
,
"3.2"
}.
Any
(
t
=>
sheet
.
StartsWith
(
t
))
&&
sheetColumns
.
Contains
(
"核算单元"
))
{
sheetColumns
.
Remove
(
"核算单元"
);
}
cells
.
AddRange
(
sheetColumns
);
headers
.
AddRange
(
sheetColumns
.
Select
(
t
=>
(
sheet
,
t
)));
mergeCells
.
Add
(
new
NestedHeader
(
sheet
,
sheetColumns
.
Count
()));
columns
.
AddRange
(
sheetColumns
.
Select
(
t
=>
new
HandsonColumn
(
sheet
+
"_"
+
t
,
true
,
DataFormat
.
小数
)));
}
#
endregion
#
region
data
List
<
Dictionary
<
string
,
object
>>
tableData
=
new
List
<
Dictionary
<
string
,
object
>>();
var
groupData
=
data
.
GroupBy
(
t
=>
new
{
t
.
AccountingUnitTechnician
,
t
.
AccountingUnitDoctor
,
t
.
AccountingUnitNurse
,
t
.
Department
});
foreach
(
var
item
in
groupData
.
OrderBy
(
t
=>
t
.
Key
.
Department
))
{
var
dic
=
new
Dictionary
<
string
,
object
>
{
{
"核算单元(医技组)"
,
item
.
Key
.
AccountingUnitTechnician
},
{
"核算单元(医生组)"
,
item
.
Key
.
AccountingUnitDoctor
},
{
"核算单元(护理组)"
,
item
.
Key
.
AccountingUnitNurse
},
{
"科室名称"
,
item
.
Key
.
Department
}
};
foreach
(
var
header
in
headers
)
{
var
key
=
header
.
Item1
+
"_"
+
header
.
Item2
;
if
(
dic
.
ContainsKey
(
key
))
continue
;
var
value
=
item
.
FirstOrDefault
(
t
=>
t
.
SheetName
==
header
.
Item1
&&
t
.
TypeName
==
header
.
Item2
)?.
CellValue
;
dic
.
Add
(
key
,
value
);
}
tableData
.
Add
(
dic
);
}
#
endregion
table
.
Columns
=
columns
;
table
.
NestedHeadersArray
=
new
object
[]
{
mergeCells
,
cells
};
table
.
ColHeaders
=
cells
;
table
.
Data
=
tableData
;
return
table
;
}
/// <summary>
/// 提交数据审核
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <param name="status"></param>
public
bool
CollectDataAudit
(
int
allotId
,
int
userId
,
int
status
)
{
var
data
=
perforcollectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
SubmitUser
==
userId
);
if
(
data
==
null
||
!
data
.
Any
())
return
true
;
data
.
ForEach
(
t
=>
{
t
.
Status
=
status
;
});
return
perforcollectdataRepository
.
UpdateRange
(
data
.
ToArray
());
}
}
}
public
class
CollectDataConfig
public
class
CollectDataConfig
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
dbed92f6
...
@@ -148,7 +148,7 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
...
@@ -148,7 +148,7 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
ExtractHelper
.
CreateNotExistSheet
(
models
,
workbook
);
ExtractHelper
.
CreateNotExistSheet
(
models
,
workbook
);
var
employeeDict
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
employeeDict
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
collectData
=
collectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
var
collectData
=
collectdataRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
&&
t
.
Status
==
3
);
var
drugfactorData
=
drugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
)
??
new
List
<
cof_drugtype_factor
>();
var
drugfactorData
=
drugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
)
??
new
List
<
cof_drugtype_factor
>();
if
(!
exdict
.
ContainsKey
(
ExDataDict
.
IncomeFactor
))
if
(!
exdict
.
ContainsKey
(
ExDataDict
.
IncomeFactor
))
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/SpecialUnitDataWrite.cs
View file @
dbed92f6
...
@@ -22,6 +22,17 @@ public SpecialUnitDataWrite(ILogger logger)
...
@@ -22,6 +22,17 @@ public SpecialUnitDataWrite(ILogger logger)
public
void
WriteCollectData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
List
<
collect_data
>
collects
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
public
void
WriteCollectData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
List
<
collect_data
>
collects
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
{
{
if
(
collects
==
null
||
!
collects
.
Any
())
return
;
var
data
=
collects
.
Select
(
t
=>
new
ExtractTransDto
{
Department
=
t
.
Department
,
SpecialAccounting
=
t
.
Department
,
Category
=
t
.
TypeName
,
Value
=
ConvertHelper
.
To
<
decimal
>(
t
.
CellValue
)
}).
ToList
();
WriteSheetData
(
sheet
,
point
,
sheetType
,
style
,
data
,
exdict
);
}
}
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
object
data
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
object
data
,
Dictionary
<
ExDataDict
,
object
>
exdict
=
null
)
...
...
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