Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2023-12-22 15:54:20 +07:00
commit b603c9331d
21 changed files with 24913 additions and 84 deletions

View file

@ -67,21 +67,21 @@ jobs:
docker-compose pull
docker-compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
# - uses: snow-actions/line-notify@v1.1.0
# if: success()
# with:
# access_token: ${{ env.TOKEN_LINE }}
# message: |
# -Success✅✅✅
# Image: ${{env.IMAGE_NAME}}
# Version: ${{ github.event.inputs.IMAGE_VER }}
# By: ${{secrets.DOCKER_USER}}
# - uses: snow-actions/line-notify@v1.1.0
# if: failure()
# with:
# access_token: ${{ env.TOKEN_LINE }}
# message: |
# -Failure❌❌❌
# Image: ${{env.IMAGE_NAME}}
# Version: ${{ github.event.inputs.IMAGE_VER }}
# By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
if: success()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
if: failure()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}

View file

@ -158,6 +158,30 @@ namespace BMA.EHR.Application.Repositories.Commands
case "C-PM-24":
result = await GetReceiver24Async(command);
break;
case "C-PM-25":
result = await GetReceiver25Async(command, token);
break;
case "C-PM-26":
result = await GetReceiver26Async(command, token);
break;
case "C-PM-27":
result = await GetReceiver27Async(command, token);
break;
case "C-PM-28":
result = await GetReceiver28Async(command, token);
break;
case "C-PM-29":
result = await GetReceiver29Async(command, token);
break;
case "C-PM-30":
result = await GetReceiver30Async(command, token);
break;
case "C-PM-31":
result = await GetReceiver31Async(command, token);
break;
case "C-PM-32":
result = await GetReceiver32Async(command, token);
break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}
@ -1659,6 +1683,497 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
/// <summary>
/// C-PM-25
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver25Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/stop";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-26
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver26Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/stop";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-27
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver27Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-28
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver28Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-29
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver29Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/up";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-30
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver30Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/down";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-31
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver31Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/down";
var commandType = await _dbContext.Set<CommandType>()
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25")
.FirstOrDefaultAsync();
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
if (commandType == null || commandType.Id != d.CommandId)
continue;
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
/// <summary>
/// C-PM-32
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
private async Task<List<CommandReceiver>> GetReceiver32Async(Command command, string token)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/discipline/result/report/reject";
var response = new PassDisciplineResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassDisciplineResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var pf = await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == d.id);
if (pf != null)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = pf.CitizenId!,
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id,
};
seq++;
resultData.Add(receiver);
}
}
}
return resultData;
}
catch
{
throw;
}
}
#endregion
#region " Execute and Deploy "
@ -1737,6 +2252,30 @@ namespace BMA.EHR.Application.Repositories.Commands
case "C-PM-24":
await ExecuteCommand24Async(command);
break;
// case "C-PM-25":
// await ExecuteCommand25Async(command);
// break;
// case "C-PM-26":
// await ExecuteCommand26Async(command);
// break;
// case "C-PM-27":
// await ExecuteCommand27Async(command);
// break;
// case "C-PM-28":
// await ExecuteCommand28Async(command);
// break;
// case "C-PM-29":
// await ExecuteCommand29Async(command);
// break;
// case "C-PM-30":
// await ExecuteCommand30Async(command);
// break;
// case "C-PM-31":
// await ExecuteCommand31Async(command);
// break;
// case "C-PM-32":
// await ExecuteCommand32Async(command);
// break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}

View file

@ -0,0 +1,16 @@
namespace BMA.EHR.Application.Responses
{
public class PassDisciplineResponse
{
// public bool successful { get; set; }
public List<DisciplineDataResponse> result { get; set; } = new();
}
public class DisciplineDataResponse
{
public Guid id { get; set; } = Guid.Empty;
public Guid? CommandId { get; set; } = Guid.Empty;
}
}

View file

