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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
257 additions
and
89 deletions
+257
-89
performance/Performance.Api/Controllers/ExtractController.cs
+0
-0
performance/Performance.Api/Controllers/ModExtractController.cs
+199
-2
performance/Performance.Api/wwwroot/Performance.Api.xml
+0
-0
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
+33
-63
No files found.
performance/Performance.Api/Controllers/ExtractController.cs
deleted
100644 → 0
View file @
08701f2e
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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
;
script
.
TimeConsuming
=
timing
;
script
.
IsExecSuccess
=
1
;
if
(
script
!=
null
)
{
script
.
TimeConsuming
=
timing
;
script
.
IsExecSuccess
=
1
;
}
}
catch
(
Exception
ex
)
{
if
(
script
==
null
)
throw
new
PerformanceException
(
""
);
if
(
script
!=
null
)
{
script
.
IsExecSuccess
=
2
;
script
.
Description
=
ex
.
Message
;
}
script
.
IsExecSuccess
=
0
;
script
.
Description
=
ex
.
Message
;
throw
new
PerformanceException
(
"查询语句时发生异常"
);
}
exscriptRepository
.
Update
(
script
);
return
script
.
TimeConsuming
;
}
#
endregion
#
region
Model
Item
Special
public
void
CreateDefaultModeul
(
int
hospitalId
)
{
var
moduleList
=
new
List
<
ex_module
>
{
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
())
finally
{
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
#
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