คำสั่ง38

This commit is contained in:
Kittapath 2024-06-28 17:38:58 +07:00
parent def2b8f7fe
commit d7677ac2a5
5 changed files with 391 additions and 43 deletions

View file

@ -1035,7 +1035,8 @@ namespace BMA.EHR.Report.Service.Controllers
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
};
var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId);
return new {
return new
{
CommandNo = command.CommandNo,
CommandYear = command.CommandYear,
IssuerOrganizationName = command.IssuerOrganizationName,
@ -5432,6 +5433,53 @@ namespace BMA.EHR.Report.Service.Controllers
}
#endregion
#region " C-PM-38 คำสั่งปรับโครงสร้าง "
/// <summary>
/// คำสั่ง C-PM-38 คำสั่งปรับโครงสร้าง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-38/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType38CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = "C-PM-38",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#endregion
}
}