Commit 11fcfc84 by 钟博

Merge branch '科室人员用户handson数据导入' into feature/科室人员用户handson批量导入

# Conflicts:
#	performance/Performance.Api/Properties/PublishProfiles/FolderProfile.pubxml
#	performance/Performance.Api/wwwroot/Performance.Api.xml
parents fda2b70d 1ca73449
......@@ -371,15 +371,29 @@ public ApiResponse DeleteUser([CustomizeValidator(RuleSet = "Delete"), FromBody]
#endregion
/// <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>
/// <param name="request"></param>
/// <returns></returns>
[Route("BatchSaveUser")]
[HttpPost]
public ApiResponse BatchSaveUser()
public ApiResponse BatchSaveUser([FromBody]UserCollectData data)
{
_userService.SaveUserHandsFlat(data);
return new ApiResponse(ResponseType.OK);
}
}
......
......@@ -181,5 +181,53 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
var data = personService.DeptIncomeDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data);
}
/// <summary>
/// 批量人员字典表头
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("person/GetBatchPersonStructrue")]
public ApiResponse GetBatchPersonStructrue(int hospitalId)
{
var result=personService.GetBatchPersonStructrue(hospitalId);
return new ApiResponse(ResponseType.OK,result);
}
/// <summary>
/// 批量添加人员信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("person/BathSavePerson")]
public ApiResponse BathSavePerson(int allotId,int hospitalId,SaveCollectData request)
{
personService.BathSavePerson(allotId, hospitalId, request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 批量科室字典表头
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/GetDeptStructrue")]
public ApiResponse GetDeptStructrue(int hospitalId)
{
var result = personService.GetDepartmentHands(hospitalId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 批量添加科室信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/SaveDeptHands")]
public ApiResponse SaveDeptHands(int hospitalId,SaveCollectData request)
{
personService.SaveDeptDicHands(hospitalId, request);
return new ApiResponse(ResponseType.OK);
}
}
}
<?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">
<PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp2.2\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp2.2</TargetFramework>
<ProjectGuid>3ae00ff5-f0ba-4d72-a23b-770186309327</ProjectGuid>
<SelfContained>false</SelfContained>
<_IsPortable>true</_IsPortable>
<publishUrl>D:\publish\jx.suvalue.com2</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -137,7 +137,14 @@
<param name="request"></param>
<returns></returns>
</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>
......@@ -607,12 +614,11 @@
<param name="request"></param>
<returns></returns>
</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>
获取cof_accounting列表
</summary>
<param name="allotId"></param>
<param name="type">1 返回accounting列表 2 返回核算单元类型 3 返回核算单元</param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.AccountingInsert(Performance.EntityModels.cof_accounting)">
......@@ -1143,6 +1149,30 @@
</summary>
<returns></returns>
</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">
<summary>
报表
......
......@@ -1819,6 +1819,21 @@
比率
</summary>
</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">
<summary>
二次分配请求
......
......@@ -25,4 +25,20 @@ public class Deptdic
public int Id { 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; }
}
}
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 Department { get; set; }
public string RoleName { get; set; }
public string HosName { get; set; }
}
}
......@@ -11,4 +11,11 @@ public class SaveCollectData
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
public class UserCollectData
{
public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
}
......@@ -695,5 +695,122 @@ public ApiResponse DeleteUser(int iD)
}
#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 void SaveUserHandsFlat(UserCollectData request)
{
var dicData = CreateDataRow(request, Users);
var roles = _roleRepository.GetEntities();
var hospitals = _hospitalRepository.GetEntities();
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>();
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<UserHandsResponse>(json);
if (!string.IsNullOrEmpty(data.Login) && !string.IsNullOrEmpty(data.RealName))
{
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,
States = 1
};
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());
}
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_role.RoleName), "角色"},
{nameof(sys_user.Department), "核算单元"},
{nameof(sys_hospital.HosName), "分配医院"},
};
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment