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
11ad72b5
Commit
11ad72b5
authored
Dec 30, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
操作提取sql配置
parent
b8cb60f9
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
401 additions
and
18 deletions
+401
-18
performance/Performance.Api/wwwroot/Performance.Api.xml
+10
-2
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+29
-4
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
+8
-3
performance/Performance.DtoModels/Request/ConsumeTimeRequest.cs
+17
-0
performance/Performance.DtoModels/Request/ExTypeRequest.cs
+15
-0
performance/Performance.DtoModels/Response/ExtractConfigResponse.cs
+40
-0
performance/Performance.EntityModels/Entity/ex_script.cs
+15
-0
performance/Performance.Repository/PerforExtypeRepository.cs
+16
-4
performance/Performance.Repository/Repository/PerforExtypeRepository.cs
+3
-0
performance/Performance.Services/ExtractExcelService/ExtractPreConfigService.cs
+227
-4
performance/Performance.Services/ExtractExcelService/QueryService.cs
+20
-0
performance/Performance.Services/HospitalService.cs
+1
-1
No files found.
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
11ad72b5
...
@@ -1199,7 +1199,7 @@
...
@@ -1199,7 +1199,7 @@
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.GetGatherHands(System.Int32,Performance.DtoModels.GatherRequest)"
>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.GetGatherHands(System.Int32,Performance.DtoModels.GatherRequest)"
>
<summary>
<summary>
手工录入
手工录入
- 录入界面
</summary>
</summary>
<param
name=
"allotId"
></param>
<param
name=
"allotId"
></param>
<param
name=
"request"
></param>
<param
name=
"request"
></param>
...
@@ -1215,7 +1215,15 @@
...
@@ -1215,7 +1215,15 @@
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,Performance.DtoModels.PersonParamsRequest)"
>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,Performance.DtoModels.PersonParamsRequest)"
>
<summary>
<summary>
手工录入列表
手工录入列表 - 明细
</summary>
<param
name=
"allotId"
></param>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)"
>
<summary>
手工录入列表 - 汇总
</summary>
</summary>
<param
name=
"allotId"
></param>
<param
name=
"allotId"
></param>
<param
name=
"request"
></param>
<param
name=
"request"
></param>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
11ad72b5
...
@@ -3619,6 +3619,16 @@
...
@@ -3619,6 +3619,16 @@
创建时间
创建时间
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.ex_result_gather.Remark"
>
<summary>
备注
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ex_result_gather.States"
>
<summary>
1 未通过 2 通过
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ex_script"
>
<member
name=
"T:Performance.EntityModels.ex_script"
>
<summary>
<summary>
...
@@ -3649,6 +3659,21 @@
...
@@ -3649,6 +3659,21 @@
是否可用 1 可用 2 不可用
是否可用 1 可用 2 不可用
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.ex_script.IsExecSuccess"
>
<summary>
是否执行通过
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ex_script.ErrorMessage"
>
<summary>
执行错误信息
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ex_script.TimeConsuming"
>
<summary>
语句执行完成所需时间
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ex_special"
>
<member
name=
"T:Performance.EntityModels.ex_special"
>
<summary>
<summary>
...
@@ -8315,14 +8340,14 @@
...
@@ -8315,14 +8340,14 @@
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.sys_hospitalconfig.Type"
>
<member
name=
"P:Performance.EntityModels.sys_hospitalconfig.
DataBase
Type"
>
<summary>
<summary>
1
标准库 2 绩效库
1
、Sql Server 2、Orcale
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.sys_hospitalconfig.
DataBaseType
"
>
<member
name=
"P:Performance.EntityModels.sys_hospitalconfig.
IsConnectioned
"
>
<summary>
<summary>
1、Sql Server 2、Orcale
</summary>
</summary>
</member>
</member>
<member
name=
"T:Performance.EntityModels.sys_menu"
>
<member
name=
"T:Performance.EntityModels.sys_menu"
>
...
...
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
11ad72b5
...
@@ -2,10 +2,7 @@
...
@@ -2,10 +2,7 @@
using
Performance.DtoModels.Request
;
using
Performance.DtoModels.Request
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
namespace
Performance.DtoModels.AutoMapper
namespace
Performance.DtoModels.AutoMapper
{
{
...
@@ -255,6 +252,14 @@ public AutoMapperConfigs()
...
@@ -255,6 +252,14 @@ public AutoMapperConfigs()
CreateMap
<
ex_result
,
ex_result_gather
>()
CreateMap
<
ex_result
,
ex_result_gather
>()
.
ReverseMap
();
.
ReverseMap
();
CreateMap
<
ex_type
,
ExtractConfigResponse
>()
.
ForMember
(
dest
=>
dest
.
TypeId
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ReverseMap
();
CreateMap
<
ex_script
,
ExtractScriptConfig
>()
.
ForMember
(
dest
=>
dest
.
ExScriptId
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
Id
))
.
ReverseMap
();
}
}
}
}
}
}
performance/Performance.DtoModels/Request/ConsumeTimeRequest.cs
0 → 100644
View file @
11ad72b5
using
System
;
namespace
Performance.DtoModels
{
public
class
ConsumeTimeRequest
{
public
int
Year
{
get
;
set
;
}
=
DateTime
.
Now
.
Year
;
public
int
Month
{
get
;
set
;
}
=
DateTime
.
Now
.
Month
;
public
int
ExScriptId
{
get
;
set
;
}
public
int
ConfigId
{
get
;
set
;
}
public
string
ExecScript
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Request/ExTypeRequest.cs
0 → 100644
View file @
11ad72b5
namespace
Performance.DtoModels
{
public
class
ExTypeRequest
{
public
int
HospitalId
{
get
;
set
;
}
public
int
?
SheetType
{
get
;
set
;
}
public
string
Search
{
get
;
set
;
}
public
int
PageNumber
{
get
;
set
;
}
public
int
PageSize
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Response/ExtractConfigResponse.cs
0 → 100644
View file @
11ad72b5
using
System.Collections.Generic
;
namespace
Performance.DtoModels
{
public
class
ExtractConfigResponse
{
public
int
TypeId
{
get
;
set
;
}
public
string
EName
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
public
int
Source
{
get
;
set
;
}
public
string
SheetType
{
get
;
set
;
}
public
decimal
TotalTime
{
get
;
set
;
}
public
List
<
ExtractScriptConfig
>
Children
{
get
;
set
;
}
=
new
List
<
ExtractScriptConfig
>();
}
public
class
ExtractScriptConfig
{
public
int
ExScriptId
{
get
;
set
;
}
public
string
ExecScript
{
get
;
set
;
}
public
int
ConfigId
{
get
;
set
;
}
public
string
ConfigName
{
get
;
set
;
}
public
int
IsEnable
{
get
;
set
;
}
public
int
IsExecSuccess
{
get
;
set
;
}
public
string
ErrorMessage
{
get
;
set
;
}
public
decimal
TimeConsuming
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ex_script.cs
View file @
11ad72b5
...
@@ -39,5 +39,20 @@ public class ex_script
...
@@ -39,5 +39,20 @@ public class ex_script
/// 是否可用 1 可用 2 不可用
/// 是否可用 1 可用 2 不可用
/// </summary>
/// </summary>
public
int
IsEnable
{
get
;
set
;
}
public
int
IsEnable
{
get
;
set
;
}
/// <summary>
/// 是否执行通过
/// </summary>
public
int
IsExecSuccess
{
get
;
set
;
}
/// <summary>
/// 执行错误信息
/// </summary>
public
string
ErrorMessage
{
get
;
set
;
}
/// <summary>
/// 语句执行完成所需时间
/// </summary>
public
decimal
TimeConsuming
{
get
;
set
;
}
=
0
;
}
}
}
}
performance/Performance.Repository/PerforExtypeRepository.cs
View file @
11ad72b5
using
Performance.EntityModels
;
using
Microsoft.EntityFrameworkCore
;
using
Performance.EntityModels
;
using
Performance.Infrastructure.Models
;
using
Performance.Infrastructure.Models
;
using
System.Linq
;
namespace
Performance.Repository
namespace
Performance.Repository
{
{
public
partial
class
PerforExtypeRepository
public
partial
class
PerforExtypeRepository
{
{
public
PageList
<
ex_type
>
GetPagingData
()
public
PageList
<
ex_type
>
GetPagingData
(
int
hospitalId
,
int
?
sheetType
,
string
search
,
int
pageNumber
,
int
pageSize
)
{
{
var
query
=
_context
.
ex_type
.
AsNoTracking
().
Where
(
w
=>
w
.
HospitalId
==
hospitalId
);
if
(
sheetType
.
HasValue
&&
sheetType
.
Value
>
0
)
{
query
=
query
.
Where
(
w
=>
w
.
Source
==
sheetType
);
}
if
(!
string
.
IsNullOrEmpty
(
search
))
{
query
=
query
.
Where
(
w
=>
w
.
EName
.
Contains
(
search
));
}
return
PageList
<
ex_type
>.
Create
(
query
,
pageNumber
,
pageSize
);
}
}
}
}
}
}
performance/Performance.Repository/Repository/PerforExtypeRepository.cs
View file @
11ad72b5
...
@@ -12,8 +12,11 @@ namespace Performance.Repository
...
@@ -12,8 +12,11 @@ namespace Performance.Repository
/// </summary>
/// </summary>
public
partial
class
PerforExtypeRepository
:
PerforRepository
<
ex_type
>
public
partial
class
PerforExtypeRepository
:
PerforRepository
<
ex_type
>
{
{
private
readonly
PerformanceDbContext
_context
;
public
PerforExtypeRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
public
PerforExtypeRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
{
_context
=
context
;
}
}
}
}
}
}
performance/Performance.Services/ExtractExcelService/ExtractPreConfigService.cs
View file @
11ad72b5
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
using
Performance.DtoModels
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure.Models
;
using
Performance.Repository
;
using
Performance.Repository
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
namespace
Performance.Services.ExtractExcelService
namespace
Performance.Services.ExtractExcelService
...
@@ -22,6 +24,8 @@ public class ExtractPreConfigService : IAutoInjection
...
@@ -22,6 +24,8 @@ public class ExtractPreConfigService : IAutoInjection
private
readonly
PerforExitemRepository
exitemRepository
;
private
readonly
PerforExitemRepository
exitemRepository
;
private
readonly
PerforExspecialRepository
exspecialRepository
;
private
readonly
PerforExspecialRepository
exspecialRepository
;
private
readonly
QueryService
queryService
;
public
ExtractPreConfigService
(
public
ExtractPreConfigService
(
ILogger
<
ExtractPreConfigService
>
logger
,
ILogger
<
ExtractPreConfigService
>
logger
,
IMapper
mapper
,
IMapper
mapper
,
...
@@ -31,7 +35,8 @@ public class ExtractPreConfigService : IAutoInjection
...
@@ -31,7 +35,8 @@ public class ExtractPreConfigService : IAutoInjection
PerforExscriptRepository
exscriptRepository
,
PerforExscriptRepository
exscriptRepository
,
PerforExmoduleRepository
exmoduleRepository
,
PerforExmoduleRepository
exmoduleRepository
,
PerforExitemRepository
exitemRepository
,
PerforExitemRepository
exitemRepository
,
PerforExspecialRepository
exspecialRepository
)
PerforExspecialRepository
exspecialRepository
,
QueryService
queryService
)
{
{
this
.
logger
=
logger
;
this
.
logger
=
logger
;
this
.
mapper
=
mapper
;
this
.
mapper
=
mapper
;
...
@@ -42,6 +47,7 @@ public class ExtractPreConfigService : IAutoInjection
...
@@ -42,6 +47,7 @@ public class ExtractPreConfigService : IAutoInjection
this
.
exmoduleRepository
=
exmoduleRepository
;
this
.
exmoduleRepository
=
exmoduleRepository
;
this
.
exitemRepository
=
exitemRepository
;
this
.
exitemRepository
=
exitemRepository
;
this
.
exspecialRepository
=
exspecialRepository
;
this
.
exspecialRepository
=
exspecialRepository
;
this
.
queryService
=
queryService
;
}
}
#
region
HospitalConfig
#
region
HospitalConfig
...
@@ -132,15 +138,232 @@ public bool TestConnectionCleared(int hospitalconfigId)
...
@@ -132,15 +138,232 @@ public bool TestConnectionCleared(int hospitalconfigId)
#
endregion
#
endregion
public
List
<
ex_type
>
GetExtractTypeAndScript
(
int
hospitalId
,
int
sheetType
,
string
search
,
int
pageNumber
,
int
pageSize
)
#
region
Extract
Scripts
public
PageList
<
ExtractConfigResponse
>
GetExtractTypeAndScript
(
ExTypeRequest
request
)
{
{
var
hospital
=
hospitalRepository
.
GetEntity
(
w
=>
w
.
ID
==
h
ospitalId
);
var
hospital
=
hospitalRepository
.
GetEntity
(
w
=>
w
.
ID
==
request
.
H
ospitalId
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院信息错误"
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院信息错误"
);
var
data
=
extypeRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
);
var
data
=
extypeRepository
.
GetPagingData
(
request
.
HospitalId
,
request
.
SheetType
,
request
.
Search
,
request
.
PageNumber
,
request
.
PageSize
);
if
(
data
==
null
||
!
data
.
Any
())
return
new
PageList
<
ExtractConfigResponse
>(
new
List
<
ExtractConfigResponse
>(),
0
,
request
.
PageNumber
,
request
.
PageSize
);
var
list
=
mapper
.
Map
<
List
<
ExtractConfigResponse
>>(
data
);
var
scripts
=
exscriptRepository
.
GetEntities
(
w
=>
data
.
Select
(
x
=>
x
.
Id
).
Contains
(
w
.
TypeId
))
??
new
List
<
ex_script
>();
var
configs
=
hospitalconfigRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
request
.
HospitalId
)
??
new
List
<
sys_hospitalconfig
>();
var
sheettypes
=
GetSheettypes
();
foreach
(
var
item
in
list
)
{
item
.
SheetType
=
sheettypes
.
FirstOrDefault
(
w
=>
w
.
Value
==
item
.
Source
)?.
Title
;
var
itemScripts
=
scripts
.
Where
(
w
=>
w
.
TypeId
==
item
.
TypeId
);
if
(
itemScripts
==
null
||
!
itemScripts
.
Any
())
continue
;
item
.
TotalTime
=
itemScripts
.
Sum
(
t
=>
t
.
TimeConsuming
);
item
.
Children
=
mapper
.
Map
<
List
<
ExtractScriptConfig
>>(
itemScripts
);
item
.
Children
.
ForEach
(
x
=>
{
var
config
=
configs
.
FirstOrDefault
(
w
=>
w
.
Id
==
x
.
ConfigId
);
if
(
config
!=
null
)
x
.
ConfigName
=
string
.
IsNullOrEmpty
(
config
.
ConfigName
)
?
config
.
DbSource
:
config
.
ConfigName
;
});
}
return
new
PageList
<
ExtractConfigResponse
>(
list
,
data
.
TotalCount
,
request
.
PageNumber
,
request
.
PageSize
);
}
public
ExtractConfigResponse
GetExtractTypeAndScriptById
(
int
typeId
)
{
var
type
=
extypeRepository
.
GetEntity
(
w
=>
w
.
Id
==
typeId
);
if
(
type
==
null
)
throw
new
PerformanceException
(
"参数无效"
);
var
data
=
mapper
.
Map
<
ExtractConfigResponse
>(
type
);
var
sheettypes
=
GetSheettypes
();
data
.
SheetType
=
sheettypes
.
FirstOrDefault
(
w
=>
w
.
Value
==
data
.
Source
)?.
Title
;
var
scripts
=
exscriptRepository
.
GetEntities
(
w
=>
w
.
TypeId
==
typeId
)
??
new
List
<
ex_script
>();
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
var
configs
=
hospitalconfigRepository
.
GetEntities
(
w
=>
scripts
.
Select
(
s
=>
s
.
ConfigId
).
Contains
(
w
.
Id
))
??
new
List
<
sys_hospitalconfig
>();
data
.
TotalTime
=
scripts
.
Sum
(
t
=>
t
.
TimeConsuming
);
data
.
Children
=
mapper
.
Map
<
List
<
ExtractScriptConfig
>>(
scripts
);
data
.
Children
.
ForEach
(
x
=>
{
var
config
=
configs
.
FirstOrDefault
(
w
=>
w
.
Id
==
x
.
ConfigId
);
if
(
config
!=
null
)
x
.
ConfigName
=
string
.
IsNullOrEmpty
(
config
.
ConfigName
)
?
config
.
DbSource
:
config
.
ConfigName
;
});
}
return
data
;
return
data
;
}
}
public
bool
DeleteExtractTypeAndScript
(
int
typeId
)
{
var
extype
=
extypeRepository
.
GetEntity
(
w
=>
w
.
Id
==
typeId
);
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
(
"提取语句删除失败"
);
return
extypeRepository
.
Remove
(
extype
);
}
public
bool
EditExtractTypeAndScript
(
int
hospitalId
,
ExtractConfigResponse
request
)
{
if
(
request
==
null
)
throw
new
ArgumentNullException
(
nameof
(
request
));
if
(
request
.
TypeId
==
0
)
{
var
entity
=
mapper
.
Map
<
ex_type
>(
request
);
entity
.
HospitalId
=
hospitalId
;
if
(!
extypeRepository
.
Add
(
entity
))
return
false
;
if
(
request
.
Children
!=
null
&&
request
.
Children
.
Any
())
{
var
scripts
=
mapper
.
Map
<
List
<
ex_script
>>(
request
.
Children
);
scripts
.
ForEach
(
t
=>
t
.
TypeId
=
entity
.
Id
);
exscriptRepository
.
AddRange
(
scripts
.
ToArray
());
}
}
else
{
var
entity
=
extypeRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
TypeId
);
entity
.
EName
=
request
.
EName
;
entity
.
Description
=
request
.
Description
;
entity
.
Source
=
request
.
Source
;
if
(!
extypeRepository
.
Update
(
entity
))
return
false
;
var
scripts
=
exscriptRepository
.
GetEntities
(
w
=>
w
.
TypeId
==
request
.
TypeId
);
/* 添加不存在的数据 */
if
(
request
.
Children
!=
null
&&
request
.
Children
.
Any
(
w
=>
w
.
ExScriptId
==
0
))
{
var
list
=
mapper
.
Map
<
List
<
ex_script
>>(
request
.
Children
);
return
exscriptRepository
.
AddRange
(
list
.
ToArray
());
}
/* 删除、修改存在的数据 */
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
var
existIds
=
request
.
Children
?.
Select
(
w
=>
w
.
ExScriptId
)
??
new
List
<
int
>();
var
delScripts
=
scripts
.
Where
(
w
=>
!
existIds
.
Contains
(
w
.
Id
));
if
(
delScripts
!=
null
&&
delScripts
.
Any
())
exscriptRepository
.
RemoveRange
(
delScripts
.
ToArray
());
var
updScripts
=
scripts
.
Where
(
w
=>
existIds
.
Contains
(
w
.
Id
));
if
(
updScripts
!=
null
&&
updScripts
.
Any
())
{
foreach
(
var
item
in
updScripts
)
{
var
model
=
request
.
Children
.
FirstOrDefault
(
w
=>
w
.
ExScriptId
==
item
.
Id
);
if
(
model
==
null
)
continue
;
item
.
ExecScript
=
model
.
ExecScript
;
item
.
ConfigId
=
model
.
ConfigId
;
item
.
IsEnable
=
model
.
IsEnable
;
}
exscriptRepository
.
UpdateRange
(
updScripts
.
ToArray
());
}
}
}
return
true
;
}
public
decimal
CheckExecsqlConsumeTime
(
ConsumeTimeRequest
request
)
{
var
config
=
hospitalconfigRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
ConfigId
);
if
(
config
==
null
)
throw
new
PerformanceException
(
"数据库配置资源无效"
);
var
script
=
exscriptRepository
.
GetEntity
(
w
=>
w
.
Id
==
request
.
ExScriptId
);
if
(
request
.
ExScriptId
!=
0
&&
script
==
null
)
throw
new
PerformanceException
(
"参数无效"
);
try
{
if
(
request
.
Month
==
0
||
request
.
Year
==
0
)
{
request
.
Month
=
DateTime
.
Now
.
Month
;
request
.
Year
=
DateTime
.
Now
.
Year
;
}
var
param
=
new
{
beginDate
=
$"
{(
request
.
Month
==
1
?
request
.
Year
-
1
:
request
.
Year
)}
-
{(
request
.
Month
==
1
?
12
:
request
.
Month
-
1
).
ToString
().
PadLeft
(
2
,
'0'
)}
"
,
endDate
=
$"
{
request
.
Year
}
-
{
request
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
};
Stopwatch
stopwatch
=
new
Stopwatch
();
stopwatch
.
Start
();
var
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
;
}
catch
(
Exception
ex
)
{
if
(
script
==
null
)
throw
new
PerformanceException
(
""
);
script
.
IsExecSuccess
=
0
;
script
.
ErrorMessage
=
ex
.
Message
;
}
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
())
{
inexistence
.
ForEach
(
t
=>
{
t
.
HospitalId
=
hospitalId
;
});
exmoduleRepository
.
AddRange
(
inexistence
.
ToArray
());
}
}
public
List
<
ex_module
>
GetExModelList
(
int
hospitalId
)
{
return
new
List
<
ex_module
>();
}
#
endregion
#
region
字典
#
region
字典
public
List
<
TitleValue
<
int
>>
GetDatatypes
()
public
List
<
TitleValue
<
int
>>
GetDatatypes
()
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
11ad72b5
...
@@ -442,6 +442,26 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
...
@@ -442,6 +442,26 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
return
pairs
;
return
pairs
;
}
}
/// <summary>
/// 查询数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="config"></param>
/// <param name="execsql"></param>
/// <param name="param"></param>
/// <returns></returns>
public
IEnumerable
<
T
>
QueryData
<
T
>(
sys_hospitalconfig
config
,
string
execsql
,
object
param
)
{
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
);
if
(
connection
==
null
)
return
new
List
<
T
>();
if
(
connection
.
State
==
ConnectionState
.
Closed
)
connection
.
Open
();
var
result
=
connection
.
Query
<
T
>(
execsql
,
param
,
commandTimeout
:
20000
);
return
result
;
}
#
endregion
QueryData
#
endregion
QueryData
}
}
}
}
performance/Performance.Services/HospitalService.cs
View file @
11ad72b5
...
@@ -50,7 +50,7 @@ public List<HospitalResponse> GetUserHopital(int userid)
...
@@ -50,7 +50,7 @@ public List<HospitalResponse> GetUserHopital(int userid)
var
hosList
=
_hospitalRepository
.
GetEntities
(
t
=>
joinList
.
Select
(
j
=>
j
.
HospitalID
).
Contains
(
t
.
ID
));
var
hosList
=
_hospitalRepository
.
GetEntities
(
t
=>
joinList
.
Select
(
j
=>
j
.
HospitalID
).
Contains
(
t
.
ID
));
var
hosId
=
hosList
?.
Select
(
item
=>
item
.
ID
).
ToList
();
var
hosId
=
hosList
?.
Select
(
item
=>
item
.
ID
).
ToList
();
//获取存在数据记录的hospital
//获取存在数据记录的hospital
hosId
=
_hospitalconfigRepository
.
GetEntities
(
t
=>
hosId
.
Contains
(
t
.
HospitalId
.
Value
))?.
Select
(
t
=>
t
.
HospitalId
.
Value
).
ToList
();
hosId
=
_hospitalconfigRepository
.
GetEntities
(
t
=>
hosId
.
Contains
(
t
.
HospitalId
))?.
Select
(
t
=>
t
.
HospitalId
).
ToList
();
//获取已经上传过模板的hospital
//获取已经上传过模板的hospital
var
firstId
=
_perfirstRepository
.
GetEntities
(
t
=>
hosId
.
Contains
(
t
.
HospitalId
.
Value
))?.
Select
(
t
=>
t
.
HospitalId
.
Value
).
ToList
();
var
firstId
=
_perfirstRepository
.
GetEntities
(
t
=>
hosId
.
Contains
(
t
.
HospitalId
.
Value
))?.
Select
(
t
=>
t
.
HospitalId
.
Value
).
ToList
();
...
...
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