From 5ca85c6e7ea87a47edc1b07d9303a9ec9248fede Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 15 Jan 2024 10:38:28 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B9=80=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3?= =?UTF-8?q?=E0=B9=89=E0=B8=AD=E0=B8=87=E0=B9=80=E0=B8=A3=E0=B8=B5=E0=B8=A2?= =?UTF-8?q?=E0=B8=99=E0=B8=95=E0=B8=AD=E0=B8=99=E0=B8=AD=E0=B8=AD=E0=B8=81?= =?UTF-8?q?=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/CommandRepository.cs | 940 +++++- .../Controllers/OrderController.cs | 22 + .../Requests/CreateCommandGroup11Request.cs | 1 + .../Requests/CreateCommandGroup13Request.cs | 1 + .../DisciplineComplaintController.cs | 28 + .../DisciplineDisciplinaryController.cs | 1 + .../Controllers/DisciplineResultController.cs | 21 +- .../DisciplineSuspendController.cs | 16 +- .../Models/Commands/Core/Command.cs | 3 + .../Discipline/DisciplineReport_Profile.cs | 2 + ...vestigates datestart nullable3.Designer.cs | 3000 +++++++++++++++++ ...irectorInvestigates datestart nullable3.cs | 52 + .../DisciplineDbContextModelSnapshot.cs | 16 + 13 files changed, 4045 insertions(+), 58 deletions(-) create mode 100644 BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.cs diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index 4348de11..d5e69983 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -1381,7 +1381,7 @@ namespace BMA.EHR.Application.Repositories.Commands } var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-19") @@ -1483,7 +1483,7 @@ namespace BMA.EHR.Application.Repositories.Commands } var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-20") @@ -1785,7 +1785,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/stop"; + var apiUrl = $"{baseAPI}/discipline/result/report/stop/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-25") @@ -1848,7 +1848,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/stop"; + var apiUrl = $"{baseAPI}/discipline/result/report/stop/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-26") @@ -1911,7 +1911,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-27") @@ -1974,7 +1974,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-28") @@ -2037,7 +2037,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-29") @@ -2100,7 +2100,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-30") @@ -2163,7 +2163,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/up"; + var apiUrl = $"{baseAPI}/discipline/result/report/up/{command.ComplaintId}"; var commandType = await _dbContext.Set() .Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-31") @@ -2226,7 +2226,7 @@ namespace BMA.EHR.Application.Repositories.Commands var resultData = new List(); var baseAPI = _configuration["API"]; - var apiUrl = $"{baseAPI}/discipline/result/report/reject"; + var apiUrl = $"{baseAPI}/discipline/result/report/reject/{command.ComplaintId}"; var response = new PassDisciplineResponse(); using (var client = new HttpClient()) @@ -7611,7 +7611,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-25 - xxxx + /// C-PM-25 - คำสั่งพักจากราชการ /// /// object ของรายการคำสั่ง /// @@ -7649,6 +7649,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย พักจากราชการ"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งพักจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งพักจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งพักจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งพักจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -7660,7 +7767,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งพักจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -7672,14 +7779,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งพักจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งพักจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -7702,7 +7809,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-26 - xxxx + /// C-PM-26 - คำสั่งให้ออกจากราชการไว้ก่อน /// /// object ของรายการคำสั่ง /// @@ -7740,6 +7847,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งให้ออกจากราชการไว้ก่อน คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งให้ออกจากราชการไว้ก่อน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งให้ออกจากราชการไว้ก่อน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งให้ออกจากราชการไว้ก่อน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -7751,7 +7965,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งให้ออกจากราชการไว้ก่อน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -7763,14 +7977,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งให้ออกจากราชการไว้ก่อน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งให้ออกจากราชการไว้ก่อน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -7793,7 +8007,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-27 - xxxx + /// C-PM-27 - คำสั่งลงโทษ ภาคทัณฑ์ /// /// object ของรายการคำสั่ง /// @@ -7831,6 +8045,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย ลงโทษ ภาคทัณฑ์"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งลงโทษ ภาคทัณฑ์ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งลงโทษ ภาคทัณฑ์ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งลงโทษ ภาคทัณฑ์ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งลงโทษ ภาคทัณฑ์ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -7842,7 +8163,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ภาคทัณฑ์ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -7854,14 +8175,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งลงโทษ ภาคทัณฑ์ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ภาคทัณฑ์ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -7884,7 +8205,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-28 - xxxx + /// C-PM-28 - คำสั่งลงโทษ ตัดเงินเดือน /// /// object ของรายการคำสั่ง /// @@ -7922,6 +8243,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย ลงโทษ ตัดเงินเดือน"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งลงโทษ ตัดเงินเดือน คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งลงโทษ ตัดเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งลงโทษ ตัดเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งลงโทษ ตัดเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -7933,7 +8361,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ตัดเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -7945,14 +8373,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งลงโทษ ตัดเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ตัดเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -7975,7 +8403,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-29 - xxxx + /// C-PM-29 - คำสั่งลงโทษ ลดขั้นเงินเดือน /// /// object ของรายการคำสั่ง /// @@ -8013,6 +8441,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย ลงโทษ ลดขั้นเงินเดือน"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งลงโทษ ลดขั้นเงินเดือน คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งลงโทษ ลดขั้นเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งลงโทษ ลดขั้นเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งลงโทษ ลดขั้นเงินเดือน เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -8024,7 +8559,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ลดขั้นเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -8036,14 +8571,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งลงโทษ ลดขั้นเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งลงโทษ ลดขั้นเงินเดือน คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -8066,7 +8601,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-30 - xxxx + /// C-PM-30 - คำสั่งเพิ่มโทษ /// /// object ของรายการคำสั่ง /// @@ -8104,6 +8639,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย เพิ่มโทษ"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งเพิ่มโทษ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งเพิ่มโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งเพิ่มโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งเพิ่มโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -8115,7 +8757,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งเพิ่มโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -8127,14 +8769,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งเพิ่มโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งเพิ่มโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -8157,7 +8799,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-31 - xxxx + /// C-PM-31 - คำสั่งงดโทษ /// /// object ของรายการคำสั่ง /// @@ -8195,6 +8837,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย งดโทษ"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งงดโทษ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งงดโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งงดโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งงดโทษ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -8206,7 +8955,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งงดโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -8218,14 +8967,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งงดโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งงดโทษ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, @@ -8248,7 +8997,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-32 - xxxx + /// C-PM-32 - คำสั่งยุติเรื่อง /// /// object ของรายการคำสั่ง /// @@ -8286,6 +9035,113 @@ namespace BMA.EHR.Application.Repositories.Commands }; var payload_str = JsonConvert.SerializeObject(payload); + foreach (var recv in command.Receivers) + { + var dataProfile = await _dbContext.Set() + .Include(x => x.Salaries) + .ThenInclude(x => x.PositionLevel) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); + + if (dataProfile == null) + throw new Exception(GlobalMessages.DataNotFound); + + dataProfile.IsActive = false; + dataProfile.IsLeave = true; + dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง"; + dataProfile.LeaveDate = command.CommandAffectDate; + + var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault(); + var order = 1; + if (lastSarary.Order != null) + order = lastSarary.Order.Value + 1; + + var salary = new ProfileSalary + { + Order = order, + Date = command.CommandAffectDate, + Amount = lastSarary.Amount, + PositionSalaryAmount = lastSarary.PositionSalaryAmount, + MouthSalaryAmount = lastSarary.MouthSalaryAmount, + SalaryClass = "", + SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}", + + OcId = lastSarary.OcId, + + PositionId = lastSarary.PositionId, + + PositionLevel = lastSarary.PositionLevel, + PositionLineId = lastSarary.PositionLineId, + PositionTypeId = lastSarary.PositionTypeId, + OrganizationShortNameId = lastSarary.OrganizationShortNameId, + PosNoId = lastSarary.PosNoId, + + CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}", + CommandTypeName = command.CommandType.Name, + + + PositionEmployeeGroupId = null, + PositionEmployeeLevelId = null, + PositionEmployeePositionId = null, + PositionEmployeePositionSideId = null, + PosNoEmployee = "", + + + //PositionPathSideId = lastSarary.PositionPathSideId == null, + PositionExecutiveId = lastSarary.PositionExecutiveId, + //PositionExecutiveSideId = lastSarary.PositionExecutiveSideId, + + IsActive = true, + CreatedAt = DateTime.Now, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + + }; + + if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId; + if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId; + + dataProfile.Salaries.Add(salary); + + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + + await _dbContext.SaveChangesAsync(); + + // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ + // Send noti inbox and email + var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + _emailSenderService.SendMail(subject, body, "dev@frappet.com"); + + + var inbox = new Inbox + { + Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Payload = payload_str, + }; + _dbContext.Set().Add(inbox); + + var noti = new Notification + { + Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + ReceiverUserId = dataProfile.Id, + Type = "LINK", + Payload = payload_str, + }; + _dbContext.Set().Add(noti); + await _dbContext.SaveChangesAsync(); + } // send cc noti inbox foreach (var cc in command.Deployments) { @@ -8297,7 +9153,7 @@ namespace BMA.EHR.Application.Repositories.Commands var inbox = new Inbox { Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Payload = payload_str, }; @@ -8309,14 +9165,14 @@ namespace BMA.EHR.Application.Repositories.Commands // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่ // Send noti inbox and email var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; - var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; + var body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}"; _emailSenderService.SendMail(subject, body, "dev@frappet.com"); } var noti = new Notification { - Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", + Body = $"คำสั่งยุติเรื่อง คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}", ReceiverUserId = pf.Id, Type = "LINK", Payload = payload_str, diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 4414a6ee..e407140b 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -2522,6 +2522,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -2579,6 +2580,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); return Success(result); @@ -2634,6 +2636,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -2691,6 +2694,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3118,6 +3122,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3168,6 +3173,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3217,6 +3223,8 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, + }; var result = await _repository.AddAsync(inserted); @@ -3267,6 +3275,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3316,6 +3325,8 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, + }; var result = await _repository.AddAsync(inserted); @@ -3366,6 +3377,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3415,6 +3427,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3465,6 +3478,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3514,6 +3528,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3564,6 +3579,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3613,6 +3629,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3663,6 +3680,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3712,6 +3730,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3762,6 +3781,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); @@ -3811,6 +3831,7 @@ namespace BMA.EHR.Command.Service.Controllers FaultLevel = req.faultLevel, RefRaw = req.refRaw, Result = req.result, + ComplaintId = req.complaintId, }; var result = await _repository.AddAsync(inserted); @@ -3861,6 +3882,7 @@ namespace BMA.EHR.Command.Service.Controllers order.FaultLevel = req.faultLevel; order.RefRaw = req.refRaw; order.Result = req.result; + order.ComplaintId = req.complaintId; var result = await _repository.UpdateAsync(order); diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup11Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup11Request.cs index dd5e4630..5207aaa9 100644 --- a/BMA.EHR.Command.Service/Requests/CreateCommandGroup11Request.cs +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup11Request.cs @@ -34,5 +34,6 @@ public string faultLevel { get; set; } public string refRaw { get; set; } public string result { get; set; } + public Guid? complaintId { get; set; } } } diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup13Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup13Request.cs index a9f88cf9..8cf80a3b 100644 --- a/BMA.EHR.Command.Service/Requests/CreateCommandGroup13Request.cs +++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup13Request.cs @@ -15,5 +15,6 @@ public int orderYear { get; set; } public string signatoryBy { get; set; } = string.Empty; public string signatoryPosition { get; set; } = string.Empty; + public Guid? complaintId { get; set; } } } diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs index 2719c9bd..00efd128 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs @@ -87,6 +87,34 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers return Success(new { data, total = data_search.Count() }); } + /// + /// list รายการวินัยเรื่องร้องเรียนในหน้าออกคำสั่ง + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("report")] + public async Task> GetDisciplineComplaintReport() + { + var data = await _context.DisciplineComplaints + .Where(x => x.Status.Contains("SEND_INVESTIGATE")) + .Select(x => new + { + Id = x.Id,//id ข้อมูลเรื่องร้องเรียน + Title = x.Title,//ชื่อเรื่อง + IsComplaint = true, + IsInvestigate = x.DisciplineInvestigates.FirstOrDefault() == null ? false : true, + IsDisciplinary = x.DisciplineInvestigates.FirstOrDefault() == null || x.DisciplineInvestigates.FirstOrDefault().DisciplineDisciplinarys.FirstOrDefault() == null ? false : true, + IsResult = x.DisciplineInvestigates.FirstOrDefault() == null || x.DisciplineInvestigates.FirstOrDefault().DisciplineDisciplinarys.FirstOrDefault() == null || (x.DisciplineInvestigates.FirstOrDefault().DisciplineDisciplinarys.FirstOrDefault().Status != "DONE" && x.DisciplineInvestigates.FirstOrDefault().DisciplineDisciplinarys.FirstOrDefault().Status != "REPORT") ? false : true, + DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา + }) + .OrderByDescending(x => x.DateConsideration) + .ToListAsync(); + return Success(data); + } + /// /// get รายการวินัยเรื่องร้องเรียน /// diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs index 0311e273..bc8fa431 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs @@ -1626,6 +1626,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers OffenseDetails = data.OffenseDetails, DisciplinaryCaseFault = data.DisciplinaryCaseFault, DisciplinaryFaultLevel = data.DisciplinaryFaultLevel, + DisciplineDisciplinary = data, Status = "PENDING", CreatedFullName = FullName ?? "System Administrator", CreatedUserId = UserId ?? "", diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs index ade91e3b..521cb209 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs @@ -327,11 +327,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("report/up")] - public async Task> GetPersonReportUp() + [HttpGet("report/up/{id:guid}")] + public async Task> GetPersonReportUp(Guid id) { var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates .Where(x => x.Status == "REPORT") + .Where(x => x.DisciplineDisciplinary.DisciplineInvestigate.DisciplineComplaint.Id == id) .Select(x => new { PersonId = x.PersonId, @@ -350,11 +351,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("report/down")] - public async Task> GetPersonReportDown() + [HttpGet("report/down/{id:guid}")] + public async Task> GetPersonReportDown(Guid id) { var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates .Where(x => x.StatusDiscard == "REPORT") + .Where(x => x.DisciplineDisciplinary.DisciplineInvestigate.DisciplineComplaint.Id == id) .Select(x => new { PersonId = x.PersonId, @@ -373,11 +375,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("report/reject")] - public async Task> GetPersonReportReject() + [HttpGet("report/reject/{id:guid}")] + public async Task> GetPersonReportReject(Guid id) { var data1 = await _context.DisciplineInvestigate_ProfileComplaints .Where(x => x.IsReport == "REPORT") + .Where(x => x.DisciplineInvestigate.DisciplineComplaint.Id == id) .Select(x => new { PersonId = x.PersonId, @@ -386,6 +389,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .ToListAsync(); var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates .Where(x => x.IsReport == "REPORT") + .Where(x => x.DisciplineDisciplinary.DisciplineInvestigate.DisciplineComplaint.Id == id) .Select(x => new { PersonId = x.PersonId, @@ -408,11 +412,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("report/stop")] - public async Task> GetPersonReportStop() + [HttpGet("report/stop/{id:guid}")] + public async Task> GetPersonReportStop(Guid id) { var data = await _context.DisciplineReport_Profiles .Where(x => x.Status == "REPORT") + .Where(x => x.DisciplineDisciplinary.DisciplineInvestigate.DisciplineComplaint.Id == id) .Select(x => new { PersonId = x.PersonId, diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs index 0345f046..2c50a504 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs @@ -83,10 +83,10 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers DescriptionSuspend = x.DescriptionSuspend, StartDateSuspend = x.StartDateSuspend, EndDateSuspend = x.EndDateSuspend, - Title = x.Title, - OffenseDetails = x.OffenseDetails,//ลักษณะความผิด - DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด - DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด + Title = x.DisciplineDisciplinary.Title, + OffenseDetails = x.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด + DisciplinaryFaultLevel = x.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด + DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด }) .OrderByDescending(x => x.CitizenId) .Skip((page - 1) * pageSize) @@ -124,10 +124,10 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers DescriptionSuspend = x.DescriptionSuspend, StartDateSuspend = x.StartDateSuspend, EndDateSuspend = x.EndDateSuspend, - Title = x.Title, - OffenseDetails = x.OffenseDetails,//ลักษณะความผิด - DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด - DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด + Title = x.DisciplineDisciplinary.Title, + OffenseDetails = x.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด + DisciplinaryFaultLevel = x.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด + DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด }) .Where(x => x.Id == id) .FirstOrDefaultAsync(); diff --git a/BMA.EHR.Domain/Models/Commands/Core/Command.cs b/BMA.EHR.Domain/Models/Commands/Core/Command.cs index fd32b481..109c5106 100644 --- a/BMA.EHR.Domain/Models/Commands/Core/Command.cs +++ b/BMA.EHR.Domain/Models/Commands/Core/Command.cs @@ -214,6 +214,9 @@ namespace BMA.EHR.Domain.Models.Commands.Core [Comment("อ้างอิงมาตราตามกฏหมาย")] public string? RefRaw { get; set; } + [Comment("Id เรื่องร้องเรียน")] + public Guid? ComplaintId { get; set; } + #endregion public virtual List Documents { get; set; } = new(); diff --git a/BMA.EHR.Domain/Models/Discipline/DisciplineReport_Profile.cs b/BMA.EHR.Domain/Models/Discipline/DisciplineReport_Profile.cs index 0931b1be..1b8c664a 100644 --- a/BMA.EHR.Domain/Models/Discipline/DisciplineReport_Profile.cs +++ b/BMA.EHR.Domain/Models/Discipline/DisciplineReport_Profile.cs @@ -48,6 +48,8 @@ namespace BMA.EHR.Domain.Models.Discipline public string? DisciplinaryFaultLevel { get; set; } [Comment("กรณีความผิด")] public string? DisciplinaryCaseFault { get; set; } + [Required, Comment("Id เรื่องสอบสวน")] + public DisciplineDisciplinary DisciplineDisciplinary { get; set; } // [Required, Comment("Id ผู้ถูกร้องเรียน")] // public DisciplineDisciplinary_ProfileComplaintInvestigate? DisciplineDisciplinary_ProfileComplaintInvestigate { get; set; } } diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.Designer.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.Designer.cs new file mode 100644 index 00000000..4e64dd38 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.Designer.cs @@ -0,0 +1,3000 @@ +// +using System; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb +{ + [DbContext(typeof(DisciplineDbContext))] + [Migration("20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3")] + partial class updatetableDisciplineDisciplinary_DirectorInvestigatesdatestartnullable3 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("char(36)") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("char(36)") + .HasComment("กรณีหน่วยงานใส่ id ของหน่วยงาน"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CaseNumber") + .HasColumnType("longtext") + .HasComment("คดีเลขที่"); + + b.Property("CaseType") + .HasColumnType("longtext") + .HasComment("ประเภทคดี"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์"); + + b.Property("Fullname") + .HasColumnType("longtext") + .HasComment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัดผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่งผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("ProfileId") + .HasColumnType("char(36)") + .HasComment("ProfileId"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะอุทธรณ์/ร้องทุกข์"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่อุทธรณ์/ร้องทุกข์"); + + b.Property("Type") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ประเภทอุทธรณ์หรือร้องทุกข์"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Appeals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaint_AppealId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaint_AppealId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("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 => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อประเภทการร้องเรียน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Channels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineComplaint_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("char(36)") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineComplaint_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Email") + .IsRequired() + .HasColumnType("longtext") + .HasComment("อีเมล"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อ"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("longtext") + .HasComment("เบอร์โทรศัพท์"); + + b.Property("Position") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("longtext") + .HasComment("คำนำหน้าชื่อ"); + + b.HasKey("Id"); + + b.ToTable("DisciplineDirectors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("char(36)") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryCauseText") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน กรณีมีมูล"); + + b.Property("DisciplinaryDateAllegation") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับทราบข้อกล่าวหา"); + + b.Property("DisciplinaryDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสอบสวน"); + + b.Property("DisciplinaryDateEvident") + .HasColumnType("datetime(6)") + .HasComment("วันที่สรุปพยานหลักฐาน"); + + b.Property("DisciplinaryDateInvestigation") + .HasColumnType("datetime(6)") + .HasComment("วันที่มีคำสั่งให้สอบสวน"); + + b.Property("DisciplinaryDateResult") + .HasColumnType("datetime(6)") + .HasComment("วันที่รายงานผลการสอบสวน"); + + b.Property("DisciplinaryDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสอบสวน"); + + b.Property("DisciplinaryDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ขยาย"); + + b.Property("DisciplinaryExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplinaryFaultLevelOther") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิดกรณีอื่นๆ"); + + b.Property("DisciplinaryInvestigateAt") + .HasColumnType("longtext") + .HasComment("สอบสวนที่"); + + b.Property("DisciplinaryRecordAccuser") + .HasColumnType("longtext") + .HasComment("บันทึกถ้อยคำของผู้กล่าวหา"); + + b.Property("DisciplinaryRefLaw") + .HasColumnType("longtext") + .HasComment("อ้างอิงมาตราตามกฎหมาย"); + + b.Property("DisciplinaryResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน เหตุผล"); + + b.Property("DisciplinaryStatusResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน ผล"); + + b.Property("DisciplinarySummaryEvidence") + .HasColumnType("longtext") + .HasComment("สรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"); + + b.Property("DisciplinaryWitnesses") + .HasColumnType("longtext") + .HasComment("พยานและบันทึกถ้อยคำพยาน"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (APPOINT_DIRECTORS คือ แต่งตั้งกรรมการสืบสวน, SECRET_INVESTIGATION คือ สืบสวนทางลับ, OTHER คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (NOT_SPECIFIED คือ ยังไม่ระบุ, HAVE_CAUSE คือ มีมูล, NO_CAUSE คือ ไม่มีมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("char(36)") + .HasComment("กรณีหน่วยงานใส่ id ของหน่วยงาน"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("ResultDescription") + .HasColumnType("longtext") + .HasComment("สรุปผลการพิจารณา"); + + b.Property("ResultDisciplineType") + .HasColumnType("longtext") + .HasComment("ประเภทวินัย"); + + b.Property("ResultInvestigate") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องสืบสวน"); + + b.Property("ResultOc") + .HasColumnType("longtext") + .HasComment("หน่วยงาย/ส่วนราชการ"); + + b.Property("ResultTitleType") + .HasColumnType("longtext") + .HasComment("ประเภทของเรื่อง"); + + b.Property("ResultYear") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineDisciplinarys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่ม"); + + b.Property("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinaryExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .IsRequired() + .HasColumnType("longtext") + .HasComment("หน้าที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDirectorId"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_DirectorInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigateRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocOthers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRecordAccusers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocResults"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocSummaryEvidences"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocWitnessess"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeDiscardId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่งงดโทด"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + b.Property("IsSuspend") + .HasColumnType("longtext") + .HasComment("ส่งไปพักราชการ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("char(36)") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("StatusDiscard") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่งงดโทด"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("char(36)") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("char(36)") + .HasComment("กรณีหน่วยงานใส่ id ของหน่วยงาน"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่ม"); + + b.Property("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigateExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigateRelevant_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .IsRequired() + .HasColumnType("longtext") + .HasComment("หน้าที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDirectorId"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_DocComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsDisciplinary") + .HasColumnType("tinyint(1)") + .HasComment("ส่งไปสอบสวน"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("char(36)") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_ProfileComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DescriptionSuspend") + .HasColumnType("longtext") + .HasComment("เหตุที่ถูกสั่งพักราชการ/ออกจากราชการไว้ก่อน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("EndDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("char(36)") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("StartDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันที่สั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineReport_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("FileSize") + .HasColumnType("int"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectRefId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("Documents"); + }); + + 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 => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Docs") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Profiles") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineDisciplinarys") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinaryExtends") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigateRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocOthers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRecordAccusers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocResults") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocSummaryEvidences") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocWitnessess") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_ProfileComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineInvestigates") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateExtends") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateRelevant_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_DocComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_ProfileComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany() + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => + { + b.Navigation("DisciplineComplaint_Docs"); + + b.Navigation("DisciplineComplaint_Profiles"); + + 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 => + { + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Navigation("DisciplineDisciplinaryExtends"); + + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocComplaintInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocInvestigateRelevants"); + + b.Navigation("DisciplineDisciplinary_DocInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocOthers"); + + b.Navigation("DisciplineDisciplinary_DocRecordAccusers"); + + b.Navigation("DisciplineDisciplinary_DocRelevants"); + + b.Navigation("DisciplineDisciplinary_DocResults"); + + b.Navigation("DisciplineDisciplinary_DocSummaryEvidences"); + + b.Navigation("DisciplineDisciplinary_DocWitnessess"); + + b.Navigation("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Navigation("DisciplineDisciplinarys"); + + b.Navigation("DisciplineInvestigateExtends"); + + b.Navigation("DisciplineInvestigateRelevant_Docs"); + + b.Navigation("DisciplineInvestigate_Directors"); + + b.Navigation("DisciplineInvestigate_DocComplaints"); + + b.Navigation("DisciplineInvestigate_Docs"); + + b.Navigation("DisciplineInvestigate_ProfileComplaints"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.cs new file mode 100644 index 00000000..bec0024c --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240115030653_update table DisciplineDisciplinary_DirectorInvestigates datestart nullable3.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb +{ + /// + public partial class updatetableDisciplineDisciplinary_DirectorInvestigatesdatestartnullable3 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DisciplineDisciplinaryId", + table: "DisciplineReport_Profiles", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.CreateIndex( + name: "IX_DisciplineReport_Profiles_DisciplineDisciplinaryId", + table: "DisciplineReport_Profiles", + column: "DisciplineDisciplinaryId"); + + migrationBuilder.AddForeignKey( + name: "FK_DisciplineReport_Profiles_DisciplineDisciplinarys_Discipline~", + table: "DisciplineReport_Profiles", + column: "DisciplineDisciplinaryId", + principalTable: "DisciplineDisciplinarys", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_DisciplineReport_Profiles_DisciplineDisciplinarys_Discipline~", + table: "DisciplineReport_Profiles"); + + migrationBuilder.DropIndex( + name: "IX_DisciplineReport_Profiles_DisciplineDisciplinaryId", + table: "DisciplineReport_Profiles"); + + migrationBuilder.DropColumn( + name: "DisciplineDisciplinaryId", + table: "DisciplineReport_Profiles"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs index ec3c5106..369ce07d 100644 --- a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs @@ -2399,6 +2399,9 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb .HasColumnType("longtext") .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + b.Property("EndDateSuspend") .HasColumnType("datetime(6)") .HasComment("วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); @@ -2480,6 +2483,8 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb b.HasKey("Id"); + b.HasIndex("DisciplineDisciplinaryId"); + b.ToTable("DisciplineReport_Profiles"); }); @@ -2909,6 +2914,17 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb b.Navigation("DisciplineInvestigate"); }); + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany() + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => { b.Navigation("DisciplineComplaint_Docs");