noti หนังสือเวียน

This commit is contained in:
Kittapath 2023-09-13 21:51:57 +07:00
parent 390eb7296b
commit d96ad94299
12 changed files with 16809 additions and 7 deletions

View file

@ -10,6 +10,8 @@ using DocumentFormat.OpenXml.Drawing;
using Telerik.Reporting;
using Telerik.Reporting.Processing;
using System.IO;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Report.Service.Requests;
namespace BMA.EHR.Report.Service.Controllers
{
@ -27,18 +29,24 @@ namespace BMA.EHR.Report.Service.Controllers
private readonly IConfiguration _configuration;
private readonly GenericReportGenerator _reportGenerator;
private readonly RetireReportRepository _repository;
private readonly MinIOService _documentService;
#endregion
#region " Constuctor and Destructor "
public DeceasedReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, GenericReportGenerator reportGenerator, RetireReportRepository repository)
public DeceasedReportController(IWebHostEnvironment hostingEnvironment,
IConfiguration configuration,
MinIOService documentService,
GenericReportGenerator reportGenerator,
RetireReportRepository repository)
{
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
_reportGenerator = reportGenerator;
_repository = repository;
_documentService = documentService;
}
#endregion
@ -98,6 +106,38 @@ namespace BMA.EHR.Report.Service.Controllers
throw;
}
}
/// <summary>
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
/// </summary>
/// <param name="id">id </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("attachment/36/{id}")]
public async Task<ActionResult<ResponseObject>> UploadDeceasedReportAsync([FromForm] FileRequest req, Guid id)
{
try
{
var data = await _repository.GetRetirementDeceasedAsync(id);
if (data == null)
return NotFound();
// check upload file
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
{
return Error(GlobalMessages.NoFileToUpload);
}
var file = Request.Form.Files[0];
var cover = await _documentService.UploadFileAsync(file);
await _repository.UploadFileRetirementDeceasedAsync(id, cover);
return Success();
}
catch
{
throw;
}
}
#endregion
#endregion