api ค้นหาผู้เกี่ยวข้องคำสั่ง
This commit is contained in:
parent
e7c71b2e15
commit
fa8dfc51e4
4 changed files with 68 additions and 3 deletions
|
|
@ -1465,7 +1465,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await ExecuteCommand12Async(command);
|
||||
break;
|
||||
case "C-PM-17":
|
||||
await ExecuteCommand17Async(command);
|
||||
await ExecuteCommand17Async(command);
|
||||
break;
|
||||
case "C-PM-18":
|
||||
await ExecuteCommand18Async(command);
|
||||
|
|
@ -2030,7 +2030,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<Profile>()
|
||||
var data = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
|
@ -3737,6 +3737,34 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#endregion
|
||||
|
||||
public async Task<dynamic> GetCommandProfileAsync(Guid commandTypeId, int year, string? posno)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.FirstOrDefaultAsync(x => x.Id == commandTypeId);
|
||||
|
||||
if (commandType == null)
|
||||
throw new Exception(GlobalMessages.CommandTypeNotFound);
|
||||
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Where(x => x.CitizenId == "0000000000001")
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
CitizenId = x.CitizenId,
|
||||
FullName = $"{x.Prefix.Name}{x.FirstName} {x.LastName}",
|
||||
PosNo = x.PosNo == null ? null : x.PosNo.Name,
|
||||
Position = x.Position == null ? null : x.Position.Name,
|
||||
})
|
||||
.ToListAsync();
|
||||
return profile;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.Application.Requests.Commands
|
||||
{
|
||||
public class SearchProfileCommandRequest
|
||||
{
|
||||
public Guid CommandTypeId { get; set; }
|
||||
|
||||
public int Year { get; set; }
|
||||
|
||||
public string? Posno { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3424,6 +3424,31 @@ 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>
|
||||
[HttpPost("search/profile/command")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandProfileAsync([FromBody] SearchProfileCommandRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _repository.GetCommandProfileAsync(req.CommandTypeId, req.Year, req.Posno);
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
#region " Command "
|
||||
|
||||
public static readonly string CommandNotFound = "ไม่พบรายการคำสั่งนี้ในระบบ โปรดตรวจความถูกต้อง";
|
||||
public static readonly string CommandTypeNotFound = "ไม่พบรายการประเภทคำสั่งนี้ในระบบ โปรดตรวจความถูกต้อง";
|
||||
|
||||
public static readonly string MethodForCommandTypeNotImplement = "Method for this command type not implement!";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue