Commit 87d8d98c by 钟博

绩效查询用户添加,查询

parent 2fcf5b0b
...@@ -147,9 +147,9 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self" ...@@ -147,9 +147,9 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
/// <returns></returns> /// <returns></returns>
[Route("list")] [Route("list")]
[HttpPost] [HttpPost]
public ApiResponse<List<UserResponse>> List() public ApiResponse<List<UserResponse>> List([FromBody] UserRequest request)
{ {
var userList = _userService.GetUserList(_claim.GetUserId()); var userList = _userService.GetUserList(_claim.GetUserId(),request.Role);
return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList); return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList);
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.List"> <member name="M:Performance.Api.Controllers.AccountController.List(Performance.DtoModels.UserRequest)">
<summary> <summary>
用户列表 用户列表
</summary> </summary>
......
...@@ -7281,6 +7281,11 @@ ...@@ -7281,6 +7281,11 @@
行政后勤是否显示管理绩效按钮 1 是 2 否 行政后勤是否显示管理绩效按钮 1 是 2 否
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospital.IsOwnerQuery">
<summary>
是否开启个人绩效查询账号创建 1 是 2 否
</summary>
</member>
<member name="T:Performance.EntityModels.sys_hospitalconfig"> <member name="T:Performance.EntityModels.sys_hospitalconfig">
<summary> <summary>
......
...@@ -9,6 +9,7 @@ public class SaveCollectData ...@@ -9,6 +9,7 @@ public class SaveCollectData
{ {
public int SheetType { get; set; } public int SheetType { get; set; }
public string SheetName { get; set; } public string SheetName { get; set; }
public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { get; set; } public string[][] Data { get; set; }
} }
...@@ -18,7 +19,7 @@ public class UserCollectData ...@@ -18,7 +19,7 @@ public class UserCollectData
public int HospitalId { get; set; } public int HospitalId { get; set; }
public int? CreateUser { get; set; } public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { get; set; } public new string[][] Data { get; set; }
} }
......
...@@ -33,6 +33,7 @@ public class PersonService : IAutoInjection ...@@ -33,6 +33,7 @@ public class PersonService : IAutoInjection
private readonly PerforRoleRepository perforRoleRepository; private readonly PerforRoleRepository perforRoleRepository;
private readonly PerforAgsecondallotRepository agsecondallotRepository; private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly PerforHospitalRepository perforHospitalRepository; private readonly PerforHospitalRepository perforHospitalRepository;
private readonly UserService userService;
private readonly Application application; private readonly Application application;
private readonly IHostingEnvironment evn; private readonly IHostingEnvironment evn;
...@@ -57,6 +58,7 @@ public class PersonService : IAutoInjection ...@@ -57,6 +58,7 @@ public class PersonService : IAutoInjection
PerforRoleRepository perforRoleRepository, PerforRoleRepository perforRoleRepository,
PerforAgsecondallotRepository agsecondallotRepository, PerforAgsecondallotRepository agsecondallotRepository,
PerforHospitalRepository perforHospitalRepository, PerforHospitalRepository perforHospitalRepository,
UserService userService,
IOptions<Application> application, IOptions<Application> application,
IHostingEnvironment evn IHostingEnvironment evn
) )
...@@ -70,6 +72,7 @@ IHostingEnvironment evn ...@@ -70,6 +72,7 @@ IHostingEnvironment evn
this.perforRoleRepository = perforRoleRepository; this.perforRoleRepository = perforRoleRepository;
this.agsecondallotRepository = agsecondallotRepository; this.agsecondallotRepository = agsecondallotRepository;
this.perforHospitalRepository = perforHospitalRepository; this.perforHospitalRepository = perforHospitalRepository;
this.userService = userService;
this.application = application.Value; this.application = application.Value;
this.evn = evn; this.evn = evn;
} }
...@@ -719,20 +722,36 @@ public HandsonTable GetDepartmentHands(int hospitalId) ...@@ -719,20 +722,36 @@ public HandsonTable GetDepartmentHands(int hospitalId)
public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
{ {
var dict = new Dictionary<string, string>(); var dict = new Dictionary<string, string>();
Person.ForEach(t => dict.Add(t.Item1, t.Item2)); PonsePassword.ForEach(t => dict.Add(t.Item1, t.Item2));
var dicData = CreateDataRow(request, dict); var dicData = CreateDataRow(request, dict);
List<per_employee> employees = new List<per_employee>(); List<per_employee> employees = new List<per_employee>();
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId); var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId);
var hospital = perforHospitalRepository.GetEntity(t => t.ID == HospitalId); var hospital = perforHospitalRepository.GetEntity(t => t.ID == HospitalId);
//var newRole = perforRoleRepository.GetEntity(t => t.RoleName == "绩效查询");
//==绩效查询角色
var usercollor = new UserCollectData
{
HospitalId = HospitalId,
CreateUser = request.CreateUser,
ColHeaders = new[] { "姓名", "登录名", "密码", "手机号码", "邮箱", "角色", "分配医院", "核算单元" },
};
var role = perforRoleRepository.GetEntity(t => t.RoleName == "绩效查询");
var userRole = perforUserroleRepository.GetEntities(t => t.RoleID == role.ID).Select(t=>t.UserID);
var users = perforUserRepository.GetEntities(t => userRole.Contains(t.ID));
//==
var newUsers = new List<string[]>();
var delPersonsNum = new List<string>(); var delPersonsNum = new List<string>();
foreach (var item in dicData) foreach (var item in dicData)
{ {
//==绩效查询角色
var isNewRole = !string.IsNullOrEmpty(item["PersonnelNumber"]) && !string.IsNullOrEmpty(item["Password"]); var isNewRole = !string.IsNullOrEmpty(item["PersonnelNumber"]) && !string.IsNullOrEmpty(item["Password"]);
if(hospital.IsOwnerQuery==1 && isNewRole) var isRepeat = users.Any(t => t.RealName == item["DoctorName"] && t.Login == item["PersonnelNumber"]);
if (hospital.IsOwnerQuery == 1 && isNewRole && !isRepeat)
{ {
newUsers.Add(new[] { $"{item["DoctorName"]}", $"{item["PersonnelNumber"]}", $"{item["Password"]}", "", "", "绩效查询", $"{hospital.HosName}", $"{item["AccountingUnit"]}"});
} }
//==
if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"])) if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
{ {
...@@ -759,6 +778,13 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -759,6 +778,13 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
employees.Add(data); employees.Add(data);
} }
} }
if (newUsers.Count > 0)
{
usercollor.Data = newUsers.ToArray();
userService.SaveUserHandsFlat(usercollor);
}
var delPerson = persons?.Where(t => delPersonsNum.Contains(t.PersonnelNumber)); var delPerson = persons?.Where(t => delPersonsNum.Contains(t.PersonnelNumber));
if (delPerson != null && delPerson.Any()) if (delPerson != null && delPerson.Any())
peremployeeRepository.RemoveRange(delPerson.ToArray()); peremployeeRepository.RemoveRange(delPerson.ToArray());
...@@ -1032,11 +1058,11 @@ public string GetPersonDictFile(int allotId, int userId) ...@@ -1032,11 +1058,11 @@ public string GetPersonDictFile(int allotId, int userId)
public bool ReloadPersonnel(int hospitalId, int allotId) public bool ReloadPersonnel(int hospitalId, int allotId)
{ {
var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList(); var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList();
if (allotList == null || !allotList.Any()) if (allotList == null || !allotList.Any())
throw new PerformanceException("加载失败,绩效记录不存在!"); throw new PerformanceException("加载失败,绩效记录不存在!");
var allot = allotList.FirstOrDefault(w => w.ID == allotId); var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null) if (allot == null)
throw new PerformanceException("加载失败,绩效记录不存在!"); throw new PerformanceException("加载失败,绩效记录不存在!");
var index = allotList.IndexOf(allot); var index = allotList.IndexOf(allot);
...@@ -1047,11 +1073,11 @@ public bool ReloadPersonnel(int hospitalId, int allotId) ...@@ -1047,11 +1073,11 @@ public bool ReloadPersonnel(int hospitalId, int allotId)
if (prevAllot == null) prevAllot.ID = -1; if (prevAllot == null) prevAllot.ID = -1;
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllot.ID); var persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllot.ID);
if (persons == null || !persons.Any()) if (persons == null || !persons.Any())
throw new PerformanceException("加载失败,未查询到上月人员信息!"); throw new PerformanceException("加载失败,未查询到上月人员信息!");
var i = peremployeeRepository.Execute($@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;", new { hospitalId, allotId }); var i = peremployeeRepository.Execute($@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;", new { hospitalId, allotId });
if (i <= 0) if (i <= 0)
throw new PerformanceException("加载失败,人员信息重置失败!"); throw new PerformanceException("加载失败,人员信息重置失败!");
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = DateTime.DaysInMonth(allot.Year, allot.Month);
......
...@@ -134,7 +134,7 @@ public sys_role GetUserFirstRole(int userId) ...@@ -134,7 +134,7 @@ public sys_role GetUserFirstRole(int userId)
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
public List<UserResponse> GetUserList(int userID) public List<UserResponse> GetUserList(int userID,int roleType=1)
{ {
var userRoles = _userroleRepository.GetEntities(); var userRoles = _userroleRepository.GetEntities();
var userHospitals = _userhospitalRepository.GetEntities(); var userHospitals = _userhospitalRepository.GetEntities();
...@@ -143,6 +143,18 @@ public List<UserResponse> GetUserList(int userID) ...@@ -143,6 +143,18 @@ public List<UserResponse> GetUserList(int userID)
var roles = _roleRepository.GetEntities(); var roles = _roleRepository.GetEntities();
var userrole = userRoles?.FirstOrDefault(t => t.UserID == userID); var userrole = userRoles?.FirstOrDefault(t => t.UserID == userID);
if (roleType == 12)
{
var jxQuery = userRoles.Where(t=>t.RoleID==roles?.FirstOrDefault(c=>c.RoleName=="绩效查询")?.ID).Select(t => t.UserID);
users = users.Where(t => jxQuery.Contains(t.ID)).ToList();
}
else
{
var jxQuery = userRoles.Where(t =>roles.Where(c => c.RoleName != "绩效查询").Select(c=>c.ID).Contains(t.RoleID)).Select(t => t.UserID);
users = users.Where(t => jxQuery.Contains(t.ID)).ToList();
}
if (userrole == null) if (userrole == null)
throw new PerformanceException("用户未配置角色"); throw new PerformanceException("用户未配置角色");
var role = roles?.FirstOrDefault(t => t.ID == userrole.RoleID); var role = roles?.FirstOrDefault(t => t.ID == userrole.RoleID);
......
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