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
716adc59
Commit
716adc59
authored
Aug 08, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效抽取日志
parent
4de40ffa
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
140 additions
and
84 deletions
+140
-84
performance/Performance.Api/Controllers/TemplateController.cs
+11
-7
performance/Performance.Api/Performance.Api.csproj
+6
-0
performance/Performance.Api/Template/医院人员绩效模板.xls
+0
-0
performance/Performance.Api/Template/医院绩效模板.xls
+0
-0
performance/Performance.Api/wwwroot/Performance.Api.xml
+2
-2
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+3
-3
performance/Performance.Repository/PerforCofdirectorRepository.cs
+1
-1
performance/Performance.Repository/PerforPerAllotRepository.cs
+3
-0
performance/Performance.Services/DFExtractService.cs
+80
-54
performance/Performance.Services/EmployeeService.cs
+10
-1
performance/Performance.Services/Hubs/AllotLogHub.cs
+1
-0
performance/Performance.Services/LogManageService.cs
+23
-16
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
716adc59
...
...
@@ -70,7 +70,7 @@ public IActionResult DownFile(int type = 1)
switch
(
type
)
{
case
1
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板.xls
x
"
);
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板.xls"
);
break
;
case
2
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院二次分配绩效模板.xlsx"
);
...
...
@@ -78,6 +78,9 @@ public IActionResult DownFile(int type = 1)
case
3
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板(无执行科室).xlsx"
);
break
;
case
4
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院人员绩效模板.xls"
);
break
;
}
var
memoryStream
=
new
MemoryStream
();
...
...
@@ -238,9 +241,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
//HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true);
if
(
string
.
IsNullOrEmpty
(
filePath
))
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
groupName =
{
request
.
GroupName
}
"
,
""
);
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
userId=
{
claim
.
GetUserId
()
}
"
,
""
);
else
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
groupName =
{
request
.
GroupName
}
"
,
filePath
,
true
);
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
userId=
{
claim
.
GetUserId
()
}
"
,
filePath
,
true
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
,
new
{
IsExtracting
=
false
});
}
...
...
@@ -357,24 +360,25 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
/// <summary>
/// 返回日志
/// </summary>
/// <param name="allotId">绩效Id</param>
/// <param name="type">1 进度条 2 信息</param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level"></param>
/// <param name="success"></param>
/// <param name="groupName"></param>
[
Route
(
"returnlog"
)]
[
HttpPost
]
[
AllowAnonymous
]
public
void
ReturnLog
(
int
allotId
,
int
type
,
string
tag
,
string
message
,
int
level
=
1
,
bool
success
=
fals
e
)
public
void
ReturnLog
(
int
type
,
string
tag
,
string
message
,
int
level
,
string
groupNam
e
)
{
logger
.
LogInformation
(
"返回日志:"
+
JsonHelper
.
Serialize
(
new
{
type
,
tag
,
message
,
level
,
groupName
}));
if
(
type
==
3
)
{
logService
.
Schedule
(
allotId
,
ConvertHelper
.
To
<
decimal
>(
message
),
level
,
success
);
logService
.
Schedule
(
groupName
,
ConvertHelper
.
To
<
decimal
>(
message
),
level
);
}
else
{
logService
.
ExtractLog
(
allotId
,
tag
,
message
,
level
);
logService
.
ExtractLog
(
groupName
,
tag
,
message
,
level
);
}
}
...
...
performance/Performance.Api/Performance.Api.csproj
View file @
716adc59
...
...
@@ -83,9 +83,15 @@
<None Update="Template\医院二次分配绩效模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院人员绩效模板.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板%28无执行科室%29.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
...
...
performance/Performance.Api/Template/医院人员绩效模板.xls
0 → 100644
View file @
716adc59
File added
performance/Performance.Api/Template/医院绩效模板.xls
View file @
716adc59
No preview for this file type
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
716adc59
...
...
@@ -1190,16 +1190,16 @@
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.
Int32,System.String,System.String,System.Int32,System.Boolean
)"
>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.
String,System.String,System.Int32,System.Boolean,System.String
)"
>
<summary>
返回日志
</summary>
<param
name=
"allotId"
>
绩效Id
</param>
<param
name=
"type"
>
1 进度条 2 信息
</param>
<param
name=
"tag"
></param>
<param
name=
"message"
></param>
<param
name=
"level"
></param>
<param
name=
"success"
></param>
<param
name=
"groupName"
></param>
</member>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)"
>
<summary>
...
...
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
716adc59
...
...
@@ -112,9 +112,9 @@ public ApiResponse Import([FromForm] IFormCollection form, int type, int hospita
/// <returns></returns>
[
Route
(
"extract"
)]
[
HttpPost
]
public
void
ExtractData
([
FromForm
]
IFormCollection
form
,
int
allotId
,
int
hospitalId
,
string
email
)
public
void
ExtractData
([
FromForm
]
IFormCollection
form
,
int
allotId
,
int
hospitalId
,
string
email
,
string
userId
)
{
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
hospitalId
,
email
}));
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
hospitalId
,
email
,
userId
}));
if
(
allotId
==
0
||
hospitalId
==
0
)
return
;
...
...
@@ -149,7 +149,7 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit
#
endregion
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId);
string
filePath
=
extractService
.
ExtractData
(
allotId
,
email
,
hospitalId
,
path
);
//抽取
string
filePath
=
extractService
.
ExtractData
(
allotId
,
email
,
hospitalId
,
"User"
+
userId
,
path
);
//抽取
#
region
保存文件到网站下
...
...
performance/Performance.Repository/PerforCofdirectorRepository.cs
View file @
716adc59
...
...
@@ -38,7 +38,7 @@ public int DeleteData(int allotId)
};
string
sql
=
""
;
tableArray
.
ForEach
(
t
=>
sql
+=
$"delete from
{
t
}
where allotid=@allotId;"
);
sql
+=
"delete from log_dbug where allotid=@allotId and
sourc
e=1;"
;
sql
+=
"delete from log_dbug where allotid=@allotId and
typ
e=1;"
;
return
Execute
(
sql
,
new
{
allotId
});
}
...
...
performance/Performance.Repository/PerforPerAllotRepository.cs
View file @
716adc59
...
...
@@ -109,6 +109,9 @@ public void ClearResultData(int allotid)
if
(
connection
.
State
!=
ConnectionState
.
Open
)
connection
.
Open
();
try
{
string
update
=
"update ex_result set isdelete = 1 where allotid = @allotid "
;
connection
.
Execute
(
update
,
new
{
allotid
},
commandTimeout
:
60
*
60
);
string
clear
=
"delete from ex_result where allotid = @allotid and isdelete = 1 and createtime < (select min(createtime) from (select distinct createtime from ex_result where allotid = @allotid and isdelete = 1 order by createtime desc limit 4) t);"
;
connection
.
Execute
(
clear
,
new
{
allotid
},
commandTimeout
:
60
*
60
);
}
...
...
performance/Performance.Services/DFExtractService.cs
View file @
716adc59
...
...
@@ -49,6 +49,7 @@ public class DFExtractService : IAutoInjection
private
const
string
specialname
=
"4.2 特殊核算单元绩效测算表"
;
private
DateTime
?
CreateTime
=
null
;
private
decimal
ratio
=
5
;
private
string
GroupName
=
""
;
public
DFExtractService
(
ILogger
<
DFExtractService
>
logger
,
IEmailService
emailService
,
...
...
@@ -96,14 +97,17 @@ public class DFExtractService : IAutoInjection
#
region
抽取
public
string
ExtractData
(
int
allotId
,
string
email
,
int
hospitalId
,
string
filePath
=
null
)
public
string
ExtractData
(
int
allotId
,
string
email
,
int
hospitalId
,
string
groupName
,
string
filePath
=
null
)
{
var
hospital
=
perforHospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
hospitalId
);
try
{
GroupName
=
groupName
;
logManage
.
ClearExtractLog
(
allotId
);
logManage
.
ReturnTheLog
(
allotId
,
2
,
"等待提取"
,
$"确认配置信息是否可完成数据提取..."
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
3
,
""
,
1
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
2
,
"等待提取"
,
$"确认配置信息是否可完成数据提取..."
);
var
allot
=
perforPerallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
Allot
=
allot
??
throw
new
PerformanceException
(
""
);
...
...
@@ -133,7 +137,7 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
var
data
=
new
List
<
ex_result
>();
var
scripts
=
perforExscriptRepository
.
GetEntities
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
logManage
.
ReturnTheLog
(
allotId
,
3
,
""
,
5
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
3
,
""
,
5
);
ClearHistData
(
allot
);
...
...
@@ -141,9 +145,12 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
var
otherItems
=
items
.
Where
(
t
=>
modules
.
Where
(
m
=>
m
.
SheetType
!=
(
int
)
SheetType
.
Income
).
Select
(
m
=>
m
.
Id
).
Contains
(
t
.
ModuleId
.
Value
)).
ToList
();
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
data
.
AddRange
(
ExtractIncome
(
modules
,
scripts
,
configs
,
allot
));
data
.
AddRange
(
ExtractItems
(
otherItems
,
scripts
,
configs
,
allot
,
modules
));
data
.
AddRange
(
ExtractSpcial
(
specials
,
scripts
,
configs
,
allot
));
var
incomedata
=
ExtractIncome
(
modules
,
scripts
,
configs
,
allot
);
data
.
AddRange
(
incomedata
);
var
itemdata
=
ExtractItems
(
otherItems
,
scripts
,
configs
,
allot
,
modules
);
data
.
AddRange
(
itemdata
);
var
specialdata
=
ExtractSpcial
(
specials
,
scripts
,
configs
,
allot
);
data
.
AddRange
(
specialdata
);
}
var
standData
=
StandData
(
data
);
...
...
@@ -153,8 +160,8 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
}
catch
(
Exception
ex
)
{
logManage
.
ReturnTheLog
(
allotId
,
2
,
"发生异常"
,
$"提取绩效数据异常"
,
4
);
logManage
.
ReturnTheLog
(
allotId
,
3
,
""
,
ratio
,
4
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
2
,
"发生异常"
,
$"提取绩效数据异常"
,
4
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
3
,
""
,
ratio
,
4
);
logger
.
LogError
(
$"提取绩效数据异常 数据写入出现异常
{
ex
.
ToString
()}
"
);
//SendEmail(email, "", $"{hospital.HosName}HIS数据提取失败", $"{hospital.HosName}提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!");
throw
ex
;
...
...
@@ -166,8 +173,8 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
if
(
workbook
!=
null
)
workbook
.
Close
();
GC
.
Collect
();
logManage
.
ReturnTheLog
(
allotId
,
2
,
"提取完成"
,
$"绩效数据提取成功"
,
5
);
logManage
.
ReturnTheLog
(
allotId
,
3
,
""
,
100
,
5
,
true
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
3
,
""
,
100
,
5
);
logManage
.
ReturnTheLog
(
allotId
,
GroupName
,
2
,
"提取完成"
,
$"绩效数据提取成功"
,
5
);
}
}
...
...
@@ -193,9 +200,9 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
var
incomemodules
=
modules
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
&&
t
.
TypeId
>
0
);
foreach
(
var
module
in
incomemodules
)
{
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"开始提取模块“
{
module
.
ModuleName
}
”的数据"
);
ratio
+=
15
/
incomemodules
.
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
ratio
+=
15
m
/
incomemodules
.
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
>
20
?
20
:
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"开始提取模块“
{
module
.
ModuleName
}
”的数据"
);
foreach
(
var
config
in
configs
)
{
var
item
=
scripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
module
.
TypeId
&&
t
.
DatabaseType
==
config
.
DataBaseType
);
...
...
@@ -207,12 +214,7 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
data
.
AddRange
(
querydata
);
}
}
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"模块“
{
module
.
ModuleName
}
”的数据已完成提取"
);
}
if
(
Math
.
Round
(
ratio
)
<
20
)
{
ratio
=
20
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"模块“
{
module
.
ModuleName
}
”的数据已完成提取"
);
}
return
data
;
...
...
@@ -230,6 +232,12 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
/// <returns></returns>
private
List
<
ex_result
>
ExtractItems
<
TEntity
>(
List
<
TEntity
>
entities
,
List
<
ex_script
>
scripts
,
List
<
sys_hospitalconfig
>
configs
,
per_allot
allot
,
List
<
ex_module
>
modules
)
{
if
(
Math
.
Round
(
ratio
)
<
20
)
{
ratio
=
20
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
);
}
var
data
=
new
List
<
ex_result
>();
var
items
=
entities
as
List
<
ex_item
>;
if
(
items
==
null
||
!
items
.
Any
(
t
=>
t
.
TypeId
>
0
))
...
...
@@ -237,9 +245,9 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
foreach
(
var
exitem
in
items
.
Where
(
t
=>
t
.
TypeId
>
0
))
{
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"开始提取项目“
{
exitem
.
ItemName
}
”的数据"
);
ratio
+=
30
/
items
.
Where
(
t
=>
t
.
TypeId
>
0
).
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
ratio
+=
30
m
/
items
.
Where
(
t
=>
t
.
TypeId
>
0
).
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
>
50
?
50
:
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"开始提取项目“
{
exitem
.
ItemName
}
”的数据"
);
var
module
=
modules
.
FirstOrDefault
(
t
=>
t
.
Id
==
exitem
.
ModuleId
);
foreach
(
var
config
in
configs
)
{
...
...
@@ -258,12 +266,7 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
data
.
AddRange
(
result
);
}
}
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"项目“
{
exitem
.
ItemName
}
”的数据已完成提取"
);
}
if
(
Math
.
Round
(
ratio
)
<
50
)
{
ratio
=
50
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"项目“
{
exitem
.
ItemName
}
”的数据已完成提取"
);
}
return
data
;
...
...
@@ -280,6 +283,12 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
/// <returns></returns>
private
List
<
ex_result
>
ExtractSpcial
<
TEntity
>(
List
<
TEntity
>
entities
,
List
<
ex_script
>
scripts
,
List
<
sys_hospitalconfig
>
configs
,
per_allot
allot
)
{
if
(
Math
.
Round
(
ratio
)
<
50
)
{
ratio
=
50
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
);
}
var
data
=
new
List
<
ex_result
>();
var
specials
=
entities
as
List
<
ex_special
>;
if
(
specials
==
null
||
!
specials
.
Any
(
t
=>
t
.
TypeId
>
0
))
...
...
@@ -287,9 +296,9 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
foreach
(
var
special
in
specials
.
Where
(
t
=>
t
.
TypeId
>
0
))
{
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"开始提取特殊核算项“
{
special
.
Target
}
”的数据"
);
ratio
+=
10
/
specials
.
Where
(
t
=>
t
.
TypeId
>
0
).
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
ratio
+=
10
m
/
specials
.
Where
(
t
=>
t
.
TypeId
>
0
).
Count
(
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
>
60
?
60
:
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"开始提取特殊核算项“
{
special
.
Target
}
”的数据"
);
foreach
(
var
config
in
configs
)
{
var
item
=
scripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
special
.
TypeId
&&
t
.
DatabaseType
==
config
.
DataBaseType
);
...
...
@@ -303,12 +312,7 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
});
data
.
AddRange
(
result
);
}
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"提取数据"
,
$"特殊核算项“
{
special
.
Target
}
”的数据已完成提取"
);
}
if
(
Math
.
Round
(
ratio
)
<
60
)
{
ratio
=
60
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"提取数据"
,
$"特殊核算项“
{
special
.
Target
}
”的数据已完成提取"
);
}
if
(
data
!=
null
&&
data
.
Any
())
perforExresultRepository
.
AddRange
(
data
.
ToArray
());
...
...
@@ -323,14 +327,18 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
private
void
ClearHistData
(
per_allot
allot
)
{
logger
.
LogInformation
(
$"开始清除历史提取数据"
);
var
data
=
perforExresultRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
&&
t
.
IsDelete
==
0
);
if
(
data
!=
null
&&
data
.
Any
(
t
=>
t
.
Id
>
0
))
{
data
.
ForEach
(
t
=>
t
.
IsDelete
=
1
);
perforExresultRepository
.
UpdateRange
(
data
.
ToArray
());
perforPerallotRepository
.
ClearResultData
(
allot
.
ID
);
}
perforPerallotRepository
.
ClearResultData
(
allot
.
ID
);
logger
.
LogInformation
(
$"清除历史提取数据已完成"
);
//var data = perforExresultRepository.GetEntities(t => t.AllotId == allot.ID && t.IsDelete == 0);
//if (data != null && data.Any(t => t.Id > 0))
//{
// data.ForEach(t => t.IsDelete = 1);
// perforExresultRepository.UpdateRange(data.ToArray());
// perforPerallotRepository.ClearResultData(allot.ID);
//}
}
/// <summary>
...
...
@@ -347,6 +355,12 @@ private void ClearHistData(per_allot allot)
/// <returns></returns>
public
string
TemplateExecute
(
string
email
,
sys_hospital
hospital
,
List
<
sys_hospitalconfig
>
configs
,
List
<
ex_module
>
modules
,
List
<
ex_item
>
items
,
List
<
ex_special
>
specials
,
List
<
NewExtractDto
>
data
)
{
if
(
Math
.
Round
(
ratio
)
<
60
)
{
ratio
=
60
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
);
}
logger
.
LogInformation
(
"空白模板提取"
);
string
originalPath
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"Template"
,
"医院绩效模板.xls"
);
var
(
tempPath
,
newPath
)
=
CopyOriginalFile
(
hospital
.
ID
,
originalPath
);
...
...
@@ -365,16 +379,19 @@ public string TemplateExecute(string email, sys_hospital hospital, List<sys_hosp
style
=
CellStyle
.
CreateCellStyle
(
workbook
,
StyleType
.
数据
);
logger
.
LogInformation
(
$"共有
{
workbook
?.
NumberOfSheets
??
0
}
个sheet"
);
for
(
int
i
=
0
;
i
<
workbook
.
NumberOfSheets
;
i
++)
{
var
sheet
=
workbook
.
GetSheetAt
(
i
);
ratio
+=
40
m
/
workbook
.
NumberOfSheets
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
>
99
?
99
:
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”开始写入数据"
);
var
sheetType
=
perSheetService
.
GetSheetType
(
sheet
.
SheetName
);
if
(
sheetType
==
SheetType
.
Unidentifiable
)
continue
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”开始写入数据"
);
ratio
+=
40
/
8
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
var
sheetRead
=
PerSheetDataFactory
.
GetDataRead
(
sheetType
);
switch
(
sheetType
)
{
...
...
@@ -403,7 +420,7 @@ public string TemplateExecute(string email, sys_hospital hospital, List<sys_hosp
WriteSpecialUnit
(
sheet
,
sheetRead
,
specials
,
data
);
break
;
}
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”已完成数据写入"
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”已完成数据写入"
);
}
using
(
FileStream
file
=
new
FileStream
(
newPath
,
FileMode
.
OpenOrCreate
))
{
...
...
@@ -429,6 +446,12 @@ public string TemplateExecute(string email, sys_hospital hospital, List<sys_hosp
/// <returns></returns>
public
string
AlllotExecute
(
string
email
,
sys_hospital
hospital
,
List
<
sys_hospitalconfig
>
configs
,
List
<
ex_module
>
modules
,
List
<
ex_item
>
items
,
List
<
ex_special
>
specials
,
List
<
NewExtractDto
>
extracts
,
per_allot
lastAllot
,
string
path
)
{
if
(
Math
.
Round
(
ratio
)
<
60
)
{
ratio
=
60
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
);
}
if
(
string
.
IsNullOrEmpty
(
path
))
throw
new
PerformanceException
(
"历史绩效文件不存在!"
);
logger
.
LogInformation
(
"Copy File"
);
...
...
@@ -448,16 +471,19 @@ public string AlllotExecute(string email, sys_hospital hospital, List<sys_hospit
style
=
CellStyle
.
CreateCellStyle
(
workbook
,
StyleType
.
数据
);
logger
.
LogInformation
(
$"共有
{
workbook
?.
NumberOfSheets
??
0
}
个sheet"
);
for
(
int
i
=
0
;
i
<
workbook
.
NumberOfSheets
;
i
++)
{
var
sheet
=
workbook
.
GetSheetAt
(
i
);
ratio
+=
40
m
/
workbook
.
NumberOfSheets
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
3
,
""
,
ratio
>
99
?
99
:
ratio
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”开始写入数据"
);
var
sheetType
=
perSheetService
.
GetSheetType
(
sheet
.
SheetName
);
if
(
sheetType
==
SheetType
.
Unidentifiable
)
continue
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”开始写入数据"
);
ratio
+=
40
/
8
;
logManage
.
ReturnTheLog
(
Allot
.
ID
,
3
,
""
,
ratio
);
var
sheetRead
=
PerSheetDataFactory
.
GetDataRead
(
sheetType
);
switch
(
sheetType
)
{
...
...
@@ -491,7 +517,7 @@ public string AlllotExecute(string email, sys_hospital hospital, List<sys_hospit
WriteSpecialUnit
(
sheet
,
sheetRead
,
specials
,
extracts
,
lastAllot
,
false
);
break
;
}
logManage
.
ReturnTheLog
(
Allot
.
ID
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”已完成数据写入"
);
logManage
.
ReturnTheLog
(
Allot
.
ID
,
GroupName
,
2
,
"写入数据"
,
$"sheet“
{
sheet
.
SheetName
}
”已完成数据写入"
);
}
using
(
FileStream
file
=
new
FileStream
(
newPath
,
FileMode
.
OpenOrCreate
))
{
...
...
performance/Performance.Services/EmployeeService.cs
View file @
716adc59
using
AutoMapper
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Logging
;
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
NPOI.XSSF.UserModel
;
...
...
@@ -330,7 +331,15 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
try
{
IWorkbook
workbook
=
new
XSSFWorkbook
(
path
);
IWorkbook
workbook
=
null
;
var
version
=
FileHelper
.
GetExtension
(
path
)
==
".xlsx"
?
ExcelVersion
.
xlsx
:
ExcelVersion
.
xls
;
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
OpenOrCreate
))
{
workbook
=
(
version
==
ExcelVersion
.
xlsx
)
?
(
IWorkbook
)(
new
XSSFWorkbook
(
fs
))
:
(
IWorkbook
)(
new
HSSFWorkbook
(
fs
));
}
if
(
workbook
==
null
)
return
;
var
sheet
=
workbook
.
GetSheetAt
(
0
);
...
...
performance/Performance.Services/Hubs/AllotLogHub.cs
View file @
716adc59
...
...
@@ -64,6 +64,7 @@ public override Task OnDisconnectedAsync(Exception exception)
cache
.
Set
(
key
,
groupName
,
new
TimeSpan
(
1
,
0
,
0
));
logger
.
LogDebug
(
$"日志推送 添加用户组
{
connectionId
}
-
{
groupName
}
"
);
//2 将用户插入分组
await
Groups
.
AddToGroupAsync
(
connectionId
,
groupName
);
}
...
...
performance/Performance.Services/LogManageService.cs
View file @
716adc59
using
Microsoft.AspNetCore.Mvc.ViewFeatures
;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels.AppSettings
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Performance.Services
{
...
...
@@ -52,36 +48,47 @@ public void WriteMsg(string tag, string message, int level, int allotId, string
/// <summary>
/// 抽取进度
/// </summary>
/// <param name="
allotId
"></param>
/// <param name="
groupName
"></param>
/// <param name="ratio"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
/// <param name="success"></param>
public
void
Schedule
(
int
allotId
,
decimal
ratio
,
int
level
=
1
,
bool
success
=
false
)
public
void
Schedule
(
string
groupName
,
decimal
ratio
,
int
level
)
{
if
(!
success
&&
ratio
>
100
)
ratio
=
99
;
ratio
=
Math
.
Round
(
ratio
)
;
if
(
success
&&
ratio
!=
100
)
ratio
=
100
;
if
(
level
!=
5
&&
ratio
>
100
)
ratio
=
99
;
hubContext
.
Clients
.
Group
(
$"Extract
{
allotId
}
"
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
if
(
level
==
5
&&
ratio
!=
100
)
ratio
=
100
;
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
}
/// <summary>
/// 抽取日志
/// </summary>
/// <param name="
allotId
"></param>
/// <param name="
groupName
"></param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
public
void
ExtractLog
(
int
allotId
,
string
tag
,
string
message
,
int
level
=
1
)
public
void
ExtractLog
(
string
groupName
,
string
tag
,
string
message
,
int
level
)
{
hubContext
.
Clients
.
Group
(
$"Extract
{
allotId
}
"
).
SendAsync
(
"ExtractLog"
,
tag
,
message
,
level
);
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"ExtractLog"
,
tag
,
message
,
level
);
}
public
void
ReturnTheLog
(
int
allotId
,
int
type
,
string
tag
,
object
message
,
int
level
=
1
,
bool
success
=
false
)
public
void
ReturnTheLog
(
int
allotId
,
string
groupName
,
int
type
,
string
tag
,
object
message
,
int
level
=
1
)
{
logdbug
.
Add
(
allotId
,
tag
,
message
.
ToString
(),
level
,
type
);
HttpHelper
.
HttpPostNoRequest
(
url
.
ImportFile
+
$"/template/returnlog?allotId=
{
allotId
}
&type=
{
type
}
&tag=
{
tag
}
&message=
{
message
}
&level=
{
level
}
&success=
{
success
}
"
,
""
);
try
{
var
http
=
url
.
ImportFile
+
$"/template/returnlog?type=
{
type
}
&tag=
{
tag
}
&message=
{
message
}
&level=
{
level
}
&groupName=
{
groupName
}
"
;
logger
.
LogInformation
(
"发送日志:"
+
http
);
logdbug
.
Add
(
allotId
,
tag
,
message
.
ToString
(),
level
,
type
);
HttpHelper
.
HttpPostNoRequest
(
http
,
""
);
}
catch
(
Exception
ex
)
{
logger
.
LogInformation
(
"发送日志失败:"
+
ex
.
ToString
());
}
}
public
bool
ClearExtractLog
(
int
allotId
)
...
...
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