เพิ่ม api สร้างคำสั่ง C-PM-18 ถึง C-PM-20
This commit is contained in:
parent
200e8eb5f6
commit
20ef0c5c09
7 changed files with 16216 additions and 2 deletions
|
|
@ -2085,6 +2085,315 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-18 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-18
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-18/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType18Async([FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
Fault = req.fault,
|
||||
GuiltyBasis = req.guiltyBasis,
|
||||
ConclusionFireNo = req.conclusionFireNo,
|
||||
ConclusionFireDate = req.conclusionFireDate,
|
||||
ConclusionFireResolution = req.conclusionFireResolution,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-18
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-18/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType18Async(Guid orderId, [FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.Fault = req.fault;
|
||||
order.GuiltyBasis = req.guiltyBasis;
|
||||
order.ConclusionFireNo = req.conclusionFireNo;
|
||||
order.ConclusionFireDate = req.conclusionFireDate;
|
||||
order.ConclusionFireResolution = req.conclusionFireResolution;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-19 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-19
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-19/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType19Async([FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
Fault = req.fault,
|
||||
GuiltyBasis = req.guiltyBasis,
|
||||
ConclusionFireNo = req.conclusionFireNo,
|
||||
ConclusionFireDate = req.conclusionFireDate,
|
||||
ConclusionFireResolution = req.conclusionFireResolution,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-19
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-19/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType19Async(Guid orderId, [FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.Fault = req.fault;
|
||||
order.GuiltyBasis = req.guiltyBasis;
|
||||
order.ConclusionFireNo = req.conclusionFireNo;
|
||||
order.ConclusionFireDate = req.conclusionFireDate;
|
||||
order.ConclusionFireResolution = req.conclusionFireResolution;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-20 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-20
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-20/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType20Async([FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
Fault = req.fault,
|
||||
GuiltyBasis = req.guiltyBasis,
|
||||
ConclusionFireNo = req.conclusionFireNo,
|
||||
ConclusionFireDate = req.conclusionFireDate,
|
||||
ConclusionFireResolution = req.conclusionFireResolution,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-20
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-20/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType20Async(Guid orderId, [FromBody] CreateCommandGroup11Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.Fault = req.fault;
|
||||
order.GuiltyBasis = req.guiltyBasis;
|
||||
order.ConclusionFireNo = req.conclusionFireNo;
|
||||
order.ConclusionFireDate = req.conclusionFireDate;
|
||||
order.ConclusionFireResolution = req.conclusionFireResolution;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue