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
f9934378
Commit
f9934378
authored
Jan 19, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HRP系统人员名单通过配置SQL自动提取、删除筛选功能删除、报表多余数据删除BUG修复、公式自动计算、二次分配改为在线EXCEL录入
parent
0c8fea5b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
255 additions
and
14 deletions
+255
-14
performance/Performance.Api/Controllers/SecondAllotController.cs
+11
-11
performance/Performance.Services/Details/SecondAllotDetails.cs
+51
-0
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+140
-0
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+28
-2
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+2
-0
performance/Performance.Services/ExtractExcelService/SheetDataWrite/SpecialUnitDataWrite.cs
+0
-1
performance/Performance.Services/Performance.Services.csproj
+1
-0
performance/Performance.Services/SecondAllotService.cs
+22
-0
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
f9934378
...
...
@@ -402,25 +402,25 @@ public ApiResponse NursingDeptAuditResult([FromBody] SecondAuditRequest request)
public
ApiResponse
OtherList
([
FromBody
]
AgOtherRequest
request
)
{
//var result = secondAllotService.OtherList(request.SecondId, claimService.GetUserId());
var
result
=
secondAllotDetails
.
GetOtherTempD
etails
(
claimService
.
GetUserId
(),
request
.
SecondId
,
request
.
IsArchive
,
request
.
EmployeeSource
);
var
obj
=
new
{
header
=
secondAllotService
.
OtherListHeader
(
request
.
SecondId
,
result
?.
Sum
(
t
=>
t
.
RealAmount
)
),
body
=
result
,
};
return
new
ApiResponse
(
ResponseType
.
OK
,
obj
);
var
result
=
secondAllotDetails
.
GetOtherTempD
ata
(
claimService
.
GetUserId
(),
request
.
SecondId
,
request
.
IsArchive
,
request
.
EmployeeSource
,
out
decimal
?
realAmount
);
//
var obj = new
//
{
// header = secondAllotService.OtherListHeader(request.SecondId, realAmount ?? 0
),
//
body = result,
//
};
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 二次绩效其他绩效保存
/// </summary>
/// <returns></returns>
[
Route
(
"api/second/other/save"
)]
[
Route
(
"api/second/other/save
/{secondId}
"
)]
[
HttpPost
]
public
ApiResponse
OtherSave
(
[
FromBody
]
AgOtherRequest
request
)
public
ApiResponse
OtherSave
(
int
secondId
,
[
FromBody
]
SaveCollectData
request
)
{
var
result
=
secondAllotService
.
OtherSave
(
request
.
SecondId
,
request
.
Othersources
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
secondAllotService
.
OtherSave
(
secondId
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
endregion
二次绩效其他绩效
...
...
performance/Performance.Services/Details/SecondAllotDetails.cs
View file @
f9934378
...
...
@@ -565,6 +565,36 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
#
region
其他模板详情
public
HandsonTable
GetOtherTempData
(
int
userId
,
int
secondId
,
int
isArchive
,
int
employeeSource
,
out
decimal
?
realAmount
)
{
var
result
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
OtherTemp
.
Select
(
t
=>
t
.
Value
).
ToArray
(),
OtherTemp
.
Select
(
t
=>
new
collect_permission
{
HeadName
=
t
.
Value
,
Visible
=
1
}).
ToList
());
var
details
=
GetOtherTempDetails
(
userId
,
secondId
,
isArchive
,
employeeSource
);
realAmount
=
details
?.
Sum
(
t
=>
t
.
RealAmount
);
if
(
details
==
null
||
!
details
.
Any
())
return
result
;
List
<
HandsonRowData
>
rowDatas
=
new
List
<
HandsonRowData
>();
int
i
=
1
;
foreach
(
var
item
in
details
)
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
firstDic
=
JsonHelper
.
Deserialize
<
Dictionary
<
string
,
string
>>(
json
);
var
cells
=
(
from
conf
in
OtherTemp
join
fst
in
firstDic
on
conf
.
Key
.
ToUpper
()
equals
fst
.
Key
.
ToUpper
()
select
new
HandsonCellData
(
conf
.
Value
,
fst
.
Value
)).
ToList
();
rowDatas
.
Add
(
new
HandsonRowData
(
i
,
cells
));
i
++;
}
result
.
SetRowData
(
rowDatas
,
rowDatas
!=
null
);
return
result
;
}
public
List
<
ag_othersource
>
GetOtherTempDetails
(
int
userId
,
int
secondId
,
int
isArchive
,
int
employeeSource
)
{
var
secondAllot
=
agsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
...
...
@@ -700,8 +730,27 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
}
}
public
static
Dictionary
<
string
,
string
>
OtherTemp
{
get
;
}
=
new
Dictionary
<
string
,
string
>
{
{
nameof
(
ag_othersource
.
WorkNumber
),
"工号"
},
{
nameof
(
ag_othersource
.
Name
),
"姓名"
},
{
nameof
(
ag_othersource
.
Department
),
"科室"
},
{
nameof
(
ag_othersource
.
WorkPost
),
"职称"
},
{
nameof
(
ag_othersource
.
TitlePerformance
),
"职称绩效"
},
{
nameof
(
ag_othersource
.
WorkPerformance
),
"工作量绩效工资"
},
{
nameof
(
ag_othersource
.
DeptReward
),
"科室单项奖励"
},
{
nameof
(
ag_othersource
.
DistPerformance
),
"可分配绩效"
},
{
nameof
(
ag_othersource
.
OtherPerformance
),
"医院其他绩效"
},
{
nameof
(
ag_othersource
.
NightWorkPerformance
),
"夜班工作量绩效"
},
{
nameof
(
ag_othersource
.
ReservedRatio
),
"预留比例"
},
{
nameof
(
ag_othersource
.
ReservedAmount
),
"预留金额"
},
{
nameof
(
ag_othersource
.
RealAmount
),
"实发绩效工资金额"
},
};
#
endregion
其他模板详情
#
region
Common
/// <summary>
/// 获取上一次的二次绩效
/// </summary>
...
...
@@ -724,6 +773,8 @@ private ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot sec
var
prevSecondAllot
=
agsecondallotRepository
.
GetEntity
(
w
=>
w
.
AllotId
==
prevAllot
.
ID
&&
w
.
UnitType
==
secondAllot
.
UnitType
&&
w
.
Department
==
secondAllot
.
Department
);
return
prevSecondAllot
;
}
#
endregion
Common
}
/// <summary>
...
...
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
0 → 100644
View file @
f9934378
using
Dapper
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.Services.ExtractExcelService
{
public
class
DictionaryService
:
IAutoInjection
{
private
readonly
ILogger
<
DictionaryService
>
logger
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforExtypeRepository
extypeRepository
;
private
readonly
PerforExscriptRepository
exscriptRepository
;
public
DictionaryService
(
ILogger
<
DictionaryService
>
logger
,
PerforPeremployeeRepository
peremployeeRepository
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforExtypeRepository
extypeRepository
,
PerforExscriptRepository
exscriptRepository
)
{
this
.
logger
=
logger
;
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
extypeRepository
=
extypeRepository
;
this
.
exscriptRepository
=
exscriptRepository
;
}
public
void
Handle
(
int
hospitalId
,
per_allot
allot
)
{
try
{
var
configs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
configs
==
null
||
!
configs
.
Any
())
throw
new
Exception
(
"医院未配置绩效抽取信息"
);
var
types
=
extypeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
new
int
[]
{
2
}.
Contains
(
t
.
Source
));
if
(
types
==
null
||
!
types
.
Any
())
return
;
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
types
.
Select
(
s
=>
s
.
Id
).
Contains
(
t
.
TypeId
)
&&
t
.
IsEnable
==
1
);
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
if
(
types
.
Any
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
))
//人员字典抽取配置
{
var
typeIds
=
types
.
Where
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
).
Select
(
t
=>
t
.
Id
);
var
script
=
scripts
.
FirstOrDefault
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
if
(
script
==
null
)
return
;
Employee
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
),
script
.
ExecScript
);
}
}
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
"获取数据时发生异常"
);
throw
ex
;
}
}
private
void
Employee
(
per_allot
allot
,
sys_hospitalconfig
config
,
string
sql
)
{
try
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
data
=
QueryData
<
per_employee
>(
config
,
allot
,
sql
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
employees
!=
null
&&
employees
.
Any
())
{
peremployeeRepository
.
RemoveRange
(
employees
.
ToArray
());
}
employees
.
AddRange
(
data
);
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
"获取人员名单时发生异常:"
+
ex
.
ToString
());
}
}
private
void
Department
()
{
}
#
region
QueryData
/// <summary>
/// 查询数据
/// </summary>
/// <param name="config"></param>
/// <param name="allot"></param>
/// <param name="execsql"></param>
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
private
IEnumerable
<
T
>
QueryData
<
T
>(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
{
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
{
foreach
(
var
item
in
parameters
)
{
execsql
=
Regex
.
Replace
(
execsql
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
var
result
=
connection
.
Query
<
T
>(
execsql
,
commandTimeout
:
20000
);
logger
.
LogInformation
(
$"提取绩效数据执行脚本获取数据
{
result
?.
Count
()
??
0
}
条记录"
);
return
result
;
}
}
/// <summary>
/// 获取参数
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
private
Dictionary
<
string
,
string
>
GetParameters
(
per_allot
allot
)
{
DateTime
beginTime
=
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
);
Dictionary
<
string
,
string
>
pairs
=
new
Dictionary
<
string
,
string
>
{
{
"@beginTime"
,
$"'
{
beginTime
.
ToString
(
"yyyy-MM-dd"
)}
'"
},
{
"@endTime"
,
$"'
{
beginTime
.
AddMonths
(
1
).
ToString
(
"yyyy-MM-dd"
)}
'"
},
};
return
pairs
;
}
#
endregion
QueryData
}
}
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
f9934378
using
NPOI.SS.UserModel
;
using
OfficeOpenXml
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
...
...
@@ -17,6 +18,7 @@ public static string GetExtractFile(int hospitalId, ref string newFilePath, stri
string
originalPath
=
string
.
IsNullOrEmpty
(
allotFilePath
)
?
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"Template"
,
"医院绩效模板.xls"
)
:
allotFilePath
;
CloseAutoFilter
(
originalPath
);
var
(
tempPath
,
filePath
)
=
CopyOriginalFile
(
hospitalId
,
originalPath
);
newFilePath
=
filePath
;
return
tempPath
;
...
...
@@ -108,5 +110,30 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
}
}
}
public
static
void
CloseAutoFilter
(
string
path
)
{
try
{
var
fileInfo
=
new
FileInfo
(
path
);
using
(
ExcelPackage
package
=
new
ExcelPackage
(
fileInfo
))
{
ExcelWorkbook
workbook
=
package
.
Workbook
;
if
(
workbook
==
null
)
return
;
foreach
(
var
sheet
in
workbook
.
Worksheets
)
{
if
(
sheet
.
AutoFilterAddress
!=
null
)
{
sheet
.
Cells
[
sheet
.
AutoFilterAddress
.
Address
].
AutoFilter
=
false
;
}
}
package
.
Save
();
}
}
catch
(
Exception
ex
)
{
}
}
}
}
\ No newline at end of file
}
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
f9934378
...
...
@@ -86,6 +86,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
workbook
=
ExcelHelper
.
GetWorkbook
(
templateFilePath
);
if
(
workbook
==
null
)
throw
new
PerformanceException
(
"文件读取失败"
);
workbook
.
GetCreationHelper
().
CreateFormulaEvaluator
().
EvaluateAll
();
//实时更新公式的结果
WriteDataToFile
(
workbook
,
allotId
,
dict
,
standData
,
groupName
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"提取完成"
,
$"绩效数据提取成功"
,
5
,
isSingle
);
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/SpecialUnitDataWrite.cs
View file @
f9934378
...
...
@@ -36,7 +36,6 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if
(
exSpecials
==
null
||
!
exSpecials
.
Any
())
return
;
var
extractDto
=
(
data
as
List
<
ExtractTransDto
>)
??
new
List
<
ExtractTransDto
>();
logger
.
LogInformation
(
"特殊科室数据1:"
+
JsonHelper
.
Serialize
(
extractDto
));
var
mergedRegions
=
new
List
<
SpecialCellRange
>();
RemoveMergedRegion
(
sheet
,
ref
mergedRegions
);
...
...
performance/Performance.Services/Performance.Services.csproj
View file @
f9934378
...
...
@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.1" />
<PackageReference Include="EPPlus" Version="4.5.3.2" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup>
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
f9934378
...
...
@@ -1688,6 +1688,28 @@ public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request
return
perforAgothersourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
}
public
void
OtherSave
(
int
secondId
,
SaveCollectData
collectData
)
{
if
(
collectData
.
ColHeaders
==
null
||
!
collectData
.
ColHeaders
.
Any
())
return
;
var
parameters
=
new
List
<
string
>();
foreach
(
var
item
in
collectData
.
ColHeaders
)
{
if
(!
SecondAllotDetails
.
OtherTemp
.
ContainsValue
(
item
))
throw
new
PerformanceException
(
$"请确认列'
{
item
}
'是否正确"
);
parameters
.
Add
(
SecondAllotDetails
.
OtherTemp
.
FirstOrDefault
(
t
=>
t
.
Value
==
item
).
Key
);
}
if
(
parameters
==
null
||
!
parameters
.
Any
())
return
;
List
<
string
>
josn
=
new
List
<
string
>();
foreach
(
var
item
in
collectData
.
Data
)
{
var
list
=
item
.
ToList
();
var
itemList
=
list
.
Select
(
t
=>
$"\"
{
parameters
[
list
.
IndexOf
(
t
)]}
\":\"
{
t
}
\""
);
josn
.
Add
(
$"
{{{
string
.
Join
(
","
,
itemList
)}}}
"
);
}
var
data
=
JsonHelper
.
Deserialize
<
List
<
ag_othersource
>>(
$"[
{
string
.
Join
(
","
,
josn
)}
]"
);
}
#
endregion
二次绩效其他来源
#
region
打印
...
...
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