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
ffd4feff
Commit
ffd4feff
authored
Jan 25, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取人员字典
parent
9e183ed8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
56 deletions
+49
-56
performance/Performance.Api/Controllers/TemplateController.cs
+6
-0
performance/Performance.Services/ExConfigService.cs
+1
-1
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+10
-51
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+4
-3
performance/Performance.Services/ExtractExcelService/QueryService.cs
+28
-1
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
ffd4feff
...
@@ -185,6 +185,12 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -185,6 +185,12 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if
(!
string
.
IsNullOrEmpty
(
message
))
if
(!
string
.
IsNullOrEmpty
(
message
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
if
(!
string
.
IsNullOrEmpty
(
filePath
))
{
var
data
=
configService
.
CheckHasNewDepartmentOrCategory
(
request
.
AllotId
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
}
//检验科室、费用类型是否需要补充
//检验科室、费用类型是否需要补充
allot
.
IsExtracting
=
allot
.
IsExtracting
??
0
;
allot
.
IsExtracting
=
allot
.
IsExtracting
??
0
;
...
...
performance/Performance.Services/ExConfigService.cs
View file @
ffd4feff
...
@@ -664,7 +664,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
...
@@ -664,7 +664,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
}.
Contains
(
t
.
States
));
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
}.
Contains
(
t
.
States
));
var
prevAllot
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
var
prevAllot
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
if
(
prevAllot
!
=
null
)
return
null
;
if
(
prevAllot
=
=
null
)
return
null
;
var
modDics
=
moddicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Type
==
"checksql"
);
var
modDics
=
moddicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Type
==
"checksql"
);
if
(
modDics
==
null
||
!
modDics
.
Any
())
return
null
;
if
(
modDics
==
null
||
!
modDics
.
Any
())
return
null
;
...
...
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
View file @
ffd4feff
...
@@ -14,6 +14,8 @@ namespace Performance.Services.ExtractExcelService
...
@@ -14,6 +14,8 @@ namespace Performance.Services.ExtractExcelService
public
class
DictionaryService
:
IAutoInjection
public
class
DictionaryService
:
IAutoInjection
{
{
private
readonly
ILogger
<
DictionaryService
>
logger
;
private
readonly
ILogger
<
DictionaryService
>
logger
;
private
readonly
QueryService
queryService
;
private
readonly
LogManageService
logService
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforExtypeRepository
extypeRepository
;
private
readonly
PerforExtypeRepository
extypeRepository
;
...
@@ -21,6 +23,8 @@ public class DictionaryService : IAutoInjection
...
@@ -21,6 +23,8 @@ public class DictionaryService : IAutoInjection
public
DictionaryService
(
public
DictionaryService
(
ILogger
<
DictionaryService
>
logger
,
ILogger
<
DictionaryService
>
logger
,
QueryService
queryService
,
LogManageService
logService
,
PerforPeremployeeRepository
peremployeeRepository
,
PerforPeremployeeRepository
peremployeeRepository
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforExtypeRepository
extypeRepository
,
PerforExtypeRepository
extypeRepository
,
...
@@ -28,13 +32,15 @@ PerforExscriptRepository exscriptRepository
...
@@ -28,13 +32,15 @@ PerforExscriptRepository exscriptRepository
)
)
{
{
this
.
logger
=
logger
;
this
.
logger
=
logger
;
this
.
queryService
=
queryService
;
this
.
logService
=
logService
;
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
extypeRepository
=
extypeRepository
;
this
.
extypeRepository
=
extypeRepository
;
this
.
exscriptRepository
=
exscriptRepository
;
this
.
exscriptRepository
=
exscriptRepository
;
}
}
public
void
Handle
(
int
hospitalId
,
per_allot
allot
)
public
void
Handle
r
(
int
hospitalId
,
per_allot
allot
,
string
groupName
,
bool
isSingle
)
{
{
try
try
{
{
...
@@ -44,6 +50,7 @@ public void Handle(int hospitalId, per_allot allot)
...
@@ -44,6 +50,7 @@ public void Handle(int hospitalId, per_allot allot)
var
types
=
extypeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
new
int
[]
{
2
}.
Contains
(
t
.
Source
));
var
types
=
extypeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
new
int
[]
{
2
}.
Contains
(
t
.
Source
));
if
(
types
==
null
||
!
types
.
Any
())
return
;
if
(
types
==
null
||
!
types
.
Any
())
return
;
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"提取人员信息数据"
,
isSingle
:
isSingle
);
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
types
.
Select
(
s
=>
s
.
Id
).
Contains
(
t
.
TypeId
)
&&
t
.
IsEnable
==
1
);
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
types
.
Select
(
s
=>
s
.
Id
).
Contains
(
t
.
TypeId
)
&&
t
.
IsEnable
==
1
);
if
(
scripts
!=
null
&&
scripts
.
Any
())
if
(
scripts
!=
null
&&
scripts
.
Any
())
{
{
...
@@ -69,7 +76,7 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
...
@@ -69,7 +76,7 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
{
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
data
=
QueryData
<
per_employee
>(
config
,
allot
,
sql
);
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
...
@@ -77,7 +84,7 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
...
@@ -77,7 +84,7 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
{
{
peremployeeRepository
.
RemoveRange
(
employees
.
ToArray
());
peremployeeRepository
.
RemoveRange
(
employees
.
ToArray
());
}
}
employees
.
AddRange
(
data
);
peremployeeRepository
.
AddRange
(
data
.
ToArray
()
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -88,53 +95,5 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
...
@@ -88,53 +95,5 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
private
void
Department
()
private
void
Department
()
{
{
}
}
#
region
QueryData
/// <summary>
/// 查询数据
/// </summary>
/// <param name="config"></param>
/// <param name="allot"></param>
/// <param name="execsql"></param>
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
private
IEnumerable
<
T
>
QueryData
<
T
>(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
{
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
{
foreach
(
var
item
in
parameters
)
{
execsql
=
Regex
.
Replace
(
execsql
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
var
result
=
connection
.
Query
<
T
>(
execsql
,
commandTimeout
:
20000
);
logger
.
LogInformation
(
$"提取绩效数据执行脚本获取数据
{
result
?.
Count
()
??
0
}
条记录"
);
return
result
;
}
}
/// <summary>
/// 获取参数
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
private
Dictionary
<
string
,
string
>
GetParameters
(
per_allot
allot
)
{
DateTime
beginTime
=
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
);
Dictionary
<
string
,
string
>
pairs
=
new
Dictionary
<
string
,
string
>
{
{
"@beginTime"
,
$"'
{
beginTime
.
ToString
(
"yyyy-MM-dd"
)}
'"
},
{
"@endTime"
,
$"'
{
beginTime
.
AddMonths
(
1
).
ToString
(
"yyyy-MM-dd"
)}
'"
},
};
return
pairs
;
}
#
endregion
QueryData
}
}
}
}
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
ffd4feff
...
@@ -18,7 +18,7 @@ public class ExtractService : IAutoInjection
...
@@ -18,7 +18,7 @@ public class ExtractService : IAutoInjection
private
readonly
QueryService
queryService
;
private
readonly
QueryService
queryService
;
private
readonly
PersonService
personService
;
private
readonly
PersonService
personService
;
private
readonly
PerSheetService
perSheetService
;
private
readonly
PerSheetService
perSheetService
;
private
readonly
PerforHospitalRepository
hospitalRepository
;
private
readonly
DictionaryService
dictionaryService
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforcollectdataRepository
collectdataRepository
;
private
readonly
PerforcollectdataRepository
collectdataRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
...
@@ -29,7 +29,7 @@ public class ExtractService : IAutoInjection
...
@@ -29,7 +29,7 @@ public class ExtractService : IAutoInjection
QueryService
queryService
,
QueryService
queryService
,
PersonService
personService
,
PersonService
personService
,
PerSheetService
perSheetService
,
PerSheetService
perSheetService
,
PerforHospitalRepository
hospitalRepository
,
DictionaryService
dictionaryService
,
PerforPerallotRepository
perallotRepository
,
PerforPerallotRepository
perallotRepository
,
PerforcollectdataRepository
collectdataRepository
,
PerforcollectdataRepository
collectdataRepository
,
PerforPeremployeeRepository
peremployeeRepository
PerforPeremployeeRepository
peremployeeRepository
...
@@ -40,7 +40,7 @@ PerforPeremployeeRepository peremployeeRepository
...
@@ -40,7 +40,7 @@ PerforPeremployeeRepository peremployeeRepository
this
.
queryService
=
queryService
;
this
.
queryService
=
queryService
;
this
.
personService
=
personService
;
this
.
personService
=
personService
;
this
.
perSheetService
=
perSheetService
;
this
.
perSheetService
=
perSheetService
;
this
.
hospitalRepository
=
hospitalRepository
;
this
.
dictionaryService
=
dictionaryService
;
this
.
perallotRepository
=
perallotRepository
;
this
.
perallotRepository
=
perallotRepository
;
this
.
collectdataRepository
=
collectdataRepository
;
this
.
collectdataRepository
=
collectdataRepository
;
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
peremployeeRepository
=
peremployeeRepository
;
...
@@ -73,6 +73,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -73,6 +73,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var
dict
=
new
Dictionary
<
ExDataDict
,
object
>();
var
dict
=
new
Dictionary
<
ExDataDict
,
object
>();
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
5
,
1
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
5
,
1
,
isSingle
);
dictionaryService
.
Handler
(
hospitalId
,
allot
,
groupName
,
isSingle
);
var
data
=
queryService
.
Handler
(
hospitalId
,
allot
,
groupName
,
isSingle
,
ref
dict
);
var
data
=
queryService
.
Handler
(
hospitalId
,
allot
,
groupName
,
isSingle
,
ref
dict
);
var
standData
=
StandDataFormat
(
hospitalId
,
data
);
var
standData
=
StandDataFormat
(
hospitalId
,
data
);
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
ffd4feff
...
@@ -80,7 +80,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
...
@@ -80,7 +80,7 @@ public List<ex_result> Handler(int hospitalId, per_allot allot, string groupName
var
data
=
new
List
<
ex_result
>();
var
data
=
new
List
<
ex_result
>();
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"开始提取数据"
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"开始提取数据"
,
isSingle
:
isSingle
);
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
extypeIds
.
Contains
(
t
.
TypeId
));
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
extypeIds
.
Contains
(
t
.
TypeId
));
if
(
scripts
!=
null
&&
scripts
.
Any
())
if
(
scripts
!=
null
&&
scripts
.
Any
())
...
@@ -386,6 +386,33 @@ public IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot al
...
@@ -386,6 +386,33 @@ public IEnumerable<ExtractDto> QueryData(sys_hospitalconfig config, per_allot al
}
}
/// <summary>
/// <summary>
/// 查询数据
/// </summary>
/// <param name="config"></param>
/// <param name="allot"></param>
/// <param name="execsql"></param>
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
public
IEnumerable
<
T
>
QueryData
<
T
>(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
{
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
{
foreach
(
var
item
in
parameters
)
{
execsql
=
Regex
.
Replace
(
execsql
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
var
result
=
connection
.
Query
<
T
>(
execsql
,
commandTimeout
:
20000
);
logger
.
LogInformation
(
$"提取绩效数据执行脚本获取数据
{
result
?.
Count
()
??
0
}
条记录"
);
return
result
;
}
}
/// <summary>
/// 获取参数
/// 获取参数
/// </summary>
/// </summary>
/// <param name="allot"></param>
/// <param name="allot"></param>
...
...
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