Merge branch 'develop' into working
This commit is contained in:
commit
f70fbff8f0
73 changed files with 121122 additions and 833 deletions
|
|
@ -138,12 +138,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType01Response
|
||||
|
|
@ -196,12 +190,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
@ -267,12 +255,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
@ -333,12 +315,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
|
|||
|
|
@ -2981,37 +2981,8 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var placementProfile = await _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementProfileDocs)
|
||||
.ThenInclude(x => x.Document)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionPathSide)
|
||||
.Include(x => x.PositionType)
|
||||
.Include(x => x.PositionLine)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
|
||||
.Include(x => x.PlacementCertificates)
|
||||
.Include(x => x.PlacementEducations)
|
||||
.ThenInclude(x => x.EducationLevel)
|
||||
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.ThenInclude(x => x.OrganizationShortName)
|
||||
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.PositionMaster)
|
||||
.ThenInclude(x => x.PositionExecutive)
|
||||
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.PositionMaster)
|
||||
.ThenInclude(x => x.PositionExecutiveSide)
|
||||
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.PositionMaster)
|
||||
.ThenInclude(x => x.PositionLine)
|
||||
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (placementProfile == null)
|
||||
|
|
@ -3093,7 +3064,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
other = edu.Other == null ? string.Empty : edu.Other,
|
||||
startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate,
|
||||
endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate,
|
||||
educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name,
|
||||
educationLevel = edu.EducationLevelName,
|
||||
educationLevelId = string.Empty,
|
||||
positionPath = edu.PositionPath == null ? null : edu.PositionPath,
|
||||
positionPathId = string.Empty,
|
||||
|
|
@ -10162,13 +10133,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var data = await (from r in _dbContext.Set<CommandReceiver>()
|
||||
.Include(x => x.Command)
|
||||
join pf in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PositionPath)
|
||||
on r.RefPlacementProfileId equals pf.Id
|
||||
where r.Command.Id == id
|
||||
select new
|
||||
{
|
||||
r.RefPlacementProfileId,
|
||||
Position = pf.PositionPath!.Name
|
||||
Position = pf.positionName
|
||||
}).ToListAsync();
|
||||
|
||||
if (data.Count > 0)
|
||||
|
|
@ -10678,27 +10648,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<PositionPath>> GetPlacementPositionPath(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.Placement)
|
||||
.Where(x => x.Placement!.Id == id)
|
||||
.Where(x => x.PositionPath != null)
|
||||
.Select(x => x.PositionPath)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
||||
return data!;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Command Info "
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using BMA.EHR.Application.Common.Interfaces;
|
|||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
|
@ -14,7 +15,9 @@ using Microsoft.AspNetCore.Http;
|
|||
using Microsoft.AspNetCore.Http.Metadata;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
{
|
||||
|
|
@ -743,31 +746,81 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
|
||||
//44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
|
||||
public async Task<dynamic> GetSummaryCoinReport(Guid id)
|
||||
public async Task<dynamic> GetSummaryCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
|
||||
.Select(x => new
|
||||
{
|
||||
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
|
||||
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
|
||||
OcId = x.Request.OrganizationId
|
||||
})
|
||||
.ToListAsync();
|
||||
/* var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
|
||||
.Select(x => new
|
||||
{
|
||||
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
|
||||
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
|
||||
OcId = x.Request.OrganizationId
|
||||
})
|
||||
.ToListAsync();*/
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");
|
||||
|
||||
var insignia = (from r in data_insignia
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1Id == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2Id == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3Id == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4Id == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var data = await data_insigniaQuery
|
||||
.Select(x => new
|
||||
{
|
||||
Gendor = x.Gender, // Gender as is, directly from x.Gender
|
||||
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
||||
OcId = x.Request.OrganizationId // Organization ID
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var insignia = (from r in data
|
||||
group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g
|
||||
select new
|
||||
{
|
||||
|
|
@ -832,7 +885,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
|
||||
//45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
|
||||
public async Task<dynamic> GetCoinReport(Guid id)
|
||||
public async Task<dynamic> GetCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
|
@ -856,45 +909,89 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
&& r.Status == "PENDING"
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
|
||||
select new
|
||||
select new
|
||||
{
|
||||
Male = r.Gender == "ชาย" ? 1 : 0,
|
||||
Female = r.Gender == "หญิง" ? 1 : 0,
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Gender)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Prefix)
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Period)
|
||||
.Include(x => x.Request)
|
||||
//.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.ToListAsync()
|
||||
where r.Request.Period == period
|
||||
&& r.IsApprove == true
|
||||
&& r.Status == "PENDING"
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
|
||||
select new
|
||||
{
|
||||
InsigniaInitial = r.RequestInsignia.ShortName,
|
||||
InsigniaName = r.RequestInsignia.Name,
|
||||
ProfileId = r.ProfileId,
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
// $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
||||
Gender = r.Gender,
|
||||
Male = gender.Sum(x => x.Male),
|
||||
Female = gender.Sum(x => x.Female),
|
||||
InsigniaId = r.RequestInsignia.Id,
|
||||
OCName = _userProfileRepository.GetOc(r.Request.OrganizationId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var dataQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Period)
|
||||
.Include(x => x.Request)
|
||||
/*.ThenInclude(x => x.Organization)*/
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Where(r => r.Request.Period == period
|
||||
&& r.IsApprove == true
|
||||
&& r.Status == "PENDING"
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ");
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
dataQuery = dataQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
dataQuery = dataQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
dataQuery = dataQuery.Where(r => r.RootId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
dataQuery = dataQuery.Where(r => r.Child1Id == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dataQuery = dataQuery.Where(r => r.Child2Id == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
dataQuery = dataQuery.Where(r => r.Child3Id == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
dataQuery = dataQuery.Where(r => r.Child4Id == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Grouping by ProfileId and InsigniaId, and calculating the sum for Male and Female
|
||||
var data = await dataQuery
|
||||
.GroupBy(r => new
|
||||
{
|
||||
r.RequestInsignia.ShortName,
|
||||
r.RequestInsignia.Name,
|
||||
r.ProfileId,
|
||||
r.Prefix,
|
||||
r.FirstName,
|
||||
r.LastName,
|
||||
r.Gender,
|
||||
r.RequestInsignia.Id,
|
||||
r.Request.OrganizationId
|
||||
})
|
||||
.Select(group => new
|
||||
{
|
||||
InsigniaInitial = group.Key.ShortName,
|
||||
InsigniaName = group.Key.Name,
|
||||
ProfileId = group.Key.ProfileId,
|
||||
FullName = $"{group.Key.Prefix}{group.Key.FirstName} {group.Key.LastName}",
|
||||
Gender = group.Key.Gender,
|
||||
Male = group.Count(r => r.Gender == "Male"), // Count male entries
|
||||
Female = group.Count(r => r.Gender == "Female"), // Count female entries
|
||||
InsigniaId = group.Key.Id,
|
||||
OCName = _userProfileRepository.GetOc(group.Key.OrganizationId, 0, AccessToken).Root
|
||||
})
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
||||
// loop to add temp row with 50 rows per page
|
||||
var insigniaList = data.Select(x => new { InsigniaId = x.InsigniaId, InsigniaInitial = x.InsigniaInitial, InsigniaName = x.InsigniaName })
|
||||
|
|
@ -959,6 +1056,115 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return s_data;
|
||||
}
|
||||
|
||||
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
||||
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
/*.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");*/
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1Id == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2Id == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3Id == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4Id == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var data = await data_insigniaQuery
|
||||
.Select(x => new
|
||||
{
|
||||
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
/* var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||
using (var _client = new HttpClient())
|
||||
{
|
||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||
var _res = await _client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
continue;
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||
};
|
||||
seq++;
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}*/
|
||||
var insignia = data.Select((r, index) => new
|
||||
{
|
||||
RowNo = (index + 1).ToNumericText().ToThaiNumber(),
|
||||
FullName = r.FullName,
|
||||
RequestInsigniaName = r.RequestInsigniaName,
|
||||
ResultY1APR = "-",
|
||||
ResultY1OCT = "-",
|
||||
ResultY2APR = "-",
|
||||
ResultY2OCT = "-",
|
||||
ResultY3APR = "-",
|
||||
ResultY3OCT = "-",
|
||||
ResultY4APR = "-",
|
||||
ResultY4OCT = "-",
|
||||
ResultY5APR = "-",
|
||||
ResultY5OCT = "-",
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
}
|
||||
|
||||
//noti ยื่นเสนอคน
|
||||
public async Task NotifyInsignia()
|
||||
{
|
||||
|
|
@ -1109,13 +1315,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
if (insigniaPeriod.StartDate >= DateTime.Now.Date || insigniaPeriod.InsigniaRequests.Count > 0)
|
||||
continue;
|
||||
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
//if (organizationType == null)
|
||||
// continue;
|
||||
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||
if (organizations == null)
|
||||
continue;
|
||||
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region 13 แบบมอบหมายงาน ฯ
|
||||
public async Task<object> GetProbationAssignAsync(Guid assign_id, string token)
|
||||
{
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}&isReport=true";
|
||||
ProbationAssignResponse probation_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -82,6 +82,15 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var competencyGroups = probation_assign.result.competency_groups.Select(x => new
|
||||
{
|
||||
name = string.IsNullOrEmpty(x.name) ? string.Empty : x.name.ToThaiNumber(),
|
||||
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
|
||||
description = string.IsNullOrEmpty(x.description)
|
||||
? string.Empty
|
||||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var outputs = probation_assign.result.outputs.Select(x => new
|
||||
{
|
||||
id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(),
|
||||
|
|
@ -89,11 +98,26 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
output_desc = string.IsNullOrEmpty(x.output_desc) ? string.Empty : x.output_desc.ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var skills = probation_assign.result.skills.Select(x => new
|
||||
{
|
||||
name = string.IsNullOrEmpty(x.title) ? string.Empty : x.title.ToThaiNumber(),
|
||||
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
|
||||
description = string.IsNullOrEmpty(x.description)
|
||||
? string.Empty
|
||||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var laws = probation_assign.result.laws.Where(x => x.selected == true).Select((x, Index) => new
|
||||
{
|
||||
title = string.IsNullOrEmpty(x.description) ? string.Empty : $"{(Index + 1).ToString().ToThaiNumber()}. {x.description.ToThaiNumber()}",
|
||||
}).ToList();
|
||||
|
||||
return new
|
||||
{
|
||||
Name = string.IsNullOrEmpty(probation_assign.result.profile.name) ? "-" : probation_assign.result.profile.name,
|
||||
Position = string.IsNullOrEmpty(probation_assign.result.profile.Position) ? "-" : probation_assign.result.profile.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(probation_assign.result.profile.positionLevelName) ? "-" : probation_assign.result.profile.positionLevelName,
|
||||
PositionAndLevel = string.IsNullOrEmpty(probation_assign.result.profile.PositionAndLevel) ? "-" : probation_assign.result.profile.PositionAndLevel,
|
||||
Department = string.IsNullOrEmpty(probation_assign.result.profile.Department) ? "-" : probation_assign.result.profile.Department,
|
||||
OrganizationOrganization = string.IsNullOrEmpty(probation_assign.result.profile.OrganizationOrganization) ? "-" : probation_assign.result.profile.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(probation_assign.result.profile.Oc) ? "-" : probation_assign.result.profile.Oc,
|
||||
|
|
@ -111,7 +135,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
Jobs = jobs,
|
||||
Knowledges = knowledges,
|
||||
Competencys = competencys,
|
||||
CompetencyGroups = competencyGroups,
|
||||
Outputs = outputs,
|
||||
Skills = skills,
|
||||
Laws = laws,
|
||||
OtherDesc = string.IsNullOrEmpty(probation_assign.result.assign.other_desc) ? "-" : probation_assign.result.assign.other_desc,
|
||||
Other4Desc = string.IsNullOrEmpty(probation_assign.result.assign.other4_desc) ? "-" : probation_assign.result.assign.other4_desc,
|
||||
Other5No1Desc = string.IsNullOrEmpty(probation_assign.result.assign.other5_no1_desc) ? "-" : probation_assign.result.assign.other5_no1_desc,
|
||||
|
|
@ -147,26 +174,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
var training_seminar = evaluate_record.result.evaluate.training_seminar == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
|
||||
var other_training = evaluate_record.result.evaluate.other_training == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
|
||||
|
||||
var expects = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? new
|
||||
{
|
||||
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col1 == "/" ? "✓" : string.Empty,
|
||||
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col2 == "/" ? "✓" : string.Empty,
|
||||
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col3 == "/" ? "✓" : string.Empty,
|
||||
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col4 == "/" ? "✓" : string.Empty,
|
||||
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col5 == "/" ? "✓" : string.Empty,
|
||||
}
|
||||
: null;
|
||||
var outputs = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? new
|
||||
{
|
||||
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col1 == "/" ? "✓" : string.Empty,
|
||||
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col2 == "/" ? "✓" : string.Empty,
|
||||
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col3 == "/" ? "✓" : string.Empty,
|
||||
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col4 == "/" ? "✓" : string.Empty,
|
||||
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col5 == "/" ? "✓" : string.Empty,
|
||||
}
|
||||
: null;
|
||||
var expects = evaluate_record?.result?.evaluate?.achievements?.evaluate_expect_level ?? null;
|
||||
var outputs = evaluate_record?.result?.evaluate?.achievements?.evaluate_output_level ?? null;
|
||||
var knows = evaluate_record.result.evaluate != null
|
||||
? new
|
||||
{
|
||||
|
|
@ -365,6 +374,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
DirectorDated = string.IsNullOrEmpty(evaluate_record.result.evaluate.sign_dated.ToString()) ? "-" : evaluate_record.result.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_record.result.experimentee.name) ? string.Empty : evaluate_record.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_record.result.experimentee.Position) ? string.Empty : evaluate_record.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_record.result.experimentee.PositionLevelName) ? "-" : evaluate_record.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_record.result.experimentee.Department) ? string.Empty : evaluate_record.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_record.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_record.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_record.result.experimentee.Oc) ? string.Empty : evaluate_record.result.experimentee.Oc,
|
||||
|
|
@ -375,13 +385,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_record.result.evaluate.date_finish.ToString()) ? string.Empty : evaluate_record.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Role = evaluate_record.result.evaluate.role == "mentor" ? "ผู้ดูแลการทดลองปฏิบัติหน้าที่ราชการ" : "ผู้บังคับบัญชา",
|
||||
Expects = expects,
|
||||
ExpectDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? evaluate_record.result.evaluate.achievements[0].evaluate_expect_desc
|
||||
: string.Empty,
|
||||
Outputs = outputs,
|
||||
OutputDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? evaluate_record.result.evaluate.achievements[0].evaluate_output_desc
|
||||
: string.Empty,
|
||||
AchievementOtherDesc = evaluate_record.result.evaluate.achievement_other_desc,
|
||||
AchievementStrengthDesc = evaluate_record.result.evaluate.achievement_strength_desc,
|
||||
AchievementImproveDesc = evaluate_record.result.evaluate.achievement_improve_desc,
|
||||
|
|
@ -592,6 +596,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -822,6 +827,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -881,9 +887,9 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#endregion
|
||||
|
||||
#region 18 แบบรายงานการประเมินผล (สำหรับประธาน และ กรณีขยายเวลา)
|
||||
public async Task<object> GetEvaluateResultAssignAsync(Guid id, string token)
|
||||
public async Task<object> GetEvaluateResultAssignAsync(Guid id, int no, string token)
|
||||
{
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}&evaluate_no={no}";
|
||||
EvaluateResultAssignResponse evaluate_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -933,6 +939,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -945,7 +952,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.Position) ? string.Empty : evaluate_assign.result.commander.Position,
|
||||
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = evaluate_assign.result.experimentee.name,
|
||||
RoundNo = evaluate_assign.result.assign.round_no.ToString().ToThaiNumber(),
|
||||
RoundNo = no.ToString().ToThaiNumber(),
|
||||
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",
|
||||
DateFinish = evaluate_assign.result.assign.date_finish != string.Empty ? dateFinish_ : "-",
|
||||
Develop1 = developComplete1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue