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
0ef5a6e6
Commit
0ef5a6e6
authored
Jan 21, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取成本收入配置根据项目配置,是否通过http请求插入数据
parent
4e0021ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
104 deletions
+79
-104
performance/Performance.Api/Controllers/ExConfigController.cs
+36
-16
performance/Performance.Api/Controllers/TemplateController.cs
+33
-85
performance/Performance.Services/ExConfigService.cs
+10
-3
No files found.
performance/Performance.Api/Controllers/ExConfigController.cs
View file @
0ef5a6e6
...
...
@@ -71,12 +71,24 @@ public ApiResponse FeeSource([FromBody] ModModuleRequest request)
if
(
request
.
HospitalId
==
null
||
request
.
HospitalId
.
Value
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 参数错误!"
);
var
http
=
new
RestSharpHelper
();
var
url
=
http
.
SetUrl
(
options
.
HttpPost
,
"/modextract/source"
);
var
req
=
http
.
CreatePostRequest
(
JsonHelper
.
Serialize
(
request
));
var
res
=
http
.
GetResponse
(
url
,
req
);
var
ret
=
http
.
GetContent
<
ApiResponse
>(
res
);
return
new
ApiResponse
(
ResponseType
.
OK
,
ret
.
Data
);
bool
isSingle
=
false
;
configService
.
QueryHosConfigs
(
request
.
ModuleId
.
Value
,
ref
isSingle
,
out
int
sheetType
);
ModFeeResponse
response
;
if
(
isSingle
)
{
response
=
configService
.
FeeSource
(
request
);
}
else
{
var
http
=
new
RestSharpHelper
();
var
url
=
http
.
SetUrl
(
options
.
HttpPost
,
"/modextract/source"
);
var
req
=
http
.
CreatePostRequest
(
JsonHelper
.
Serialize
(
request
));
var
res
=
http
.
GetResponse
(
url
,
req
);
var
ret
=
http
.
GetContent
<
ApiResponse
<
ModFeeResponse
>>(
res
);
response
=
ret
.
Data
;
}
return
new
ApiResponse
(
ResponseType
.
OK
,
response
);
}
/// <summary>
...
...
@@ -165,20 +177,28 @@ public ApiResponse AddItem([FromBody] ItemListRequest request)
[
HttpPost
]
public
ApiResponse
Items
([
FromBody
]
ModItemRequest
request
)
{
if
(!
configService
.
QueryHosConfigs
(
request
.
ModuleId
.
Value
,
out
int
sheetType
))
bool
isSingle
=
false
;
if
(!
configService
.
QueryHosConfigs
(
request
.
ModuleId
.
Value
,
ref
isSingle
,
out
int
sheetType
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
"当前医院未配置地址"
);
if
(
sheetType
==
(
int
)
SheetType
.
Income
)
{
logger
.
LogInformation
(
$"绩效收入模板配置项列表 : 请求地址
{
options
.
HttpPost
}
/modextract/items"
);
var
http
=
new
RestSharpHelper
();
var
url
=
http
.
SetUrl
(
options
.
HttpPost
,
"/modextract/items"
);
var
req
=
http
.
CreatePostRequest
(
JsonHelper
.
Serialize
(
request
));
var
res
=
http
.
GetResponse
(
url
,
req
);
var
ret
=
http
.
GetContent
<
ApiResponse
>(
res
);
logger
.
LogInformation
(
$"绩效收入模板配置项列表在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:ss完成请求"
)}
"
);
if
(
isSingle
)
{
configService
.
AddItems
(
request
.
ModuleId
.
Value
);
}
else
{
logger
.
LogInformation
(
$"绩效收入模板配置项列表 : 请求地址
{
options
.
HttpPost
}
/modextract/items"
);
var
http
=
new
RestSharpHelper
();
var
url
=
http
.
SetUrl
(
options
.
HttpPost
,
"/modextract/items"
);
var
req
=
http
.
CreatePostRequest
(
JsonHelper
.
Serialize
(
request
));
var
res
=
http
.
GetResponse
(
url
,
req
);
var
ret
=
http
.
GetContent
<
ApiResponse
>(
res
);
logger
.
LogInformation
(
$"绩效收入模板配置项列表在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:ss完成请求"
)}
"
);
}
}
var
list
=
configService
.
QueryItems
(
request
.
ModuleId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
...
...
performance/Performance.Api/Controllers/TemplateController.cs
View file @
0ef5a6e6
using
FluentValidation.AspNetCore
;
using
Hangfire
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
...
...
@@ -25,44 +25,48 @@ namespace Performance.Api.Controllers
[
Route
(
"api/[controller]"
)]
public
class
TemplateController
:
Controller
{
private
readonly
ILogger
logger
;
private
readonly
IHostingEnvironment
env
;
private
readonly
ClaimService
claim
;
private
readonly
WebapiUrl
url
;
private
readonly
Application
application
;
private
readonly
TemplateService
templateService
;
private
readonly
DFExtractService
extractService
;
private
readonly
ExtractIncomeService
extractIncomeService
;
private
readonly
ExtractService
extractEService
;
private
HospitalService
hospitalService
;
private
IHostingEnvironment
env
;
private
ClaimService
claim
;
private
Application
application
;
private
WebapiUrl
url
;
private
readonly
HospitalService
hospitalService
;
private
readonly
AllotService
allotService
;
private
readonly
LogManageService
logService
;
private
readonly
I
Logger
<
ExceptionsFilter
>
logger
;
private
readonly
I
ServiceScopeFactory
serviceScopeFactory
;
public
TemplateController
(
TemplateService
templateService
,
HospitalService
hospitalService
,
DFExtractService
extractService
,
ExtractIncomeService
extractIncomeService
,
ExtractService
extractEService
,
public
TemplateController
(
ILogger
<
ExceptionsFilter
>
logger
,
IHostingEnvironment
env
,
ClaimService
claim
,
IOptions
<
Application
>
options
,
IOptions
<
WebapiUrl
>
url
,
IOptions
<
Application
>
options
,
TemplateService
templateService
,
DFExtractService
extractService
,
ExtractIncomeService
extractIncomeService
,
ExtractService
extractEService
,
HospitalService
hospitalService
,
AllotService
allotService
,
LogManageService
logService
,
I
Logger
<
ExceptionsFilter
>
logger
)
I
ServiceScopeFactory
serviceScopeFactory
)
{
this
.
logger
=
logger
;
this
.
env
=
env
;
this
.
claim
=
claim
;
this
.
url
=
url
.
Value
;
this
.
application
=
options
.
Value
;
this
.
templateService
=
templateService
;
this
.
extractService
=
extractService
;
this
.
extractIncomeService
=
extractIncomeService
;
this
.
extractEService
=
extractEService
;
this
.
hospitalService
=
hospitalService
;
this
.
env
=
env
;
this
.
claim
=
claim
;
this
.
application
=
options
.
Value
;
this
.
url
=
url
.
Value
;
this
.
allotService
=
allotService
;
this
.
logService
=
logService
;
this
.
logger
=
logger
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
}
/// <summary>
...
...
@@ -162,71 +166,6 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
region
老版提取
///// <summary>
///// 提取绩效数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("extractdata")]
//[HttpPost]
//public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBody]AllotRequest request)
//{
// try
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot == null)
// return new ApiResponse(ResponseType.Fail, "该绩效无效");
// allot.IsExtracting = allot.IsExtracting ?? 0;
// if (allot.IsExtracting == 1)
// return new ApiResponse(ResponseType.Fail, "正在提取数据,请稍等。");
// var hospital = hospitalService.GetHopital(request.HospitalId.Value);
// if (hospital == null)
// return new ApiResponse(ResponseType.Fail, "医院无效");
// var email = claim.GetUserClaim(JwtClaimTypes.Mail);
// allot.IsExtracting = 1;
// allotService.Update(allot);
// string path = extractService.GetFilepath(hospital.ID, out int type);
// if (!string.IsNullOrEmpty(path) && type != 0)
// {
// //发送请求,返回路径
// string retJson = HttpHelper.HttpClient(url.ImportFirst + $"?type={type}&hospitalId={hospital.ID}&year={allot.Year}&month={allot.Month}", path);
// var ret = JsonHelper.Deserialize<ApiResponse>(retJson);
// if ((int)ret.State != 1)
// return new ApiResponse(ResponseType.Fail, "首次模板地址无效!");
// path = ret.Message;
// }
// string param = JsonHelper.Serialize(new
// {
// id = request.ID,
// hospitalId = hospital.ID,
// mail = email,
// path = path
// });
// HttpHelper.HttpPostNoRequest(url.ExtractData, param, true);
// //extractService.ExtractData(request.ID, user.Mail, hospital);
// //BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
// return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!");
// }
// catch (Exception ex)
// {
// var allot = allotService.GetAllot(request.ID);
// if (allot != null)
// {
// allot.IsExtracting = 3;
// allotService.Update(allot);
// }
// throw ex;
// }
//}
#
endregion
老版提取
#
region
新版提取
/// <summary>
...
...
@@ -249,6 +188,8 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if
(!
string
.
IsNullOrEmpty
(
message
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
//检验科室、费用类型是否需要补充
allot
.
IsExtracting
=
allot
.
IsExtracting
??
0
;
if
(
allot
.
IsExtracting
==
1
)
return
new
ApiResponse
(
ResponseType
.
OK
,
"正在提取数据,请稍等!"
,
new
{
IsExtracting
=
true
});
...
...
@@ -258,7 +199,14 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if
(
isSingle
)
{
string
extractFilePath
=
extractEService
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
"User"
+
claim
.
GetUserId
(),
filePath
,
true
);
Task
.
Run
(()
=>
{
using
(
var
scope
=
serviceScopeFactory
.
CreateScope
())
{
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
ExtractService
>();
string
extractFilePath
=
scopedServices
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
"User"
+
claim
.
GetUserId
(),
filePath
,
isSingle
);
}
});
}
else
{
...
...
performance/Performance.Services/ExConfigService.cs
View file @
0ef5a6e6
...
...
@@ -23,6 +23,7 @@ public class ExConfigService : IAutoInjection
private
readonly
PerforExspecialRepository
exspecialRepository
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforHospitalRepository
hospitalRepository
;
private
readonly
PerforExtractRepository
extractRepository
;
private
readonly
PerforModdicRepository
moddicRepository
;
private
readonly
ILogger
logger
;
...
...
@@ -34,6 +35,7 @@ public class ExConfigService : IAutoInjection
PerforExspecialRepository
exspecialRepository
,
PerforPerallotRepository
perallotRepository
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforHospitalRepository
hospitalRepository
,
PerforExtractRepository
extractRepository
,
PerforModdicRepository
moddicRepository
,
ILogger
<
ExConfigService
>
logger
)
...
...
@@ -45,6 +47,7 @@ public class ExConfigService : IAutoInjection
this
.
exspecialRepository
=
exspecialRepository
;
this
.
perallotRepository
=
perallotRepository
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
hospitalRepository
=
hospitalRepository
;
this
.
extractRepository
=
extractRepository
;
this
.
moddicRepository
=
moddicRepository
;
this
.
logger
=
logger
;
...
...
@@ -328,7 +331,7 @@ public void DelSpecial(int specialId)
#
endregion
特殊科室
public
bool
QueryHosConfigs
(
int
moduleId
,
out
int
sheetType
)
public
bool
QueryHosConfigs
(
int
moduleId
,
ref
bool
isSingle
,
out
int
sheetType
)
{
var
module
=
exmoduleRepository
.
GetEntity
(
t
=>
t
.
Id
==
moduleId
);
if
(
module
==
null
)
...
...
@@ -338,6 +341,11 @@ public bool QueryHosConfigs(int moduleId, out int sheetType)
//if (module.SheetType != (int)SheetType.Income)
// throw new PerformanceException("当前模板不能进行考核项目自动添加");
var
hospital
=
hospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
module
.
HospitalId
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院信息错误!"
);
isSingle
=
hospital
.
IsSingleProject
==
1
;
var
hospitalConfigs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
module
.
HospitalId
);
if
(
hospitalConfigs
!=
null
&&
hospitalConfigs
.
Any
())
return
true
;
...
...
@@ -564,4 +572,4 @@ public ModFeeResponse FeeSource(ModModuleRequest request)
return
new
ModFeeResponse
();
}
}
}
\ No newline at end of file
}
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