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
11ca1d7d
Commit
11ca1d7d
authored
Oct 28, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提取数据1.收入sheet替换原有错误的核算单元 2.抽取文件名称添加年月 3.hrp人员抽取修改
parent
c53339fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
16 deletions
+95
-16
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+81
-10
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+12
-6
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+2
-0
No files found.
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
View file @
11ca1d7d
...
...
@@ -112,16 +112,13 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
);
if
(
data
==
null
||
!
d
ata
.
Any
())
return
;
var
limitData
=
queryService
.
QueryData
<
dynamic
>(
config
,
allot
,
$"select * from (
{
sql
}
) t limit 1;"
);
if
(
limitData
==
null
||
!
limitD
ata
.
Any
())
return
;
//var employees = peremployeeRepository.GetEntities(t => t.AllotId == allot.ID);
//if (employees != null && employees.Any())
//{
// peremployeeRepository.RemoveRange(employees.ToArray());
//}
var
columns
=
((
IDictionary
<
string
,
object
>)
limitData
.
ElementAt
(
0
)).
Select
(
t
=>
t
.
Key
.
ToLower
()).
ToList
();
data
.
ToList
().
ForEach
(
t
=>
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
).
ToList
();
data
.
ForEach
(
t
=>
{
t
.
AllotId
=
allot
.
ID
;
t
.
HospitalId
=
allot
.
HospitalId
;
...
...
@@ -135,10 +132,31 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
{
t
.
outer
.
AccountingUnit
=
t
.
inner
?.
FirstOrDefault
()?.
AccountingUnit
;
return
t
.
outer
;
});
}).
ToList
();
}
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
employees
==
null
||
!
employees
.
Any
())
{
peremployeeRepository
.
AddRange
(
data
.
ToArray
());
return
;
}
var
needAddData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
if
(
needAddData
!=
null
&&
needAddData
.
Any
())
peremployeeRepository
.
AddRange
(
needAddData
.
ToArray
());
var
needRemarkData
=
employees
.
Where
(
w
=>
!
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
))?.
ToList
();
if
(
needRemarkData
!=
null
&&
needRemarkData
.
Any
())
{
needRemarkData
.
ForEach
(
t
=>
t
.
Remark
=
"HRP中无此工号数据"
);
peremployeeRepository
.
UpdateRange
(
needRemarkData
.
ToArray
());
}
peremployeeRepository
.
AddRange
(
data
.
ToArray
());
var
needUpdateData
=
employees
.
Where
(
w
=>
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
if
(
needUpdateData
!=
null
&&
needUpdateData
.
Any
())
{
JudgeDataEqual
(
columns
,
needUpdateData
.
ToList
(),
data
);
}
}
catch
(
Exception
ex
)
{
...
...
@@ -146,6 +164,59 @@ private void Employee(per_allot allot, sys_hospitalconfig config, string sql)
}
}
private
void
JudgeDataEqual
(
List
<
string
>
columns
,
List
<
per_employee
>
emps
,
List
<
per_employee
>
hrps
)
{
Dictionary
<
string
,
Func
<
per_employee
,
object
>>
dict
=
new
Dictionary
<
string
,
Func
<
per_employee
,
object
>>
{
{
nameof
(
per_employee
.
AccountingUnit
),
(
t
)
=>
t
.
AccountingUnit
},
{
nameof
(
per_employee
.
Department
),
(
t
)
=>
t
.
Department
},
{
nameof
(
per_employee
.
DoctorName
),
(
t
)
=>
t
.
DoctorName
},
{
nameof
(
per_employee
.
PersonnelNumber
),
(
t
)
=>
t
.
DoctorName
},
{
nameof
(
per_employee
.
JobNumber
),
(
t
)
=>
t
.
JobNumber
},
{
nameof
(
per_employee
.
JobCategory
),
(
t
)
=>
t
.
JobCategory
},
{
nameof
(
per_employee
.
Duty
),
(
t
)
=>
t
.
Duty
},
{
nameof
(
per_employee
.
JobTitle
),
(
t
)
=>
t
.
JobTitle
},
{
nameof
(
per_employee
.
UnitType
),
(
t
)
=>
t
.
UnitType
},
{
nameof
(
per_employee
.
Attendance
),
(
t
)
=>
t
.
Attendance
},
{
nameof
(
per_employee
.
AttendanceDay
),
(
t
)
=>
t
.
AttendanceDay
},
{
nameof
(
per_employee
.
PermanentStaff
),
(
t
)
=>
t
.
PermanentStaff
},
{
nameof
(
per_employee
.
EfficiencyNumber
),
(
t
)
=>
t
.
EfficiencyNumber
},
{
nameof
(
per_employee
.
BirthDate
),
(
t
)
=>
t
.
BirthDate
},
{
nameof
(
per_employee
.
ReservedRatio
),
(
t
)
=>
t
.
ReservedRatio
},
{
nameof
(
per_employee
.
BankCard
),
(
t
)
=>
t
.
BankCard
},
};
if
(
columns
.
Contains
(
nameof
(
per_employee
.
PersonnelNumber
)))
columns
.
Remove
(
nameof
(
per_employee
.
PersonnelNumber
));
List
<
per_employee
>
updateData
=
new
List
<
per_employee
>();
foreach
(
var
emp
in
emps
)
{
var
hrp
=
hrps
.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
emp
.
PersonnelNumber
);
if
(
hrp
==
null
)
continue
;
foreach
(
var
item
in
dict
)
{
if
(!
columns
.
Contains
(
item
.
Key
.
ToLower
()))
continue
;
var
empVal
=
item
.
Value
.
Invoke
(
emp
);
var
hrpVal
=
item
.
Value
.
Invoke
(
hrp
);
if
((
empVal
==
null
&&
hrpVal
!=
null
)
||
(
empVal
!=
null
&&
!
empVal
.
Equals
(
hrpVal
)))
{
hrp
.
Id
=
emp
.
Id
;
updateData
.
Add
(
hrp
);
break
;
}
}
}
if
(
updateData
!=
null
&&
updateData
.
Any
())
{
string
updateSql
=
$"update per_employee set
{
string
.
Join
(
","
,
columns
.
Select
(
t
=>
$"
{
t
}
=@
{
t
}
"
))}
where id = @id"
;
logger
.
LogInformation
(
"同步hrp人员字典Sql语句: "
+
updateSql
);
peremployeeRepository
.
Execute
(
updateSql
,
updateData
);
}
}
private
void
HisData
(
per_allot
allot
,
sys_hospitalconfig
config
,
his_script
script
)
{
try
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
11ca1d7d
...
...
@@ -255,9 +255,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
deptContents
=
new
Dictionary
<
int
,
string
>
{
{
1
,
item
.
Department
},
{
2
,
item
.
NurseAccount
},
{
3
,
item
.
DoctorAccount
},
{
4
,
item
.
TechnicAccounting
},
{
2
,
(
sheet
.
SheetName
.
Contains
(
"门诊"
)
?
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
OutNurseAccounting
))?.
OutNurseAccounting
:
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
InpatNurseAccounting
))?.
InpatNurseAccounting
)
??
item
.
NurseAccount
},
{
3
,
(
sheet
.
SheetName
.
Contains
(
"门诊"
)
?
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
OutDoctorAccounting
))?.
OutDoctorAccounting
:
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
InpatDoctorAccounting
))?.
InpatDoctorAccounting
)
??
item
.
DoctorAccount
},
{
4
,
(
sheet
.
SheetName
.
Contains
(
"门诊"
)
?
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
OutTechnicAccounting
))?.
OutTechnicAccounting
:
deptData
.
FirstOrDefault
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
InpatTechnicAccounting
))?.
InpatTechnicAccounting
)
??
item
.
TechnicAccounting
},
};
foreach
(
var
content
in
deptContents
)
...
...
@@ -296,9 +302,9 @@ public static string HasValue(params string[] list)
private
static
readonly
Dictionary
<
string
,
Func
<
ExtractTransDto
,
string
>>
fieldInpat
=
new
Dictionary
<
string
,
Func
<
ExtractTransDto
,
string
>>
{
{
"科室名称"
,
(
dto
)
=>
dto
.
Department
},
{
"核算单元(医生组)"
,
(
dto
)
=>
dto
.
InpatDoctorAccounting
},
{
"核算单元(护理组)"
,
(
dto
)
=>
dto
.
InpatNurseAccounting
},
{
"核算单元(医技组)"
,
(
dto
)
=>
dto
.
InpatTechnicAccounting
},
{
"核算单元(医生组)"
,
(
dto
)
=>
dto
.
InpatDoctorAccounting
},
{
"核算单元(护理组)"
,
(
dto
)
=>
dto
.
InpatNurseAccounting
},
{
"核算单元(医技组)"
,
(
dto
)
=>
dto
.
InpatTechnicAccounting
},
};
/// <summary> 门诊核算单元 </summary>
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
11ca1d7d
...
...
@@ -99,6 +99,8 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var
templateFilePath
=
ExtractHelper
.
GetExtractFile
(
hospitalId
,
ref
extractFilePath
,
filePath
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"创建文件"
,
$"模板文件:
{
templateFilePath
}
"
,
1
,
isSingle
);
extractFilePath
=
$"
{
allot
.
Year
}
_
{
allot
.
Month
}
_"
+
extractFilePath
;
if
(!
FileHelper
.
IsExistFile
(
templateFilePath
))
throw
new
PerformanceException
(
"抽取文件创建失败"
);
workbook
=
ExcelHelper
.
GetWorkbook
(
templateFilePath
);
...
...
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