fix report

This commit is contained in:
Suphonchai Phoonsawat 2023-05-13 20:13:01 +07:00
parent a15f2a1081
commit d86eb050a8
6 changed files with 64 additions and 17 deletions

View file

@ -33,6 +33,32 @@ namespace BMA.EHR.Report.Service.Services
#region " Report Query "
public async Task<IEnumerable<dynamic>?> GetOrganizationTypes(string type)
{
var Organizations = await _context.Organizations.ToListAsync();
var OrganizationOrganizations = await _context.OrganizationOrganizations.ToListAsync();
var OrganizationTypes = await _context.OrganizationTypes.FirstOrDefaultAsync(x => x.Name == type);
if (OrganizationTypes == null)
{
throw new Exception("Invalid Organization type.");
}
var dataType = (from o in Organizations
join os in OrganizationOrganizations on o.OrganizationOrganizationId equals os.Id into os1
from os in os1.DefaultIfEmpty()
where o.OrganizationTypeId == OrganizationTypes.Id && os != null
orderby o.OrganizationOrder
select new
{
organizationId = o.Id,
organizationName = os.Name
}).ToList();
return dataType;
}
public async Task<List<Account1ResultItem>> GetReport1Query(Guid ocId)
{
var ocIdList = _profileService.GetAllIdByRoot(ocId);