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
5f87b304
Commit
5f87b304
authored
May 16, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新exeractpath记录
parent
e0dddd80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
13 deletions
+47
-13
performance/Performance.Api/Controllers/TemplateController.cs
+13
-3
performance/Performance.DtoModels/Request/AllotRequest.cs
+6
-0
performance/Performance.EntityModels/Entity/per_allot.cs
+5
-0
performance/Performance.Services/ExtractService.cs
+23
-10
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
5f87b304
...
@@ -26,12 +26,14 @@ public class TemplateController : Controller
...
@@ -26,12 +26,14 @@ public class TemplateController : Controller
private
IHostingEnvironment
evn
;
private
IHostingEnvironment
evn
;
private
ClaimService
claim
;
private
ClaimService
claim
;
private
Application
application
;
private
Application
application
;
private
readonly
AllotService
allotService
;
public
TemplateController
(
TemplateService
templateService
,
public
TemplateController
(
TemplateService
templateService
,
HospitalService
hospitalService
,
HospitalService
hospitalService
,
ExtractService
extractService
,
ExtractService
extractService
,
IHostingEnvironment
evn
,
IHostingEnvironment
evn
,
ClaimService
claim
,
ClaimService
claim
,
IOptions
<
Application
>
options
)
IOptions
<
Application
>
options
,
AllotService
allotService
)
{
{
this
.
templateService
=
templateService
;
this
.
templateService
=
templateService
;
this
.
extractService
=
extractService
;
this
.
extractService
=
extractService
;
...
@@ -39,6 +41,7 @@ public class TemplateController : Controller
...
@@ -39,6 +41,7 @@ public class TemplateController : Controller
this
.
evn
=
evn
;
this
.
evn
=
evn
;
this
.
claim
=
claim
;
this
.
claim
=
claim
;
this
.
application
=
options
.
Value
;
this
.
application
=
options
.
Value
;
this
.
allotService
=
allotService
;
}
}
/// <summary>
/// <summary>
...
@@ -100,12 +103,19 @@ public ApiResponse Import([FromForm] IFormCollection form)
...
@@ -100,12 +103,19 @@ public ApiResponse Import([FromForm] IFormCollection form)
/// <returns></returns>
/// <returns></returns>
[
Route
(
"extractdata"
)]
[
Route
(
"extractdata"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
ExtractData
([
CustomizeValidator
(
RuleSet
=
"
Delete"
),
FromBody
]
Hospital
Request
request
)
public
ApiResponse
ExtractData
([
CustomizeValidator
(
RuleSet
=
"
Template"
),
FromBody
]
Allot
Request
request
)
{
{
var
hospital
=
hospitalService
.
GetHopital
(
request
.
ID
);
var
allot
=
allotService
.
GetAllot
(
request
.
ID
);
if
(
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该绩效无效"
);
var
hospital
=
hospitalService
.
GetHopital
(
request
.
HospitalId
.
Value
);
if
(
hospital
==
null
)
if
(
hospital
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"医院无效"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"医院无效"
);
var
user
=
claim
.
At
(
request
.
Token
);
var
user
=
claim
.
At
(
request
.
Token
);
//extractService.ExtractData(request.ID, user.Mail, hospital);
BackgroundJob
.
Enqueue
(()
=>
extractService
.
ExtractData
(
request
.
ID
,
user
.
Mail
,
hospital
));
BackgroundJob
.
Enqueue
(()
=>
extractService
.
ExtractData
(
request
.
ID
,
user
.
Mail
,
hospital
));
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
}
}
...
...
performance/Performance.DtoModels/Request/AllotRequest.cs
View file @
5f87b304
...
@@ -48,6 +48,12 @@ public AllotRequestValidator()
...
@@ -48,6 +48,12 @@ public AllotRequestValidator()
{
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
});
});
RuleSet
(
"Template"
,
()
=>
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
});
}
}
}
}
}
}
performance/Performance.EntityModels/Entity/per_allot.cs
View file @
5f87b304
...
@@ -70,5 +70,10 @@ public class per_allot
...
@@ -70,5 +70,10 @@ public class per_allot
/// 备注
/// 备注
/// </summary>
/// </summary>
public
string
Remark
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 提取绩效数据文件生成路径
/// </summary>
public
string
ExtractPath
{
get
;
set
;
}
}
}
}
}
performance/Performance.Services/ExtractService.cs
View file @
5f87b304
...
@@ -64,16 +64,16 @@ public class ExtractService : IAutoInjection
...
@@ -64,16 +64,16 @@ public class ExtractService : IAutoInjection
this
.
perforHospitalconfigRepository
=
perforHospitalconfigRepository
;
this
.
perforHospitalconfigRepository
=
perforHospitalconfigRepository
;
}
}
public
void
ExtractData
(
int
hospital
Id
,
string
mail
,
sys_hospital
hospital
)
public
void
ExtractData
(
int
allot
Id
,
string
mail
,
sys_hospital
hospital
)
{
{
List
<
PerSheet
>
sheetList
=
new
List
<
PerSheet
>();
List
<
PerSheet
>
sheetList
=
new
List
<
PerSheet
>();
try
try
{
{
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
Id
);
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
ID
);
var
configList
=
perforHospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
Id
);
var
configList
=
perforHospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
ID
);
var
firstList
=
perforPerfirstRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
Id
);
var
firstList
=
perforPerfirstRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
ID
);
var
scriptList
=
perforExtractRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
Id
);
var
scriptList
=
perforExtractRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
ID
);
if
(
configList
==
null
||
!
configList
.
Any
())
if
(
configList
==
null
||
!
configList
.
Any
())
throw
new
PerformanceException
(
$"暂不支持自动提取绩效数据"
);
throw
new
PerformanceException
(
$"暂不支持自动提取绩效数据"
);
...
@@ -94,16 +94,29 @@ public void ExtractData(int hospitalId, string mail, sys_hospital hospital)
...
@@ -94,16 +94,29 @@ public void ExtractData(int hospitalId, string mail, sys_hospital hospital)
else
else
{
{
//非首次 从数据库中获取人员信息,SHEET页信息,列头信息
//非首次 从数据库中获取人员信息,SHEET页信息,列头信息
var
allot
=
allotList
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
allotList
=
allotList
.
Where
(
t
=>
t
.
Path
!=
null
&&
t
.
Path
!=
""
).
ToList
();
sheetList
=
GetRepositoryData
(
allot
.
ID
);
if
(
allotList
!=
null
&&
allotList
.
Count
>
0
)
originalPath
=
allot
.
Path
;
{
var
allot
=
allotList
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
sheetList
=
GetRepositoryData
(
allot
.
ID
);
originalPath
=
allot
.
Path
;
}
else
throw
new
PerformanceException
(
$"历史绩效未上传文件"
);
}
}
var
dpath
=
Path
.
Combine
(
environment
.
ContentRootPath
,
"Files"
,
$"
{
hospital
Id
}
"
,
"autoextract"
);
var
dpath
=
Path
.
Combine
(
environment
.
ContentRootPath
,
"Files"
,
$"
{
hospital
.
ID
}
"
,
"autoextract"
);
FileHelper
.
CreateDirectory
(
dpath
);
FileHelper
.
CreateDirectory
(
dpath
);
string
path
=
Path
.
Combine
(
dpath
,
$"绩效数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
string
path
=
Path
.
Combine
(
dpath
,
$"绩效数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
//根据SHEET页信息,列头信息,创建EXCEL文件
//根据SHEET页信息,列头信息,创建EXCEL文件
if
(
WriteExcel
(
path
,
originalPath
,
sheetList
,
hospitalConfig
,
hospitalId
,
out
string
filepath
))
if
(
WriteExcel
(
path
,
originalPath
,
sheetList
,
hospitalConfig
,
hospital
.
ID
,
out
string
filepath
))
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
allot
.
ExtractPath
=
filepath
;
if
(!
string
.
IsNullOrEmpty
(
filepath
))
perforPerallotRepository
.
Update
(
allot
);
SendEmail
(
mail
,
filepath
,
$"
{
hospital
.
HosName
}
HIS数据提取成功"
,
$"
{
hospital
.
HosName
}
在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
成功提取。"
);
SendEmail
(
mail
,
filepath
,
$"
{
hospital
.
HosName
}
HIS数据提取成功"
,
$"
{
hospital
.
HosName
}
在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
成功提取。"
);
}
}
}
catch
(
PerformanceException
ex
)
catch
(
PerformanceException
ex
)
{
{
...
...
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