no message
This commit is contained in:
parent
569f0f7fd9
commit
2f3a68254e
1 changed files with 68 additions and 0 deletions
|
|
@ -8672,6 +8672,74 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// เอกสารแนบท้าย C-PM-40
|
||||||
|
/// </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>
|
||||||
|
[HttpPost("command40/report/attachment")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand40Attachment([FromBody] ReportPersonRequest req_)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var raw_data = await _context.Set<CommandReceiver>()
|
||||||
|
.Include(c => c.Command)
|
||||||
|
.Where(c => req_.refIds.Contains(c.Id.ToString()))
|
||||||
|
.ToListAsync();
|
||||||
|
if (raw_data == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
var data = new List<CommandType40Response>();
|
||||||
|
var no = 1;
|
||||||
|
foreach (var d in raw_data)
|
||||||
|
{
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/pos/act/{d.RefDisciplineId}/{d.RefPlacementProfileId}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
continue;
|
||||||
|
var receiver = new CommandType40Response
|
||||||
|
{
|
||||||
|
no = no.ToString().ToThaiNumber(),
|
||||||
|
fullName = $"{org.result.prefix}{org.result.firstName} {org.result.lastName}",
|
||||||
|
organization = org.result.organization,
|
||||||
|
position = org.result.position,
|
||||||
|
postype = org.result.postype,
|
||||||
|
poslevel = org.result.poslevel,
|
||||||
|
organizationNew = org.result.organizationNew,
|
||||||
|
dateStart = d.Command.ActStartDate == null ? "-" : d.Command.ActStartDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
dateEnd = d.Command.ActEndDate == null ? "-" : d.Command.ActEndDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
|
order = org.result.order,
|
||||||
|
};
|
||||||
|
no = no + 1;
|
||||||
|
|
||||||
|
data.Add(receiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ออกคำสั่ง C-PM-40
|
/// ออกคำสั่ง C-PM-40
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue