api อุทธร
This commit is contained in:
parent
d4ae5f8c53
commit
c1b3ad7f7a
10 changed files with 12651 additions and 0 deletions
|
|
@ -0,0 +1,416 @@
|
||||||
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
|
using BMA.EHR.Discipline.Service.Requests;
|
||||||
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Models.Discipline;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
// using BMA.EHR.Placement.Service.Requests;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/discipline/complaint_appeal")]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[ApiController]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Authorize]
|
||||||
|
[SwaggerTag("ระบบย่อย อุทธรณ์/ร้องทุกข์")]
|
||||||
|
public class DisciplineComplaint_AppealController : BaseController
|
||||||
|
{
|
||||||
|
private readonly DisciplineDbContext _context;
|
||||||
|
private readonly MinIODisciplineService _documentService;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
||||||
|
MinIODisciplineService documentService,
|
||||||
|
IHttpContextAccessor httpContextAccessor)
|
||||||
|
{
|
||||||
|
// _repository = repository;
|
||||||
|
_context = context;
|
||||||
|
_documentService = documentService;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List รายการยื่นอุทธรณ์/ร้องทุกข์ (USER)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("user")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
||||||
|
{
|
||||||
|
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
||||||
|
where x.Title.Contains(keyword) ||
|
||||||
|
x.Description.Contains(keyword) ||
|
||||||
|
x.CaseType.Contains(keyword) ||
|
||||||
|
x.CaseNumber.Contains(keyword) ||
|
||||||
|
x.Fullname.Contains(keyword) ||
|
||||||
|
x.CitizenId.Contains(keyword)
|
||||||
|
where x.CreatedUserId == UserId
|
||||||
|
select x).ToList();
|
||||||
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Status == status).ToList();
|
||||||
|
if (type.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Type == type).ToList();
|
||||||
|
if (year != 0)
|
||||||
|
data_search = data_search.Where(x => x.Year == year).ToList();
|
||||||
|
var data = data_search
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Title = x.Title,
|
||||||
|
Description = x.Description,
|
||||||
|
Status = x.Status,
|
||||||
|
Type = x.Type,
|
||||||
|
Year = x.Year,
|
||||||
|
CaseType = x.CaseType,
|
||||||
|
CaseNumber = x.CaseNumber,
|
||||||
|
Fullname = x.Fullname,
|
||||||
|
CitizenId = x.CitizenId,
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
})
|
||||||
|
.OrderByDescending(x => x.LastUpdatedAt)
|
||||||
|
.Skip((page - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToList();
|
||||||
|
return Success(new { data, total = data_search.Count() });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// รายละเอียดยื่นอุทธรณ์/ร้องทุกข์ (USER/ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("{id:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
|
||||||
|
{
|
||||||
|
var _data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Include(x => x.DisciplineComplaint_Appeal_Docs)
|
||||||
|
.Include(x => x.DisciplineComplaint_Appeal_Historys)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Title = x.Title,
|
||||||
|
Description = x.Description,
|
||||||
|
Status = x.Status,
|
||||||
|
Type = x.Type,
|
||||||
|
Year = x.Year,
|
||||||
|
CaseType = x.CaseType,
|
||||||
|
CaseNumber = x.CaseNumber,
|
||||||
|
Fullname = x.Fullname,
|
||||||
|
CitizenId = x.CitizenId,
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
HistoryStatus = x.DisciplineComplaint_Appeal_Historys.Select(p => new
|
||||||
|
{
|
||||||
|
Status = p.Status,
|
||||||
|
CreatedAt = p.CreatedAt,
|
||||||
|
}),
|
||||||
|
DisciplineComplaint_Appeal_Docs = x.DisciplineComplaint_Appeal_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
|
})
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (_data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
var disciplineComplaint_Appeal_Docs = new List<dynamic>();
|
||||||
|
foreach (var doc in _data.DisciplineComplaint_Appeal_Docs)
|
||||||
|
{
|
||||||
|
var _doc = new
|
||||||
|
{
|
||||||
|
doc.Id,
|
||||||
|
doc.FileName,
|
||||||
|
PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
|
};
|
||||||
|
disciplineComplaint_Appeal_Docs.Add(_doc);
|
||||||
|
}
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
_data.Id,
|
||||||
|
_data.Title,
|
||||||
|
_data.Description,
|
||||||
|
_data.Status,
|
||||||
|
_data.Type,
|
||||||
|
_data.Year,
|
||||||
|
_data.CaseType,
|
||||||
|
_data.CaseNumber,
|
||||||
|
_data.Fullname,
|
||||||
|
_data.CitizenId,
|
||||||
|
_data.ProfileId,
|
||||||
|
_data.LastUpdatedAt,
|
||||||
|
_data.HistoryStatus,
|
||||||
|
disciplineComplaint_Appeal_Docs,
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// สร้างรายการยื่นอุทธรณ์/ร้องทุกข์ (USER/ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost()]
|
||||||
|
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromForm] DisciplineComplaint_AppealRequest req)
|
||||||
|
{
|
||||||
|
var disciplineComplaint_Appeal = new Domain.Models.Discipline.DisciplineComplaint_Appeal
|
||||||
|
{
|
||||||
|
Title = req.Title,
|
||||||
|
Description = req.Description,
|
||||||
|
Status = "NEW",
|
||||||
|
Type = req.Type,
|
||||||
|
Year = req.Year,
|
||||||
|
CaseType = req.CaseType,
|
||||||
|
CaseNumber = req.CaseNumber,
|
||||||
|
Fullname = req.Fullname,
|
||||||
|
CitizenId = req.CitizenId,
|
||||||
|
ProfileId = req.ProfileId,
|
||||||
|
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 _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("file/{id:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UploadFileComplaintAppeals([FromForm] DisciplineFileRequest req, Guid id)
|
||||||
|
{
|
||||||
|
var data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
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 = data,
|
||||||
|
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 _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>
|
||||||
|
[HttpDelete("file/{id:guid}/{docId:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> DeleteFileComplaintAppeals(Guid id, Guid docId)
|
||||||
|
{
|
||||||
|
var data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Include(x => x.DisciplineComplaint_Appeal_Docs)
|
||||||
|
.ThenInclude(x => x.Document)
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
|
var dataDoc = data.DisciplineComplaint_Appeal_Docs.Where(x => x.Document.Id == docId).FirstOrDefault();
|
||||||
|
if (dataDoc != null)
|
||||||
|
{
|
||||||
|
_context.DisciplineComplaint_Appeal_Docs.Remove(dataDoc);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
var dataDocComplaint = data.DisciplineComplaint_Appeal_Docs.Where(x => x.Document.Id == docId).FirstOrDefault();
|
||||||
|
if (dataDocComplaint == null)
|
||||||
|
{
|
||||||
|
await _documentService.DeleteFileAsync(docId);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List รายการยื่นอุทธรณ์/ร้องทุกข์ (ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("admin")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDisciplineAdmin(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
||||||
|
{
|
||||||
|
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
||||||
|
where x.Title.Contains(keyword) ||
|
||||||
|
x.Description.Contains(keyword) ||
|
||||||
|
x.CaseType.Contains(keyword) ||
|
||||||
|
x.CaseNumber.Contains(keyword) ||
|
||||||
|
x.Fullname.Contains(keyword) ||
|
||||||
|
x.CitizenId.Contains(keyword)
|
||||||
|
select x).ToList();
|
||||||
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Status == status).ToList();
|
||||||
|
if (type.Trim().ToUpper() != "ALL")
|
||||||
|
data_search = data_search.Where(x => x.Type == type).ToList();
|
||||||
|
if (year != 0)
|
||||||
|
data_search = data_search.Where(x => x.Year == year).ToList();
|
||||||
|
var data = data_search
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Title = x.Title,
|
||||||
|
Description = x.Description,
|
||||||
|
Status = x.Status,
|
||||||
|
Type = x.Type,
|
||||||
|
Year = x.Year,
|
||||||
|
CaseType = x.CaseType,
|
||||||
|
CaseNumber = x.CaseNumber,
|
||||||
|
Fullname = x.Fullname,
|
||||||
|
CitizenId = x.CitizenId,
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
})
|
||||||
|
.OrderByDescending(x => x.LastUpdatedAt)
|
||||||
|
.Skip((page - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToList();
|
||||||
|
return Success(new { data, total = data_search.Count() });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// แก้ไขรายการยื่นอุทธรณ์/ร้องทุกข์ (ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPut("{id:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromBody] DisciplineComplaint_AppealUpdateRequest req)
|
||||||
|
{
|
||||||
|
var data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
data.Title = req.Title;
|
||||||
|
data.Description = req.Description;
|
||||||
|
if (data.Status != req.Status.Trim().ToUpper())
|
||||||
|
{
|
||||||
|
var disciplineComplaint_Appeal_History = new DisciplineComplaint_Appeal_History
|
||||||
|
{
|
||||||
|
DisciplineComplaint_Appeal = data,
|
||||||
|
Status = req.Status.Trim().ToUpper(),
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
|
||||||
|
}
|
||||||
|
data.Status = req.Status.Trim().ToUpper();
|
||||||
|
data.Type = req.Type;
|
||||||
|
data.Year = req.Year;
|
||||||
|
data.CaseType = req.CaseType;
|
||||||
|
data.CaseNumber = req.CaseNumber;
|
||||||
|
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
data.LastUpdateUserId = UserId ?? "";
|
||||||
|
data.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Discipline.Service.Requests
|
||||||
|
{
|
||||||
|
public class DisciplineComplaint_AppealRequest
|
||||||
|
{
|
||||||
|
public string? Title { get; set; } = string.Empty;
|
||||||
|
public string? Description { get; set; } = string.Empty;
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
public int? Year { get; set; }
|
||||||
|
public string? CaseType { get; set; } = string.Empty;
|
||||||
|
public string? CaseNumber { get; set; } = string.Empty;
|
||||||
|
public Guid ProfileId { get; set; }
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
public string? Fullname { get; set; }
|
||||||
|
public List<FormFile>? File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Discipline.Service.Requests
|
||||||
|
{
|
||||||
|
public class DisciplineComplaint_AppealUpdateRequest
|
||||||
|
{
|
||||||
|
public string? Title { get; set; } = string.Empty;
|
||||||
|
public string? Description { get; set; } = string.Empty;
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
public int? Year { get; set; }
|
||||||
|
public string? CaseType { get; set; } = string.Empty;
|
||||||
|
public string? CaseNumber { get; set; } = string.Empty;
|
||||||
|
public string Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
{
|
||||||
|
public class DisciplineComplaint_Appeal : EntityBase
|
||||||
|
{
|
||||||
|
|
||||||
|
[Required, Comment("สถานะอุทธรณ์/ร้องทุกข์")]
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Comment("เรื่องที่อุทธรณ์/ร้องทุกข์"), Column(TypeName = "text")]
|
||||||
|
public string? Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Comment("รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์"), Column(TypeName = "text")]
|
||||||
|
public string? Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required, Comment("ประเภทอุทธรณ์หรือร้องทุกข์")]
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Comment("ปีงบประมาณ")]
|
||||||
|
public int? Year { get; set; }
|
||||||
|
|
||||||
|
[Comment("ประเภทคดี")]
|
||||||
|
public string? CaseType { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Comment("คดีเลขที่")]
|
||||||
|
public string? CaseNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required, Comment("ProfileId")]
|
||||||
|
public Guid ProfileId { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(13), Comment("รหัสบัตรประชาชน")]
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
|
||||||
|
[Comment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์")]
|
||||||
|
public string? Fullname { get; set; }
|
||||||
|
|
||||||
|
public virtual List<DisciplineComplaint_Appeal_Doc> DisciplineComplaint_Appeal_Docs { get; set; } = new List<DisciplineComplaint_Appeal_Doc>();
|
||||||
|
public virtual List<DisciplineComplaint_Appeal_History> DisciplineComplaint_Appeal_Historys { get; set; } = new List<DisciplineComplaint_Appeal_History>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
{
|
||||||
|
public class DisciplineComplaint_Appeal_Doc : EntityBase
|
||||||
|
{
|
||||||
|
[Required, Comment("อ้างอิงรหัสเอกสาร")]
|
||||||
|
public Document Document { get; set; }
|
||||||
|
[Required, Comment("อ้างอิงเรื่องอุทธรณ์/ร้องทุกข์")]
|
||||||
|
public DisciplineComplaint_Appeal DisciplineComplaint_Appeal { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
{
|
||||||
|
public class DisciplineComplaint_Appeal_History : EntityBase
|
||||||
|
{
|
||||||
|
[Required, Comment("สถานะอุทธรณ์/ร้องทุกข์")]
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required, Comment("อ้างอิงเรื่องอุทธรณ์/ร้องทุกข์")]
|
||||||
|
public DisciplineComplaint_Appeal DisciplineComplaint_Appeal { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11714
BMA.EHR.Infrastructure/Migrations/DisciplineDb/20231212180648_add table DisciplineComplaint_Appeals.Designer.cs
generated
Normal file
11714
BMA.EHR.Infrastructure/Migrations/DisciplineDb/20231212180648_add table DisciplineComplaint_Appeals.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,150 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addtableDisciplineComplaint_Appeals : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "DisciplineComplaint_Appeals",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Status = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: true, comment: "เรื่องที่อุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "text", nullable: true, comment: "รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทอุทธรณ์หรือร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: true, comment: "ปีงบประมาณ"),
|
||||||
|
CaseType = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทคดี")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CaseNumber = table.Column<string>(type: "longtext", nullable: true, comment: "คดีเลขที่")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "ProfileId", collation: "ascii_general_ci"),
|
||||||
|
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Fullname = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_DisciplineComplaint_Appeals", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "DisciplineComplaint_Appeal_Docs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
DisciplineComplaint_AppealId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_DisciplineComplaint_Appeal_Docs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_DisciplineComplaint_Appeal_Docs_DisciplineComplaint_Appeals_~",
|
||||||
|
column: x => x.DisciplineComplaint_AppealId,
|
||||||
|
principalTable: "DisciplineComplaint_Appeals",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_DisciplineComplaint_Appeal_Docs_Documents_DocumentId",
|
||||||
|
column: x => x.DocumentId,
|
||||||
|
principalTable: "Documents",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "DisciplineComplaint_Appeal_Historys",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Status = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
DisciplineComplaint_AppealId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_DisciplineComplaint_Appeal_Historys", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_DisciplineComplaint_Appeal_Historys_DisciplineComplaint_Appe~",
|
||||||
|
column: x => x.DisciplineComplaint_AppealId,
|
||||||
|
principalTable: "DisciplineComplaint_Appeals",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_DisciplineComplaint_Appeal_Docs_DisciplineComplaint_AppealId",
|
||||||
|
table: "DisciplineComplaint_Appeal_Docs",
|
||||||
|
column: "DisciplineComplaint_AppealId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_DisciplineComplaint_Appeal_Docs_DocumentId",
|
||||||
|
table: "DisciplineComplaint_Appeal_Docs",
|
||||||
|
column: "DocumentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_DisciplineComplaint_Appeal_Historys_DisciplineComplaint_Appe~",
|
||||||
|
table: "DisciplineComplaint_Appeal_Historys",
|
||||||
|
column: "DisciplineComplaint_AppealId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "DisciplineComplaint_Appeal_Docs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "DisciplineComplaint_Appeal_Historys");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "DisciplineComplaint_Appeals");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -135,6 +135,225 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
b.ToTable("DisciplineComplaints");
|
b.ToTable("DisciplineComplaints");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<string>("CaseNumber")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("คดีเลขที่");
|
||||||
|
|
||||||
|
b.Property<string>("CaseType")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทคดี");
|
||||||
|
|
||||||
|
b.Property<string>("CitizenId")
|
||||||
|
.HasMaxLength(13)
|
||||||
|
.HasColumnType("varchar(13)")
|
||||||
|
.HasComment("รหัสบัตรประชาชน");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasComment("รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<string>("Fullname")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProfileId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("ProfileId");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะอุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasComment("เรื่องที่อุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทอุทธรณ์หรือร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<int?>("Year")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ปีงบประมาณ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("DisciplineComplaint_Appeals");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<Guid>("DisciplineComplaint_AppealId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid>("DocumentId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DisciplineComplaint_AppealId");
|
||||||
|
|
||||||
|
b.HasIndex("DocumentId");
|
||||||
|
|
||||||
|
b.ToTable("DisciplineComplaint_Appeal_Docs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<Guid>("DisciplineComplaint_AppealId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะอุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DisciplineComplaint_AppealId");
|
||||||
|
|
||||||
|
b.ToTable("DisciplineComplaint_Appeal_Historys");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -10091,6 +10310,36 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
b.ToTable("ProfilePositions");
|
b.ToTable("ProfilePositions");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal")
|
||||||
|
.WithMany("DisciplineComplaint_Appeal_Docs")
|
||||||
|
.HasForeignKey("DisciplineComplaint_AppealId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("DocumentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("DisciplineComplaint_Appeal");
|
||||||
|
|
||||||
|
b.Navigation("Document");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal")
|
||||||
|
.WithMany("DisciplineComplaint_Appeal_Historys")
|
||||||
|
.HasForeignKey("DisciplineComplaint_AppealId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("DisciplineComplaint_Appeal");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint")
|
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint")
|
||||||
|
|
@ -11227,6 +11476,13 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
b.Navigation("DisciplineInvestigates");
|
b.Navigation("DisciplineInvestigates");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("DisciplineComplaint_Appeal_Docs");
|
||||||
|
|
||||||
|
b.Navigation("DisciplineComplaint_Appeal_Historys");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("DisciplineDisciplinary_DirectorInvestigates");
|
b.Navigation("DisciplineDisciplinary_DirectorInvestigates");
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
public DbSet<DisciplineDisciplinary_DocOther> DisciplineDisciplinary_DocOthers { get; set; }
|
public DbSet<DisciplineDisciplinary_DocOther> DisciplineDisciplinary_DocOthers { get; set; }
|
||||||
public DbSet<DisciplineDisciplinary_DocRelevant> DisciplineDisciplinary_DocRelevants { get; set; }
|
public DbSet<DisciplineDisciplinary_DocRelevant> DisciplineDisciplinary_DocRelevants { get; set; }
|
||||||
public DbSet<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; }
|
public DbSet<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; }
|
||||||
|
|
||||||
|
public DbSet<DisciplineComplaint_Appeal> DisciplineComplaint_Appeals { get; set; }
|
||||||
|
public DbSet<DisciplineComplaint_Appeal_Doc> DisciplineComplaint_Appeal_Docs { get; set; }
|
||||||
|
public DbSet<DisciplineComplaint_Appeal_History> DisciplineComplaint_Appeal_Historys { get; set; }
|
||||||
public DbSet<Document> Documents { get; set; }
|
public DbSet<Document> Documents { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue