diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index 7a66f1fe..901f42cd 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -1,5 +1,6 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Commands;
+using BMA.EHR.Command.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Shared;
@@ -7,6 +8,7 @@ using BMA.EHR.Infrastructure.Persistence;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore.Infrastructure;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
@@ -203,6 +205,49 @@ namespace BMA.EHR.Command.Service.Controllers
}
}
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostAsync([FromBody] CreateCommandRequest req)
+ {
+ try
+ {
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo.ToString(),
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ PositionName = req.registerPosition,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ ExamRoundId = req.examRound,
+ ConclusionRegisterNo = req.conclusionRegisterNo,
+ ConclusionRegisterDate = req.conclusionRegisterDate,
+ ConclusionResultNo = req.conclusionResultNo,
+ ConclusionResultDate = req.conclusionResultDate
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// PM7-24 : dropdown รอบการสอบ หน้ารายละเอียดการออกคำสั่ง
///
diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs b/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs
new file mode 100644
index 00000000..336cd3c4
--- /dev/null
+++ b/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs
@@ -0,0 +1,31 @@
+namespace BMA.EHR.Command.Service.Requests
+{
+ public class CreateCommandRequest
+ {
+ public Guid orderTypeValue { get; set; }
+
+ public string orderTitle { get; set; }
+
+ public int orderNo { get; set; }
+
+ public int orderYear { get; set; }
+
+ public Guid orderBy { get; set; }
+
+ public string signatoryBy { get; set; }
+
+ public string signatoryPosition { get; set; }
+
+ public Guid examRound { get; set; }
+
+ public string registerPosition { get; set; }
+
+ public string conclusionRegisterNo { get; set; }
+
+ public DateTime conclusionRegisterDate { get; set; }
+
+ public string conclusionResultNo { get; set; }
+
+ public DateTime conclusionResultDate { get; set; }
+ }
+}
diff --git a/BMA.EHR.Command.Service/Requests/UpdateCommandRequest.cs b/BMA.EHR.Command.Service/Requests/UpdateCommandRequest.cs
new file mode 100644
index 00000000..855ac069
--- /dev/null
+++ b/BMA.EHR.Command.Service/Requests/UpdateCommandRequest.cs
@@ -0,0 +1,31 @@
+namespace BMA.EHR.Command.Service.Requests
+{
+ public class UpdateCommandRequest
+ {
+ public Guid orderTypeValue { get; set; }
+
+ public string orderTitle { get; set; }
+
+ public int orderNo { get; set; }
+
+ public int orderYear { get; set; }
+
+ public Guid orderBy { get; set; }
+
+ public string signatoryBy { get; set; }
+
+ public string signatoryPosition { get; set; }
+
+ public Guid examRound { get; set; }
+
+ public string registerPosition { get; set; }
+
+ public string conclusionRegisterNo { get; set; }
+
+ public DateTime conclusionRegisterDate { get; set; }
+
+ public string conclusionResultNo { get; set; }
+
+ public DateTime conclusionResultDate { get; set; }
+ }
+}