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
b932b898
Commit
b932b898
authored
Mar 09, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取修改
parent
123c69f4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
19 deletions
+54
-19
performance/Performance.Api/Controllers/TemplateController.cs
+8
-12
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+42
-6
performance/Performance.Extract.Api/Template/东方医院绩效模板.xlsx
+0
-0
performance/Performance.Services/DFExtractService.cs
+0
-0
performance/Performance.Services/NewExtractService.cs
+4
-1
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
b932b898
...
@@ -223,7 +223,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
...
@@ -223,7 +223,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
// 判断是那种抽取
// 判断是那种抽取
try
try
{
{
string
message
=
newExtractService
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
);
string
message
=
newExtractService
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
,
out
string
filePath
);
if
(!
string
.
IsNullOrEmpty
(
message
))
if
(!
string
.
IsNullOrEmpty
(
message
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
...
@@ -233,18 +233,14 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
...
@@ -233,18 +233,14 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
allot
.
IsExtracting
=
1
;
allot
.
IsExtracting
=
1
;
allotService
.
Update
(
allot
);
allotService
.
Update
(
allot
);
//request.Email = claim.GetUserClaim(JwtClaimTypes.Mail);
var
email
=
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
);
request
.
Email
=
email
;
//if (request.UseScheme == (int)UseTemplate.Config)
//{
logger
.
LogInformation
(
"提取绩效数据请求路径:"
+
url
.
HttpPost
+
"/extract/extract"
);
logger
.
LogInformation
(
"提取绩效数据请求路径:"
+
url
.
HttpPost
+
"/extract/extract"
);
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
"/extract/extract"
,
JsonHelper
.
Serialize
(
request
),
true
);
//
HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true);
//}
if
(
string
.
IsNullOrEmpty
(
filePath
))
//else
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
"
,
""
);
//{
else
// return new ApiResponse(ResponseType.Fail, "该功能暂未实现!"
);
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
"
,
filePath
);
//}
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
b932b898
...
@@ -118,14 +118,48 @@ public void Index([FromBody]AllotRequest request)
...
@@ -118,14 +118,48 @@ public void Index([FromBody]AllotRequest request)
/// <returns></returns>
/// <returns></returns>
[
Route
(
"extract"
)]
[
Route
(
"extract"
)]
[
HttpPost
]
[
HttpPost
]
public
void
ExtractData
([
CustomizeValidator
,
FromBody
]
ExtractRequest
request
)
public
void
ExtractData
([
FromForm
]
IFormCollection
form
,
int
allotId
,
int
hospitalId
,
string
email
)
{
{
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
request
));
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
hospitalId
,
email
}));
//string filePath = newExtractService.ExtractData(request.AllotId, request.Email, request.HospitalId);
if
(
allotId
==
0
||
hospitalId
==
0
)
string
filePath
=
dfExtractService
.
ExtractData
(
request
.
AllotId
,
request
.
Email
,
request
.
HospitalId
);
return
;
var
path
=
string
.
Empty
;
#
region
保存历史绩效文件
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
if
(
file
==
null
)
logger
.
LogInformation
(
$"文件为空!"
);
else
{
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
,
"Files"
,
"HospitalAllot"
,
$"
{
hospitalId
}
"
);
FileHelper
.
CreateDirectory
(
dpath
);
path
=
Path
.
Combine
(
dpath
,
FileHelper
.
GetFileName
(
file
.
FileName
));
logger
.
LogInformation
(
$"保存历史绩效文件保存路径:"
+
path
);
using
(
var
stream
=
file
.
OpenReadStream
())
{
byte
[]
bytes
=
new
byte
[
stream
.
Length
];
stream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
if
(!
FileHelper
.
CreateFile
(
path
,
bytes
))
{
logger
.
LogInformation
(
$"保存历史绩效文件保存失败"
);
}
}
}
#
endregion
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId);
string
filePath
=
dfExtractService
.
ExtractData
(
allotId
,
email
,
hospitalId
,
path
);
//抽取
if
(!
string
.
IsNullOrEmpty
(
path
)
&&
FileHelper
.
IsExistFile
(
path
))
FileHelper
.
DeleteFile
(
path
);
#
region
保存文件到网站下
if
(!
string
.
IsNullOrEmpty
(
filePath
)
&&
FileHelper
.
IsExistFile
(
filePath
))
if
(!
string
.
IsNullOrEmpty
(
filePath
)
&&
FileHelper
.
IsExistFile
(
filePath
))
{
{
logger
.
LogInformation
(
"请求路径:"
+
url
.
ImportFile
+
",请求参数"
+
JsonHelper
.
Serialize
(
new
{
allotId
=
request
.
AllotId
,
hospitalId
=
request
.
H
ospitalId
}));
logger
.
LogInformation
(
"请求路径:"
+
url
.
ImportFile
+
",请求参数"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
h
ospitalId
}));
int
i
=
1
;
int
i
=
1
;
while
(
i
<=
5
)
while
(
i
<=
5
)
{
{
...
@@ -135,7 +169,7 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
...
@@ -135,7 +169,7 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
logger
.
LogInformation
(
$"正在尝试第
{
i
}
次保存!"
);
logger
.
LogInformation
(
$"正在尝试第
{
i
}
次保存!"
);
//保存文件
//保存文件
string
retJson
=
HttpHelper
.
HttpClient
(
url
.
ImportFile
+
$"?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
H
ospitalId
}
"
,
filePath
);
string
retJson
=
HttpHelper
.
HttpClient
(
url
.
ImportFile
+
$"?allotId=
{
allotId
}
&hospitalId=
{
h
ospitalId
}
"
,
filePath
);
logger
.
LogInformation
(
"保存提取文件返回结果:"
+
JsonHelper
.
Serialize
(
retJson
));
logger
.
LogInformation
(
"保存提取文件返回结果:"
+
JsonHelper
.
Serialize
(
retJson
));
logger
.
LogInformation
(
retJson
);
logger
.
LogInformation
(
retJson
);
var
ret
=
JsonHelper
.
Deserialize
<
ApiResponse
>(
retJson
);
var
ret
=
JsonHelper
.
Deserialize
<
ApiResponse
>(
retJson
);
...
@@ -149,6 +183,8 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
...
@@ -149,6 +183,8 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
}
}
else
else
logger
.
LogInformation
(
$"保存提取文件提取文件不存在!"
);
logger
.
LogInformation
(
$"保存提取文件提取文件不存在!"
);
#
endregion
}
}
#
endregion
#
endregion
...
...
performance/Performance.Extract.Api/Template/东方医院绩效模板.xlsx
View file @
b932b898
No preview for this file type
performance/Performance.Services/DFExtractService.cs
View file @
b932b898
This diff is collapsed.
Click to expand it.
performance/Performance.Services/NewExtractService.cs
View file @
b932b898
...
@@ -888,9 +888,10 @@ public void OutToExcelCell(ICell cell, object obj)
...
@@ -888,9 +888,10 @@ public void OutToExcelCell(ICell cell, object obj)
/// <param name="allotId"></param>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="hospitalId"></param>
/// <param name="useTemplate"></param>
/// <param name="useTemplate"></param>
public
string
Judge
(
int
allotId
,
int
hospitalId
,
int
useTemplate
)
public
string
Judge
(
int
allotId
,
int
hospitalId
,
int
useTemplate
,
out
string
filePath
)
{
{
string
result
=
null
;
string
result
=
null
;
filePath
=
""
;
try
try
{
{
// 获取绩效信息
// 获取绩效信息
...
@@ -909,6 +910,8 @@ public string Judge(int allotId, int hospitalId, int useTemplate)
...
@@ -909,6 +910,8 @@ public string Judge(int allotId, int hospitalId, int useTemplate)
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
if
(
allotLast
!=
null
)
filePath
=
allotLast
.
Path
;
// 获取当前医院模版信息
// 获取当前医院模版信息
var
modulesList
=
perforModmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
modulesList
=
perforModmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
modulesList
==
null
||
modulesList
.
Count
==
0
)
if
(
modulesList
==
null
||
modulesList
.
Count
==
0
)
...
...
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