@ -290,6 +290,14 @@ namespace BMA.EHR.Command.Service.Controllers
return Success(new { result = "N" });
}
case "C-PM-24":
case "C-PM-25":
case "C-PM-26":
case "C-PM-27":
case "C-PM-28":
case "C-PM-29":
case "C-PM-30":
case "C-PM-31":
case "C-PM-32":
default:
{
if (command.CommandNo != "" &&
@ -2936,6 +2944,798 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
#region " C-PM-25 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-25
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-25/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType25Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-25
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-25/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType25Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-26 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-26
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-26/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType26Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-26
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-26/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType26Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-27 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-27
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-27/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType27Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-27
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-27/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType27Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-28 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-28
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-28/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType28Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-28
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-28/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType28Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-29 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-29
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-29/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType29Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-29
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-29/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType29Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-30 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-30
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-30/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType30Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-30
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-30/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType30Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-31 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-31
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-31/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType31Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-31
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-31/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType31Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-32 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-32
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-32/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType32Async([FromBody] CreateCommandGroup13Request 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,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-32
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-32/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType32Async(Guid orderId, [FromBody] CreateCommandGroup13Request 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.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#endregion
/// <summary>

View file

@ -0,0 +1,19 @@
namespace BMA.EHR.Command.Service.Requests
{
public class CreateCommandGroup13Request
{
public string caseFault { get; set; }
public string faultLevel { get; set; }
public string refRaw { get; set; }
public string result { get; set; }
public Guid orderBy { get; set; }
public string orderByOrganizationName { get; set; } = string.Empty;
public DateTime orderDate { get; set; }
public string orderTitle { get; set; } = string.Empty;
public string orderNo { get; set; } = string.Empty;
public Guid orderTypeValue { get; set; }
public int orderYear { get; set; }
public string signatoryBy { get; set; } = string.Empty;
public string signatoryPosition { get; set; } = string.Empty;
}
}

View file

@ -180,7 +180,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
}
/// <summary>
/// สร้างรายการยื่นอุทธรณ์/ร้องทุกข์ (USER/ADMIN)
/// สร้างรายการยื่นอุทธรณ์/ร้องทุกข์ (USER)
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
@ -262,6 +262,89 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
return Success(disciplineComplaint_Appeal.Id);
}
/// <summary>
/// สร้างรายการยื่นอุทธรณ์/ร้องทุกข์ (ADMIN)
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("admin")]
public async Task<ActionResult<ResponseObject>> CreateDisciplineAdmin([FromForm] DisciplineComplaint_AppealRequest req)
{
var disciplineComplaint_Appeal = new Domain.Models.Discipline.DisciplineComplaint_Appeal
{
Title = req.Title,
Description = req.Description,
Status = "NEW",
Type = req.Type.Trim().ToUpper(),
Year = req.Year == null ? DateTime.Now.Year : req.Year,
CaseType = req.CaseType,
CaseNumber = req.CaseNumber,
Fullname = req.Fullname,
CitizenId = req.CitizenId,
ProfileId = req.ProfileId,
Position = req.Position,
Oc = req.Oc,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
{
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
Status = "NEW",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
// await _context.DisciplineComplaint_Appeals.AddAsync(disciplineComplaint_Appeal);
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
await _context.SaveChangesAsync();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
foreach (var file in Request.Form.Files)
{
var fileExtension = Path.GetExtension(file.FileName);
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null)
{
var disciplineComplaint_Appeal_Doc = new DisciplineComplaint_Appeal_Doc
{
DisciplineComplaint_Appeal = disciplineComplaint_Appeal,
Document = _doc,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.DisciplineComplaint_Appeal_Docs.AddAsync(disciplineComplaint_Appeal_Doc);
}
}
}
await _repositoryNoti.PushNotificationAsync(
req.ProfileId,
$"เจ้าหน้าที่ได้ทำการสร้างคำร้องอุทธรณ์ร้องทุกข์ให้คุณ",
$"เจ้าหน้าที่ได้ทำการสร้างคำร้องอุทธรณ์ร้องทุกข์ให้คุณ",
"",
true,
true
);
await _context.SaveChangesAsync();
return Success(disciplineComplaint_Appeal.Id);
}
/// <summary>
/// อัพไฟล์เอกสารอุทธรณ์/ร้องทุกข์
/// </summary>

View file

@ -459,6 +459,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
IsSuspend = p.IsSuspend,
Status = p.Status,
StatusDiscard = p.StatusDiscard,
Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
@ -680,7 +681,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PosNo = item.posNo,
Status = isReport == null ? "NEW" : isReport.Status,
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
IsReport = isReport == null ? false : isReport.IsReport,
IsReport = isReport == null ? "NEW" : isReport.IsReport,
IsSuspend = isReport == null ? "NEW" : isReport.IsSuspend,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -1480,29 +1482,29 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "NEW").FirstOrDefault();
if (personIdDupicate == null)
continue;
if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
continue;
personIdDupicate.DisciplineReport_Profiles.Add(
new DisciplineReport_Profile
{
PersonId = item.PersonId,
CitizenId = item.CitizenId,
Prefix = item.Prefix,
FirstName = item.FirstName,
LastName = item.LastName,
Organization = item.Organization,
Salary = item.Salary,
PosNo = item.PosNo,
Position = item.Position,
PositionLevel = item.PositionLevel,
Status = "PENDING",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
// if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
// continue;
// personIdDupicate.DisciplineReport_Profiles.Add(
// new DisciplineReport_Profile
// {
// PersonId = item.PersonId,
// CitizenId = item.CitizenId,
// Prefix = item.Prefix,
// FirstName = item.FirstName,
// LastName = item.LastName,
// Organization = item.Organization,
// Salary = item.Salary,
// PosNo = item.PosNo,
// Position = item.Position,
// PositionLevel = item.PositionLevel,
// Status = "PENDING",
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
item.CommandTypeId = commandTypeId;
item.Status = "REPORT";
item.LastUpdateFullName = FullName ?? "System Administrator";
@ -1537,6 +1539,65 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
foreach (var item in persons)
{
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "REPORT" && x.StatusDiscard == "NEW").FirstOrDefault();
if (personIdDupicate == null)
continue;
// if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
// continue;
// personIdDupicate.DisciplineReport_Profiles.Add(
// new DisciplineReport_Profile
// {
// PersonId = item.PersonId,
// CitizenId = item.CitizenId,
// Prefix = item.Prefix,
// FirstName = item.FirstName,
// LastName = item.LastName,
// Organization = item.Organization,
// Salary = item.Salary,
// PosNo = item.PosNo,
// Position = item.Position,
// PositionLevel = item.PositionLevel,
// Status = "PENDING",
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
item.CommandTypeDiscardId = commandTypeId;
item.StatusDiscard = "REPORT";
item.LastUpdateFullName = FullName ?? "System Administrator";
item.LastUpdateUserId = UserId ?? "";
item.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// สั่งรายชื่อไปพักราชการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("suspend/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToSuspendGovernment([FromBody] DisciplinePersonIdRequest req, Guid id)
{
var data = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
.ThenInclude(x => x.DisciplineReport_Profiles)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
var persons = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => req.persons.Contains(x.Id)).ToList();
foreach (var item in persons)
{
var personIdDupicate = data.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.PersonId == item.PersonId && x.Status == "NEW").FirstOrDefault();
if (personIdDupicate == null)
continue;
if (personIdDupicate.DisciplineReport_Profiles.Count() > 0)
@ -1562,8 +1623,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
item.CommandTypeDiscardId = commandTypeId;
item.StatusDiscard = "REPORT";
item.IsSuspend = "REPORT";
item.LastUpdateFullName = FullName ?? "System Administrator";
item.LastUpdateUserId = UserId ?? "";
item.LastUpdatedAt = DateTime.Now;
@ -1620,7 +1680,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = true;
uppdated.IsReport = "REPORT";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
@ -1629,5 +1689,33 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// ระบุหน้าที่กรรมการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("director/{disciplineId:guid}/{id:guid}")]
public async Task<ActionResult<ResponseObject>> AddDutyDisciplineDisciplinary([FromBody] DisciplineDutyRequest req, Guid disciplineId, Guid id)
{
var data = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
.Where(x => x.Id == disciplineId)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
var director = data.DisciplineDisciplinary_DirectorInvestigates.FirstOrDefault(x => x.Id == id);
if (director == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
director.Duty = req.duty;
director.LastUpdateFullName = FullName ?? "System Administrator";
director.LastUpdateUserId = UserId ?? "";
director.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -448,7 +448,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Salary = item.salary,
PersonId = item.personId,
PosNo = item.posNo,
IsReport = isReport == null ? false : isReport.IsReport,
IsReport = isReport == null ? "NEW" : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -572,7 +572,8 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
PositionLevel = item.PositionLevel,
Status = "NEW",
StatusDiscard = "NEW",
IsReport = false,
IsReport = "NEW",
IsSuspend = "NEW",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -970,7 +971,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = true;
uppdated.IsReport = "REPORT";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
@ -979,5 +980,33 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// ระบุหน้าที่กรรมการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("director/{disciplineId:guid}/{id:guid}")]
public async Task<ActionResult<ResponseObject>> AddDutyDisciplineInvestigate([FromBody] DisciplineDutyRequest req, Guid disciplineId, Guid id)
{
var data = await _context.DisciplineInvestigates
.Include(x => x.DisciplineInvestigate_Directors)
.Where(x => x.Id == disciplineId)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
var director = data.DisciplineInvestigate_Directors.FirstOrDefault(x => x.Id == id);
if (director == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
director.Duty = req.duty;
director.LastUpdateFullName = FullName ?? "System Administrator";
director.LastUpdateUserId = UserId ?? "";
director.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -2,6 +2,7 @@
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@ -98,7 +99,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW").Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -186,34 +187,34 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Success(data.Id);
}
/// <summary>
/// สั่งรายชื่อไปออกคำสั่งให้ออกจากราชการไว้ก่อน
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req, Guid commandTypeId)
{
foreach (var item in req.Id)
{
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// /// <summary>
// /// สั่งรายชื่อไปออกคำสั่งให้ออกจากราชการไว้ก่อน
// /// </summary>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpPut("report/{commandTypeId:length(36)}")]
// public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req, Guid commandTypeId)
// {
// foreach (var item in req.Id)
// {
// var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
// .FirstOrDefaultAsync(x => x.Id == item);
// if (uppdated == null)
// continue;
uppdated.CommandTypeId = commandTypeId;
uppdated.Status = "REPORT";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
}
// uppdated.CommandTypeId = commandTypeId;
// uppdated.Status = "REPORT";
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
// uppdated.LastUpdateUserId = UserId ?? "";
// uppdated.LastUpdatedAt = DateTime.Now;
// }
await _context.SaveChangesAsync();
return Success();
}
// await _context.SaveChangesAsync();
// return Success();
// }
/// <summary>
/// อัพไฟล์เอกสารสืบสวนวินัย
@ -297,5 +298,105 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
}
}
/// <summary>
/// รายชื่อออกคำสั่งลงโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/up")]
public async Task<ActionResult<ResponseObject>> GetPersonReportUp()
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.Status == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeId,
})
.ToListAsync();
return Success(data);
}
/// <summary>
/// รายชื่อออกคำสั่งงด/ลดโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/down")]
public async Task<ActionResult<ResponseObject>> GetPersonReportDown()
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.StatusDiscard == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeDiscardId,
})
.ToListAsync();
return Success(data);
}
/// <summary>
/// รายชื่อออกคำสั่งยุติ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/reject")]
public async Task<ActionResult<ResponseObject>> GetPersonReportReject()
{
var data1 = await _context.DisciplineInvestigate_ProfileComplaints
.Where(x => x.IsReport == "REPORT")
.Select(x => new
{
Id = x.PersonId,
})
.ToListAsync();
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.IsReport == "REPORT")
.Select(x => new
{
Id = x.PersonId,
})
.ToListAsync();
foreach (var data in data1)
{
data2.Add(data);
};
return Success(data2);
}
/// <summary>
/// รายชื่อออกคำสั่งพักราชการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/stop")]
public async Task<ActionResult<ResponseObject>> GetPersonReportStop()
{
var data = await _context.DisciplineReport_Profiles
.Where(x => x.Status == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeId,
})
.ToListAsync();
return Success(data);
}
}
}

