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
86a64175
Commit
86a64175
authored
May 31, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效数据调整
parent
2e468456
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
16 deletions
+40
-16
performance/Performance.Api/Controllers/TemplateController.cs
+2
-2
performance/Performance.Repository/PerforExtractRepository.cs
+1
-1
performance/Performance.Services/ExtractService.cs
+37
-13
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
86a64175
...
...
@@ -115,8 +115,8 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
return
new
ApiResponse
(
ResponseType
.
Fail
,
"医院无效"
);
var
user
=
claim
.
At
(
request
.
Token
);
//
extractService.ExtractData(request.ID, user.Mail, hospital);
BackgroundJob
.
Enqueue
(()
=>
extractService
.
ExtractData
(
request
.
ID
,
user
.
Mail
,
hospital
));
extractService
.
ExtractData
(
request
.
ID
,
user
.
Mail
,
hospital
);
//
BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
}
}
...
...
performance/Performance.Repository/PerforExtractRepository.cs
View file @
86a64175
...
...
@@ -22,7 +22,7 @@ public List<CustomExecute> ExecuteScript(IDbConnection connection, string sql, s
List
<
CustomExecute
>
result
=
new
List
<
CustomExecute
>();
using
(
connection
)
{
var
dataReader
=
connection
.
ExecuteReader
(
sql
,
param
);
var
dataReader
=
connection
.
ExecuteReader
(
sql
,
param
,
commandTimeout
:
1000
*
3600
*
24
);
int
row
=
0
;
while
(
dataReader
.
Read
())
{
...
...
performance/Performance.Services/ExtractService.cs
View file @
86a64175
...
...
@@ -138,16 +138,16 @@ public void ExtractData(int allotId, string mail, sys_hospital hospital)
/// <param name="body"></param>
private
void
SendEmail
(
string
mail
,
string
path
,
string
subject
,
string
body
)
{
var
message
=
new
EmailMessage
{
To
=
new
List
<
string
>
{
mail
},
DisplayName
=
"溯直健康"
,
Subject
=
subject
,
Body
=
body
};
if
(!
string
.
IsNullOrEmpty
(
path
))
message
.
Attachments
=
new
List
<
string
>
{
path
};
emailService
.
Send
(
message
);
//
var message = new EmailMessage
//
{
//
To = new List<string> { mail },
//
DisplayName = "溯直健康",
//
Subject = subject,
//
Body = body
//
};
//
if (!string.IsNullOrEmpty(path))
//
message.Attachments = new List<string> { path };
//
emailService.Send(message);
}
/// <summary>
...
...
@@ -167,10 +167,12 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
throw
new
PerformanceException
(
$"
{
originalPath
}
文件路径无效"
);
var
scriptList
=
perforExtractRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
connection
=
ConnectionBuilder
.
Create
(
DatabaseType
.
SqlServer
,
hospitalConfig
.
DbSource
,
hospitalConfig
.
DbName
,
hospitalConfig
.
DbUser
,
hospitalConfig
.
DbPassword
);
//根据SHEET页信息,列头信息,创建EXCEL文件
IWorkbook
workbook
=
new
XSSFWorkbook
(
originalPath
);
IWorkbook
workbook
=
null
;
try
{
workbook
=
new
XSSFWorkbook
(
originalPath
);
foreach
(
var
sheet
in
sheetList
)
{
var
importSheet
=
workbook
.
GetSheet
(
sheet
.
SheetName
);
...
...
@@ -238,6 +240,7 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
var
script
=
scriptList
.
First
(
t
=>
sheet
.
SheetName
.
Contains
(
t
.
SheetName
));
if
(!
string
.
IsNullOrEmpty
(
script
.
ExecuteScript
))
{
var
connection
=
ConnectionBuilder
.
Create
(
DatabaseType
.
SqlServer
,
hospitalConfig
.
DbSource
,
hospitalConfig
.
DbName
,
hospitalConfig
.
DbUser
,
hospitalConfig
.
DbPassword
);
var
dataList
=
perforExtractRepository
.
ExecuteScript
(
connection
,
script
.
ExecuteScript
,
null
);
//创建数据行
foreach
(
var
pointRow
in
dataList
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
OrderBy
(
t
=>
t
))
...
...
@@ -261,6 +264,15 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
filepath
=
newpath
;
return
true
;
}
catch
(
Exception
ex
)
{
throw
ex
;
}
finally
{
workbook
.
Close
();
}
}
/// <summary>
/// 从数据库中获取sheet及列头
...
...
@@ -318,8 +330,11 @@ private List<PerSheet> GetFileData(string path)
if
(!
FileHelper
.
IsExistFile
(
path
))
throw
new
PerformanceException
(
$"
{
path
}
文件不存在"
);
List
<
PerSheet
>
sheetList
=
new
List
<
PerSheet
>();
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Open
))
FileStream
fs
=
null
;
try
{
fs
=
new
FileStream
(
path
,
FileMode
.
Open
);
var
version
=
FileHelper
.
GetExtension
(
path
)
==
".xlsx"
?
ExcelVersion
.
xlsx
:
ExcelVersion
.
xls
;
IWorkbook
workbook
=
(
version
==
ExcelVersion
.
xlsx
)
?
(
IWorkbook
)(
new
XSSFWorkbook
(
fs
))
:
(
IWorkbook
)(
new
HSSFWorkbook
(
fs
));
for
(
int
i
=
0
;
i
<
workbook
.
NumberOfSheets
;
i
++)
...
...
@@ -348,6 +363,15 @@ private List<PerSheet> GetFileData(string path)
}
}
}
catch
(
Exception
ex
)
{
throw
ex
;
}
finally
{
fs
.
Close
();
}
return
sheetList
;
}
...
...
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