api ประวัติการออกคำสั่ง
This commit is contained in:
parent
a61bc8fc77
commit
528ebda465
3 changed files with 56 additions and 0 deletions
|
|
@ -8683,5 +8683,26 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public async Task<dynamic> GetHistoryCommandByProfileAsync(string type, Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _dbContext.Set<Command>()
|
||||||
|
.Where(x => x.CommandType.Category == type.Trim().ToLower())
|
||||||
|
.Where(x => x.Receivers.Where(x => x.RefPlacementProfileId == id).FirstOrDefault() != null)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
CommandSubject = x.CommandSubject,
|
||||||
|
CreatedAt = x.CreatedAt,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4698,6 +4698,33 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// แสดงประวัติการออกคำสั่ง
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">ประเภทระบบคำสั่ง</param>
|
||||||
|
/// <param name="profileId">Id ผู้ใช้งาน</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("history/{type}/{profileId}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetHistoryCommandByProfileAsync(string type, Guid profileId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _repository.GetHistoryCommandByProfileAsync(type, profileId);
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,10 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromBody] DisciplineDirectorRequest req)
|
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromBody] DisciplineDirectorRequest req)
|
||||||
{
|
{
|
||||||
|
var dataDup = await _context.DisciplineDirectors.Where(x => x.FirstName == req.firstName && x.LastName == req.lastName).FirstOrDefaultAsync();
|
||||||
|
if (dataDup != null)
|
||||||
|
return Error("ชื่อกรรมการนี้มีอยู่ในระบบแล้ว", StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
var disciplineDirector = new Domain.Models.Discipline.DisciplineDirector
|
var disciplineDirector = new Domain.Models.Discipline.DisciplineDirector
|
||||||
{
|
{
|
||||||
Prefix = req.prefix,
|
Prefix = req.prefix,
|
||||||
|
|
@ -155,6 +159,10 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
||||||
[HttpPut("{id:guid}")]
|
[HttpPut("{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromBody] DisciplineDirectorRequest req)
|
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromBody] DisciplineDirectorRequest req)
|
||||||
{
|
{
|
||||||
|
var dataDup = await _context.DisciplineDirectors.Where(x => x.FirstName == req.firstName && x.LastName == req.lastName && x.Id != id).FirstOrDefaultAsync();
|
||||||
|
if (dataDup != null)
|
||||||
|
return Error("ชื่อกรรมการนี้มีอยู่ในระบบแล้ว", StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
var data = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
var data = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue