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
ed9795df
Commit
ed9795df
authored
Mar 21, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临床科室医护绩效测算表-完结
parent
1dcfb22a
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
135 additions
and
17 deletions
+135
-17
performance/Performance.Api/Controllers/AllotController.cs
+2
-2
performance/Performance.Api/Startup.cs
+2
-1
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
+1
-0
performance/Performance.EntityModels/Entity/cof_income.cs
+38
-0
performance/Performance.Repository/PerforCofincomeRepository.cs
+21
-0
performance/Performance.Services/PerExcelService/PerExcelService.cs
+22
-3
performance/Performance.Services/PerExcelService/PerSheetService.cs
+10
-5
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeEconomic.cs
+27
-4
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeWorkload.cs
+2
-2
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadDeptAccountingt.cs
+1
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadEmployee.cs
+2
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadExpend.cs
+1
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
+2
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadOtherIncome.cs
+2
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadWorkload.cs
+2
-0
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
ed9795df
...
...
@@ -144,8 +144,8 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
||
string
.
IsNullOrEmpty
(
allot
.
Path
))
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
BackgroundJob
.
Schedule
(()
=>
_perExcelService
.
Execute
(
allot
),
TimeSpan
.
FromSeconds
(
10
));
//_perExcelService.Execute(allot);
BackgroundJob
.
Enqueue
(()
=>
_perExcelService
.
Execute
(
allot
));
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
...
...
performance/Performance.Api/Startup.cs
View file @
ed9795df
...
...
@@ -117,6 +117,7 @@ public void ConfigureServices(IServiceCollection services)
//后台任务调度
services
.
AddHangfire
(
config
=>
{
config
.
UseFilter
(
new
AutomaticRetryAttribute
{
Attempts
=
0
});
config
.
UseStorage
(
new
MySqlStorage
(
connection
.
Value
.
HangfireConnectionString
));
});
...
...
@@ -148,7 +149,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
// c.RoutePrefix = string.Empty;
//});
app
.
UseHangfireServer
();
app
.
UseHangfireDashboard
(
"/hangfire"
,
new
DashboardOptions
{
Authorization
=
new
[]
{
new
HangfireAuthorizationFilter
()
}
});
...
...
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
View file @
ed9795df
...
...
@@ -28,5 +28,6 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public
virtual
DbSet
<
im_accountdoctor
>
Im_AccountDoctor
{
get
;
set
;
}
public
virtual
DbSet
<
im_accountnurse
>
Im_AccountNurse
{
get
;
set
;
}
public
virtual
DbSet
<
cof_drugprop
>
Cof_DrugProp
{
get
;
set
;
}
public
virtual
DbSet
<
cof_income
>
Cof_Income
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/cof_income.cs
0 → 100644
View file @
ed9795df
//-----------------------------------------------------------------------
// <copyright file=" cof_income.cs">
// * FileName: cof_income.cs
// * history : 2019-03-21 15:03:58
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
namespace
Performance.EntityModels
{
/// <summary>
/// cof_income Entity Model
/// </summary>
public
class
cof_income
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 关键字匹配
/// </summary>
public
string
SheetNameKeyword
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
UnitName
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
decimal
>
Value
{
get
;
set
;
}
}
}
performance/Performance.Repository/PerforCofincomeRepository.cs
0 → 100644
View file @
ed9795df
//-----------------------------------------------------------------------
// <copyright file=" cof_income.cs">
// * FileName: cof_income.cs
// * history : Created by T4 2019-03-21 15:03:54
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// cof_income Repository
/// </summary>
public
class
PerforCofincomeRepository
:
PerforRepository
<
cof_income
>
{
public
PerforCofincomeRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Services/PerExcelService/PerExcelService.cs
View file @
ed9795df
...
...
@@ -49,9 +49,10 @@ public class PerExcelService : IAutoInjection
_perforCofdrugpropRepository
=
perforCofdrugpropRepository
;
}
public
void
Execute
(
sys_allot
allot
)
{
//清空当前绩效下数据
Clear
(
allot
.
ID
);
// 拷贝配置信息
Copy
(
allot
.
ID
);
...
...
@@ -70,6 +71,19 @@ public void Execute(sys_allot allot)
// 计算最总数据
Compute
(
excel
);
//发送邮件
SendEmail
(
allot
);
}
private
void
SendEmail
(
sys_allot
allot
)
{
}
private
void
Clear
(
int
iD
)
{
}
/// <summary>
...
...
@@ -124,6 +138,11 @@ public List<PerSheet> ProcessCompute(PerExcel excel)
return
_perSheetService
.
ProcessCompute
(
excel
,
confs
);
}
/// <summary>
/// 获取药占比分割比例
/// </summary>
/// <param name="excel"></param>
/// <returns></returns>
private
List
<
CofDrugProp
>
GetDrugConfig
(
PerExcel
excel
)
{
//计算药占比
...
...
@@ -131,7 +150,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel)
var
incomeSheet
=
excel
.
PerSheet
.
FirstOrDefault
(
t
=>
t
.
SheetType
==
SheetType
.
Income
&&
t
.
SheetName
.
Contains
(
"门诊"
)
&&
t
.
SheetName
.
Contains
(
"就诊"
));
var
datalist
=
incomeSheet
.
PerData
.
Select
(
t
=>
(
PerData
)
t
);
var
drugData
=
datalist
.
Where
(
t
=>
t
.
TypeName
==
"西药费"
&&
t
.
TypeName
==
"中成药费"
).
GroupBy
(
t
=>
t
.
AccountingUnit
).
Select
(
t
=>
new
{
AccountingUnit
=
t
.
Key
,
SumValue
=
t
.
Sum
(
s
=>
s
.
CellValue
)
});
var
drugData
=
datalist
.
Where
(
t
=>
t
.
TypeName
==
"西药费"
||
t
.
TypeName
==
"中成药费"
).
GroupBy
(
t
=>
t
.
AccountingUnit
).
Select
(
t
=>
new
{
AccountingUnit
=
t
.
Key
,
SumValue
=
t
.
Sum
(
s
=>
s
.
CellValue
)
});
var
allData
=
datalist
.
GroupBy
(
t
=>
t
.
AccountingUnit
).
Select
(
t
=>
new
{
AccountingUnit
=
t
.
Key
,
SumValue
=
t
.
Sum
(
s
=>
s
.
CellValue
)
});
var
cofList
=
_perforCofdrugpropRepository
.
GetEntities
();
...
...
@@ -142,7 +161,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel)
var
dsv
=
drugData
.
FirstOrDefault
(
t
=>
t
.
AccountingUnit
==
unit
)?.
SumValue
;
var
asv
=
allData
.
FirstOrDefault
(
t
=>
t
.
AccountingUnit
==
unit
)?.
SumValue
;
var
prop
=
asv
.
HasValue
||
asv
.
Value
==
0
?
0
:
Math
.
Round
(
dsv
.
Value
/
asv
.
Value
,
2
)
;
var
prop
=
asv
.
HasValue
&&
asv
.
Value
>
0
?
Math
.
Round
((
dsv
??
0
)
/
asv
.
Value
,
2
)
:
0
;
var
fvalue
=
prop
==
0
?
0
:
cofList
.
FirstOrDefault
(
t
=>
prop
>
t
.
MinRange
&&
prop
<=
t
.
MaxRange
)?.
Value
??
0
;
...
...
performance/Performance.Services/PerExcelService/PerSheetService.cs
View file @
ed9795df
...
...
@@ -2,6 +2,7 @@
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -11,10 +12,13 @@ namespace Performance.Services
{
public
class
PerSheetService
:
IAutoInjection
{
PerHeaderService
_perHeader
;
public
PerSheetService
(
PerHeaderService
perHeader
)
private
PerHeaderService
_perHeader
;
private
PerforCofincomeRepository
_perforCofincomeRepository
;
public
PerSheetService
(
PerHeaderService
perHeader
,
PerforCofincomeRepository
perforCofincomeRepository
)
{
_perHeader
=
perHeader
;
_perforCofincomeRepository
=
perforCofincomeRepository
;
}
/// <summary>
...
...
@@ -52,7 +56,7 @@ public SheetType GetSheetType(string sheetName)
return
SheetType
.
Employee
;
else
if
(
sheetName
.
StartsWith
(
"1.0"
))
return
SheetType
.
OtherIncome
;
else
if
(
sheetName
.
StartsWith
(
"1.
1
"
))
else
if
(
sheetName
.
StartsWith
(
"1."
))
return
SheetType
.
Income
;
else
if
(
sheetName
.
StartsWith
(
"2."
))
return
SheetType
.
Expend
;
...
...
@@ -69,8 +73,9 @@ internal List<PerSheet> ProcessCompute(PerExcel excel, List<CofDrugProp> confs)
//合并科室收入、支出
var
incomeconfs
=
_perforCofincomeRepository
.
GetEntities
();
var
economicCompute
=
new
PerSheetDataComputeEconomic
();
var
mergeResult
=
economicCompute
.
MergeCompute
(
excel
);
var
mergeResult
=
economicCompute
.
MergeCompute
(
excel
,
incomeconfs
);
//一次计算
var
onceEconomic
=
economicCompute
.
OnceCompute
(
mergeResult
);
...
...
@@ -120,7 +125,7 @@ internal List<PerSheet> ProcessCompute(PerExcel excel, List<CofDrugProp> confs)
var
nurse
=
Mapper
.
Map
<
PerDataAccountNurse
>(
dept
);
var
econNurse
=
twiceEconomicResult
.
PerData
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
"护理组"
&&
t
.
AccountingUnit
==
dept
.
AccountingUnit
);
nurse
.
Income
=
econNurse
?.
CellValue
??
0
;
var
workNurse
=
twiceWorkloadResult2
.
PerData
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
"
医生
组"
&&
t
.
AccountingUnit
==
dept
.
AccountingUnit
);
var
workNurse
=
twiceWorkloadResult2
.
PerData
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
"
护理
组"
&&
t
.
AccountingUnit
==
dept
.
AccountingUnit
);
nurse
.
WorkloadFee
=
workNurse
?.
CellValue
??
0
;
nurseSheet
.
PerData
.
Add
(
nurse
);
}
...
...
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeEconomic.cs
View file @
ed9795df
...
...
@@ -19,7 +19,7 @@ public class PerSheetDataComputeEconomic
/// </summary>
/// <param name="excel"></param>
/// <returns></returns>
public
PerSheet
MergeCompute
(
PerExcel
excel
)
public
PerSheet
MergeCompute
(
PerExcel
excel
,
List
<
EntityModels
.
cof_income
>
incomeconfs
)
{
PerSheet
compSheet
=
new
PerSheet
{
...
...
@@ -42,12 +42,17 @@ public PerSheet MergeCompute(PerExcel excel)
var
sheetList
=
excel
.
PerSheet
.
Where
(
t
=>
t
.
SheetType
==
type
);
if
(
sheetList
.
Any
())
{
bool
isHasData
=
false
;
List
<
PerHeader
>
headList
=
new
List
<
PerHeader
>();
//子集列号为父级列号
int
childPointCell
=
pointCell
;
foreach
(
var
sheet
in
sheetList
)
{
var
dataList
=
sheet
.
PerData
.
Select
(
t
=>
(
PerData
)
t
);
//判断是否创建头部
if
(!
isHasData
&&
dataList
!=
null
&&
dataList
.
Count
()
>
0
)
isHasData
=
true
;
foreach
(
var
group
in
dataList
.
GroupBy
(
t
=>
t
.
UnitType
))
{
var
typeName
=
$"
{
GetCleanSheetName
(
sheet
.
SheetName
)}
(
{
group
.
Key
}
)"
;
...
...
@@ -61,7 +66,7 @@ public PerSheet MergeCompute(PerExcel excel)
SignID
=
childHeader
.
SignID
,
UnitType
=
group
.
Key
,
AccountingUnit
=
t
.
Key
,
CellValue
=
t
.
Sum
(
s
=>
s
.
IsFactor
?
(
s
.
CellValue
*
(
s
.
FactorValue
??
0
))
:
s
.
CellValue
),
CellValue
=
ComputeValue
(
t
,
sheet
.
SheetName
,
group
.
Key
,
incomeconfs
),
TypeName
=
typeName
,
RowNumber
=
dataList
.
FirstOrDefault
(
s
=>
s
.
AccountingUnit
==
t
.
Key
&&
s
.
UnitType
==
group
.
Key
)?.
RowNumber
??
0
,
ComputRule
=
type
==
SheetType
.
Expend
?
2
:
1
...
...
@@ -71,8 +76,12 @@ public PerSheet MergeCompute(PerExcel excel)
childPointCell
++;
}
}
PerHeader
header
=
new
PerHeader
(
0
,
pointCell
,
EnumHelper
.
GetDescription
(
type
),
1
,
1
,
headList
.
Count
,
headList
,
2
);
compSheet
.
PerHeader
.
Add
(
header
);
if
(
isHasData
)
{
PerHeader
header
=
new
PerHeader
(
0
,
pointCell
,
EnumHelper
.
GetDescription
(
type
),
1
,
1
,
headList
.
Count
,
headList
,
2
);
compSheet
.
PerHeader
.
Add
(
header
);
}
//父级列号为当前列号+子集个数
pointCell
=
pointCell
+
headList
.
Count
;
}
...
...
@@ -88,6 +97,20 @@ public PerSheet MergeCompute(PerExcel excel)
return
compSheet
;
}
private
decimal
?
ComputeValue
(
IGrouping
<
string
,
PerData
>
group
,
string
sheetName
,
string
unit
,
List
<
EntityModels
.
cof_income
>
incomeconfs
)
{
var
value
=
group
.
Sum
(
s
=>
s
.
IsFactor
?
(
s
.
CellValue
*
(
s
.
FactorValue
??
0
))
:
s
.
CellValue
);
foreach
(
var
conf
in
incomeconfs
)
{
if
(
sheetName
.
Contains
(
conf
.
SheetNameKeyword
)
&&
conf
.
UnitName
==
unit
)
{
value
=
value
*
conf
.
Value
;
}
}
return
value
;
}
private
string
GetCleanSheetName
(
string
sheetName
)
{
sheetName
=
sheetName
.
Trim
()
...
...
performance/Performance.Services/PerExcelService/SheetDataCompute/PerSheetDataComputeWorkload.cs
View file @
ed9795df
...
...
@@ -78,9 +78,9 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
return
sheet
;
}
private
static
decimal
?
ComputValue
(
PerHeader
header
,
List
<
CofDrugProp
>
confs
,
IGrouping
<
string
,
PerData
>
group
)
private
decimal
?
ComputValue
(
PerHeader
header
,
List
<
CofDrugProp
>
confs
,
IGrouping
<
string
,
PerData
>
group
)
{
var
value
=
group
.
Sum
(
s
=>
s
.
CellValue
);
var
value
=
group
.
Sum
(
s
=>
s
.
IsFactor
?
s
.
CellValue
*
s
.
FactorValue
:
s
.
CellValue
);
if
(
header
.
CellValue
==
"门急诊工作量"
)
{
var
factor
=
confs
.
FirstOrDefault
(
t
=>
t
.
AccoutingUnit
==
group
.
Key
)?.
Factor
??
0
;
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadDeptAccountingt.cs
View file @
ed9795df
...
...
@@ -28,6 +28,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
var
accountingUnit
=
row
.
GetCell
(
perHeader
.
FirstOrDefault
(
p
=>
p
.
CellValue
==
"核算单元"
).
PointCell
).
ToString
();
if
(
string
.
IsNullOrEmpty
(
accountingUnit
))
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadEmployee.cs
View file @
ed9795df
...
...
@@ -28,6 +28,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
var
accountingUnit
=
row
.
GetCell
(
perHeader
.
FirstOrDefault
(
p
=>
p
.
CellValue
==
"核算单元"
).
PointCell
).
ToString
();
if
(
string
.
IsNullOrEmpty
(
accountingUnit
))
continue
;
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadExpend.cs
View file @
ed9795df
...
...
@@ -50,6 +50,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
for
(
int
c
=
0
;
c
<
vhead
.
Count
();
c
++)
{
//获取当前核算单元名称
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
View file @
ed9795df
...
...
@@ -53,6 +53,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
for
(
int
c
=
0
;
c
<
vhead
.
Count
();
c
++)
{
//获取当前核算单元名称
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadOtherIncome.cs
View file @
ed9795df
...
...
@@ -41,6 +41,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
for
(
int
c
=
0
;
c
<
vhead
.
Count
();
c
++)
{
//获取当前核算单元名称
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadWorkload.cs
View file @
ed9795df
...
...
@@ -41,6 +41,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
for
(
int
r
=
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
{
var
row
=
sheet
.
GetRow
(
r
);
if
(
row
==
null
)
continue
;
for
(
int
c
=
0
;
c
<
vhead
.
Count
();
c
++)
{
//获取当前核算单元名称
...
...
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