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
f4080e41
Commit
f4080e41
authored
Dec 16, 2021
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 手工录入
parents
ff0a869f
6b4bcb05
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
182 additions
and
134 deletions
+182
-134
performance/Performance.Api/Controllers/EmployeeController.cs.rej
+9
-0
performance/Performance.Api/Controllers/TemplateController.cs
+21
-9
performance/Performance.Repository/Common/ConnectionBuilder.cs
+2
-2
performance/Performance.Repository/PerforPeremployeeRepository.cs
+6
-2
performance/Performance.Repository/Performance.Repository.csproj
+1
-1
performance/Performance.Services/AllotCompute/ImportDataService.cs
+5
-10
performance/Performance.Services/AllotCompute/ResultComputeService.cs
+1
-1
performance/Performance.Services/ComputeService.cs
+8
-8
performance/Performance.Services/ConfigService.cs
+1
-1
performance/Performance.Services/ExConfigService.cs
+3
-3
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+10
-10
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+11
-8
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+38
-15
performance/Performance.Services/ExtractExcelService/QueryService.cs
+17
-57
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CustomDataWrite.cs
+31
-1
performance/Performance.Services/RedistributionService.cs
+1
-1
performance/Performance.Services/SecondAllot/SecondAllotService.cs
+10
-4
performance/Performance.Services/UnitTypeUtil.cs
+4
-1
performance/Performance.Services/UserService.cs
+3
-0
No files found.
performance/Performance.Api/Controllers/EmployeeController.cs.rej
0 → 100644
View file @
f4080e41
diff a/performance/Performance.Api/Controllers/EmployeeController.cs b/performance/Performance.Api/Controllers/EmployeeController.cs (rejected hunks)
@@ -824,6 +824,7 @@
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
+ var result = employeeService.GetGatherTotal(allotId, request);
return new ApiResponse(ResponseType.OK, result);
}
performance/Performance.Api/Controllers/TemplateController.cs
View file @
f4080e41
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
using
Performance.Services
;
using
Performance.Services
;
using
Performance.Services.ExtractExcelService
;
using
Performance.Services.ExtractExcelService
;
using
Performance.Services.Queues
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
...
@@ -37,6 +38,8 @@ public class TemplateController : Controller
...
@@ -37,6 +38,8 @@ public class TemplateController : Controller
private
readonly
AllotService
allotService
;
private
readonly
AllotService
allotService
;
private
readonly
LogManageService
logService
;
private
readonly
LogManageService
logService
;
private
readonly
IServiceScopeFactory
serviceScopeFactory
;
private
readonly
IServiceScopeFactory
serviceScopeFactory
;
private
readonly
IBackgroundTaskQueue
_backgroundTaskQueue
;
private
readonly
ExtractService
extractService
;
public
TemplateController
(
public
TemplateController
(
ILogger
<
ExceptionsFilter
>
logger
,
ILogger
<
ExceptionsFilter
>
logger
,
...
@@ -50,7 +53,9 @@ public class TemplateController : Controller
...
@@ -50,7 +53,9 @@ public class TemplateController : Controller
HospitalService
hospitalService
,
HospitalService
hospitalService
,
AllotService
allotService
,
AllotService
allotService
,
LogManageService
logService
,
LogManageService
logService
,
IServiceScopeFactory
serviceScopeFactory
)
IBackgroundTaskQueue
backgroundTaskQueue
,
IServiceScopeFactory
serviceScopeFactory
,
ExtractService
extractService
)
{
{
this
.
logger
=
logger
;
this
.
logger
=
logger
;
this
.
env
=
env
;
this
.
env
=
env
;
...
@@ -64,6 +69,8 @@ public class TemplateController : Controller
...
@@ -64,6 +69,8 @@ public class TemplateController : Controller
this
.
allotService
=
allotService
;
this
.
allotService
=
allotService
;
this
.
logService
=
logService
;
this
.
logService
=
logService
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
_backgroundTaskQueue
=
backgroundTaskQueue
;
this
.
extractService
=
extractService
;
}
}
/// <summary>
/// <summary>
...
@@ -226,22 +233,22 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -226,22 +233,22 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
allot
.
IsExtracting
=
1
;
allot
.
IsExtracting
=
1
;
allot
.
ExtractTime
=
DateTime
.
Now
;
allot
.
ExtractTime
=
DateTime
.
Now
;
allotService
.
Update
(
allot
);
allotService
.
Update
(
allot
);
string
email
=
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
);
// string email = claim.GetUserClaim(JwtClaimTypes.Mail);
string
email
=
""
;
if
(
isSingle
)
if
(
isSingle
)
{
{
logger
.
LogInformation
(
"同一项目中进行提取"
);
logger
.
LogInformation
(
"同一项目中进行提取"
);
Task
.
Run
(()
=>
_backgroundTaskQueue
.
QueueBackgroundWorkItem
(
async
token
=>
{
{
using
(
var
scope
=
serviceScopeFactory
.
CreateScope
())
using
(
var
scope
=
serviceScopeFactory
.
CreateScope
())
{
{
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
ExtractService
>();
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
ExtractService
>();
logger
.
LogInformation
(
"提取绩效数据参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
=
allot
.
ID
,
hospitalId
=
allot
.
HospitalId
,
userId
=
claim
.
GetUserId
()
}));
logger
.
LogInformation
(
"提取绩效数据参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
=
allot
.
ID
,
hospitalId
=
allot
.
HospitalId
}));
string
extractFilePath
=
scopedServices
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
"User"
+
claim
.
GetUserId
(),
filePath
,
isSingle
);
string
extractFilePath
=
scopedServices
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
allot
.
ID
.
ToString
(),
filePath
,
isSingle
);
}
}
});
});
Thread
.
Sleep
(
1000
);
}
}
else
else
{
{
...
@@ -252,8 +259,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -252,8 +259,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
{
{
AllotId
=
request
.
AllotId
,
AllotId
=
request
.
AllotId
,
HospitalId
=
request
.
HospitalId
,
HospitalId
=
request
.
HospitalId
,
Email
=
email
,
Email
=
email
UserId
=
claim
.
GetUserId
()
};
};
string
json
=
JsonHelper
.
Serialize
(
obj
);
string
json
=
JsonHelper
.
Serialize
(
obj
);
...
@@ -284,6 +290,12 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -284,6 +290,12 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
// B 使用配置作为模板
// B 使用配置作为模板
}
}
[
HttpPost
(
"extract/allot/file"
)]
public
ApiResponse
ExtractAllotFile
(
ExtractRequest
request
)
{
extractService
.
Main
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
Email
,
request
.
AllotId
.
ToString
(),
""
,
true
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
/// <summary>
/// <summary>
/// 提取日志
/// 提取日志
...
...
performance/Performance.Repository/Common/ConnectionBuilder.cs
View file @
f4080e41
using
Microsoft.Data.SqlClient
;
using
MySql.Data.MySqlClient
;
using
MySql.Data.MySqlClient
;
using
Oracle.ManagedDataAccess.Client
;
using
Oracle.ManagedDataAccess.Client
;
using
System
;
using
System
;
using
System.Data
;
using
System.Data
;
using
System.Data.SqlClient
;
namespace
Performance.Repository
namespace
Performance.Repository
{
{
...
...
performance/Performance.Repository/PerforPeremployeeRepository.cs
View file @
f4080e41
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
using
Performance.Repository
;
using
Performance.Repository
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Linq.Expressions
;
...
@@ -124,7 +125,10 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ
...
@@ -124,7 +125,10 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ
TotalCount
=
DapperQuery
<
int
>(
queryCount
,
new
{
allotId
,
searchQuery
,
parm
=
$"%
{
searchQuery
}
%"
})?.
FirstOrDefault
()
??
0
,
TotalCount
=
DapperQuery
<
int
>(
queryCount
,
new
{
allotId
,
searchQuery
,
parm
=
$"%
{
searchQuery
}
%"
})?.
FirstOrDefault
()
??
0
,
};
};
}
}
}
public
IDbConnection
GetDbConnection
()
{
return
context
.
Database
.
GetDbConnection
();
}
}
}
}
performance/Performance.Repository/Performance.Repository.csproj
View file @
f4080e41
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.4" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.4" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
</ItemGroup>
</ItemGroup>
...
...
performance/Performance.Services/AllotCompute/ImportDataService.cs
View file @
f4080e41
...
@@ -75,13 +75,13 @@ private PerExcel Import(per_allot allot)
...
@@ -75,13 +75,13 @@ private PerExcel Import(per_allot allot)
Version
=
FileHelper
.
GetExtension
(
path
)
==
".xlsx"
?
ExcelVersion
.
xlsx
:
ExcelVersion
.
xls
,
Version
=
FileHelper
.
GetExtension
(
path
)
==
".xlsx"
?
ExcelVersion
.
xlsx
:
ExcelVersion
.
xls
,
PerSheet
=
new
List
<
PerSheet
>()
PerSheet
=
new
List
<
PerSheet
>()
};
};
_logManageService
.
WriteMsg
(
"读取文件"
,
$"文件读取中...当前操作需要一点时间,请耐心等待"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Open
))
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Open
))
{
{
IWorkbook
workbook
=
(
excel
.
Version
==
ExcelVersion
.
xlsx
)
IWorkbook
workbook
=
(
excel
.
Version
==
ExcelVersion
.
xlsx
)
?
new
XSSFWorkbook
(
fs
)
:
new
HSSFWorkbook
(
fs
);
?
(
IWorkbook
)(
new
XSSFWorkbook
(
fs
))
:
(
IWorkbook
)(
new
HSSFWorkbook
(
fs
));
bool
isnew
=
false
;
bool
isnew
=
false
;
var
tasks
=
new
List
<
Task
>();
for
(
int
i
=
0
;
i
<
workbook
.
NumberOfSheets
;
i
++)
for
(
int
i
=
0
;
i
<
workbook
.
NumberOfSheets
;
i
++)
{
{
var
sheet
=
workbook
.
GetSheetAt
(
i
);
var
sheet
=
workbook
.
GetSheetAt
(
i
);
...
@@ -93,8 +93,6 @@ private PerExcel Import(per_allot allot)
...
@@ -93,8 +93,6 @@ private PerExcel Import(per_allot allot)
try
try
{
{
tasks
.
Add
(
Task
.
Factory
.
StartNew
(()
=>
{
// 保留临床科室测算表全部结构,用作展示,不做其他用途
// 保留临床科室测算表全部结构,用作展示,不做其他用途
if
(
sheetType
==
SheetType
.
AccountBasic
)
if
(
sheetType
==
SheetType
.
AccountBasic
)
{
{
...
@@ -112,7 +110,7 @@ private PerExcel Import(per_allot allot)
...
@@ -112,7 +110,7 @@ private PerExcel Import(per_allot allot)
if
(
sheet
.
SheetName
.
Contains
(
"开单医院"
))
if
(
sheet
.
SheetName
.
Contains
(
"开单医院"
))
isnew
=
true
;
isnew
=
true
;
}
}
}));
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -121,9 +119,6 @@ private PerExcel Import(per_allot allot)
...
@@ -121,9 +119,6 @@ private PerExcel Import(per_allot allot)
}
}
}
}
_logManageService
.
WriteMsg
(
"读取文件"
,
$"文件读取中...当前操作需要一点时间,请耐心等待"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
Task
.
WaitAll
(
tasks
.
ToArray
());
_logManageService
.
WriteMsg
(
"读取文件"
,
$"EXCEL文件基础数据读取完成!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
_logManageService
.
WriteMsg
(
"读取文件"
,
$"EXCEL文件基础数据读取完成!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
return
excel
;
return
excel
;
...
...
performance/Performance.Services/AllotCompute/ResultComputeService.cs
View file @
f4080e41
...
@@ -673,7 +673,7 @@ public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest req
...
@@ -673,7 +673,7 @@ public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest req
{
{
var
second
=
secondList
?.
FirstOrDefault
(
f
=>
f
.
UnitType
==
item
.
UnitType
&&
f
.
Department
==
item
.
Department
);
var
second
=
secondList
?.
FirstOrDefault
(
f
=>
f
.
UnitType
==
item
.
UnitType
&&
f
.
Department
==
item
.
Department
);
var
isDiffer
=
(
item
.
RealGiveFee
??
0
)
>
0
&&
(
item
.
PreRealGiveFee
??
0
)
>
0
&&
((
item
.
RealGiveFee
??
0
)
!=
(
item
.
PreRealGiveFee
??
0
)
);
var
isDiffer
=
(
item
.
RealGiveFee
??
0
)
!=
(
item
.
PreRealGiveFee
??
0
);
if
((
item
.
RealGiveFee
??
0
)
==
0
&&
(
item
.
PreRealGiveFee
??
0
)
>
0
)
if
((
item
.
RealGiveFee
??
0
)
==
0
&&
(
item
.
PreRealGiveFee
??
0
)
>
0
)
{
{
...
...
performance/Performance.Services/ComputeService.cs
View file @
f4080e41
...
@@ -206,7 +206,8 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
...
@@ -206,7 +206,8 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
}
}
else
else
{
{
var
compute
=
_perforRescomputeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
AccountType
==
items
.
FirstOrDefault
(
p
=>
p
.
Value
==
type
).
Name
);
var
name
=
items
.
FirstOrDefault
(
p
=>
p
.
Value
==
type
)?.
Name
??
""
;
var
compute
=
_perforRescomputeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
&&
t
.
AccountType
==
name
);
if
(
type
==
(
int
)
AccountUnitType
.
行政工勤
)
if
(
type
==
(
int
)
AccountUnitType
.
行政工勤
)
compute
=
compute
?.
Where
(
w
=>
w
.
NeedSecondAllot
==
"否"
)?.
ToList
();
compute
=
compute
?.
Where
(
w
=>
w
.
NeedSecondAllot
==
"否"
)?.
ToList
();
...
@@ -2000,20 +2001,19 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
...
@@ -2000,20 +2001,19 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
/// <returns></returns>
/// <returns></returns>
public
List
<
cof_alias
>
CustomColumnHeaders
(
int
hospitalId
,
string
route
)
public
List
<
cof_alias
>
CustomColumnHeaders
(
int
hospitalId
,
string
route
)
{
{
var
alias
=
cofaliasRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
Route
.
Equals
(
route
,
StringComparison
.
OrdinalIgnoreCase
));
var
init
=
new
List
<
cof_alias
>();
var
alias
=
cofaliasRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
)
??
new
List
<
cof_alias
>();
alias
=
alias
.
Where
(
t
=>
t
.
Route
.
Equals
(
route
,
StringComparison
.
OrdinalIgnoreCase
)).
OrderBy
(
w
=>
w
.
Id
).
ToList
()
??
new
List
<
cof_alias
>();
if
(
alias
==
null
||
alias
.
Count
==
0
)
{
var
pairs
=
new
Dictionary
<
string
,
List
<
cof_alias
>>
var
pairs
=
new
Dictionary
<
string
,
List
<
cof_alias
>>
{
{
{
"/result/compute"
,
ComputeConfig
.
AllComputeView
},
{
"/result/compute"
,
ComputeConfig
.
AllComputeView
},
{
"/result/wholehospital"
,
ComputeConfig
.
AllComputePersonView
},
{
"/result/wholehospital"
,
ComputeConfig
.
AllComputePersonView
},
{
"/result/print/compute"
,
ComputeConfig
.
AllComputeDepartmentView
},
{
"/result/print/compute"
,
ComputeConfig
.
AllComputeDepartmentView
},
};
};
var
init
=
pairs
.
ContainsKey
(
route
.
ToLower
())
?
pairs
[
route
.
ToLower
()]
:
new
List
<
cof_alias
>();
init
=
pairs
.
ContainsKey
(
route
.
ToLower
())
?
pairs
[
route
.
ToLower
()]
:
new
List
<
cof_alias
>();
foreach
(
var
item
in
init
)
{
item
.
HospitalId
=
hospitalId
;
item
.
Route
=
route
;
item
.
OriginalName
=
item
.
Alias
;
}
}
if
(
alias
!=
null
&&
alias
.
Count
>
0
)
if
(
alias
!=
null
&&
alias
.
Count
>
0
)
...
...
performance/Performance.Services/ConfigService.cs
View file @
f4080e41
...
@@ -868,7 +868,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request)
...
@@ -868,7 +868,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request)
{
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
cof_accounting
>(
json
);
var
data
=
JsonHelper
.
Deserialize
<
cof_accounting
>(
json
);
data
.
AllotId
=
allotId
;
if
(!
unitType
.
Contains
(
data
?.
UnitType
)
&&
!
string
.
IsNullOrEmpty
(
data
?.
UnitType
))
return
false
;
if
(!
unitType
.
Contains
(
data
?.
UnitType
)
&&
!
string
.
IsNullOrEmpty
(
data
?.
UnitType
))
return
false
;
if
(
getAccounts
!=
null
)
if
(
getAccounts
!=
null
)
if
(
getAccounts
.
Any
(
t
=>
t
.
AccountingUnit
==
data
?.
AccountingUnit
&&
t
.
UnitType
==
data
?.
UnitType
))
continue
;
if
(
getAccounts
.
Any
(
t
=>
t
.
AccountingUnit
==
data
?.
AccountingUnit
&&
t
.
UnitType
==
data
?.
UnitType
))
continue
;
...
...
performance/Performance.Services/ExConfigService.cs
View file @
f4080e41
...
@@ -624,7 +624,7 @@ public string LastAllotFilePath(int allotId)
...
@@ -624,7 +624,7 @@ public string LastAllotFilePath(int allotId)
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
OrDefault
();
if
(
allotLast
!=
null
)
if
(
allotLast
!=
null
)
return
allotLast
.
Path
;
return
allotLast
.
Path
;
...
@@ -659,7 +659,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
...
@@ -659,7 +659,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
// 获取最近一次绩效
// 获取最近一次绩效
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
OrDefault
();
if
(
allotLast
!=
null
)
if
(
allotLast
!=
null
)
filePath
=
allotLast
.
Path
;
filePath
=
allotLast
.
Path
;
// 获取当前医院模版信息
// 获取当前医院模版信息
...
@@ -775,7 +775,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
...
@@ -775,7 +775,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
if
(
conf
==
null
)
if
(
conf
==
null
)
continue
;
continue
;
var
data
=
queryService
.
QueryData
(
conf
,
allot
,
scr
.
ExecScript
);
var
data
=
queryService
.
QueryData
<
ExtractDto
>(
conf
,
scr
.
ExecScript
,
allot
,
false
);
if
(
data
==
null
||
!
data
.
Any
())
continue
;
if
(
data
==
null
||
!
data
.
Any
())
continue
;
foreach
(
var
module
in
moduleSheet
.
Where
(
t
=>
t
.
CheckScriptId
==
scr
.
Id
))
foreach
(
var
module
in
moduleSheet
.
Where
(
t
=>
t
.
CheckScriptId
==
scr
.
Id
))
...
...
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
View file @
f4080e41
...
@@ -71,7 +71,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -71,7 +71,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
var
typeIds
=
types
.
Where
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
).
Select
(
t
=>
t
.
Id
);
var
typeIds
=
types
.
Where
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
).
Select
(
t
=>
t
.
Id
);
var
script
=
scripts
.
Where
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
var
script
=
scripts
.
Where
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
if
(
script
!=
null
)
if
(
script
!=
null
)
Employee
(
allot
,
configs
,
scripts
);
Employee
(
allot
,
configs
,
scripts
,
isSingle
);
}
}
if
(
types
.
Any
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
OnlyExtract
))
//不写入Excel的提取数据
if
(
types
.
Any
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
OnlyExtract
))
//不写入Excel的提取数据
{
{
...
@@ -84,7 +84,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -84,7 +84,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
foreach
(
var
script
in
thisTypeScripts
)
foreach
(
var
script
in
thisTypeScripts
)
{
{
logger
.
LogInformation
(
$"提取sql:
{
script
.
ExecScript
}
"
);
logger
.
LogInformation
(
$"提取sql:
{
script
.
ExecScript
}
"
);
ExResult
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
),
script
.
ExecScript
,
type
.
EName
);
ExResult
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
),
script
.
ExecScript
,
type
.
EName
,
isSingle
);
}
}
}
}
}
}
...
@@ -96,7 +96,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -96,7 +96,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
foreach
(
var
item
in
hisScrips
)
foreach
(
var
item
in
hisScrips
)
{
{
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"提取
{
item
.
SourceType
}
-
{
item
.
Category
}
数据"
,
isSingle
:
isSingle
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"提取
{
item
.
SourceType
}
-
{
item
.
Category
}
数据"
,
isSingle
:
isSingle
);
HisData
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
item
.
ConfigId
),
item
);
HisData
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
item
.
ConfigId
),
item
,
isSingle
);
}
}
}
}
catch
(
Exception
)
catch
(
Exception
)
...
@@ -106,7 +106,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -106,7 +106,7 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
}
}
}
}
private
void
Employee
(
per_allot
allot
,
List
<
sys_hospitalconfig
>
configs
,
IEnumerable
<
ex_script
>
scripts
)
private
void
Employee
(
per_allot
allot
,
List
<
sys_hospitalconfig
>
configs
,
IEnumerable
<
ex_script
>
scripts
,
bool
isSingle
)
{
{
try
try
{
{
...
@@ -116,12 +116,12 @@ private void Employee(per_allot allot, List<sys_hospitalconfig> configs, IEnumer
...
@@ -116,12 +116,12 @@ private void Employee(per_allot allot, List<sys_hospitalconfig> configs, IEnumer
var
sql
=
script
.
ExecScript
;
var
sql
=
script
.
ExecScript
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
limitData
=
queryService
.
QueryData
<
dynamic
>(
config
,
allot
,
sql
);
var
limitData
=
queryService
.
QueryData
<
dynamic
>(
config
,
sql
,
allot
,
isSingle
);
if
(
limitData
==
null
||
!
limitData
.
Any
())
return
;
if
(
limitData
==
null
||
!
limitData
.
Any
())
return
;
var
columns
=
((
IDictionary
<
string
,
object
>)
limitData
.
ElementAt
(
0
)).
Select
(
t
=>
t
.
Key
.
ToLower
()).
ToList
();
var
columns
=
((
IDictionary
<
string
,
object
>)
limitData
.
ElementAt
(
0
)).
Select
(
t
=>
t
.
Key
.
ToLower
()).
ToList
();
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
).
ToList
();
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
sql
,
allot
,
isSingle
).
ToList
();
data
.
ForEach
(
t
=>
data
.
ForEach
(
t
=>
{
{
t
.
AllotId
=
allot
.
ID
;
t
.
AllotId
=
allot
.
ID
;
...
@@ -223,13 +223,13 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
...
@@ -223,13 +223,13 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
}
}
}
}
private
void
HisData
(
per_allot
allot
,
sys_hospitalconfig
config
,
his_script
script
)
private
void
HisData
(
per_allot
allot
,
sys_hospitalconfig
config
,
his_script
script
,
bool
isSingle
)
{
{
try
try
{
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
script
.
ExecScript
))
return
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
script
.
ExecScript
))
return
;
var
data
=
queryService
.
QueryData
<
HisData
>(
config
,
allot
,
script
.
ExecScript
);
var
data
=
queryService
.
QueryData
<
HisData
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
hisdata
=
hisdataRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
&&
t
.
SourceType
==
script
.
SourceType
&&
t
.
Category
==
script
.
Category
);
var
hisdata
=
hisdataRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
&&
t
.
SourceType
==
script
.
SourceType
&&
t
.
Category
==
script
.
Category
);
...
@@ -265,13 +265,13 @@ private void Department()
...
@@ -265,13 +265,13 @@ private void Department()
{
{
}
}
private
void
ExResult
(
per_allot
allot
,
sys_hospitalconfig
config
,
string
sql
,
string
enmae
)
private
void
ExResult
(
per_allot
allot
,
sys_hospitalconfig
config
,
string
sql
,
string
enmae
,
bool
isSingle
)
{
{
try
try
{
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
data
=
queryService
.
QueryData
(
config
,
allot
,
sql
);
var
data
=
queryService
.
QueryData
<
ExtractDto
>(
config
,
sql
,
allot
,
isSingle
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
createTime
=
DateTime
.
Now
;
var
createTime
=
DateTime
.
Now
;
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
f4080e41
...
@@ -52,6 +52,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -52,6 +52,8 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
pairs
.
Add
(
workbook
.
GetSheetAt
(
i
).
SheetName
,
i
);
pairs
.
Add
(
workbook
.
GetSheetAt
(
i
).
SheetName
,
i
);
}
}
try
{
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
OrderBy
(
t
=>
t
.
ModuleName
))
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
...
@@ -60,34 +62,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -60,34 +62,35 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
string
[]
keyArray
=
new
string
[]
{
"开单"
,
"就诊"
,
"执行"
};
string
[]
keyArray
=
new
string
[]
{
"开单"
,
"就诊"
,
"执行"
};
if
(
keyArray
.
Any
(
key
=>
module
.
ModuleName
.
Contains
(
key
)))
if
(
keyArray
.
Any
(
key
=>
module
.
ModuleName
.
Contains
(
key
)))
{
{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
StartsWith
(
"1."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
()
.
StartsWith
(
"1."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
if
(
copysheet
==
null
)
continue
;
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
}
}
}
}
}
}
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
OtherWorkload
,
(
int
)
SheetType
.
Assess
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
var
sheet
=
workbook
.
GetSheet
(
module
.
ModuleName
)
??
workbook
.
GetSheet
(
module
.
ModuleName
.
NoBlank
());
if
(
sheet
==
null
)
if
(
sheet
==
null
)
{
{
//string key = "工作量";
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
ToString
().
NoBlank
().
StartsWith
(
"3."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
//if (module.ModuleName.Contains(key))
//{
var
item
=
pairs
.
Where
(
t
=>
t
.
Key
.
StartsWith
(
"3."
)).
OrderByDescending
(
t
=>
t
.
Key
).
First
();
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
var
copysheet
=
workbook
.
GetSheet
(
item
.
Key
);
if
(
copysheet
==
null
)
continue
;
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
var
newSheet
=
copysheet
.
CopySheet
(
module
.
ModuleName
,
true
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
workbook
.
SetSheetOrder
(
newSheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
var
point
=
PerSheetDataFactory
.
GetDataRead
(
SheetType
.
Workload
)?.
Point
;
var
point
=
PerSheetDataFactory
.
GetDataRead
(
SheetType
.
Workload
)?.
Point
;
ClearSheetTemplate
(
newSheet
,
point
,
(
SheetType
)
module
.
SheetType
);
ClearSheetTemplate
(
newSheet
,
point
,
(
SheetType
)
module
.
SheetType
);
//}
}
}
}
}
}
}
catch
{
}
}
public
static
void
ClearSheetPartialData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
)
public
static
void
ClearSheetPartialData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
)
{
{
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
f4080e41
using
Microsoft.Extensions.Logging
;
using
Dapper
;
using
Microsoft.Extensions.Logging
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
...
@@ -7,6 +8,7 @@
...
@@ -7,6 +8,7 @@
using
Performance.Services.ExtractExcelService.SheetDataWrite
;
using
Performance.Services.ExtractExcelService.SheetDataWrite
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
...
@@ -79,9 +81,11 @@ PerforExresultRepository exresultRepository
...
@@ -79,9 +81,11 @@ PerforExresultRepository exresultRepository
/// <param name="isSingle">抽取是否在同一项目</param>
/// <param name="isSingle">抽取是否在同一项目</param>
public
string
Main
(
int
allotId
,
int
hospitalId
,
string
email
,
string
groupName
,
string
filePath
=
null
,
bool
isSingle
=
false
)
public
string
Main
(
int
allotId
,
int
hospitalId
,
string
email
,
string
groupName
,
string
filePath
=
null
,
bool
isSingle
=
false
)
{
{
groupName
=
allotId
.
ToString
();
string
extractFilePath
=
""
;
string
extractFilePath
=
""
;
per_allot
allot
=
null
;
per_allot
allot
=
null
;
IWorkbook
workbook
=
null
;
IWorkbook
workbook
=
null
;
IDbConnection
connection
=
peremployeeRepository
.
GetDbConnection
();
try
try
{
{
logService
.
ClearExtractLog
(
allotId
);
logService
.
ClearExtractLog
(
allotId
);
...
@@ -123,6 +127,11 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -123,6 +127,11 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
allot
.
ExtractPath
=
extractFilePath
;
allot
.
ExtractPath
=
extractFilePath
;
workbook
.
EvaluateAll
();
workbook
.
EvaluateAll
();
using
(
FileStream
file
=
new
FileStream
(
extractFilePath
,
FileMode
.
OpenOrCreate
))
{
workbook
.
Write
(
file
);
}
workbook
.
Close
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -133,12 +142,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -133,12 +142,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
finally
finally
{
{
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
100
,
5
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
100
,
5
,
isSingle
);
using
(
FileStream
file
=
new
FileStream
(
extractFilePath
,
FileMode
.
OpenOrCreate
))
UpdateAllot
(
connection
,
allot
);
{
workbook
.
Write
(
file
);
}
workbook
.
Close
();
perallotRepository
.
Update
(
allot
);
}
}
return
extractFilePath
;
return
extractFilePath
;
}
}
...
@@ -329,19 +333,38 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
...
@@ -329,19 +333,38 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
Department
=
t
.
Key
.
Department
,
Department
=
t
.
Key
.
Department
,
Category
=
t
.
Key
.
Category
,
Category
=
t
.
Key
.
Category
,
Value
=
t
.
Sum
(
group
=>
group
.
Value
)
==
0
?
null
:
t
.
Sum
(
group
=>
group
.
Value
),
Value
=
t
.
Sum
(
group
=>
group
.
Value
)
==
0
?
null
:
t
.
Sum
(
group
=>
group
.
Value
),
OutDoctorAccounting
=
t
.
First
()
.
OutDoctorAccounting
,
OutDoctorAccounting
=
t
.
First
OrDefault
()?
.
OutDoctorAccounting
,
OutNurseAccounting
=
t
.
First
()
.
OutNurseAccounting
,
OutNurseAccounting
=
t
.
First
OrDefault
()?
.
OutNurseAccounting
,
OutTechnicAccounting
=
t
.
First
()
.
OutTechnicAccounting
,
OutTechnicAccounting
=
t
.
First
OrDefault
()?
.
OutTechnicAccounting
,
InpatDoctorAccounting
=
t
.
First
()
.
InpatDoctorAccounting
,
InpatDoctorAccounting
=
t
.
First
OrDefault
()?
.
InpatDoctorAccounting
,
InpatNurseAccounting
=
t
.
First
()
.
InpatNurseAccounting
,
InpatNurseAccounting
=
t
.
First
OrDefault
()?
.
InpatNurseAccounting
,
InpatTechnicAccounting
=
t
.
First
()
.
InpatTechnicAccounting
,
InpatTechnicAccounting
=
t
.
First
OrDefault
()?
.
InpatTechnicAccounting
,
SpecialAccounting
=
t
.
First
()
.
SpecialAccounting
,
SpecialAccounting
=
t
.
First
OrDefault
()?
.
SpecialAccounting
,
EName
=
t
.
FirstOrDefault
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
EName
)).
EName
EName
=
t
.
FirstOrDefault
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
EName
))
?
.
EName
});
});
return
groupdata
.
ToList
();
return
groupdata
.
ToList
();
}
}
private
void
UpdateAllot
(
IDbConnection
connection
,
per_allot
allot
)
{
try
{
string
sql
=
"update per_allot set isextracting = @isextracting, extractpath = @extractpath where id = @id"
;
if
(
connection
==
null
)
return
;
if
(
connection
.
State
==
ConnectionState
.
Closed
)
connection
.
Open
();
connection
.
Execute
(
sql
,
allot
);
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
ex
.
Message
);
}
}
private
readonly
List
<
SheetType
>
OtherConfigSheet
=
new
List
<
SheetType
>
private
readonly
List
<
SheetType
>
OtherConfigSheet
=
new
List
<
SheetType
>
{
{
SheetType
.
AccountExtra
,
SheetType
.
AccountExtra
,
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
f4080e41
...
@@ -59,6 +59,7 @@ PerforPerallotRepository perallotRepository
...
@@ -59,6 +59,7 @@ PerforPerallotRepository perallotRepository
}
}
private
readonly
DateTime
CreateTime
=
DateTime
.
Now
;
private
readonly
DateTime
CreateTime
=
DateTime
.
Now
;
private
static
Dictionary
<
int
,
IDbConnection
>
pools
=
new
Dictionary
<
int
,
IDbConnection
>();
/// <summary>
/// <summary>
/// 获取抽取数据
/// 获取抽取数据
...
@@ -194,8 +195,6 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
...
@@ -194,8 +195,6 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
3
,
""
,
ratio
>
20
?
20
:
ratio
,
1
,
isSingle
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
3
,
""
,
ratio
>
20
?
20
:
ratio
,
1
,
isSingle
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"开始提取模块“
{
string
.
Join
(
"、"
,
thisModules
.
Select
(
t
=>
t
.
ModuleName
))}
”的数据"
,
1
,
isSingle
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"开始提取模块“
{
string
.
Join
(
"、"
,
thisModules
.
Select
(
t
=>
t
.
ModuleName
))}
”的数据"
,
1
,
isSingle
);
Dictionary
<
int
,
IDbConnection
>
pools
=
new
Dictionary
<
int
,
IDbConnection
>();
foreach
(
var
script
in
scripts
.
Where
(
t
=>
t
.
TypeId
==
typeId
))
foreach
(
var
script
in
scripts
.
Where
(
t
=>
t
.
TypeId
==
typeId
))
{
{
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
...
@@ -203,20 +202,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
...
@@ -203,20 +202,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
try
try
{
{
try
var
querydata
=
QueryData
<
ExtractDto
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
{
if
(!
pools
.
ContainsKey
(
config
.
Id
))
pools
.
Add
(
config
.
Id
,
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
));
}
catch
{
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"数据库连接"
,
$"数据库“
{
config
.
DbName
}
”连接失败"
,
3
,
isSingle
);
}
IDbConnection
connection
=
pools
[
config
.
Id
];
var
parameters
=
GetParameters
(
allot
);
var
querydata
=
QueryData
(
connection
,
parameters
,
script
.
ExecScript
);
if
(
querydata
!=
null
&&
querydata
.
Any
())
if
(
querydata
!=
null
&&
querydata
.
Any
())
{
{
...
@@ -287,7 +273,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
...
@@ -287,7 +273,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
if
(
config
==
null
)
continue
;
if
(
config
==
null
)
continue
;
var
querydata
=
QueryData
(
config
,
allot
,
script
.
ExecScript
);
var
querydata
=
QueryData
<
ExtractDto
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
if
(
querydata
!=
null
&&
querydata
.
Any
())
if
(
querydata
!=
null
&&
querydata
.
Any
())
{
{
thisItems
.
ForEach
(
f
=>
thisItems
.
ForEach
(
f
=>
...
@@ -351,7 +337,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
...
@@ -351,7 +337,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
);
if
(
config
==
null
)
continue
;
if
(
config
==
null
)
continue
;
var
querydata
=
QueryData
(
config
,
allot
,
script
.
ExecScript
);
var
querydata
=
QueryData
<
ExtractDto
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
if
(
querydata
!=
null
&&
querydata
.
Any
())
if
(
querydata
!=
null
&&
querydata
.
Any
())
{
{
thisSpecials
.
ForEach
(
f
=>
thisSpecials
.
ForEach
(
f
=>
...
@@ -396,54 +382,29 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
...
@@ -396,54 +382,29 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
/// <param name="source"></param>
/// <param name="source"></param>
/// <param name="category"></param>
/// <param name="category"></param>
/// <returns></returns>
/// <returns></returns>
public
IEnumerable
<
ExtractDto
>
QueryData
(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
public
IEnumerable
<
T
>
QueryData
<
T
>(
sys_hospitalconfig
config
,
string
execsql
,
per_allot
allot
,
bool
isSingle
)
{
{
var
parameters
=
GetParameters
(
allot
);
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
{
return
QueryData
(
connection
,
parameters
,
execsql
);
}
}
/// <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
<
ExtractDto
>
QueryData
(
IDbConnection
connection
,
Dictionary
<
string
,
string
>
parameters
,
string
execsql
)
{
foreach
(
var
item
in
parameters
)
foreach
(
var
item
in
parameters
)
{
{
execsql
=
Regex
.
Replace
(
execsql
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
execsql
=
Regex
.
Replace
(
execsql
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
}
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
IDbConnection
connection
=
null
;
var
result
=
connection
.
Query
<
ExtractDto
>(
execsql
,
commandTimeout
:
20000
);
try
logger
.
LogInformation
(
$"提取绩效数据执行脚本获取数据
{
result
?.
Count
()
??
0
}
条记录"
);
{
if
(!
pools
.
ContainsKey
(
config
.
Id
))
pools
.
Add
(
config
.
Id
,
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
));
connection
=
pools
[
config
.
Id
];
return
result
;
if
(
connection
==
null
)
return
Enumerable
.
Empty
<
T
>();
}
/// <summary>
if
(
connection
.
State
==
ConnectionState
.
Closed
)
/// 查询数据
connection
.
Open
();
/// </summary>
}
/// <param name="config"></param>
catch
/// <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
.
IgnoreCas
e
);
logService
.
ReturnTheLog
(
allot
.
ID
,
allot
.
ID
.
ToString
(),
2
,
"数据库连接"
,
$"数据库“
{
config
.
DbName
}
”连接失败"
,
3
,
isSingl
e
);
}
}
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
logger
.
LogInformation
(
$"提取绩效数据SQL脚本
{
execsql
}
"
);
...
@@ -452,7 +413,6 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, per_allot allot, s
...
@@ -452,7 +413,6 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, per_allot allot, s
return
result
;
return
result
;
}
}
}
/// <summary>
/// <summary>
/// 获取参数
/// 获取参数
...
...
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CustomDataWrite.cs
View file @
f4080e41
...
@@ -63,7 +63,7 @@ public void WriteDataToCustom(IWorkbook workbook, per_allot allot, ExcelStyle st
...
@@ -63,7 +63,7 @@ public void WriteDataToCustom(IWorkbook workbook, per_allot allot, ExcelStyle st
sheet
=
workbook
.
CreateSheet
(
module
.
ModuleName
);
sheet
=
workbook
.
CreateSheet
(
module
.
ModuleName
);
workbook
.
SetSheetOrder
(
sheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
workbook
.
SetSheetOrder
(
sheet
.
SheetName
,
workbook
.
NumberOfSheets
-
1
);
}
}
ClearSheetData
(
sheet
);
var
exscript
=
exscripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
module
.
TypeId
);
var
exscript
=
exscripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
module
.
TypeId
);
if
(
exscript
==
null
)
continue
;
if
(
exscript
==
null
)
continue
;
...
@@ -116,5 +116,35 @@ public void WriteDataToCustom(IWorkbook workbook, per_allot allot, ExcelStyle st
...
@@ -116,5 +116,35 @@ public void WriteDataToCustom(IWorkbook workbook, per_allot allot, ExcelStyle st
}
}
}
}
}
}
private
void
ClearSheetData
(
ISheet
sheet
)
{
try
{
for
(
int
i
=
Point
.
DataFirstRowNum
.
Value
;
i
<
sheet
.
LastRowNum
+
1
;
i
++)
{
var
row
=
sheet
.
GetRow
(
i
);
if
(
row
!=
null
)
{
row
.
ZeroHeight
=
false
;
//取消隐藏行
int
dataFirstCellRowNum
=
Point
.
DataFirstCellNum
.
Value
;
//跳过核算单元和科室
for
(
int
j
=
dataFirstCellRowNum
;
j
<
row
.
LastCellNum
;
j
++)
{
var
cell
=
row
.
GetCell
(
j
);
if
(
cell
!=
null
&&
cell
.
CellType
!=
CellType
.
Formula
)
{
cell
.
RemoveCellComment
();
row
.
RemoveCell
(
cell
);
}
}
}
}
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
ex
.
Message
);
}
}
}
}
}
}
performance/Performance.Services/RedistributionService.cs
View file @
f4080e41
...
@@ -92,7 +92,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
...
@@ -92,7 +92,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
var
allot
=
_perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
second
.
AllotId
);
var
allot
=
_perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
second
.
AllotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在!"
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在!"
);
// 填报模板带出 行政工勤 绩效
// 填报模板带出 行政工勤 绩效
var
computes
=
_rescomputeRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
UnitTypeUtil
.
IsOffice
(
w
.
AccountType
));
var
computes
=
_rescomputeRepository
.
GetEntities
(
w
=>
w
.
AllotID
==
allot
.
ID
&&
UnitTypeUtil
.
Office
.
Contains
(
w
.
AccountType
));
var
loads
=
GetWorkLoads
(
allot
.
HospitalId
,
second
.
UnitType
,
second
.
Department
);
var
loads
=
GetWorkLoads
(
allot
.
HospitalId
,
second
.
UnitType
,
second
.
Department
);
var
employees
=
_peremployeeRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
second
.
AllotId
);
var
employees
=
_peremployeeRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
second
.
AllotId
);
...
...
performance/Performance.Services/SecondAllot/SecondAllotService.cs
View file @
f4080e41
...
@@ -511,8 +511,8 @@ public void SaveSecondAllotHeadData(int secondId, string json)
...
@@ -511,8 +511,8 @@ public void SaveSecondAllotHeadData(int secondId, string json)
List
<
ag_worktype_source
>
insertData
=
new
List
<
ag_worktype_source
>();
List
<
ag_worktype_source
>
insertData
=
new
List
<
ag_worktype_source
>();
var
worktypeSources
=
agworktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
var
worktypeSources
=
agworktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
worktypeSources
==
null
||
!
worktypeSources
.
Any
())
{
//多工作量
var
workTypes
=
agworkloadtypeRepository
.
GetEntities
();
var
workTypes
=
agworkloadtypeRepository
.
GetEntities
();
var
workValue
=
new
List
<
int
>();
var
workValue
=
new
List
<
int
>();
foreach
(
var
item
in
keys
)
foreach
(
var
item
in
keys
)
...
@@ -542,13 +542,19 @@ public void SaveSecondAllotHeadData(int secondId, string json)
...
@@ -542,13 +542,19 @@ public void SaveSecondAllotHeadData(int secondId, string json)
}
}
}
}
agworktypesourceRepository
.
AddRange
(
insertData
.
ToArray
());
foreach
(
var
k
in
worktypeSources
.
Select
(
t
=>
t
.
FieldId
))
{
var
remove
=
insertData
.
FirstOrDefault
(
t
=>
t
.
FieldId
.
EqualsIgnoreCase
(
k
));
if
(
remove
!=
null
)
{
insertData
.
Remove
(
remove
);
}
}
}
agworktypesourceRepository
.
AddRange
(
insertData
.
ToArray
());
worktypeSources
=
agworktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
worktypeSources
=
agworktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
foreach
(
var
key
in
keys
)
foreach
(
var
key
in
keys
)
{
{
var
update
=
worktypeSources
.
FirstOrDefault
(
t
=>
t
.
FieldId
.
EqualsIgnoreCase
(
key
));
var
update
=
worktypeSources
.
FirstOrDefault
(
t
=>
t
.
FieldId
.
EqualsIgnoreCase
(
key
));
...
...
performance/Performance.Services/UnitTypeUtil.cs
View file @
f4080e41
...
@@ -8,6 +8,8 @@ namespace Performance.Services
...
@@ -8,6 +8,8 @@ namespace Performance.Services
{
{
public
class
UnitTypeUtil
public
class
UnitTypeUtil
{
{
public
static
string
[]
Office
=
new
string
[]
{
"行政后勤"
,
"行政工勤"
};
/// <summary>
/// <summary>
/// 是否是行政后勤/工勤
/// 是否是行政后勤/工勤
/// </summary>
/// </summary>
...
@@ -17,6 +19,7 @@ public static bool IsOffice(int? unit)
...
@@ -17,6 +19,7 @@ public static bool IsOffice(int? unit)
{
{
return
unit
==
(
int
)
UnitType
.
行政后勤
;
return
unit
==
(
int
)
UnitType
.
行政后勤
;
}
}
/// <summary>
/// <summary>
/// 是否是行政后勤/工勤
/// 是否是行政后勤/工勤
/// </summary>
/// </summary>
...
@@ -24,7 +27,7 @@ public static bool IsOffice(int? unit)
...
@@ -24,7 +27,7 @@ public static bool IsOffice(int? unit)
/// <returns></returns>
/// <returns></returns>
public
static
bool
IsOffice
(
string
unit
)
public
static
bool
IsOffice
(
string
unit
)
{
{
return
!
string
.
IsNullOrEmpty
(
unit
)
&&
(
unit
==
"行政后勤"
||
unit
==
"行政工勤"
);
return
!
string
.
IsNullOrEmpty
(
unit
)
&&
Office
.
Contains
(
unit
);
}
}
/// <summary>
/// <summary>
...
...
performance/Performance.Services/UserService.cs
View file @
f4080e41
...
@@ -782,6 +782,9 @@ public string SaveUserHandsFlat(UserCollectData request)
...
@@ -782,6 +782,9 @@ public string SaveUserHandsFlat(UserCollectData request)
{
{
if
(
item
==
null
)
return
"必填项为空"
;
if
(
item
==
null
)
return
"必填项为空"
;
var
HospitalId
=
hospitals
.
FirstOrDefault
(
w
=>
w
.
HosName
==
item
)?.
ID
;
var
HospitalId
=
hospitals
.
FirstOrDefault
(
w
=>
w
.
HosName
==
item
)?.
ID
;
if
(
HospitalId
==
null
)
return
"未找到分配医院"
;
var
allot
=
_perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
HospitalId
);
var
allot
=
_perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
HospitalId
);
var
accountingUnits
=
accounts
?.
Join
(
allot
,
t
=>
t
.
AllotId
,
w
=>
w
.
ID
,
(
t
,
w
)
=>
t
.
AccountingUnit
).
Distinct
().
ToList
();
var
accountingUnits
=
accounts
?.
Join
(
allot
,
t
=>
t
.
AllotId
,
w
=>
w
.
ID
,
(
t
,
w
)
=>
t
.
AccountingUnit
).
Distinct
().
ToList
();
res
.
Add
(
item
,
accountingUnits
);
res
.
Add
(
item
,
accountingUnits
);
...
...
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