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
371d7fcf
Commit
371d7fcf
authored
May 20, 2021
by
钟博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/科室人员用户handson批量导入' into develop
parents
4a6a8b85
b0df5767
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
638 additions
and
16 deletions
+638
-16
performance/Performance.Api/Controllers/AccountController.cs
+31
-4
performance/Performance.Api/Controllers/PersonController.cs
+51
-0
performance/Performance.Api/Properties/PublishProfiles/FolderProfile.pubxml
+11
-8
performance/Performance.Api/wwwroot/Performance.Api.xml
+34
-4
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+15
-0
performance/Performance.DtoModels/Request/PerEmployeeRquest.cs
+21
-0
performance/Performance.DtoModels/Response/DeptdicResponse.cs
+16
-0
performance/Performance.DtoModels/Response/UserHandsResponse.cs
+18
-0
performance/Performance.DtoModels/SaveCollectData.cs
+8
-0
performance/Performance.Services/PersonService.cs
+293
-0
performance/Performance.Services/UserService.cs
+140
-0
No files found.
performance/Performance.Api/Controllers/AccountController.cs
View file @
371d7fcf
...
@@ -315,7 +315,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request)
...
@@ -315,7 +315,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request)
if
(
request
.
Role
<=
0
)
if
(
request
.
Role
<=
0
)
user
.
IsAgainAdmin
=
user
.
Role
!=
null
?
roleArray
.
Contains
(
user
.
Role
.
First
().
Type
??
0
)
:
false
;
user
.
IsAgainAdmin
=
user
.
Role
!=
null
?
roleArray
.
Contains
(
user
.
Role
.
First
().
Type
??
0
)
:
false
;
else
else
user
.
IsAgainAdmin
=
user
.
Role
!=
null
?
roleArray
.
Contains
(
user
.
Role
.
First
(
t
=>
t
.
RoleID
==
request
.
Role
).
Type
??
0
)
:
false
;
user
.
IsAgainAdmin
=
user
.
Role
!=
null
?
roleArray
.
Contains
(
user
.
Role
.
First
(
t
=>
t
.
RoleID
==
request
.
Role
).
Type
??
0
)
:
false
;
return
new
ApiResponse
(
ResponseType
.
OK
,
user
);
return
new
ApiResponse
(
ResponseType
.
OK
,
user
);
}
}
...
@@ -371,16 +371,42 @@ public ApiResponse DeleteUser([CustomizeValidator(RuleSet = "Delete"), FromBody]
...
@@ -371,16 +371,42 @@ public ApiResponse DeleteUser([CustomizeValidator(RuleSet = "Delete"), FromBody]
#
endregion
#
endregion
/// <summary>
/// <summary>
/// 批量新增用户表头
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"GetBatchUserStructrue"
)]
[
HttpPost
]
public
ApiResponse
GetBatchUserStructrue
()
{
var
result
=
_userService
.
GetUserHandsFlat
();
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 批量新增用户
/// 批量新增用户
/// </summary>
/// </summary>
/// <param name="request"></param>
/// <param name="request"></param>
/// <returns></returns>
/// <returns></returns>
[
Route
(
"BatchSaveUser"
)]
[
Route
(
"BatchSaveUser"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
BatchSaveUser
()
public
ApiResponse
BatchSaveUser
(
[
FromBody
]
UserCollectData
data
)
{
{
var
result
=
_userService
.
SaveUserHandsFlat
(
data
);
return
new
ApiResponse
(
ResponseType
.
OK
);
switch
(
result
)
{
case
0
:
//hack:后续根据accounting更改提示信息
return
new
ApiResponse
(
ResponseType
.
Error
,
"科室字典为空"
);
case
1
:
return
new
ApiResponse
(
ResponseType
.
OK
);
case
2
:
return
new
ApiResponse
(
ResponseType
.
Error
,
"登录名重复"
);
default
:
return
new
ApiResponse
(
ResponseType
.
Error
,
"核算单元填写错误"
);
}
}
}
}
}
}
}
\ No newline at end of file
performance/Performance.Api/Controllers/PersonController.cs
View file @
371d7fcf
...
@@ -181,5 +181,56 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
...
@@ -181,5 +181,56 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
var
data
=
personService
.
DeptIncomeDetail
(
request
,
claimService
.
GetUserId
());
var
data
=
personService
.
DeptIncomeDetail
(
request
,
claimService
.
GetUserId
());
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
}
/// <summary>
/// 批量人员字典表头
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"person/GetBatchPersonStructrue/{hospitalId}"
)]
public
ApiResponse
GetBatchPersonStructrue
(
int
hospitalId
)
{
var
result
=
personService
.
GetBatchPersonStructrue
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 批量添加人员信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"person/{allotId}/BathSavePerson/{hospitalId}"
)]
public
ApiResponse
BathSavePerson
(
int
allotId
,
int
hospitalId
,
SaveCollectData
request
)
{
var
result
=
personService
.
BathSavePerson
(
allotId
,
hospitalId
,
request
);
if
(
result
)
return
new
ApiResponse
(
ResponseType
.
OK
);
else
return
new
ApiResponse
(
ResponseType
.
Error
,
"出勤天数或预留比例格式错误"
);
}
/// <summary>
/// 批量科室字典表头
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/GetDeptStructrue/{hospitalId}"
)]
public
ApiResponse
GetDeptStructrue
(
int
hospitalId
)
{
var
result
=
personService
.
GetDepartmentHands
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 批量添加科室信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/SaveDeptHands/{hospitalId}"
)]
public
ApiResponse
SaveDeptHands
(
int
hospitalId
,
SaveCollectData
request
)
{
personService
.
SaveDeptDicHands
(
hospitalId
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
}
}
}
performance/Performance.Api/Properties/PublishProfiles/FolderProfile.pubxml
View file @
371d7fcf
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
-->
<Project
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Project
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles>
<WebPublishMethod>
FileSystem
</WebPublishMethod>
<ExcludeApp_Data>False</ExcludeApp_Data>
<PublishProvider>
FileSystem
</PublishProvider>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>
Release
</LastUsedBuildConfiguration>
<LastUsedBuildConfiguration>
Release
</LastUsedBuildConfiguration>
<LastUsedPlatform>
Any CPU
</LastUsedPlatform>
<LastUsedPlatform>
Any CPU
</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp2.2\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish
/>
<SiteUrlToLaunchAfterPublish
/>
<LaunchSiteAfterPublish>
True
</LaunchSiteAfterPublish>
<ExcludeApp_Data>
False
</ExcludeApp_Data>
<TargetFramework>
netcoreapp2.2
</TargetFramework>
<TargetFramework>
netcoreapp2.2
</TargetFramework>
<ProjectGuid>
3ae00ff5-f0ba-4d72-a23b-770186309327
</ProjectGuid>
<ProjectGuid>
3ae00ff5-f0ba-4d72-a23b-770186309327
</ProjectGuid>
<SelfContained>
false
</SelfContained>
<SelfContained>
false
</SelfContained>
<_IsPortable>
true
</_IsPortable>
<publishUrl>
D:\publish\jx.suvalue.com2
</publishUrl>
<DeleteExistingFiles>
True
</DeleteExistingFiles>
</PropertyGroup>
</PropertyGroup>
</Project>
</Project>
\ No newline at end of file
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
371d7fcf
...
@@ -137,7 +137,14 @@
...
@@ -137,7 +137,14 @@
<param
name=
"request"
></param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.BatchSaveUser"
>
<member
name=
"M:Performance.Api.Controllers.AccountController.GetBatchUserStructrue"
>
<summary>
批量新增用户表头
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.BatchSaveUser(Performance.DtoModels.UserCollectData)"
>
<summary>
<summary>
批量新增用户
批量新增用户
</summary>
</summary>
...
@@ -607,12 +614,11 @@
...
@@ -607,12 +614,11 @@
<param
name=
"request"
></param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.ConfigController.GetAccountingList(
System.Int32,System.Int32
)"
>
<member
name=
"M:Performance.Api.Controllers.ConfigController.GetAccountingList(
Performance.DtoModels.AccoungingRequest
)"
>
<summary>
<summary>
获取cof_accounting列表
获取cof_accounting列表
</summary>
</summary>
<param
name=
"allotId"
></param>
<param
name=
"request"
></param>
<param
name=
"type"
>
1 返回accounting列表 2 返回核算单元类型 3 返回核算单元
</param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.ConfigController.AccountingInsert(Performance.EntityModels.cof_accounting)"
>
<member
name=
"M:Performance.Api.Controllers.ConfigController.AccountingInsert(Performance.EntityModels.cof_accounting)"
>
...
@@ -1143,6 +1149,30 @@
...
@@ -1143,6 +1149,30 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.PersonController.GetBatchPersonStructrue(System.Int32)"
>
<summary>
批量人员字典表头
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.PersonController.BathSavePerson(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)"
>
<summary>
批量添加人员信息
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.PersonController.GetDeptStructrue(System.Int32)"
>
<summary>
批量科室字典表头
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.PersonController.SaveDeptHands(System.Int32,Performance.DtoModels.SaveCollectData)"
>
<summary>
批量添加科室信息
</summary>
<returns></returns>
</member>
<member
name=
"T:Performance.Api.Controllers.ReportController"
>
<member
name=
"T:Performance.Api.Controllers.ReportController"
>
<summary>
<summary>
报表
报表
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
371d7fcf
...
@@ -1819,6 +1819,21 @@
...
@@ -1819,6 +1819,21 @@
比率
比率
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.AccoungingRequest.AllotId"
>
<summary>
绩效Id
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AccoungingRequest.Type"
>
<summary>
1 返回accounting列表 2 返回核算单元类型 3 返回核算单元
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AccoungingRequest.UnitType"
>
<summary>
核算单元类型、核算组别
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AgainAllotRequest"
>
<member
name=
"T:Performance.DtoModels.AgainAllotRequest"
>
<summary>
<summary>
二次分配请求
二次分配请求
...
...
performance/Performance.DtoModels/Request/PerEmployeeRquest.cs
0 → 100644
View file @
371d7fcf
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
PerEmployeeRquest
{
public
string
AccountingUnit
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
DoctorName
{
get
;
set
;
}
public
string
PersonnelNumber
{
get
;
set
;
}
public
string
JobCategory
{
get
;
set
;
}
public
string
Duty
{
get
;
set
;
}
public
string
JobTitle
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
public
int
?
AttendanceDay
{
get
;
set
;
}
public
decimal
?
ReservedRatio
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Response/DeptdicResponse.cs
View file @
371d7fcf
...
@@ -25,4 +25,20 @@ public class Deptdic
...
@@ -25,4 +25,20 @@ public class Deptdic
public
int
Id
{
get
;
set
;
}
public
int
Id
{
get
;
set
;
}
public
string
AccountingUnit
{
get
;
set
;
}
public
string
AccountingUnit
{
get
;
set
;
}
}
}
public
class
DeptdicHands
{
public
int
HospitalId
{
get
;
set
;
}
public
string
HISDeptName
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
OutDoctorAccounting
{
get
;
set
;
}
public
string
OutNurseAccounting
{
get
;
set
;
}
public
string
OutTechnicAccounting
{
get
;
set
;
}
public
string
InpatDoctorAccounting
{
get
;
set
;
}
public
string
InpatNurseAccounting
{
get
;
set
;
}
public
string
InpatTechnicAccounting
{
get
;
set
;
}
public
string
LogisticsAccounting
{
get
;
set
;
}
public
string
SpecialAccounting
{
get
;
set
;
}
public
DateTime
?
CreateTime
{
get
;
set
;
}
}
}
}
performance/Performance.DtoModels/Response/UserHandsResponse.cs
0 → 100644
View file @
371d7fcf
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
UserHandsResponse
{
public
string
RealName
{
get
;
set
;
}
public
string
Login
{
get
;
set
;
}
public
string
Password
{
get
;
set
;
}
public
string
Mobile
{
get
;
set
;
}
public
string
Mail
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
RoleName
{
get
;
set
;
}
public
string
HosName
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/SaveCollectData.cs
View file @
371d7fcf
...
@@ -11,4 +11,12 @@ public class SaveCollectData
...
@@ -11,4 +11,12 @@ public class SaveCollectData
public
string
[]
ColHeaders
{
get
;
set
;
}
public
string
[]
ColHeaders
{
get
;
set
;
}
public
string
[][]
Data
{
get
;
set
;
}
public
string
[][]
Data
{
get
;
set
;
}
}
}
public
class
UserCollectData
{
public
int
HospitalId
{
get
;
set
;
}
public
int
?
CreateUser
{
get
;
set
;
}
public
string
[]
ColHeaders
{
get
;
set
;
}
public
string
[][]
Data
{
get
;
set
;
}
}
}
}
performance/Performance.Services/PersonService.cs
View file @
371d7fcf
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.Services
namespace
Performance.Services
{
{
...
@@ -588,5 +589,297 @@ private string[] GetUnitType(int userId)
...
@@ -588,5 +589,297 @@ private string[] GetUnitType(int userId)
return
dict
[
role
.
Type
.
Value
];
return
dict
[
role
.
Type
.
Value
];
}
}
public
HandsonTable
GetBatchPersonStructrue
(
int
hospitalId
)
{
var
result
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
Person
.
Select
(
t
=>
t
.
Value
).
ToArray
(),
Person
.
Select
(
t
=>
new
collect_permission
{
HeadName
=
t
.
Value
,
Visible
=
1
}).
ToList
());
var
deptdics
=
perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
ss
=
deptdics
?.
Where
(
t
=>
!
new
string
[]
{
UnitType
.
专家组
.
ToString
()
}.
Contains
(
t
.
UnitType
));
if
(
result
.
Columns
!=
null
&&
result
.
Columns
.
Any
())
{
foreach
(
var
column
in
result
.
Columns
)
{
if
(
column
.
Data
==
"人员类别"
)
{
column
.
Type
=
"autocomplete"
;
column
.
Source
=
deptdics
?
.
Where
(
t
=>
!
new
string
[]
{
UnitType
.
专家组
.
ToString
()
}.
Contains
(
t
.
UnitType
))
.
Select
(
t
=>
t
.
UnitType
).
Distinct
().
ToArray
();
column
.
Strict
=
true
;
}
else
if
(
new
[]
{
"出勤天数"
,
"预留比例"
}.
Contains
(
column
.
Data
))
{
column
.
Type
=
"numeric"
;
column
.
NumericFormat
=
new
NumericFormat
{
Pattern
=
"0,00"
};
}
}
}
return
result
;
}
public
HandsonTable
GetDepartmentHands
(
int
hospitalId
)
{
HandsonTable
handson
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
DeptDic
.
Select
(
c
=>
c
.
Value
).
ToArray
(),
DeptDic
.
Select
(
t
=>
new
collect_permission
{
HeadName
=
t
.
Value
,
Visible
=
1
,
Readnoly
=
0
}).
ToList
());
#
region
科室下拉
//if (handson.Columns != null && handson.Columns.Any())
//{
// foreach (var column in handson.Columns)
// {
// if (column.Data == "标准科室")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 2).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "系统科室")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 1).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (new[] { "住院·核算单元医生组", "住院·核算单元护理组", "住院·核算单元医技组", "门诊·核算单元医生组", "门诊·核算单元护理组", "门诊·核算单元医技组" }.Contains(column.Data))
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 3).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "行政后勤")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 4).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "特殊核算组")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 5).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// }
//}
#
endregion
return
handson
;
}
public
bool
BathSavePerson
(
int
AllotId
,
int
HospitalId
,
SaveCollectData
request
)
{
var
dicData
=
CreateDataRow
(
request
,
Person
);
List
<
per_employee
>
employees
=
new
List
<
per_employee
>();
var
persons
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
HospitalId
&&
t
.
AllotId
==
AllotId
);
foreach
(
var
item
in
dicData
)
{
if
(!
string
.
IsNullOrEmpty
(
item
[
"AttendanceDay"
])
&&
!
string
.
IsNullOrEmpty
(
item
[
"ReservedRatio"
])
)
{
if
((!
Regex
.
IsMatch
(
item
[
"AttendanceDay"
],
"^([12][0-9]|31|[1-9])$"
))
||
(!
Regex
.
IsMatch
(
item
[
"ReservedRatio"
],
@"0.\d+"
)))
return
false
;
}
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
per_employee
>(
json
);
if
(
persons
.
Any
(
t
=>
t
.
PersonnelNumber
?.
Trim
()
==
data
.
PersonnelNumber
?.
Trim
()
&&
t
.
DoctorName
?.
Trim
()
==
data
.
DoctorName
?.
Trim
())
||
employees
.
Any
(
w
=>
w
.
Department
?.
Trim
()
==
data
.
Department
?.
Trim
()
&&
w
.
DoctorName
?.
Trim
()
==
data
.
DoctorName
?.
Trim
()))
continue
;
if
(!
string
.
IsNullOrEmpty
(
data
.
Department
?.
Trim
())
||
!
string
.
IsNullOrEmpty
(
data
.
AccountingUnit
?.
Trim
())
||
!
string
.
IsNullOrEmpty
(
data
.
DoctorName
?.
Trim
()))
{
data
.
HospitalId
=
HospitalId
;
data
.
AllotId
=
AllotId
;
data
.
DoctorName
=
data
.
DoctorName
?.
Trim
();
data
.
PersonnelNumber
=
data
.
PersonnelNumber
?.
Trim
();
data
.
CreateTime
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:dd"
));
employees
.
Add
(
data
);
}
}
if
(
employees
.
Any
())
peremployeeRepository
.
AddRange
(
employees
.
ToArray
());
return
true
;
}
public
void
SaveDeptDicHands
(
int
HospitalId
,
SaveCollectData
request
)
{
var
dicData
=
CreateDataRow
(
request
,
DeptDic
);
var
depts
=
perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
HospitalId
).
Select
(
w
=>
new
{
w
.
Department
,
w
.
HISDeptName
}).
Distinct
();
List
<
per_dept_dic
>
deptDics
=
new
List
<
per_dept_dic
>();
foreach
(
var
dic
in
dicData
)
{
var
json
=
JsonHelper
.
Serialize
(
dic
);
var
data
=
JsonHelper
.
Deserialize
<
DeptdicHands
>(
json
);
if
(
depts
.
Any
(
t
=>
t
.
Department
?.
Trim
()
==
data
.
Department
?.
Trim
()
&&
t
.
HISDeptName
?.
Trim
()
==
data
.
HISDeptName
?.
Trim
())
||
deptDics
.
Any
(
w
=>
w
.
Department
?.
Trim
()
==
data
.
Department
?.
Trim
()
&&
w
.
HISDeptName
?.
Trim
()
==
data
.
HISDeptName
?.
Trim
()))
continue
;
if
(!
string
.
IsNullOrEmpty
(
data
.
Department
?.
Trim
())
||
!
string
.
IsNullOrEmpty
(
data
.
HISDeptName
?.
Trim
()))
{
DeptDicList
(
HospitalId
,
deptDics
,
data
);
}
}
if
(
deptDics
.
Any
())
perdeptdicRepository
.
AddRange
(
deptDics
.
ToArray
());
}
private
void
DeptDicList
(
int
HospitalId
,
List
<
per_dept_dic
>
deptDics
,
DeptdicHands
data
)
{
var
nowTime
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:ss"
));
#
region
住院
if
(
data
.
InpatDoctorAccounting
!=
""
||
data
.
InpatNurseAccounting
!=
""
||
data
.
InpatTechnicAccounting
!=
""
)
{
if
(
data
.
InpatDoctorAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"住院"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
InpatDoctorAccounting
?.
Trim
();
deptDic
.
UnitType
=
"医生组"
;
deptDics
.
Add
(
deptDic
);
}
if
(
data
.
InpatNurseAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"住院"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
InpatNurseAccounting
?.
Trim
();
deptDic
.
UnitType
=
"护理组"
;
deptDics
.
Add
(
deptDic
);
}
if
(
data
.
InpatTechnicAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"住院"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
InpatTechnicAccounting
?.
Trim
();
deptDic
.
UnitType
=
"医技组"
;
deptDics
.
Add
(
deptDic
);
}
}
#
endregion
#
region
门诊
if
(
data
.
OutDoctorAccounting
!=
""
||
data
.
OutNurseAccounting
!=
""
||
data
.
OutTechnicAccounting
!=
""
)
{
if
(
data
.
OutDoctorAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"门诊"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
OutDoctorAccounting
?.
Trim
();
deptDic
.
UnitType
=
"医生组"
;
deptDics
.
Add
(
deptDic
);
}
if
(
data
.
OutNurseAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"门诊"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
OutNurseAccounting
?.
Trim
();
deptDic
.
UnitType
=
"护理组"
;
deptDics
.
Add
(
deptDic
);
}
if
(
data
.
OutTechnicAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
Source
=
"门诊"
,
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
};
deptDic
.
AccountingUnit
=
data
.
OutTechnicAccounting
?.
Trim
();
deptDic
.
UnitType
=
"医技组"
;
deptDics
.
Add
(
deptDic
);
}
}
#
endregion
if
(
data
.
LogisticsAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
,
AccountingUnit
=
data
.
LogisticsAccounting
?.
Trim
(),
UnitType
=
"行政后勤"
};
deptDics
.
Add
(
deptDic
);
}
if
(
data
.
SpecialAccounting
!=
""
)
{
per_dept_dic
deptDic
=
new
per_dept_dic
()
{
HospitalId
=
HospitalId
,
Department
=
data
.
Department
?.
Trim
(),
HISDeptName
=
data
.
HISDeptName
?.
Trim
(),
CreateTime
=
nowTime
,
AccountingUnit
=
data
.
LogisticsAccounting
?.
Trim
(),
UnitType
=
"特殊核算组"
};
deptDics
.
Add
(
deptDic
);
}
}
private
List
<
Dictionary
<
string
,
string
>>
CreateDataRow
(
SaveCollectData
request
,
Dictionary
<
string
,
string
>
config
)
{
List
<
Dictionary
<
string
,
string
>>
allData
=
new
List
<
Dictionary
<
string
,
string
>>();
for
(
int
r
=
0
;
r
<
request
.
Data
.
Length
;
r
++)
{
// 创建固定数据列
Dictionary
<
string
,
string
>
baseData
=
CreateBaseData
(
request
,
config
,
r
);
allData
.
Add
(
baseData
);
}
return
allData
;
}
private
Dictionary
<
string
,
string
>
CreateBaseData
(
SaveCollectData
request
,
Dictionary
<
string
,
string
>
config
,
int
rownumber
)
{
Dictionary
<
string
,
string
>
result
=
new
Dictionary
<
string
,
string
>();
for
(
int
c
=
0
;
c
<
request
.
ColHeaders
.
Length
;
c
++)
{
var
header
=
request
.
ColHeaders
[
c
];
var
first
=
config
.
FirstOrDefault
(
w
=>
w
.
Value
==
header
);
if
(!
default
(
KeyValuePair
<
string
,
string
>).
Equals
(
first
)
&&
!
result
.
ContainsKey
(
header
)
&&
request
.
Data
[
rownumber
].
Length
>
c
)
{
result
.
Add
(
first
.
Key
,
request
.
Data
[
rownumber
][
c
]);
}
}
return
result
;
}
public
static
Dictionary
<
string
,
string
>
Person
{
get
;
}
=
new
Dictionary
<
string
,
string
>
{
{
nameof
(
per_employee
.
AccountingUnit
),
"核算单元"
},
{
nameof
(
per_employee
.
Department
),
"科室名称"
},
{
nameof
(
per_employee
.
DoctorName
),
"姓名"
},
{
nameof
(
per_employee
.
PersonnelNumber
),
"员工工号"
},
{
nameof
(
per_employee
.
JobCategory
),
"正式/临聘"
},
{
nameof
(
per_employee
.
Duty
),
"职务"
},
{
nameof
(
per_employee
.
JobTitle
),
"职称"
},
{
nameof
(
per_employee
.
UnitType
),
"人员类别"
},
{
nameof
(
per_employee
.
AttendanceDay
),
"出勤天数"
},
{
nameof
(
per_employee
.
ReservedRatio
),
"预留比例"
},
{
nameof
(
per_employee
.
Remark
),
"备注"
},
};
private
static
Dictionary
<
string
,
string
>
DeptDic
{
get
;
}
=
new
Dictionary
<
string
,
string
>
{
{
nameof
(
DeptdicResponse
.
Department
),
"标准科室"
},
{
nameof
(
DeptdicResponse
.
HISDeptName
),
"系统科室"
},
{
nameof
(
DeptdicResponse
.
OutDoctorAccounting
),
"门诊·核算单元医生组"
},
{
nameof
(
DeptdicResponse
.
OutNurseAccounting
),
"门诊·核算单元护理组"
},
{
nameof
(
DeptdicResponse
.
OutTechnicAccounting
),
"门诊·核算单元医技组"
},
{
nameof
(
DeptdicResponse
.
InpatDoctorAccounting
),
"住院·核算单元医生组"
},
{
nameof
(
DeptdicResponse
.
InpatNurseAccounting
),
"住院·核算单元护理组"
},
{
nameof
(
DeptdicResponse
.
InpatTechnicAccounting
),
"住院·核算单元医技组"
},
{
nameof
(
DeptdicResponse
.
LogisticsAccounting
),
"行政后勤"
},
{
nameof
(
DeptdicResponse
.
SpecialAccounting
),
"特殊核算组"
}
};
}
}
}
}
performance/Performance.Services/UserService.cs
View file @
371d7fcf
...
@@ -695,5 +695,144 @@ public ApiResponse DeleteUser(int iD)
...
@@ -695,5 +695,144 @@ public ApiResponse DeleteUser(int iD)
}
}
#
endregion
#
endregion
public
HandsonTable
GetUserHandsFlat
()
{
var
result
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
Users
.
Select
(
t
=>
t
.
Value
).
ToArray
(),
Users
.
Select
(
t
=>
new
collect_permission
{
HeadName
=
t
.
Value
,
Visible
=
1
}).
ToList
());
if
(
result
.
Columns
!=
null
&&
result
.
Columns
.
Any
())
{
foreach
(
var
column
in
result
.
Columns
)
{
if
(
column
.
Data
==
"角色"
)
{
column
.
Type
=
"autocomplete"
;
column
.
Source
=
_roleRepository
.
GetEntities
().
Select
(
t
=>
t
.
RoleName
).
ToArray
();
column
.
Strict
=
true
;
}
else
if
(
column
.
Data
==
"分配医院"
)
{
column
.
Type
=
"autocomplete"
;
column
.
Source
=
_hospitalRepository
.
GetEntities
().
Select
(
t
=>
t
.
HosName
).
ToArray
();
column
.
Strict
=
true
;
}
}
}
return
result
;
}
public
int
SaveUserHandsFlat
(
UserCollectData
request
)
{
try
{
var
dicData
=
CreateDataRow
(
request
,
Users
);
var
getUsers
=
_userRepository
.
GetEntities
();
var
roles
=
_roleRepository
.
GetEntities
();
var
hospitals
=
_hospitalRepository
.
GetEntities
();
//hack:后续修改为accounting中的数据
var
depts
=
_perdeptdicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
)?.
Select
(
w
=>
w
.
Department
).
Distinct
();
List
<
sys_user
>
users
=
new
List
<
sys_user
>();
List
<
sys_user_role
>
userRoles
=
new
List
<
sys_user_role
>();
List
<
sys_user_hospital
>
userHoss
=
new
List
<
sys_user_hospital
>();
var
roleArr
=
new
[]
{
"护士长"
,
"科主任"
,
"特殊科室"
,
"行政科室"
};
foreach
(
var
item
in
dicData
)
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
UserHandsResponse
>(
json
);
if
(
roleArr
.
Contains
(
data
.
RoleName
)
&&
(
depts
==
null
||
!
depts
.
Any
()))
return
0
;
if
(
users
.
Any
(
c
=>
c
.
Login
==
data
?.
Login
)
||
getUsers
.
Any
(
c
=>
c
.
Login
==
data
?.
Login
))
return
2
;
if
(
roleArr
.
Contains
(
data
.
RoleName
)
&&
!
depts
.
Any
(
t
=>
t
==
data
.
Department
))
return
3
;
if
(!
string
.
IsNullOrEmpty
(
data
.
Login
)
&&
!
string
.
IsNullOrEmpty
(
data
.
RealName
)
&&
!
string
.
IsNullOrEmpty
(
data
.
HosName
))
{
var
user
=
new
sys_user
{
RealName
=
data
.
RealName
,
CreateDate
=
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:dd"
)),
CreateUser
=
request
.
CreateUser
,
Department
=
data
?.
Department
??
""
,
IsDelete
=
1
,
Login
=
data
.
Login
,
Password
=
data
?.
Password
??
"123456"
,
States
=
1
,
Mobile
=
data
?.
Mobile
??
""
,
Mail
=
data
?.
Mail
??
""
};
users
.
Add
(
user
);
var
userRole
=
new
sys_user_role
{
RoleID
=
(
int
)
roles
.
FirstOrDefault
(
t
=>
t
.
RoleName
==
data
.
RoleName
)?.
Type
,
};
userRoles
.
Add
(
userRole
);
var
userHos
=
new
sys_user_hospital
{
HospitalID
=
hospitals
.
FirstOrDefault
(
t
=>
t
.
HosName
==
data
.
HosName
)?.
ID
};
userHoss
.
Add
(
userHos
);
}
}
_userRepository
.
AddRange
(
users
.
ToArray
());
var
roleJoin
=
userRoles
.
Join
(
users
,
t
=>
new
{
},
w
=>
new
{
},
(
t
,
w
)
=>
new
sys_user_role
{
RoleID
=
t
.
RoleID
,
UserID
=
w
.
ID
});
var
hosJoin
=
userHoss
.
Join
(
users
,
t
=>
new
{
},
w
=>
new
{
},
(
t
,
w
)
=>
new
sys_user_hospital
{
HospitalID
=
t
.
HospitalID
,
UserID
=
w
.
ID
});
_userroleRepository
.
AddRange
(
roleJoin
.
ToArray
());
_userhospitalRepository
.
AddRange
(
hosJoin
.
ToArray
());
return
1
;
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
static
Dictionary
<
string
,
string
>
Users
{
get
;
}
=
new
Dictionary
<
string
,
string
>
{
{
nameof
(
sys_user
.
RealName
),
"姓名"
},
{
nameof
(
sys_user
.
Login
),
"登录名"
},
{
nameof
(
sys_user
.
Password
),
"密码"
},
{
nameof
(
sys_user
.
Mobile
),
"手机号码"
},
{
nameof
(
sys_user
.
Mail
),
"邮箱"
},
{
nameof
(
sys_role
.
RoleName
),
"角色"
},
{
nameof
(
sys_hospital
.
HosName
),
"分配医院"
},
{
nameof
(
sys_user
.
Department
),
"核算单元"
},
};
private
List
<
Dictionary
<
string
,
string
>>
CreateDataRow
(
UserCollectData
request
,
Dictionary
<
string
,
string
>
config
)
{
List
<
Dictionary
<
string
,
string
>>
allData
=
new
List
<
Dictionary
<
string
,
string
>>();
for
(
int
r
=
0
;
r
<
request
.
Data
.
Length
;
r
++)
{
// 创建固定数据列
Dictionary
<
string
,
string
>
baseData
=
CreateBaseData
(
request
,
config
,
r
);
allData
.
Add
(
baseData
);
}
return
allData
;
}
private
Dictionary
<
string
,
string
>
CreateBaseData
(
UserCollectData
request
,
Dictionary
<
string
,
string
>
config
,
int
rownumber
)
{
Dictionary
<
string
,
string
>
result
=
new
Dictionary
<
string
,
string
>();
for
(
int
c
=
0
;
c
<
request
.
ColHeaders
.
Length
;
c
++)
{
var
header
=
request
.
ColHeaders
[
c
];
var
first
=
config
.
FirstOrDefault
(
w
=>
w
.
Value
==
header
);
if
(!
default
(
KeyValuePair
<
string
,
string
>).
Equals
(
first
)
&&
!
result
.
ContainsKey
(
header
)
&&
request
.
Data
[
rownumber
].
Length
>
c
)
{
result
.
Add
(
first
.
Key
,
request
.
Data
[
rownumber
][
c
]);
}
}
return
result
;
}
}
}
}
}
\ No newline at end of file
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