View file

@ -0,0 +1,9 @@
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineDutyRequest
{
public string duty { get; set; }//
}
}

View file

@ -200,6 +200,22 @@ namespace BMA.EHR.Domain.Models.Commands.Core
#endregion
#region " C-PM-25 - C-PM-32 "
[Comment("ระดับความผิด")]
public string? FaultLevel { get; set; }
[Comment("กรณีความผิด")]
public string? CaseFault { get; set; }
[Comment("ผลดำเนินการพิจารณา")]
public string? Result { get; set; }
[Comment("อ้างอิงมาตราตามกฏหมาย")]
public string? RefRaw { get; set; }
#endregion
public virtual List<CommandDocument> Documents { get; set; } = new();
public virtual List<CommandReceiver> Receivers { get; set; }

View file

@ -30,15 +30,17 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("เงินเดือน")]
public double? Salary { get; set; }
[Comment("สถานะออกคำสั่ง")]
public string? Status { get; set; }
public string? Status { get; set; } = "NEW";
[Comment("ประเภทออกคำสั่ง")]
public Guid? CommandTypeId { get; set; }
[Comment("สถานะออกคำสั่งงดโทด")]
public string? StatusDiscard { get; set; }
public string? StatusDiscard { get; set; } = "NEW";
[Comment("ประเภทออกคำสั่งงดโทด")]
public Guid? CommandTypeDiscardId { get; set; }
[Comment("ส่งไปยุติเรื่อง")]
public bool IsReport { get; set; } = false;
public string? IsReport { get; set; } = "NEW";
[Comment("ส่งไปพักราชการ")]
public string? IsSuspend { get; set; } = "NEW";
[Required, Comment("Id เรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
public virtual List<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; } = new List<DisciplineReport_Profile>();

View file

@ -30,7 +30,7 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("เงินเดือน")]
public double? Salary { get; set; }
[Comment("ส่งไปยุติเรื่อง")]
public bool IsReport { get; set; } = false;
public string? IsReport { get; set; } = "NEW";
[Required, Comment("Id เรื่องสืบสวน")]
public DisciplineInvestigate DisciplineInvestigate { get; set; }
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updateCommandaddFaultLevel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CaseFault",
table: "Commands",
type: "longtext",
nullable: true,
comment: "กรณีความผิด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FaultLevel",
table: "Commands",
type: "longtext",
nullable: true,
comment: "ระดับความผิด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "RefRaw",
table: "Commands",
type: "longtext",
nullable: true,
comment: "อ้างอิงมาตราตามกฏหมาย")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Result",
table: "Commands",
type: "longtext",
nullable: true,
comment: "ผลดำเนินการพิจารณา")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CaseFault",
table: "Commands");
migrationBuilder.DropColumn(
name: "FaultLevel",
table: "Commands");
migrationBuilder.DropColumn(
name: "RefRaw",
table: "Commands");
migrationBuilder.DropColumn(
name: "Result",
table: "Commands");
}
}
}

View file

@ -42,6 +42,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
b.Property<string>("CaseFault")
.HasColumnType("longtext")
.HasComment("กรณีความผิด");
b.Property<string>("ChairManFullName")
.HasColumnType("longtext")
.HasComment("ประธานคณะกรรมการ");
@ -163,6 +167,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("รายละเอียดการกระทำผิด");
b.Property<string>("FaultLevel")
.HasColumnType("longtext")
.HasComment("ระดับความผิด");
b.Property<DateTime?>("GovAidCommandDate")
.HasColumnType("datetime(6)")
.HasComment("ลงวันที่ (คำสั่งช่วยราชการ)");
@ -263,6 +271,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ส่วนราชการที่รับโอน");
b.Property<string>("RefRaw")
.HasColumnType("longtext")
.HasComment("อ้างอิงมาตราตามกฏหมาย");
b.Property<string>("Result")
.HasColumnType("longtext")
.HasComment("ผลดำเนินการพิจารณา");
b.Property<string>("SourceOrganizationName")
.HasColumnType("longtext")
.HasComment("หน่วยงานต้นสังกัด ก่อนรับราชการทหาร");

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetableDisciplineDisciplinarysaddIsSuspend : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsSuspend",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปพักราชการ");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsSuspend",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates");
}
}
}

