เพิ่ม API
This commit is contained in:
parent
5c5c85a120
commit
c649861bd6
2 changed files with 61 additions and 1 deletions
|
|
@ -1240,7 +1240,16 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
var rootOcId = await GetRootOcIdAsync(UserOrganizationId);
|
||||
|
||||
var oc = await _dbContext.Set<OrganizationEntity>().FirstOrDefaultAsync(x => x.Id == rootOcId);
|
||||
var oc = await _dbContext.Set<OrganizationEntity>()
|
||||
.Include(x => x.OrganizationOrganization)
|
||||
.Select(x => new KeyValueItemResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.OrganizationOrganization!.Name
|
||||
})
|
||||
.FirstOrDefaultAsync(x => x.Id == rootOcId);
|
||||
if (oc != null)
|
||||
ret.Add(oc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1145,6 +1145,57 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แสดงรายชื่อหน่วยงานสำหรับเลือกเพื่อออกคำสั่ง
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("organizations")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandOrganizationAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _repository.GetCommandOrgAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แสดงชื่อผู้อนุมัติในรายการคำสั่ง
|
||||
/// </summary>
|
||||
/// <param name="ocId">Id ของหน่วยงานที่เลือกเพื่อออกคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("approver/{ocId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandOrganizationApproverAsync(Guid ocId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _repository.GetOrgApproverAsync(ocId);
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue