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
74668ca7
Commit
74668ca7
authored
Feb 14, 2022
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改提取信息配置接口内容
parent
08701f2e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
326 additions
and
468 deletions
+326
-468
performance/Performance.Api/Controllers/ExtractController.cs
+0
-310
performance/Performance.Api/Controllers/ModExtractController.cs
+199
-2
performance/Performance.Api/wwwroot/Performance.Api.xml
+74
-74
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+1
-1
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
+8
-4
performance/Performance.EntityModels/Entity/ex_script.cs
+1
-1
performance/Performance.Services/ExConfigService.cs
+15
-18
performance/Performance.Services/ExtractExcelService/ExtractPreConfigService.cs
+28
-58
No files found.
performance/Performance.Api/Controllers/ExtractController.cs
deleted
100644 → 0
View file @
08701f2e
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Microsoft.Extensions.DependencyInjection
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Services
;
using
Performance.Services.ExtractExcelService
;
using
Performance.Services.Queues
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Threading.Tasks
;
namespace
Performance.Api.Controllers
{
[
Route
(
"api/extract"
)]
[
ApiController
]
public
class
ExtractController
:
ControllerBase
{
private
readonly
ClaimService
_claim
;
private
readonly
AllotService
_allotService
;
private
readonly
CustomExtractService
_extractService
;
private
readonly
IServiceScopeFactory
_serviceScopeFactory
;
private
readonly
IBackgroundTaskQueue
_backgroundTaskQueue
;
private
readonly
IHubNotificationQueue
_notificationQueue
;
private
readonly
ExtractPreConfigService
_preConfigService
;
public
ExtractController
(
ClaimService
claim
,
AllotService
allotService
,
CustomExtractService
extractService
,
IServiceScopeFactory
serviceScopeFactory
,
IBackgroundTaskQueue
backgroundTaskQueue
,
IHubNotificationQueue
notificationQueue
,
ExtractPreConfigService
preConfigService
)
{
_claim
=
claim
;
_allotService
=
allotService
;
_extractService
=
extractService
;
_serviceScopeFactory
=
serviceScopeFactory
;
_backgroundTaskQueue
=
backgroundTaskQueue
;
_notificationQueue
=
notificationQueue
;
_preConfigService
=
preConfigService
;
}
#
region
自定义提取
///// <summary>
///// 自定义提取
///// </summary>
///// <param name="allotId"></param>
///// <returns></returns>
//[HttpPost("custom/{allotId}")]
//public ApiResponse CustomExtract(int allotId)
//{
// var userId = _claim.GetUserId();
// if (!_extractService.CheckConfigScript(userId, allotId))
// return new ApiResponse(ResponseType.Fail, "未配置自定义抽取,请联系绩效管理人员。");
// _backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
// {
// using (var scope = _serviceScopeFactory.CreateScope())
// {
// var scopedServices = scope.ServiceProvider.GetRequiredService<CustomExtractService>();
// var scopedAllotService = scope.ServiceProvider.GetRequiredService<AllotService>();
// var scopedQueue = scope.ServiceProvider.GetRequiredService<IHubNotificationQueue>();
// if (scopedServices.ExtractData(userId, allotId, out string resultFilePath))
// {
// scopedAllotService.UpdateAllotCustomExtractPath(allotId, resultFilePath);
// scopedQueue.Send(new Notification(allotId, "CustomDowoload", new CustomDownloadContent("自定义数据提取数据成功,是否立即下载", allotId)));
// }
// else
// {
// scopedQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取数据失败", NotificationLevel.ERR)));
// }
// await Task.Delay(TimeSpan.FromSeconds(5), token);
// }
// });
// _notificationQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取任务开始执行")));
// return new ApiResponse(ResponseType.OK);
//}
///// <summary>
///// 从WebAPI下载文件
///// </summary>
///// <returns></returns>
//[Route("down/{allotId}")]
//[HttpGet]
//[AllowAnonymous]
//public IActionResult DownFile(int allotId)
//{
// var allot = _allotService.GetAllot(allotId);
// if (allot == null || string.IsNullOrWhiteSpace(allot.CustomExtractPath) || !FileHelper.IsExistFile(allot.CustomExtractPath))
// {
// return new ObjectResult(new ApiResponse(ResponseType.Fail, "文件不存在"));
// }
// var memoryStream = new MemoryStream();
// using (var stream = new FileStream(allot.CustomExtractPath, FileMode.Open))
// {
// stream.CopyToAsync(memoryStream).Wait();
// }
// memoryStream.Seek(0, SeekOrigin.Begin);
// string fileExt = Path.GetExtension(allot.CustomExtractPath);
// var provider = new FileExtensionContentTypeProvider();
// var memi = provider.Mappings[fileExt];
// return File(memoryStream, memi, Path.GetFileName(allot.CustomExtractPath));
//}
#
endregion
#
region
医院数据库配置
/// <summary>
/// 医院数据库配置列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"hospital/config/{hospitalId}"
)]
public
ApiResponse
<
List
<
sys_hospitalconfig
>>
GetHospitalConfig
([
FromRoute
]
int
hospitalId
)
{
if
(
hospitalId
==
0
)
return
new
ApiResponse
<
List
<
sys_hospitalconfig
>>(
ResponseType
.
ParameterError
,
"参数错误"
);
var
list
=
_preConfigService
.
GetHospitalConfig
(
hospitalId
);
return
new
ApiResponse
<
List
<
sys_hospitalconfig
>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 创建医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/create"
)]
public
ApiResponse
CreateHospitalConfig
([
FromBody
]
sys_hospitalconfig
hospitalconfig
)
{
if
(
hospitalconfig
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
CreateHospitalConfig
(
hospitalconfig
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 修改医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/update"
)]
public
ApiResponse
UpdateHospitalConfig
([
FromBody
]
sys_hospitalconfig
hospitalconfig
)
{
if
(
hospitalconfig
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
UpdateHospitalConfig
(
hospitalconfig
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 删除医院数据库配置
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/{hospitalconfigId}"
)]
public
ApiResponse
DeleteHospitalConfig
([
FromRoute
]
int
hospitalconfigId
)
{
if
(
hospitalconfigId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
DeleteHospitalConfig
(
hospitalconfigId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 测试连接
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/connection/{hospitalconfigId}"
)]
public
ApiResponse
TestConnectionCleared
([
FromRoute
]
int
hospitalconfigId
)
{
if
(
hospitalconfigId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
TestConnectionCleared
(
hospitalconfigId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"连接成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"连接失败"
);
}
#
endregion
#
region
提取
script
配置
/// <summary>
/// 数据提取信息列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"type/{hospitalId}"
)]
public
ApiResponse
GetExtractTypeAndScript
([
FromRoute
]
int
hospitalId
)
{
if
(
hospitalId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
list
=
_preConfigService
.
GetExtractTypeAndScript
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 数据提取详情
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[
HttpGet
(
"type/{typeId}/{scriptId}"
)]
public
ApiResponse
GetExtractTypeAndScriptById
([
FromRoute
]
int
typeId
,
int
scriptId
)
{
if
(
typeId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
data
=
_preConfigService
.
GetExtractTypeAndScriptById
(
typeId
,
scriptId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
/// <summary>
/// 删除提取Sql
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[
HttpPost
(
"type/{typeId}/{scriptId}"
)]
public
ApiResponse
DeleteExtractTypeAndScript
([
FromRoute
]
int
typeId
,
int
scriptId
)
{
if
(
typeId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
DeleteExtractTypeAndScript
(
typeId
,
scriptId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"删除失败"
);
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="typeId"></param>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
(
"type/{typeId}/edit"
)]
public
ApiResponse
EditExtractTypeAndScript
([
FromRoute
]
int
typeId
,
[
FromBody
]
ExtractConfigResponse
request
)
{
if
(
typeId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
EditExtractTypeAndScript
(
typeId
,
request
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"操作成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"操作失败"
);
}
/// <summary>
/// 执行Sql
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
(
"type/{typeId}/querytime"
)]
public
ApiResponse
CheckExecsqlConsumeTime
([
FromBody
]
ConsumeTimeRequest
request
)
{
if
(
request
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
CheckExecsqlConsumeTime
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
flag
);
}
#
endregion
#
region
字典
/// <summary>
/// 数据库类型
/// </summary>
/// <returns></returns>
[
HttpGet
(
"database"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetDatatypes
()
{
var
list
=
_preConfigService
.
GetDatatypes
();
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 来源类型
/// </summary>
/// <returns></returns>
[
HttpGet
(
"sheettype"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetSheettypes
()
{
var
list
=
_preConfigService
.
GetSheettypes
();
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 医院数据库连接配置
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"config/{hospitalId}"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetConfigs
([
FromRoute
]
int
hospitalId
)
{
var
list
=
_preConfigService
.
GetConfigs
(
hospitalId
);
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
#
endregion
}
}
performance/Performance.Api/Controllers/ModExtractController.cs
View file @
74668ca7
...
...
@@ -2,12 +2,14 @@
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Services
;
using
Performance.Services.ExtractExcelService
;
using
Performance.Services.Queues
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Threading.Tasks
;
...
...
@@ -22,6 +24,7 @@ public class ModExtractController : Controller
private
readonly
IServiceScopeFactory
_serviceScopeFactory
;
private
readonly
IBackgroundTaskQueue
_backgroundTaskQueue
;
private
readonly
IHubNotificationQueue
_notificationQueue
;
private
readonly
ExtractPreConfigService
_preConfigService
;
public
ModExtractController
(
ClaimService
claim
,
...
...
@@ -29,7 +32,9 @@ public class ModExtractController : Controller
CustomExtractService
extractService
,
IServiceScopeFactory
serviceScopeFactory
,
IBackgroundTaskQueue
backgroundTaskQueue
,
IHubNotificationQueue
notificationQueue
)
IHubNotificationQueue
notificationQueue
,
ExtractPreConfigService
preConfigService
)
{
_claim
=
claim
;
_allotService
=
allotService
;
...
...
@@ -37,6 +42,7 @@ public class ModExtractController : Controller
_serviceScopeFactory
=
serviceScopeFactory
;
_backgroundTaskQueue
=
backgroundTaskQueue
;
_notificationQueue
=
notificationQueue
;
_preConfigService
=
preConfigService
;
}
[
HttpPost
(
"custom/{allotId}"
)]
...
...
@@ -99,5 +105,195 @@ public IActionResult DownFile(int allotId)
var
memi
=
provider
.
Mappings
[
fileExt
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
allot
.
CustomExtractPath
));
}
#
region
医院数据库配置
/// <summary>
/// 医院数据库配置列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"hospital/config/{hospitalId}"
)]
public
ApiResponse
<
List
<
sys_hospitalconfig
>>
GetHospitalConfig
([
FromRoute
]
int
hospitalId
)
{
if
(
hospitalId
==
0
)
return
new
ApiResponse
<
List
<
sys_hospitalconfig
>>(
ResponseType
.
ParameterError
,
"参数错误"
);
var
list
=
_preConfigService
.
GetHospitalConfig
(
hospitalId
);
return
new
ApiResponse
<
List
<
sys_hospitalconfig
>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 创建医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/create"
)]
public
ApiResponse
CreateHospitalConfig
([
FromBody
]
sys_hospitalconfig
hospitalconfig
)
{
if
(
hospitalconfig
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
CreateHospitalConfig
(
hospitalconfig
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 修改医院数据库配置
/// </summary>
/// <param name="hospitalconfig"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/update"
)]
public
ApiResponse
UpdateHospitalConfig
([
FromBody
]
sys_hospitalconfig
hospitalconfig
)
{
if
(
hospitalconfig
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
UpdateHospitalConfig
(
hospitalconfig
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 删除医院数据库配置
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/config/{hospitalconfigId}"
)]
public
ApiResponse
DeleteHospitalConfig
([
FromRoute
]
int
hospitalconfigId
)
{
if
(
hospitalconfigId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
DeleteHospitalConfig
(
hospitalconfigId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"添加失败"
);
}
/// <summary>
/// 测试连接
/// </summary>
/// <param name="hospitalconfigId"></param>
/// <returns></returns>
[
HttpPost
(
"hospital/connection/{hospitalconfigId}"
)]
public
ApiResponse
TestConnectionCleared
([
FromRoute
]
int
hospitalconfigId
)
{
if
(
hospitalconfigId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
TestConnectionCleared
(
hospitalconfigId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"连接成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"连接失败"
);
}
#
endregion
#
region
提取
script
配置
/// <summary>
/// 数据提取信息列表
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"type/{hospitalId}"
)]
public
ApiResponse
GetExtractTypeAndScript
([
FromRoute
]
int
hospitalId
)
{
if
(
hospitalId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
list
=
_preConfigService
.
GetExtractTypeAndScript
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 数据提取详情
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[
HttpGet
(
"type/{typeId}/{scriptId}"
)]
public
ApiResponse
GetExtractTypeAndScriptById
([
FromRoute
]
int
typeId
,
int
scriptId
)
{
if
(
typeId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
data
=
_preConfigService
.
GetExtractTypeAndScriptById
(
typeId
,
scriptId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
/// <summary>
/// 删除提取Sql
/// </summary>
/// <param name="typeId"></param>
/// <param name="scriptId"></param>
/// <returns></returns>
[
HttpPost
(
"type/{typeId}/{scriptId}"
)]
public
ApiResponse
DeleteExtractTypeAndScript
([
FromRoute
]
int
typeId
,
int
scriptId
)
{
if
(
typeId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
DeleteExtractTypeAndScript
(
typeId
,
scriptId
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"删除失败"
);
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
(
"type/{hospitalId}/save"
)]
public
ApiResponse
EditExtractTypeAndScript
([
FromRoute
]
int
hospitalId
,
[
FromBody
]
ExtractConfigResponse
request
)
{
var
flag
=
_preConfigService
.
EditExtractTypeAndScript
(
hospitalId
,
request
);
return
flag
?
new
ApiResponse
(
ResponseType
.
OK
,
"操作成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"操作失败"
);
}
/// <summary>
/// 执行Sql
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
(
"type/{typeId}/execute"
)]
public
ApiResponse
ExecsqlAndGetResult
([
FromBody
]
ConsumeTimeRequest
request
)
{
if
(
request
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"参数错误"
);
var
flag
=
_preConfigService
.
ExecsqlAndGetResult
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
flag
);
}
#
endregion
#
region
字典
/// <summary>
/// 数据库类型
/// </summary>
/// <returns></returns>
[
HttpGet
(
"database"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetDatatypes
()
{
var
list
=
ExtractPreConfigService
.
GetDatatypes
();
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 来源类型
/// </summary>
/// <returns></returns>
[
HttpGet
(
"sheettype"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetSheettypes
()
{
var
list
=
ExtractPreConfigService
.
GetSheettypes
();
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 医院数据库连接配置
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[
HttpGet
(
"config/{hospitalId}"
)]
public
ApiResponse
<
List
<
TitleValue
<
int
>>>
GetConfigs
([
FromRoute
]
int
hospitalId
)
{
var
list
=
_preConfigService
.
GetConfigs
(
hospitalId
);
return
new
ApiResponse
<
List
<
TitleValue
<
int
>>>(
ResponseType
.
OK
,
list
);
}
#
endregion
}
}
\ No newline at end of file
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
74668ca7
...
...
@@ -1347,190 +1347,190 @@
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetHospitalConfig(System.Int32
)"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.Guarantee(Performance.DtoModels.GuaranteeRequest
)"
>
<summary>
医院数据库
配置列表
保底绩效
配置列表
</summary>
<param
name=
"
hospitalId
"
></param>
<param
name=
"
request
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.CreateHospitalConfig(Performance.EntityModels.sys_hospitalconfig
)"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantInsert(Performance.DtoModels.GuaranteeRequest
)"
>
<summary>
创建医院数据库
配置
新增保底绩效
配置
</summary>
<param
name=
"
hospitalconfig
"
></param>
<param
name=
"
request
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.UpdateHospitalConfig(Performance.EntityModels.sys_hospitalconfig
)"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantUpdate(Performance.DtoModels.GuaranteeRequest
)"
>
<summary>
修改
医院数据库
配置
修改
保底绩效
配置
</summary>
<param
name=
"
hospitalconfig
"
></param>
<param
name=
"
request
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.DeleteHospitalConfig(System.Int32
)"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantDelete(Performance.DtoModels.GuaranteeRequest
)"
>
<summary>
删除
医院数据库
配置
删除
保底绩效
配置
</summary>
<param
name=
"
hospitalconfigId
"
></param>
<param
name=
"
request
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.TestConnectionCleared(System.Int32
)"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.Accounting(Performance.DtoModels.GuaranteeRequest
)"
>
<summary>
测试连接
医院核算单元
</summary>
<param
name=
"
hospitalconfigId
"
></param>
<param
name=
"
request
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetExtractTypeAndScript(System.Int32)
"
>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.UnitType
"
>
<summary>
数据提取信息列表
医院核算单元
</summary>
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetExtractTypeAndScriptById(System.Int32,System.Int32
)"
>
<member
name=
"M:Performance.Api.Controllers.
HistoryController.Import(Microsoft.AspNetCore.Http.IFormCollection
)"
>
<summary>
数据提取详情
上传历史绩效数据
</summary>
<param
name=
"typeId"
></param>
<param
name=
"scriptId"
></param>
<param
name=
"form"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.DeleteExtractTypeAndScript(System.Int32,System.Int32)
"
>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.GetHospitalList
"
>
<summary>
删除提取Sql
获取当前登录用户管辖医院列表
</summary>
<param
name=
"typeId"
></param>
<param
name=
"scriptId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.EditExtractTypeAndScript(System.Int32,Performance.DtoModels.ExtractConfigResponse
)"
>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Insert(Performance.DtoModels.HospitalRequest
)"
>
<summary>
修改提取信息
新增医院
</summary>
<param
name=
"typeId"
></param>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.CheckExecsqlConsumeTime(Performance.DtoModels.ConsumeTime
Request)"
>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Update(Performance.DtoModels.Hospital
Request)"
>
<summary>
检查Sql执行时间
修改医院信息
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetDatatypes
"
>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Delete(Performance.DtoModels.HospitalRequest)
"
>
<summary>
数据库类型
删除医院
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetSheettypes
"
>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Disabled(Performance.DtoModels.HospitalRequest)
"
>
<summary>
来源类型
启用/禁用医院
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
ExtractController.GetConfigs(System.Int32)
"
>
<member
name=
"M:Performance.Api.Controllers.
MenuController.MenuList
"
>
<summary>
医院数据库连接配置
设置用户管辖医院
</summary>
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.Guarantee(Performance.DtoModels.GuaranteeRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.DownFile(System.Int32
)"
>
<summary>
保底绩效配置列表
从WebAPI下载文件
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantInsert(Performance.DtoModels.GuaranteeRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.GetHospitalConfig(System.Int32
)"
>
<summary>
新增保底绩效配置
医院数据库配置列表
</summary>
<param
name=
"
request
"
></param>
<param
name=
"
hospitalId
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantUpdate(Performance.DtoModels.GuaranteeRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.CreateHospitalConfig(Performance.EntityModels.sys_hospitalconfig
)"
>
<summary>
修改保底绩效
配置
创建医院数据库
配置
</summary>
<param
name=
"
request
"
></param>
<param
name=
"
hospitalconfig
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.GuarantDelete(Performance.DtoModels.GuaranteeRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.UpdateHospitalConfig(Performance.EntityModels.sys_hospitalconfig
)"
>
<summary>
删除保底绩效
配置
修改医院数据库
配置
</summary>
<param
name=
"
request
"
></param>
<param
name=
"
hospitalconfig
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.Accounting(Performance.DtoModels.GuaranteeRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.DeleteHospitalConfig(System.Int32
)"
>
<summary>
医院核算单元
删除医院数据库配置
</summary>
<param
name=
"
request
"
></param>
<param
name=
"
hospitalconfigId
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
GuaranteeController.UnitType
"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.TestConnectionCleared(System.Int32)
"
>
<summary>
医院核算单元
测试连接
</summary>
<param
name=
"hospitalconfigId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HistoryController.Import(Microsoft.AspNetCore.Http.IFormCollection
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.GetExtractTypeAndScript(System.Int32
)"
>
<summary>
上传历史绩效数据
数据提取信息列表
</summary>
<param
name=
"
form
"
></param>
<param
name=
"
hospitalId
"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.GetHospitalList
"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.GetExtractTypeAndScriptById(System.Int32,System.Int32)
"
>
<summary>
获取当前登录用户管辖医院列表
数据提取详情
</summary>
<param
name=
"typeId"
></param>
<param
name=
"scriptId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Insert(Performance.DtoModels.HospitalRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.DeleteExtractTypeAndScript(System.Int32,System.Int32
)"
>
<summary>
新增医院
删除提取Sql
</summary>
<param
name=
"request"
></param>
<param
name=
"typeId"
></param>
<param
name=
"scriptId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Update(Performance.DtoModels.HospitalRequest
)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.EditExtractTypeAndScript(System.Int32,Performance.DtoModels.ExtractConfigResponse
)"
>
<summary>
修改医院信息
保存数据
</summary>
<param
name=
"hospitalId"
></param>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Delete(Performance.DtoModels.Hospital
Request)"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.ExecsqlAndGetResult(Performance.DtoModels.ConsumeTime
Request)"
>
<summary>
删除医院
执行Sql
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.
HospitalController.Disabled(Performance.DtoModels.HospitalRequest)
"
>
<member
name=
"M:Performance.Api.Controllers.
ModExtractController.GetDatatypes
"
>
<summary>
启用/禁用医院
数据库类型
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.M
enuController.MenuList
"
>
<member
name=
"M:Performance.Api.Controllers.M
odExtractController.GetSheettypes
"
>
<summary>
设置用户管辖医院
来源类型
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.ModExtractController.
DownFile
(System.Int32)"
>
<member
name=
"M:Performance.Api.Controllers.ModExtractController.
GetConfigs
(System.Int32)"
>
<summary>
从WebAPI下载文件
医院数据库连接配置
</summary>
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"T:Performance.Api.Controllers.OriginalController"
>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
74668ca7
...
...
@@ -3661,7 +3661,7 @@
</member>
<member
name=
"P:Performance.EntityModels.ex_script.IsExecSuccess"
>
<summary>
是否执行通过
是否执行通过
0 未执行 1 通过 2 失败
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ex_script.Description"
>
...
...
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
74668ca7
...
...
@@ -256,14 +256,18 @@ public AutoMapperConfigs()
CreateMap
<
ex_type
,
ExtractConfigResponse
>()
.
ForMember
(
dest
=>
dest
.
TypeId
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ForMember
(
dest
=>
dest
.
Value
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ForMember
(
dest
=>
dest
.
Title
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
EName
))
.
ReverseMap
();
.
ForMember
(
dest
=>
dest
.
Title
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
EName
));
CreateMap
<
ExtractConfigResponse
,
ex_type
>()
.
ForMember
(
dest
=>
dest
.
Id
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
TypeId
));
CreateMap
<
ex_script
,
ExtractConfigResponse
>()
.
ForMember
(
dest
=>
dest
.
ExScriptId
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ForMember
(
dest
=>
dest
.
Value
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ForMember
(
dest
=>
dest
.
Title
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Name
))
.
ReverseMap
();
.
ForMember
(
dest
=>
dest
.
Title
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Name
));
CreateMap
<
ExtractConfigResponse
,
ex_script
>()
.
ForMember
(
dest
=>
dest
.
Id
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
ExScriptId
));
CreateMap
<
cof_workitem
,
WorkItemRequest
>()
.
ReverseMap
();
...
...
performance/Performance.EntityModels/Entity/ex_script.cs
View file @
74668ca7
...
...
@@ -46,7 +46,7 @@ public class ex_script
public
int
IsEnable
{
get
;
set
;
}
/// <summary>
/// 是否执行通过
/// 是否执行通过
0 未执行 1 通过 2 失败
/// </summary>
public
int
IsExecSuccess
{
get
;
set
;
}
...
...
performance/Performance.Services/ExConfigService.cs
View file @
74668ca7
...
...
@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId)
DefaultModules
(
hospitalId
);
var
list
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
).
OrderBy
(
t
=>
t
.
ModuleName
).
ToList
();
list
?.
ForEach
(
t
=>
t
.
ReadOnly
=
t
.
SheetType
==
(
int
)
SheetType
.
Income
?
0
:
1
);
return
list
;
}
public
void
DefaultModules
(
int
hospitalId
)
{
var
moduleList
=
new
ex_module
[]
var
moduleList
=
new
List
<
ex_module
>
{
new
ex_module
{
ModuleName
=
"1.0.1 额外收入"
,
SheetType
=
(
int
)
SheetType
.
OtherIncome
},
new
ex_module
{
ModuleName
=
"1.1.1 门诊开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
},
new
ex_module
{
ModuleName
=
"1.1.2 门诊执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
},
new
ex_module
{
ModuleName
=
"1.2.1 住院开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
},
new
ex_module
{
ModuleName
=
"1.2.2 住院执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
},
new
ex_module
{
ModuleName
=
"2.1 成本支出统计表"
,
SheetType
=
(
int
)
SheetType
.
Expend
},
new
ex_module
{
ModuleName
=
"3.1 医生组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
},
new
ex_module
{
ModuleName
=
"3.2 护理组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
},
new
ex_module
{
ModuleName
=
"1.0.1 额外收入"
,
SheetType
=
(
int
)
SheetType
.
OtherIncome
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"1.1.1 门诊开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.1.2 门诊执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.2.1 住院开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.2.2 住院执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"2.1 成本支出统计表"
,
SheetType
=
(
int
)
SheetType
.
Expend
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"3.1 医生组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"3.2 护理组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
,
ReadOnly
=
0
},
};
var
data
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
inexistence
=
(
data
==
null
||
!
data
.
Any
())
?
moduleList
:
moduleList
.
Where
(
t
=>
!
data
.
Any
(
w
=>
w
.
ModuleName
.
StartsWith
(
t
.
ModuleName
.
Split
(
' '
)[
0
])));
var
inexistence
=
(
data
==
null
||
!
data
.
Any
())
?
moduleList
:
moduleList
.
Where
(
t
=>
!
data
.
Any
(
w
=>
w
.
ModuleName
.
StartsWith
(
t
.
ModuleName
.
Split
(
' '
)[
0
])))?.
ToList
();
if
(
inexistence
!=
null
&&
inexistence
.
Any
())
{
var
modules
=
inexistence
.
Select
(
t
=>
new
ex_module
inexistence
.
ForEach
(
t
=>
{
HospitalId
=
hospitalId
,
ModuleName
=
t
.
ModuleName
,
SheetType
=
(
int
)
t
.
SheetType
,
ReadOnly
=
t
.
SheetType
==
(
int
)
SheetType
.
Income
?
0
:
1
,
TypeId
=
null
,
t
.
HospitalId
=
hospitalId
;
});
exmoduleRepository
.
AddRange
(
modules
.
ToArray
());
exmoduleRepository
.
AddRange
(
inexistence
.
ToArray
());
}
}
...
...
performance/Performance.Services/ExtractExcelService/ExtractPreConfigService.cs
View file @
74668ca7
...
...
@@ -77,7 +77,7 @@ public bool CreateHospitalConfig(sys_hospitalconfig hospitalconfig)
var
hospital
=
hospitalRepository
.
GetEntity
(
w
=>
w
.
ID
==
hospitalconfig
.
HospitalId
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院信息错误"
);
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
ConfigName
==
hospitalconfig
.
ConfigName
);
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
ConfigName
==
hospitalconfig
.
ConfigName
&&
w
.
HospitalId
==
hospitalconfig
.
HospitalId
);
if
(
config
!=
null
)
throw
new
PerformanceException
(
"连接名称重复"
);
var
result
=
hospitalconfigRepository
.
Add
(
hospitalconfig
);
...
...
@@ -97,7 +97,7 @@ public bool UpdateHospitalConfig(sys_hospitalconfig hospitalconfig)
if
(!
databases
.
Select
(
t
=>
t
.
Value
).
Contains
(
hospitalconfig
.
DataBaseType
))
throw
new
PerformanceException
(
"数据库类型错误"
);
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
ConfigName
==
hospitalconfig
.
ConfigName
&&
w
.
Id
!=
hospitalconfig
.
Id
);
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
ConfigName
==
hospitalconfig
.
ConfigName
&&
w
.
HospitalId
==
hospitalconfig
.
HospitalId
&&
w
.
Id
!=
hospitalconfig
.
Id
);
if
(
config
!=
null
)
throw
new
PerformanceException
(
"连接名称重复"
);
var
entity
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
Id
==
hospitalconfig
.
Id
);
...
...
@@ -247,10 +247,8 @@ public bool DeleteExtractTypeAndScript(int typeId, int scriptId)
if
(
extype
==
null
)
throw
new
PerformanceException
(
"参数typeId无效"
);
var
scripts
=
exscriptRepository
.
GetEntities
(
w
=>
w
.
TypeId
==
typeId
);
if
(
scripts
==
null
||
!
scripts
.
Any
())
return
true
;
if
(!
exscriptRepository
.
RemoveRange
(
scripts
.
ToArray
()))
if
(
extype
==
null
)
throw
new
PerformanceException
(
"提取语句删除失败"
);
if
(
scripts
!=
null
&&
scripts
.
Any
()
&&
!
exscriptRepository
.
RemoveRange
(
scripts
.
ToArray
()))
throw
new
PerformanceException
(
"提取语句删除失败"
);
return
extypeRepository
.
Remove
(
extype
);
}
...
...
@@ -265,7 +263,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque
var
sheettypes
=
GetSheettypes
();
if
(!
sheettypes
.
Any
(
w
=>
w
.
Value
==
request
.
Source
))
throw
new
PerformanceException
(
"暂不支持该类型"
);
var
type
=
extypeRepository
.
GetEntity
(
w
=>
w
.
EName
==
request
.
EName
&&
w
.
Id
!=
request
.
TypeId
);
var
type
=
extypeRepository
.
GetEntity
(
w
=>
w
.
EName
==
request
.
EName
&&
w
.
HospitalId
==
hospitalId
&&
w
.
Id
!=
request
.
TypeId
);
if
(
type
!=
null
)
throw
new
PerformanceException
(
"费用名称重复"
);
if
(
request
.
TypeId
==
0
)
...
...
@@ -324,7 +322,7 @@ public bool EditExtractTypeAndScript(int hospitalId, ExtractConfigResponse reque
return
true
;
}
public
d
ecimal
CheckExecsqlConsumeTime
(
ConsumeTimeRequest
request
)
public
d
ynamic
ExecsqlAndGetResult
(
ConsumeTimeRequest
request
)
{
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
ConfigId
);
if
(
config
==
null
)
throw
new
PerformanceException
(
"数据库配置资源无效"
);
...
...
@@ -332,84 +330,56 @@ public decimal CheckExecsqlConsumeTime(ConsumeTimeRequest request)
var
script
=
exscriptRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
ExScriptId
);
if
(
request
.
ExScriptId
!=
0
&&
script
==
null
)
throw
new
PerformanceException
(
"参数无效"
);
IEnumerable
<
dynamic
>
data
=
null
;
try
{
if
(
request
.
Month
==
0
||
request
.
Year
==
0
)
{
request
.
Month
=
DateTime
.
Now
.
Month
;
request
.
Year
=
DateTime
.
Now
.
Year
;
}
var
begindate
=
request
.
Month
>
0
&&
request
.
Year
>
0
?
new
DateTime
(
request
.
Year
,
request
.
Month
,
1
)
:
DateTime
.
Now
.
AddMonths
(-
1
);
var
enddate
=
begindate
.
AddMonths
(
1
);
var
param
=
new
{
begin
Date
=
$"
{(
request
.
Month
==
1
?
request
.
Year
-
1
:
request
.
Year
)}
-
{(
request
.
Month
==
1
?
12
:
request
.
Month
-
1
)
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
,
end
Date
=
$"
{
request
.
Year
}
-
{
request
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
begin
Time
=
$"
{
begindate
.
Year
}
-
{
begindate
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
,
end
Time
=
$"
{
enddate
.
Year
}
-
{
enddate
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
};
Stopwatch
stopwatch
=
new
Stopwatch
();
stopwatch
.
Start
();
var
data
=
queryService
.
QueryData
<
dynamic
>(
config
,
request
.
ExecScript
,
param
);
data
=
queryService
.
QueryData
<
dynamic
>(
config
,
request
.
ExecScript
,
param
);
stopwatch
.
Stop
();
var
timing
=
Math
.
Ceiling
(
stopwatch
.
ElapsedMilliseconds
/
1000
m
);
if
(
script
==
null
)
return
timing
;
if
(
script
!=
null
)
{
script
.
TimeConsuming
=
timing
;
script
.
IsExecSuccess
=
1
;
}
}
catch
(
Exception
ex
)
{
if
(
script
==
null
)
throw
new
PerformanceException
(
""
);
script
.
IsExecSuccess
=
0
;
if
(
script
!=
null
)
{
script
.
IsExecSuccess
=
2
;
script
.
Description
=
ex
.
Message
;
}
exscriptRepository
.
Update
(
script
);
return
script
.
TimeConsuming
;
throw
new
PerformanceException
(
"查询语句时发生异常"
);
}
#
endregion
#
region
Model
Item
Special
public
void
CreateDefaultModeul
(
int
hospitalId
)
{
var
moduleList
=
new
List
<
ex_module
>
finally
{
new
ex_module
{
ModuleName
=
"1.0.1 额外收入"
,
SheetType
=
(
int
)
SheetType
.
OtherIncome
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"1.1.1 门诊开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.1.2 门诊执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.2.1 住院开单收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"1.2.2 住院执行收入"
,
SheetType
=
(
int
)
SheetType
.
Income
,
ReadOnly
=
1
},
new
ex_module
{
ModuleName
=
"2.1 成本支出统计表"
,
SheetType
=
(
int
)
SheetType
.
Expend
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"3.1 医生组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
,
ReadOnly
=
0
},
new
ex_module
{
ModuleName
=
"3.2 护理组工作量绩效测算表"
,
SheetType
=
(
int
)
SheetType
.
Workload
,
ReadOnly
=
0
},
};
var
data
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
inexistence
=
data
==
null
?
moduleList
:
moduleList
.
Where
(
t
=>
!
data
.
Any
(
w
=>
w
.
ModuleName
.
StartsWith
(
t
.
ModuleName
.
Split
(
' '
)[
0
])))?.
ToList
();
if
(
inexistence
!=
null
&&
inexistence
.
Any
())
{
inexistence
.
ForEach
(
t
=>
{
t
.
HospitalId
=
hospitalId
;
});
exmoduleRepository
.
AddRange
(
inexistence
.
ToArray
());
}
if
(
script
!=
null
)
exscriptRepository
.
Update
(
script
);
}
public
List
<
ex_module
>
GetExModelList
(
int
hospitalId
)
{
return
new
List
<
ex_module
>();
if
(
data
==
null
||
!
data
.
Any
())
throw
new
PerformanceException
(
"查询结果为空"
);
var
header
=
((
IDictionary
<
string
,
object
>)
data
.
ElementAt
(
0
)).
Keys
;
return
new
{
header
,
data
};
}
#
endregion
#
region
字典
public
List
<
TitleValue
<
int
>>
GetDatatypes
()
public
static
List
<
TitleValue
<
int
>>
GetDatatypes
()
{
return
EnumHelper
.
GetItems
<
DatabaseType
>().
Select
(
t
=>
new
TitleValue
<
int
>
{
...
...
@@ -418,7 +388,7 @@ public List<TitleValue<int>> GetDatatypes()
}).
ToList
();
}
public
List
<
TitleValue
<
int
>>
GetSheettypes
()
public
static
List
<
TitleValue
<
int
>>
GetSheettypes
()
{
var
showItems
=
new
int
[]
{
...
...
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