diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 75b6f527..e77d2419 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -1295,6 +1295,794 @@ namespace BMA.EHR.Command.Service.Controllers #endregion + #region " C-PM-10 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-10 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-10/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType10Async([FromBody] CreateCommandGroup6Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + PlacementCommandIssuer = req.placementCommandIssuer, + PlacementCommandNo = req.placementCommandNo, + PlacementCommandDate = req.placementCommandDate, + PlacementPositionName = req.placementPositionName, + PlacementOrganizationName = req.placementOrganizationName, + ProbationStartDate = req.probationStartDate, + ProbationEndDate = req.probationEndDate, + ChairManFullName = req.chairManFullName, + Member1FullName = req.member1FullName, + Member2FullName = req.member2FullName, + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-10 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-10/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType10Async(Guid orderId, [FromBody] CreateCommandGroup6Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.PlacementCommandIssuer = req.placementCommandIssuer; + order.PlacementCommandNo = req.placementCommandNo; + order.PlacementCommandDate = req.placementCommandDate; + order.PlacementPositionName = req.placementPositionName; + order.PlacementOrganizationName = req.placementOrganizationName; + order.ProbationStartDate = req.probationStartDate; + order.ProbationEndDate = req.probationEndDate; + order.ChairManFullName = req.chairManFullName; + order.Member1FullName = req.member1FullName; + order.Member2FullName = req.member2FullName; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-11 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-11 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-11/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType11Async([FromBody] CreateCommandGroup7Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + PlacementCommandIssuer = req.placementCommandIssuer, + PlacementCommandNo = req.placementCommandNo, + PlacementCommandDate = req.placementCommandDate, + + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-11 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-11/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType11Async(Guid orderId, [FromBody] CreateCommandGroup7Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.PlacementCommandIssuer = req.placementCommandIssuer; + order.PlacementCommandNo = req.placementCommandNo; + order.PlacementCommandDate = req.placementCommandDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-12 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-12 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-12/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType12Async([FromBody] CreateCommandGroup7Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + PlacementCommandIssuer = req.placementCommandIssuer, + PlacementCommandNo = req.placementCommandNo, + PlacementCommandDate = req.placementCommandDate, + + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-12 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-12/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType12Async(Guid orderId, [FromBody] CreateCommandGroup7Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.PlacementCommandIssuer = req.placementCommandIssuer; + order.PlacementCommandNo = req.placementCommandNo; + order.PlacementCommandDate = req.placementCommandDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-13 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-13 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-13/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType13Async([FromBody] CreateCommandGroup8Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + ReceiveOrganizationName = req.receiveOrganizationName, + + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-13 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-13/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType13Async(Guid orderId, [FromBody] CreateCommandGroup8Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.ReceiveOrganizationName = req.receiveOrganizationName; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-14 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-14 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-14/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType14Async([FromBody] CreateCommandGroup9Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + TransferOrganizationName = req.transferOrganizationName, + ConclusionReceiveNo = req.conclusionReceiveNo, + ConclusionReceiveDate = req.conclusionReceiveDate, + + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-14 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-14/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType14Async(Guid orderId, [FromBody] CreateCommandGroup9Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.TransferOrganizationName = req.transferOrganizationName; + order.ConclusionReceiveNo = req.conclusionReceiveNo; + order.ConclusionReceiveDate = req.conclusionReceiveDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-15 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-15 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-15/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType15Async([FromBody] CreateCommandGroup0Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-15 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-15/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType15Async(Guid orderId, [FromBody] CreateCommandGroup0Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-16 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-16 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-16/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType16Async([FromBody] CreateCommandGroup10Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + + GovAidCommandNo = req.govAidCommandNo, + GovAidCommandDate = req.govAidCommandDate, + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-16 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-16/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType16Async(Guid orderId, [FromBody] CreateCommandGroup10Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + order.GovAidCommandNo = req.govAidCommandNo; + order.GovAidCommandDate = req.govAidCommandDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + + #region " C-PM-17 " + + /// + /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-17 + /// + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("c-pm-17/detail")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PostType17Async([FromBody] CreateCommandGroup0Request req) + { + try + { + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + + var inserted = new Domain.Models.Commands.Core.Command + { + CommandNo = req.orderNo, + CommandYear = req.orderYear.ToString(), + CommandSubject = req.orderTitle, + CommandTypeId = req.orderTypeValue, + IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, + AuthorizedUserFullName = req.signatoryBy, + AuthorizedPosition = req.signatoryPosition, + + CommandAffectDate = req.orderDate, + OwnerGovId = OcId, + }; + + var result = await _repository.AddAsync(inserted); + + return Success(result); + } + catch + { + throw; + } + } + + /// + /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-17 + /// + /// Record Id ของคำสั่ง + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("c-pm-17/detail/{orderId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> PutType17Async(Guid orderId, [FromBody] CreateCommandGroup0Request req) + { + try + { + var order = await _repository.GetByIdAsync(orderId); + if (order == null) + throw new Exception(GlobalMessages.CommandNotFound); + + + var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue); + var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId); + + order.CommandNo = req.orderNo; + order.CommandYear = req.orderYear.ToString(); + order.CommandSubject = req.orderTitle; + order.CommandType = commandType!; + order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; + order.AuthorizedUserFullName = req.signatoryBy; + order.AuthorizedPosition = req.signatoryPosition; + order.CommandStatus = status!; + order.CommandAffectDate = req.orderDate; + + var result = await _repository.UpdateAsync(order); + + return Success(result); + } + catch + { + throw; + } + } + + #endregion + #endregion /// diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup0Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup0Request.cs new file mode 100644 index 00000000..17b9817b --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup0Request.cs @@ -0,0 +1,23 @@ +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup0Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup10Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup10Request.cs new file mode 100644 index 00000000..91df5ac8 --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup10Request.cs @@ -0,0 +1,27 @@ +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup10Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + + public string govAidCommandNo { get; set; } + + public DateTime govAidCommandDate { get; set; } + } +} diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup6Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup6Request.cs new file mode 100644 index 00000000..084a1818 --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup6Request.cs @@ -0,0 +1,43 @@ +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup6Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + + public string placementCommandIssuer { get; set; } + + public string placementCommandNo { get; set; } + + public DateTime placementCommandDate { get; set; } + + public string placementPositionName { get; set; } + + public string placementOrganizationName { get; set; } + + public DateTime probationStartDate { get; set; } + + public DateTime probationEndDate { get; set; } + + public string chairManFullName { get; set; } + + public string member1FullName { get; set; } + + public string member2FullName { get; set; } + } +} diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup7Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup7Request.cs new file mode 100644 index 00000000..c6bcb8b5 --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup7Request.cs @@ -0,0 +1,29 @@ +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup7Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + + public string placementCommandIssuer { get; set; } + + public string placementCommandNo { get; set; } + + public DateTime placementCommandDate { get; set; } + } +} diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup8Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup8Request.cs new file mode 100644 index 00000000..88e8c5de --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup8Request.cs @@ -0,0 +1,25 @@ +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup8Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + + public string receiveOrganizationName { get; set; } + } +} diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup9Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup9Request.cs new file mode 100644 index 00000000..52889232 --- /dev/null +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup9Request.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Command.Service.Requests +{ + public class CreateCommandGroup9Request + { + public Guid orderTypeValue { get; set; } + + public string orderTitle { get; set; } = string.Empty; + + public string orderNo { get; set; } = string.Empty; + + public int orderYear { get; set; } + + public DateTime orderDate { get; set; } + + public Guid orderBy { get; set; } + + public string orderByOrganizationName { get; set; } = string.Empty; + + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; + + public string transferOrganizationName { get; set; } + + public string? conclusionReceiveNo { get; set; } + + public DateTime? conclusionReceiveDate { get; set; } + } +} diff --git a/BMA.EHR.Domain/Models/Commands/Core/Command.cs b/BMA.EHR.Domain/Models/Commands/Core/Command.cs index 0f991980..173e77b1 100644 --- a/BMA.EHR.Domain/Models/Commands/Core/Command.cs +++ b/BMA.EHR.Domain/Models/Commands/Core/Command.cs @@ -103,6 +103,72 @@ namespace BMA.EHR.Domain.Models.Commands.Core #endregion + #region " C-PM-10,C-PM-11,C-PM-12 " + + [Comment("หน่วยงานที่ออกคำสั่งบรรจุ")] + public string? PlacementCommandIssuer { get; set; } + + [Comment("เลขที่คำสั่งบรรจุ")] + public string? PlacementCommandNo { get; set; } + + [Comment("คำสั่งบรรจุลงวันที่")] + public DateTime? PlacementCommandDate { get; set; } + + #endregion + + #region " C-PM-10 " + + [Comment("ตำแหน่งที่บรรจุ")] + public string? PlacementPositionName { get; set; } + + [Comment("สังกัดที่บรรจุ")] + public string? PlacementOrganizationName { get; set; } + + [Comment("วันที่เริ่มทดลองปฏิบัติราชการ")] + public DateTime? ProbationStartDate { get; set; } + + [Comment("วันที่สิ้นสุดการทดลองปฏิบัติราชการ")] + public DateTime? ProbationEndDate { get; set; } + + [Comment("ประธานคณะกรรมการ")] + public string? ChairManFullName { get; set; } + + [Comment("กรรมการคนที่ 1")] + public string? Member1FullName { get; set; } + + [Comment("กรรมการคนที่ 2")] + public string? Member2FullName { get; set; } + + #endregion + + #region " C-PM-13 " + + [Comment("ส่วนราชการที่รับโอน")] + public string? ReceiveOrganizationName { get; set; } + + #endregion + + #region " C-PM-14 " + + [Comment("ส่วนราชการที่ให้โอน")] + public string? TransferOrganizationName { get; set; } + + [Comment("มติ กก. ครั้งที่ (การรับโอน)")] + public string? ConclusionReceiveNo { get; set; } + + [Comment("ลงวันที่ (การรับโอน)")] + public DateTime? ConclusionReceiveDate { get; set; } + + #endregion + + #region " C-PM-16 " + + public string? GovAidCommandNo { get; set; } + + public DateTime? GovAidCommandDate { get; set; } + + #endregion + public virtual List Documents { get; set; } = new(); public virtual List Receivers { get; set; } diff --git a/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp b/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp index 07383996..bc4f20d5 100644 Binary files a/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp and b/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp differ