Report C-PM-11, C-PM-12, C-PM-21 (Template เท่านั้น)

This commit is contained in:
Suphonchai Phoonsawat 2023-09-04 09:17:18 +07:00
parent 55a0f5c6ed
commit 7b4d0e1ae6
5 changed files with 250 additions and 12 deletions

View file

@ -1,4 +1,6 @@
using BMA.EHR.Application.Common.Interfaces;
using Amazon.Runtime.Internal.Transform;
using Amazon.S3.Model.Internal.MarshallTransformations;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses.Reports;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Commands.Core;
@ -460,6 +462,76 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<List<CommandType11Response>> GetCommandType11Async(Guid id)
{
try
{
var raw_data = await _dbContext.Set<CommandReceiver>()
.Include(c => c.Command)
.Where(c => c.Command.Id == id)
.Select(r => new CommandType11Response
{
CommandNo = r.Command.CommandNo,
CommandYear = r.Command.CommandYear,
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(),
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PlacementCommandIssuer = r.Command.PlacementCommandIssuer,
PlacementCommandNo = r.Command.PlacementCommandNo,
PlacementCommandDate = r.Command.PlacementCommandDate == null ? "" : r.Command.PlacementCommandDate.Value.ToThaiFullDate3()
})
.ToListAsync();
if (raw_data == null)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
return raw_data;
}
catch
{
throw;
}
}
public async Task<List<CommandType11Response>> GetCommandType12Async(Guid id)
{
try
{
var raw_data = await _dbContext.Set<CommandReceiver>()
.Include(c => c.Command)
.Where(c => c.Command.Id == id)
.Select(r => new CommandType11Response
{
CommandNo = r.Command.CommandNo,
CommandYear = r.Command.CommandYear,
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(),
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PlacementCommandIssuer = r.Command.PlacementCommandIssuer,
PlacementCommandNo = r.Command.PlacementCommandNo,
PlacementCommandDate = r.Command.PlacementCommandDate == null ? "" : r.Command.PlacementCommandDate.Value.ToThaiFullDate3()
})
.ToListAsync();
if (raw_data == null)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
return raw_data;
}
catch
{
throw;
}
}
public async Task<List<CommandType15Response>> GetCommandType15AttachmentAsync(Guid id)
{
try