View file

@ -0,0 +1,90 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetableDisciplineDisciplinarysaddIsSuspend1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "IsReport",
table: "DisciplineInvestigate_ProfileComplaints",
type: "longtext",
nullable: true,
comment: "ส่งไปยุติเรื่อง",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ส่งไปยุติเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "IsSuspend",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "longtext",
nullable: true,
comment: "ส่งไปพักราชการ",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ส่งไปพักราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "IsReport",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "longtext",
nullable: true,
comment: "ส่งไปยุติเรื่อง",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ส่งไปยุติเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<bool>(
name: "IsReport",
table: "DisciplineInvestigate_ProfileComplaints",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปยุติเรื่อง",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ส่งไปยุติเรื่อง")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "IsSuspend",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปพักราชการ",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ส่งไปพักราชการ")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "IsReport",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปยุติเรื่อง",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ส่งไปยุติเรื่อง")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View file

@ -1674,10 +1674,14 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsReport")
.HasColumnType("tinyint(1)")
b.Property<string>("IsReport")
.HasColumnType("longtext")
.HasComment("ส่งไปยุติเรื่อง");
b.Property<string>("IsSuspend")
.HasColumnType("longtext")
.HasComment("ส่งไปพักราชการ");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
@ -2279,8 +2283,8 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsReport")
.HasColumnType("tinyint(1)")
b.Property<string>("IsReport")
.HasColumnType("longtext")
.HasComment("ส่งไปยุติเรื่อง");
b.Property<string>("LastName")