ต้นแบบการทำรายงาน

This commit is contained in:
Suphonchai Phoonsawat 2023-08-17 10:46:30 +07:00
parent 3332af583b
commit 3c11d1b5a1
6 changed files with 83 additions and 5 deletions

View file

@ -22,6 +22,7 @@ namespace BMA.EHR.Application
services.AddTransient<OrganizationCommonRepository>();
services.AddTransient<InboxRepository>();
services.AddTransient<NotificationRepository>();
services.AddTransient<RetirementRepository>();
return services;
}

View file

@ -0,0 +1,63 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Retirement;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMA.EHR.Application.Repositories.Reports
{
public class RetireReportRepository
{
#region " Fields "
private readonly IApplicationDBContext _dbContext;
#endregion
#region " Constructor and Destructor "
public RetireReportRepository(IApplicationDBContext dbContext)
{
_dbContext = dbContext;
}
#endregion
#region " Methods "
public async Task<List<RetirementPeriod>> GetListRetirePeriodAsync()
{
try
{
// 1. query
var data = await _dbContext.Set<RetirementPeriod>()
.Include(x => x.RetirementPeriodHistorys)
.Include(x => x.RetirementProfiles)
.ThenInclude(x => x.Profile)
.ToListAsync();
// 2. data not found throw exception
// 3. Load Report File
return data;
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -40,10 +40,6 @@
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
<ItemGroup>
<None Include=".github\workflows\build-local.yaml" />
<None Include=".github\workflows\release.yaml" />

View file

@ -0,0 +1,18 @@
using BMA.EHR.Domain.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Report.Service.Controllers
{
[Route("api/v{version:apiVersion}/report/retire")]
[ApiVersion("2.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("API รายงานระบบเกษียณ")]
public class RetireReportController : BaseController
{
}
}

View file

@ -14,7 +14,7 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",