report placement.probation
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
Bright 2025-01-20 17:54:15 +07:00
parent afb1f83bdf
commit 35f590e1f3

View file

@ -397,6 +397,50 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success(new List<dynamic>());
}
[HttpGet("exam-probation/{citizenId:length(13)}")]
public async Task<ActionResult<ResponseObject>> GetDataExamByPlacement(string citizenId)
{
var dateAppoint = string.Empty;
var apiUrl = $"{_configuration["API"]}/org/profile/citizenid/position/{citizenId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
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();
if (_res.IsSuccessStatusCode)
{
var json = JObject.Parse(_result);
var dateAppointToken = json["result"]?["dateAppoint"];
if (dateAppointToken != null)
{
dateAppoint = dateAppointToken.ToString();
}
}
}
var placementProfile = await _context.PlacementProfiles
.Include(x => x.Placement)
.Select(x => new
{
fullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
citizenId = x.CitizenId,
examName = x.Placement.Name,
})
.Where(x => x.citizenId == citizenId.ToString())
.FirstOrDefaultAsync();
var data = new
{
fullName = placementProfile != null ? placementProfile.fullName : "",
citizenId = placementProfile != null ? placementProfile.citizenId : "",
examName = placementProfile != null ? placementProfile.examName : "",
dateAppoint = dateAppoint
};
return Success(data);
}
[HttpGet("personal/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetProfileByUser(Guid personalId)
{