แก้ ไฟล์ docker

This commit is contained in:
Kittapath 2023-07-13 11:03:06 +07:00
parent 8edfbc7466
commit 202099605a
8 changed files with 342 additions and 21 deletions

View file

@ -15,10 +15,11 @@ using System.Security.Cryptography;
namespace BMA.EHR.Placement.Service.Controllers
{
[Route("api/[controller]/placement")]
[ApiController]
[Produces("application/json")]
[Authorize]
[Route("api/v{version:apiVersion}/placement")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("ระบบบรรจุ")]
public class PlacementController : BaseController
{
@ -338,20 +339,44 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpGet("pass/stat/{examId:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetDashboardByPlacement(Guid examId)
{
var placement = await _context.Placements
.Where(x => x.Id == examId)
.Select(x => new
{
Total = x.PlacementProfiles.Count(),
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
}).FirstOrDefaultAsync();
if (placement == null)
return Error(GlobalMessages.DataNotFound, 404);
if (PlacementAdmin == true)
{
var placement = await _context.Placements
.Where(x => x.Id == examId)
.Select(x => new
{
Total = x.PlacementProfiles.Count(),
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
}).FirstOrDefaultAsync();
if (placement == null)
return Error(GlobalMessages.DataNotFound, 404);
return Success(placement);
return Success(placement);
}
else
{
var profileOrg = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId ?? "00000000-0000-0000-0000-000000000000"));
if (profileOrg == null)
return Error(GlobalMessages.DataNotFound, 404);
var ocIdList = _documentService.GetAllIdByRoot(profileOrg.OcId);
var placement = await _context.Placements
.Where(x => x.Id == examId)
.Select(x => new
{
Total = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Count(),
UnContain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
PrepareContain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
Contain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
Disclaim = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
}).FirstOrDefaultAsync();
if (placement == null)
return Error(GlobalMessages.DataNotFound, 404);
return Success(placement);
}
}
[HttpPost("pass/deferment"), DisableRequestSizeLimit]