diff --git a/BMA.EHR.Report.Service.csproj b/BMA.EHR.Report.Service.csproj index d5863cc..fa7c82e 100644 --- a/BMA.EHR.Report.Service.csproj +++ b/BMA.EHR.Report.Service.csproj @@ -26,14 +26,15 @@ + + - @@ -56,11 +57,27 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Controllers/ExamReportController.cs b/Controllers/ExamReportController.cs new file mode 100644 index 0000000..31bb248 --- /dev/null +++ b/Controllers/ExamReportController.cs @@ -0,0 +1,254 @@ +using BMA.EHR.Profile.Service.Controllers; +using BMA.EHR.Report.Service.Data; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Swashbuckle.AspNetCore.Annotations; +using Telerik.Reporting.Processing; +using Telerik.Reporting; +using BMA.EHR.Report.Service.Responses; +using BMA.EHR.Extensions; + +namespace BMA.EHR.Report.Service.Controllers +{ + [Route("api/v{version:apiVersion}/report/exam")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("รายงานข้อมูลการสอบคัดเลือก")] + public class ExamReportController : BaseController + { + #region " Fields " + + private readonly ExamDbContext _context; + private readonly IWebHostEnvironment _hostingEnvironment; + private readonly IConfiguration _configuration; + private readonly string space = "ㅤ"; + + #endregion + + #region " Constructor and Destructor " + + public ExamReportController(ExamDbContext context, + IWebHostEnvironment hostingEnvironment, + IConfiguration configuration) + { + this._context = context; + this._hostingEnvironment = hostingEnvironment; + this._configuration = configuration; + } + + #endregion + + #region " Methods " + + #region " Privates " + + private int GetExamCountTes(string citizenId) + { + try + { + var count = _context.Candidates.AsQueryable() + .Where(x => x.CitizenId == citizenId) + .Count(); + + return count; + } + catch + { + throw; + } + } + + #endregion + + /// + /// แสดงหนังสือรับรอง + /// + /// รหัสรอบการสอบ + /// เลขประจำตัวผู้สมัครสอบ + /// ชนิดของรายงาน + /// + /// เมื่อแสดงรายงานสำเร็จ + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + + [HttpGet("certificate/{type:int}/{id:length(36)}/{examId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetCertificateReportAsync(Guid id, string examId, int type) + { + try + { + var data = await _context.Disables.AsQueryable() + .Include(x => x.PeriodExam) + .Where(x => x.PeriodExam.Id == id) + .Where(x => x.ExamId == examId) + .Join(_context.DisableScores.AsQueryable() + .Include(x => x.ScoreImport), + rc => new { rc.PeriodExam.Year, rc.ExamId }, + sc => new { sc.ScoreImport.Year, sc.ExamId }, + (p, sr) => new + { + ExamID = p.ExamId, + p.CitizenId, + Order = p.PeriodExam.Round, + Year = p.PeriodExam.Year.Value.ToThaiYear(), + FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", + ExamResult = sr == null ? "" : sr.ExamStatus, + EndDate = p.PeriodExam.RegisterEndDate.ToThaiFullDate3(), + AuthName = "นายณัฐพงศ์ ดิษยบุตร", + AuthPosition = "หัวหน้าสำนักงาน ก.ก." + }) + .FirstOrDefaultAsync(); + + var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCertificate{type}.trdp"); + + ReportPackager reportPackager = new ReportPackager(); + Telerik.Reporting.Report? report = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile)) + { + report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + } + + report.DataSource = data; + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + + InstanceReportSource instanceReportSource = new InstanceReportSource() + { + ReportDocument = report + }; + + + ReportProcessor reportProcessor = new ReportProcessor(_configuration); + RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo); + + var content = result.DocumentBytes; + return File(content, "application/pdf", $"หนังสือรับรอง_{data.CitizenId}_{data.FullName}.pdf"); + + } + catch (Exception ex) + { + return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน"); + } + } + + /// + /// แสดงเอกสารผลสอบ + /// + /// รหัสรอบการสอบ + /// เลขประจำตัวผู้สมัครสอบ + /// + /// เมื่อแสดงรายงานสำเร็จ + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("score/{id:length(36)}/{examId}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetScoreReportAsync(Guid id, string examId) + { + try + { + var data = await _context.Disables.AsQueryable() + .Include(x => x.PeriodExam) + .Include(x => x.Documents) + .ThenInclude(x => x.DocumentFile) + .Where(x => x.PeriodExam.Id == id) + .Where(x => x.ExamId == examId) + .Join(_context.DisableScores.AsQueryable() + .Include(x => x.ScoreImport), + rc => new { rc.PeriodExam.Year, rc.ExamId }, + sc => new { sc.ScoreImport.Year, sc.ExamId }, + (p, sr) => new + { + ExamId = p.ExamId, + CitizenId = p.CitizenId, + p.Prefix, + FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", + DateOfBirth = p.DateOfBirth.ToThaiShortDate(), + Gender = p.Gendor, + Degree = p.Educations.First().Degree, + Major = p.Educations.First().Major, + ExamResult = sr == null ? "" : sr.ExamStatus, + University = p.Educations.First().University, + PositionName = p.PositionName, + ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}", + Number = sr == null ? "" : sr.Number, + // ExamCount = 10, + // ExamCount = GetExamCountTes(p.CitizenId), + ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate(), + FullA = sr == null ? 0 : sr.FullA, + SumA = sr == null ? 0 : sr.SumA, + FullB = sr == null ? 0 : sr.FullB, + SumB = sr == null ? 0 : sr.SumB, + FullC = sr == null ? 0 : sr.FullC, + SumC = sr == null ? 0 : sr.SumC, + }) + .FirstOrDefaultAsync(); + var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptExamResult.trdp"); + ReportPackager reportPackager = new ReportPackager(); + Telerik.Reporting.Report? report = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile)) + { + report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + } + + report.DataSource = data; + if (data != null) + { + var _data = new + { + ExamId = data.ExamId, + CitizenId = data.CitizenId, + Prefix = data.Prefix, + FullName = data.FullName, + DateOfBirth = data.DateOfBirth, + Gender = data.Gender, + Degree = data.Degree, + Major = data.Major, + ExamResult = data.ExamResult, + University = data.University, + PositionName = data.PositionName, + ExamName = data.ExamName, + Number = data.Number, + ExamCount = GetExamCountTes(data.CitizenId), + ScoreExpire = data.ScoreExpire, + FullA = data.FullA, + SumA = data.SumA, + FullB = data.FullB, + SumB = data.SumB, + FullC = data.FullC, + SumC = data.SumC, + }; + report.DataSource = _data; + } + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + + InstanceReportSource instanceReportSource = new InstanceReportSource() + { + ReportDocument = report + }; + + + ReportProcessor reportProcessor = new ReportProcessor(_configuration); + RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo); + + var content = result.DocumentBytes; + return File(content, "application/pdf", $"ผลคะแนนสอบ_{data.CitizenId}_{data.FullName}.pdf"); + } + catch (Exception ex) + { + return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน"); + } + } + + #endregion + } +} diff --git a/Controllers/OrganizationReportController.cs b/Controllers/OrganizationReportController.cs new file mode 100644 index 0000000..895eab2 --- /dev/null +++ b/Controllers/OrganizationReportController.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BMA.EHR.Report.Service.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class OrganizationReportController : ControllerBase + { + } +} diff --git a/Controllers/ProfileReportController.cs b/Controllers/ProfileReportController.cs new file mode 100644 index 0000000..3ba7629 --- /dev/null +++ b/Controllers/ProfileReportController.cs @@ -0,0 +1,552 @@ +using BMA.EHR.Extensions; +using BMA.EHR.Profile.Service.Controllers; +using BMA.EHR.Report.Service.Data; +using BMA.EHR.Report.Service.Responses; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Swashbuckle.AspNetCore.Annotations; +using System.Runtime.Versioning; +using System.Linq; +using BMA.EHR.Profile.Service.Services; +using Telerik.Reporting.Processing; +using Telerik.Reporting; +using System.Security.Cryptography.Pkcs; +using static System.Runtime.InteropServices.JavaScript.JSType; +using BMA.EHR.Recruit.Service.Services; +using System.Drawing; +using iText.Kernel.Pdf; +using Microsoft.CodeAnalysis; +using Telerik.Reporting.Drawing; +using GreatFriends.ThaiBahtText; +using BMA.EHR.Core; + +namespace BMA.EHR.Report.Service.Controllers +{ + [Route("api/v{version:apiVersion}/report/profile")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + //[Authorize] + [SwaggerTag("รายงานระบบทะเบียนประวัติ")] + public class ProfileReportController : BaseController + { + #region " Fields " + + private readonly EHRDbContext _context; + private readonly IWebHostEnvironment _hostingEnvironment; + private readonly IConfiguration _configuration; + private readonly string space = "ㅤ"; + private readonly ProfileService _profileService; + private readonly MinIOService _minioService; + + + #endregion + + #region " Constructor and Destructor " + + public ProfileReportController(EHRDbContext context, + IWebHostEnvironment hostingEnvironment, + IConfiguration configuration, + ProfileService profileService, + MinIOService minioService) + { + this._context = context; + this._hostingEnvironment = hostingEnvironment; + this._configuration = configuration; + this._profileService = profileService; + this._minioService = minioService; + } + + #endregion + + #region " Methods " + + /// + /// แสดงหนังสือรับรอง + /// + /// รหัสข้อมูลข้าราชการ + /// + /// เมื่อแสดงรายงานสำเร็จ + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + + [HttpGet("kp7-short/{id:length(36)}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetKp7ShortReport(Guid id) + { + try + { + var profile_salaries = (from ps in _context.ProfileSalaries.ToList() + join pos in _context.PositionPaths.ToList() + on ps.PositionId equals pos.Id + where ps.Profile.Id == id + select new + { + ProfileId = ps.Profile.Id, + PositionName = pos.Name, + ps.OcId, + SalaryDateAnnounce = ps.Date, + ps.Amount, + ps.PositionSalaryAmount + }).ToList(); + + var profile = (from p in _context.Profiles.ToList() + join pf in _context.Prefixes.ToList() on p.PrefixId equals pf.Id + + where p.Id == id + select new + { + CitizenId = p.CitizenId, + Prefix = pf.Name, + p.FirstName, + p.LastName, + DateOfBirth = p.BirthDate.ToThaiShortDate(), + RegistrationAddress = "-", + OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false), + DateAppoint = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(), + Salaries = profile_salaries, + SalaryAmount = p.Salaries.Count == 0 ? "-" + : $"{p.Salaries.OrderByDescending(s => s.Date.Value).FirstOrDefault().Amount.Value.ToString("#,##0")}", + Education = p.Educations.Count == 0 ? "-" + : $"{p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Degree} {p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Field}" + }).FirstOrDefault(); + + var data = new List(); + var c = 1; + if (profile.Salaries.Count == 0) + { + var ret2 = new + { + CitizenId = profile.CitizenId, + Prefix = profile.Prefix, + FirstName = profile.FirstName, + LastName = profile.LastName, + DateOfBirth = profile.DateOfBirth, + RegistrationAddress = profile.RegistrationAddress, + SalaryAmount = profile.SalaryAmount, + Education = profile.Education, + AppointText = "", + SalaryDate = profile.DateAppoint, + PositionName = "", + OCFullPath = profile.OcFullPath + }; + data.Add(ret2); + } + var old_date = DateTime.Now; + var old_position = ""; + var old_ocid = Guid.NewGuid(); + dynamic ret; + + foreach (var s in profile.Salaries) + { + //if((old_date.Date != s.SalaryDateAnnounce.Value.Date)) + //{ + // old_date = s.SalaryDateAnnounce.Value; + // old_position= s.PositionName; + // old_ocid = s.OcId; + + // ret = new + // { + // CitizenId = profile.CitizenId, + // Prefix = profile.Prefix, + // FirstName = profile.FirstName, + // LastName = profile.LastName, + // DateOfBirth = profile.DateOfBirth, + // RegistrationAddress = profile.RegistrationAddress, + // SalaryAmount = profile.SalaryAmount, + // Education = profile.Education, + // AppointText = c == 1 ? "(เริ่มรับราชการ)" : "", + // SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(), + // PositionName = s.PositionName, + // OCFullPath = CoreCommandReport.GetOrganizationNameFullPath(s.OcId, false, false) + // }; + // data.Add(ret); + //} + if (old_position != s.PositionName) + { + old_date = s.SalaryDateAnnounce.Value; + old_position = s.PositionName; + old_ocid = s.OcId.Value; + ret = new + { + CitizenId = profile.CitizenId, + Prefix = profile.Prefix, + FirstName = profile.FirstName, + LastName = profile.LastName, + DateOfBirth = profile.DateOfBirth, + RegistrationAddress = profile.RegistrationAddress, + SalaryAmount = profile.SalaryAmount, + Education = profile.Education, + AppointText = c == 1 ? "(เริ่มรับราชการ)" : "", + SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(), + PositionName = s.PositionName, + OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false) + }; + data.Add(ret); + } + else if (old_ocid != s.OcId) + { + old_date = s.SalaryDateAnnounce.Value; + old_position = s.PositionName; + old_ocid = s.OcId.Value; + ret = new + { + CitizenId = profile.CitizenId, + Prefix = profile.Prefix, + FirstName = profile.FirstName, + LastName = profile.LastName, + DateOfBirth = profile.DateOfBirth, + RegistrationAddress = profile.RegistrationAddress, + SalaryAmount = profile.SalaryAmount, + Education = profile.Education, + AppointText = c == 1 ? "(เริ่มรับราชการ)" : "", + SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(), + PositionName = s.PositionName, + OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false) + }; + data.Add(ret); + } + + c++; + } + + var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp"); + + ReportPackager reportPackager = new ReportPackager(); + Telerik.Reporting.Report? report = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile)) + { + report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + } + + report.DataSource = data; + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + + InstanceReportSource instanceReportSource = new InstanceReportSource() + { + ReportDocument = report + }; + + + ReportProcessor reportProcessor = new ReportProcessor(_configuration); + RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo); + + var content = result.DocumentBytes; + return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_{data.First().CitizenId}.pdf"); + + + + } + catch (Exception ex) + { + return Error(ex, "ไม่สามารถแสดงผลรายงานได้!!!"); + } + } + + + [HttpGet("kk1/{id:length(36)}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetKK1Report(Guid id) + { + try + { + var profile = (from p in _context.Profiles + join pf in _context.Prefixes on p.PrefixId equals pf.Id into p_pf_join + from p_pf in p_pf_join.DefaultIfEmpty() + join cpf in _context.Prefixes on p.CouplePrefixId equals cpf.Id into c_pf_join + from c_pf in c_pf_join.DefaultIfEmpty() + join fpf in _context.Prefixes on p.FatherPrefixId equals fpf.Id into f_pf_join + from f_pf in f_pf_join.DefaultIfEmpty() + join mpf in _context.Prefixes on p.MotherPrefixId equals mpf.Id into m_pf_join + from m_pf in m_pf_join.DefaultIfEmpty() + where p.Id == id + select new + { + p.CitizenId, + Prefix = p_pf == null ? "" : p_pf.Name, + p.FirstName, + p.LastName, + FullName = $"{p.FirstName} {p.LastName}", + BirthDay = p.BirthDate.Day, + BirthDayText = Convert.ToDecimal(p.BirthDate.Day).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""), + BirthMonth = p.BirthDate.Month.ToThaiMonth(), + BirthYear = p.BirthDate.Year.ToThaiYear(), + BirthYearText = Convert.ToDecimal(p.BirthDate.Year.ToThaiYear()).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""), + Address = "", + District = "", + Area = "", + Province = "", + Telephone = p.TelephoneNumber, + CouplePrefix = c_pf == null ? "" : c_pf.Name, + CoupleFullName = $"{p.CoupleFirstName} {p.CoupleLastName}".Trim(), + FatherPrefix = f_pf == null ? "" : f_pf.Name, + FatherFullName = $"{p.FatherFirstName} {p.FatherLastName}".Trim(), + MotherPrefix = m_pf == null ? "" : m_pf.Name, + MotherFullName = $"{p.MotherFirstName} {p.MotherLastName}".Trim(), + OcId = p.OcId, + OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false), + Division = "", + Institute = "", + StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate(), + AppointDate = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(), + BirthDate = p.BirthDate.ToThaiShortDate(), + RetireDate = p.BirthDate.CalculateRetireDate().ToThaiShortDate(), + }).ToList(); + + if (!profile.Any()) + return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound); + + // certificate + var cert = (from c in _context.ProfileCertificates.AsQueryable() + where c.Profile.Id == id + orderby c.IssueDate.Value.Year + select new + { + c.CertificateType, + c.Issuer, + c.CertificateNo, + IssueDate = c.IssueDate == null ? "" : c.IssueDate.Value.ToThaiShortDate() + }).ToList(); + + // add temp rows + while (cert.Count < 3) + { + cert.Add(new + { + CertificateType = "", + Issuer = "", + CertificateNo = "", + IssueDate = "" + }); + } + + // training + var training = (from t in _context.ProfileTrainings.AsQueryable() + where t.Profile.Id == id + orderby t.StartDate.Value.Year + select new + { + Institute = t.Host, + Start = t.StartDate == null ? "" : t.StartDate.Value.Year.ToThaiYear().ToString(), + End = t.EndDate == null ? "" : t.EndDate.Value.Year.ToThaiYear().ToString(), + Level = "", + Degree = t.Subject, + Field = "" + }).ToList(); + + while (training.Count < 3) + { + training.Add(new + { + Institute = "", + Start = "", + End = "", + Level = "", + Degree = "", + Field = "" + }); + } + + // disciplines + var discipline = (from d in _context.ProfileDisciplines.AsQueryable() + where d.Profile.Id == id + orderby d.Date.Value.Year + select new + { + DisciplineYear = d.Date == null ? "" : d.Date.Value.Year.ToThaiYear().ToString(), + DisciplineDetail = d.Detail, + RefNo = d.RefCommandNo + }).ToList(); + + while (discipline.Count < 3) + { + discipline.Add(new + { + DisciplineYear = "", + DisciplineDetail = "", + RefNo = "" + }); + } + + // education + var education = (from e in _context.ProfileEducations.AsQueryable() + where e.Profile.Id == id + orderby e.StartDate.Value.Year + select new + { + Institute = e.Institute, + Start = e.StartDate == null ? "" : e.StartDate.Value.Year.ToThaiYear().ToString(), + End = e.EndDate == null ? "" : e.EndDate.Value.Year.ToThaiYear().ToString(), + Level = e.EducationLevel, + Degree = e.Degree, + Field = e.Field.Trim() == "-" ? "" : e.Field + }).ToList(); + + while (education.Count < 4) + { + education.Add(new + { + Institute = "", + Start = "", + End = "", + Level = "", + Degree = "", + Field = "" + }); + } + + + + + + + + var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp"); + + ReportPackager reportPackager = new ReportPackager(); + Telerik.Reporting.Report? report = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile)) + { + report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + } + report.DataSource = profile; + + // binding to table + var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"]; + tblCertificate.DataSource = cert; + + var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"]; + tblTraining.DataSource = training; + + var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"]; + tblDiscipline.DataSource = discipline; + + var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"]; + tblEducation.DataSource = education; + + try + { + // Get avatar Image + var picContent = (await _minioService.DownloadFileAsync(Guid.Parse("08db510a-a7cb-44ef-85c8-f5c214f87972"))).FileContent; + var pictureBox = (Telerik.Reporting.PictureBox)report.Items["pageFooterSection1"].Items["picAvatar"]; + pictureBox.Value = Image.FromStream(new MemoryStream(picContent)); + } + catch { } + + + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + + InstanceReportSource instanceReportSource = new InstanceReportSource() + { + ReportDocument = report + }; + + + ReportProcessor reportProcessor = new ReportProcessor(_configuration); + RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo); + + // byte array waiting for merge pdf + var content = result.DocumentBytes; + + // page2 + var salary = (from s in _context.ProfileSalaries + join pos in _context.PositionPaths on s.PositionId equals pos.Id + join pos_no in _context.PositionNumbers on s.PosNoId equals pos_no.Id + join pos_lv in _context.PositionLevels on s.PositionLevelId equals pos_lv.Id + join pos_type in _context.PositionTypes on s.PositionTypeId equals pos_type.Id + where s.Profile.Id == id + orderby s.Date.Value + select new + { + SalaryDate = s.Date == null ? "" : s.Date == new DateTime(1, 1, 1) ? "" : s.Date.Value.ToThaiShortDate(), + Position = s.SalaryClass, + PosNo = pos_no.Name, + Rank = pos_lv.Name, + Salary = s.Amount == null ? "" : s.Amount.ToString().ToInteger().ToNumericText(), + RefAll = s.SalaryRef, + PositionType = pos_type.Name, + PositionLevel = pos_lv.Name, + PositionAmount = s.PositionSalaryAmount, + FullName = $"{s.Profile.FirstName} {s.Profile.LastName}", + OcFullPath = _profileService.GetOrganizationNameFullPath(s.Profile.OcId.Value, false, false), + }).ToList(); + + var rptFile2 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page2.trdp"); + + ReportPackager reportPackager2 = new ReportPackager(); + Telerik.Reporting.Report? report2 = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile2)) + { + report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + } + report2.DataSource = salary; + // binding to table + var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"]; + tblSalary.DataSource = salary; + + System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable(); + + InstanceReportSource instanceReportSource2 = new InstanceReportSource() + { + ReportDocument = report2 + }; + + + ReportProcessor reportProcessor2 = new ReportProcessor(_configuration); + RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2); + + // byte array waiting for merge pdf + var content2 = result2.DocumentBytes; + + // merge pdf + using (MemoryStream ms = new MemoryStream()) + { + using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true))) + { + // Create reader from bytes + using (MemoryStream memoryStream = new MemoryStream(content)) + { + // Create reader from bytes + using (PdfReader reader = new PdfReader(memoryStream)) + { + PdfDocument srcDoc = new PdfDocument(reader); + srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf); + } + } + + // Create reader from bytes + using (MemoryStream memoryStream = new MemoryStream(content2)) + { + // Create reader from bytes + using (PdfReader reader = new PdfReader(memoryStream)) + { + PdfDocument srcDoc = new PdfDocument(reader); + srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf); + } + } + + pdf.Close(); + } + + var fileContent = ms.ToArray(); + return File(fileContent, "application/pdf", $"กก_1_{id}.pdf"); + } + } + catch (Exception ex) + { + return Error(ex); + } + } + + #endregion + } +} diff --git a/Core/GlobalMessages.cs b/Core/GlobalMessages.cs new file mode 100644 index 0000000..30057cf --- /dev/null +++ b/Core/GlobalMessages.cs @@ -0,0 +1,11 @@ +namespace BMA.EHR.Recruit.Service.Core +{ + public class GlobalMessages + { + public const string FileNotFoundOnServer = "ไม่พบไฟล์ในระบบ!!"; + public const string CannotInsertToDatabase = "ไม่สามารถบันทึกลงฐานข้อมูลได้!!"; + public const string InvalidRequestParam = "Request parameter ไม่ถูกต้อง!!"; + public const string NoFileToUpload = "ไม่พบไฟล์เพื่อทำการอัพโหลด"; + public const string DataNotFound = "ไม่พบข้อมูลในระบบ"; + } +} diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index 78f6a1a..b6ded4b 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -1,4 +1,7 @@ -using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.MetaData.Service.Models; +using BMA.EHR.Profile.Service.Models; +using BMA.EHR.Profile.Service.Models.HR; +using BMA.EHR.Recruit.Service.Models.Documents; using BMA.EHR.Recruit.Service.Models.Recruits; using Microsoft.EntityFrameworkCore; @@ -52,5 +55,7 @@ namespace BMA.EHR.Report.Service.Data public DbSet RecruitDocuments { get; set; } public DbSet RecruitImportHistories { get; set; } - } + + + } } diff --git a/Data/EHRDbContext.cs b/Data/EHRDbContext.cs new file mode 100644 index 0000000..9abfbfb --- /dev/null +++ b/Data/EHRDbContext.cs @@ -0,0 +1,225 @@ +using BMA.EHR.MetaData.Service.Models; +using BMA.EHR.Profile.Service.Models; +using BMA.EHR.Profile.Service.Models.HR; +using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.Recruit.Service.Models.Recruits; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Report.Service.Data +{ + public class EHRDbContext : DbContext + { + public EHRDbContext(DbContextOptions options) + : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + //base.OnModelCreating(modelBuilder); + + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + } + + public DbSet Documents { get; set; } + + #region " From Existing DB " + + public DbSet AvailablePositionLevels { get; set; } + + public DbSet PositionMasters { get; set; } + + public DbSet Organizations { get; set; } + + public DbSet PositionNumbers { get; set; } + + public DbSet OrganizationPositions { get; set; } + + public DbSet Prefixes { get; set; } + + public DbSet BloodGroups { get; set; } + + public DbSet Genders { get; set; } + + public DbSet PhysicalStatuses { get; set; } + + public DbSet Religions { get; set; } + + public DbSet EducationLevels { get; set; } + + public DbSet PositionPaths { get; set; } + + public DbSet PositionTypes { get; set; } + + public DbSet PositionEmployeePositions { get; set; } + + public DbSet PositionEmployeePositionSides { get; set; } + + public DbSet PositionEmployeeGroups { get; set; } + + public DbSet PositionEmployeeLines { get; set; } + + public DbSet PositionEmployeeLevels { get; set; } + + public DbSet PositionEmployeeStatuses { get; set; } + + public DbSet PositionLines { get; set; } + + public DbSet PositionExecutives { get; set; } + + public DbSet PositionStatuss { get; set; } + + public DbSet PositionLevels { get; set; } + + public DbSet Relationships { get; set; } + + public DbSet Positions { get; set; } + + public DbSet PositionPathSides { get; set; } + + public DbSet PositionExecutiveSides { get; set; } + + public DbSet InsigniaTypes { get; set; } + + public DbSet Insignias { get; set; } + + public DbSet Provinces { get; set; } + + public DbSet Districts { get; set; } + + public DbSet SubDistricts { get; set; } + + public DbSet Holidays { get; set; } + + public DbSet OrganizationTypes { get; set; } + + public DbSet OrganizationLevels { get; set; } + + public DbSet OrganizationOrganizations { get; set; } + + public DbSet OrganizationShortNames { get; set; } + + public DbSet OrganizationStatuses { get; set; } + + public DbSet OrganizationAgencys { get; set; } + + public DbSet OrganizationGovernmentAgencys { get; set; } + + public DbSet OrganizationTelExternals { get; set; } + + public DbSet OrganizationTelInternals { get; set; } + + public DbSet OrganizationFaxs { get; set; } + + public DbSet RoyalHierarchys { get; set; } + + public DbSet RoyalTypes { get; set; } + + public DbSet Royals { get; set; } + + #endregion + + public DbSet Profiles { get; set; } + + public DbSet ProfileEducations { get; set; } + + public DbSet ProfileEducationHistorys { get; set; } + + public DbSet ProfileHonors { get; set; } + + public DbSet ProfileHonorHistorys { get; set; } + + public DbSet ProfileAssessments { get; set; } + + public DbSet ProfileAssessmentHistorys { get; set; } + + public DbSet ProfileDisciplines { get; set; } + + public DbSet ProfileDisciplineHistorys { get; set; } + + public DbSet ProfileCertificates { get; set; } + + public DbSet ProfileCertificateHistorys { get; set; } + + public DbSet ProfileTrainings { get; set; } + + public DbSet ProfileTrainingHistorys { get; set; } + + public DbSet ProfileInsignias { get; set; } + + public DbSet ProfileInsigniaHistorys { get; set; } + + public DbSet ProfileSalaries { get; set; } + + public DbSet ProfileSalaryHistories { get; set; } + + public DbSet ProfileSalaryOrganizations { get; set; } + + public DbSet ProfileSalaryPositions { get; set; } + + public DbSet ProfileSalaryPositionsNumbers { get; set; } + + public DbSet ProfileHistory { get; set; } + + public DbSet ProfileCoupleHistory { get; set; } + + public DbSet ProfileFatherHistory { get; set; } + + public DbSet ProfileMotherHistory { get; set; } + + public DbSet ProfileFamilyHistory { get; set; } + + public DbSet ProfileGovernmentHistory { get; set; } + + public DbSet ProfileLeaves { get; set; } + + public DbSet ProfileLeaveHistorys { get; set; } + + public DbSet ProfileSalaryPositionLevels { get; set; } + + public DbSet ProfileSalaryPositionTypes { get; set; } + + public DbSet ProfileChildrens { get; set; } + + public DbSet ProfileChildrenHistories { get; set; } + + public DbSet ProfilePapers { get; set; } + + public DbSet ProfileCurrentAddressHistories { get; set; } + + public DbSet ProfileRegistrationAddressHistories { get; set; } + + public DbSet ProfileAddressHistories { get; set; } + + public DbSet ProfileOthers { get; set; } + + public DbSet ProfileOtherHistorys { get; set; } + + public DbSet ProfileAbilitys { get; set; } + + public DbSet ProfileAbilityHistorys { get; set; } + + public DbSet ProfileDutys { get; set; } + + public DbSet ProfileDutyHistorys { get; set; } + + public DbSet ProfileNopaids { get; set; } + + public DbSet ProfileNopaidHistorys { get; set; } + + public DbSet ProfileAvatarHistories { get; set; } + + public DbSet ProfilePositions { get; set; } + } +} diff --git a/Data/ExamDbContext.cs b/Data/ExamDbContext.cs new file mode 100644 index 0000000..19e8268 --- /dev/null +++ b/Data/ExamDbContext.cs @@ -0,0 +1,79 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.Recurit.Exam.Service.Models; +using BMA.EHR.Recurit.Exam.Service.Models.Disables; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Report.Service.Data +{ + public class ExamDbContext : DbContext + { + public ExamDbContext(DbContextOptions options) + : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + //base.OnModelCreating(modelBuilder); + + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + //modelBuilder.Ignore(); + } + + public DbSet PeriodExams { get; set; } + + public DbSet Candidates { get; set; } + + public DbSet Careers { get; set; } + + public DbSet Educations { get; set; } + + public DbSet Documents { get; set; } + + public DbSet CandidateDocuments { get; set; } + + public DbSet PositionExams { get; set; } + + public DbSet BankExams { get; set; } + + public DbSet PeriodExamDocuments { get; set; } + + public DbSet PeriodExamImages { get; set; } + + public DbSet CMSCandidates { get; set; } + + public DbSet CMSAgencys { get; set; } + + public DbSet CMSGovernments { get; set; } + + public DbSet Disables { get; set; } + + public DbSet DisableAddresses { get; set; } + + public DbSet DisableOccupations { get; set; } + + public DbSet DisableCertificates { get; set; } + + public DbSet DisableEducations { get; set; } + + public DbSet ScoreImports { get; set; } + + public DbSet DisableScores { get; set; } + + public DbSet DisablePayments { get; set; } + + public DbSet DisableDocuments { get; set; } + + public DbSet DisableImportHistories { get; set; } + } +} diff --git a/Models/AvailablePositionLevelEntity.cs b/Models/AvailablePositionLevelEntity.cs new file mode 100644 index 0000000..b797d9d --- /dev/null +++ b/Models/AvailablePositionLevelEntity.cs @@ -0,0 +1,25 @@ + +using BMA.EHR.Report.Service.Models; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models +{ + public class AvailablePositionLevelEntity : EntityBase + { + + [ForeignKey("PositionMasterId")] + public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; } + + [Column(Order = 2), Comment("PositionMasterId")] + public Guid? PositionMasterId { get; set; } + + [Column(Order = 3), Comment("PositionLevelId")] + public Guid? PositionLevelId { get; set; } + + + + + } +} diff --git a/Models/Exam/BankExam.cs b/Models/Exam/BankExam.cs new file mode 100644 index 0000000..71d447a --- /dev/null +++ b/Models/Exam/BankExam.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class BankExam : EntityBase + { + [Required, Comment("Id การสอบ")] + public virtual PeriodExam? PeriodExam { get; set; } + + [Comment("เลขบัญชี")] + public string? AccountNumber { get; set; } + + [Comment("ธนาคาร")] + public string? BankName { get; set; } + + [Comment("ชื่อบัญชี")] + public string? AccountName { get; set; } + } +} diff --git a/Models/Exam/CMSAgency.cs b/Models/Exam/CMSAgency.cs new file mode 100644 index 0000000..c017a70 --- /dev/null +++ b/Models/Exam/CMSAgency.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class CMSAgency : EntityBase + { + [Required, Comment("Id CMS")] + public virtual CMSCandidate? CMSCandidate { get; set; } + + [Comment("ชื่อลิงค์")] + public string? Name { get; set; } + + [Comment("ลิงค์")] + public string? Link { get; set; } + } +} diff --git a/Models/Exam/CMSCandidate.cs b/Models/Exam/CMSCandidate.cs new file mode 100644 index 0000000..f2dce56 --- /dev/null +++ b/Models/Exam/CMSCandidate.cs @@ -0,0 +1,64 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class CMSCandidate : EntityBase + { + + [Comment("Id โลโก้เว็บ")] + public virtual Document? LogoImg { get; set; } + + [Comment("Id Banner")] + public virtual Document? BannerImg { get; set; } + + + [Comment("ชื่อเว็บภาษาไทย")] + public string? NameTh { get; set; } + + [Comment("ชื่อย่อ")] + public string? ShortName { get; set; } + + [Comment("ชื่อเว็บภาษาอังกฤษ")] + public string? NameEn { get; set; } + + [Comment("ข้อมูลเว็บโดยย่อ")] + public string? Description { get; set; } + + + [Comment("ข้อมูลเกี่ยวกับเรา")] + public string? About { get; set; } + + [Comment("ที่อยู่ปัจจุบัน")] + public string? Address { get; set; } + + [Comment("Id จังหวัด")] + public Guid? ProvinceId { get; set; } + + [Comment("จังหวัด")] + public string? ProvinceName { get; set; } + + [Comment("Id อำเภอ")] + public Guid? DistrictId { get; set; } + + [Comment("อำเภอ")] + public string? DistrictName { get; set; } + + [Comment("Id ตำบล")] + public Guid? SubDistrictId { get; set; } + + [Comment("ตำบล")] + public string? SubDistrictName { get; set; } + + [MaxLength(10), Comment("รหัสไปรษณีย์")] + public string? ZipCode { get; set; } + + [MaxLength(20), Comment("โทรศัพท์")] + public string? Telephone { get; set; } + + public List CMSAgencys { get; set; } = new List(); + + public List CMSGovernments { get; set; } = new List(); + } +} diff --git a/Models/Exam/CMSGovernment.cs b/Models/Exam/CMSGovernment.cs new file mode 100644 index 0000000..d946fca --- /dev/null +++ b/Models/Exam/CMSGovernment.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class CMSGovernment : EntityBase + { + [Required, Comment("Id CMS")] + public virtual CMSCandidate? CMSCandidate { get; set; } + + [Comment("ชื่อลิงค์")] + public string? Name { get; set; } + + [Comment("ลิงค์")] + public string? Link { get; set; } + } +} diff --git a/Models/Exam/Candidate.cs b/Models/Exam/Candidate.cs new file mode 100644 index 0000000..3dfed1e --- /dev/null +++ b/Models/Exam/Candidate.cs @@ -0,0 +1,256 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Candidate : EntityBase + { + [Required, Comment("Id การสอบ")] + public virtual PeriodExam? PeriodExam { get; set; } + + [Comment("Id ตำแหน่งสอบ")] + public virtual PositionExam? PositionExam { get; set; } + + [Required, MaxLength(40), Comment("User Id ผู้สมัคร")] + public string UserId { get; set; } = string.Empty; + + [Required, MaxLength(20), Comment("สถานะผู้สมัคร")] + public string Status { get; set; } = "register"; + + [Comment("เลขประจำตัวสอบ")] + public string? ExamIdenNumber { get; set; } + + [Comment("เลขที่นั่งสอบ")] + public string? SeatNumber { get; set; } + + [Comment("คะแนนเต็มภาค ข")] + public string? PointTotalB { get; set; } + + [Comment("คะแนนภาค ข")] + public string? PointB { get; set; } + + [Comment("ผลสอบภาค ข")] + public string? ResultB { get; set; } + + [Comment("คะแนนเต็มภาค ค")] + public string? PointTotalC { get; set; } + + [Comment("คะแนนภาค ค")] + public string? PointC { get; set; } + + [Comment("ผลสอบภาค ค")] + public string? ResultC { get; set; } + + [Comment("Id รูปโปรไฟล์")] + public virtual Document? ProfileImg { get; set; } + + [Comment("Id หลักฐานชำระเงิน")] + public virtual Document? PaymentImg { get; set; } + + [Comment("ลำดับที่สอบได้")] + public string? Number { get; set; } + + + [Comment("Id คำนำหน้าชื่อ")] + public Guid? PrefixId { get; set; } + + [Comment("คำนำหน้าชื่อ")] + public string? PrefixName { get; set; } + + [MaxLength(100), Column(Order = 1), Comment("ชื่อจริง")] + public string? FirstName { get; set; } + + [MaxLength(100), Column(Order = 2), Comment("นามสกุล")] + public string? LastName { get; set; } + + [MaxLength(40), Column(Order = 3), Comment("สัญชาติ")] + public string? Nationality { get; set; } + + [MaxLength(40), Comment("วันเกิด")] + public DateTime? DateOfBirth { get; set; } + + [Comment("Id สถานภาพ")] + public Guid? RelationshipId { get; set; } + + [Comment("สถานภาพ")] + public string? RelationshipName { get; set; } + + [MaxLength(200), Comment("อีเมล")] + public string? Email { get; set; } + + [MaxLength(20), Comment("เลขประจำตัวประชาชน")] + public string? CitizenId { get; set; } + + [Comment("Id เขตที่ออกบัตรประชาชน")] + public Guid? CitizenDistrictId { get; set; } + + [Comment("เขตที่ออกบัตรประชาชน")] + public string? CitizenDistrictName { get; set; } + + [Comment("Id จังหวัดที่ออกบัตรประชาชน")] + public Guid? CitizenProvinceId { get; set; } + + [Comment("จังหวัดที่ออกบัตรประชาชน")] + public string? CitizenProvinceName { get; set; } + + [Comment("วันที่ออกบัตร")] + public DateTime? CitizenDate { get; set; } + + [MaxLength(20), Comment("โทรศัพท์")] + public string? Telephone { get; set; } + + [MaxLength(20), Comment("โทรศัพท์มือถือ")] + public string? MobilePhone { get; set; } + + [Comment("ความสามารถพิเศษ")] + public string? Knowledge { get; set; } + + + + + [Comment("ที่อยู่ตามทะเบียนบ้าน")] + public string? RegistAddress { get; set; } + + [Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")] + public Guid? RegistProvinceId { get; set; } + + [Comment("จังหวัดที่อยู่ตามทะเบียนบ้าน")] + public string? RegistProvinceName { get; set; } + + [Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")] + public Guid? RegistDistrictId { get; set; } + + [Comment("อำเภอที่อยู่ตามทะเบียนบ้าน")] + public string? RegistDistrictName { get; set; } + + [Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")] + public Guid? RegistSubDistrictId { get; set; } + + [Comment("ตำบลที่อยู่ตามทะเบียนบ้าน")] + public string? RegistSubDistrictName { get; set; } + + [MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")] + public string? RegistZipCode { get; set; } + + [Comment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน")] + public bool? RegistSame { get; set; } + + [Comment("ที่อยู่ปัจจุบัน")] + public string? CurrentAddress { get; set; } + + [Comment("Id จังหวัดที่อยู่ปัจจุบัน")] + public Guid? CurrentProvinceId { get; set; } + + [Comment("จังหวัดที่อยู่ปัจจุบัน")] + public string? CurrentProvinceName { get; set; } + + [Comment("Id อำเภอที่อยู่ปัจจุบัน")] + public Guid? CurrentDistrictId { get; set; } + + [Comment("อำเภอที่อยู่ปัจจุบัน")] + public string? CurrentDistrictName { get; set; } + + [Comment("Id ตำบลที่อยู่ปัจจุบัน")] + public Guid? CurrentSubDistrictId { get; set; } + + [Comment("ตำบลที่อยู่ปัจจุบัน")] + public string? CurrentSubDistrictName { get; set; } + + [MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")] + public string? CurrentZipCode { get; set; } + + + + [Comment("คู่สมรส")] + public bool? Marry { get; set; } + + [Comment("Id คำนำหน้าชื่อคู่สมรส")] + public Guid? MarryPrefixId { get; set; } + + [Comment("คำนำหน้าชื่อคู่สมรส")] + public string? MarryPrefixName { get; set; } + + [MaxLength(100), Comment("ชื่อจริงคู่สมรส")] + public string? MarryFirstName { get; set; } + + [MaxLength(100), Comment("นามสกุลคู่สมรส")] + public string? MarryLastName { get; set; } + + [MaxLength(200), Comment("อาชีพคู่สมรส")] + public string? MarryOccupation { get; set; } + + [MaxLength(100), Comment("สัญชาติคู่สมรส")] + public string? MarryNationality { get; set; } + + [Comment("Id คำนำหน้าชื่อบิดา")] + public Guid? FatherPrefixId { get; set; } + + [Comment("คำนำหน้าชื่อบิดา")] + public string? FatherPrefixName { get; set; } + + [MaxLength(100), Comment("ชื่อจริงบิดา")] + public string? FatherFirstName { get; set; } + + [MaxLength(100), Comment("นามสกุลบิดา")] + public string? FatherLastName { get; set; } + + [MaxLength(200), Comment("อาชีพบิดา")] + public string? FatherOccupation { get; set; } + + [MaxLength(100), Comment("สัญชาติบิดา")] + public string? FatherNationality { get; set; } + + [Comment("Id คำนำหน้าชื่อมารดา")] + public Guid? MotherPrefixId { get; set; } + + [Comment("คำนำหน้าชื่อมารดา")] + public string? MotherPrefixName { get; set; } + + [MaxLength(100), Comment("ชื่อจริงมารดา")] + public string? MotherFirstName { get; set; } + + [MaxLength(100), Comment("นามสกุลมารดา")] + public string? MotherLastName { get; set; } + + [MaxLength(200), Comment("อาชีพมารดา")] + public string? MotherOccupation { get; set; } + + [MaxLength(100), Comment("สัญชาติมารดา")] + public string? MotherNationality { get; set; } + + + + [Comment("ประเภทอาชีพที่ทำงานมาก่อน")] + public string? OccupationType { get; set; } + + [Comment("ตำแหน่งอาชีพ")] + public string? OccupationPosition { get; set; } + + [Comment("สำนัก/บริษัท บริษัท")] + public string? OccupationCompany { get; set; } + + [Comment("กอง/ฝ่าย บริษัท")] + public string? OccupationDepartment { get; set; } + + [MaxLength(200), Comment("อีเมล บริษัท")] + public string? OccupationEmail { get; set; } + + [MaxLength(20), Comment("โทรศัพท์ บริษัท")] + public string? OccupationTelephone { get; set; } + + [Comment("เหตุผลการไม่อนุมัติ")] + public string? RejectDetail { get; set; } + + [Comment("ผลสมัครสอบ")] + public string? Pass { get; set; } + + [Comment("คะแนนความพึงพอใจ")] + public int? ReviewPoint { get; set; } + + [Comment("ข้อแนะนำ")] + public string? Review { get; set; } + + } +} diff --git a/Models/Exam/CandidateDocument.cs b/Models/Exam/CandidateDocument.cs new file mode 100644 index 0000000..00270b1 --- /dev/null +++ b/Models/Exam/CandidateDocument.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Recruit.Service.Models.Documents; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class CandidateDocument : EntityBase + { + [Required, Comment("Id ผู้สมัครสอบ")] + public virtual Candidate? Candidate { get; set; } + + [Required, Comment("Id ไฟล์เอกสาร")] + public virtual Document? Document { get; set; } + } +} diff --git a/Models/Exam/Career.cs b/Models/Exam/Career.cs new file mode 100644 index 0000000..c4561e0 --- /dev/null +++ b/Models/Exam/Career.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Career : EntityBase + { + [Required, Column(Order = 7), Comment("Id ผู้สมัคร")] + public virtual Candidate? Candidate { get; set; } + + [Required, Column(Order = 3), Comment("สถานที่ทำงาน/ฝึกงาน")] + public string Name { get; set; } = string.Empty; + + [Required, Column(Order = 4), Comment("ตำแหน่ง/ลักษณะงาน")] + public string Position { get; set; } = string.Empty; + + [Required, MaxLength(20), Column(Order = 5), Comment("เงินเดือนสุดท้ายก่อนออก")] + public int Salary { get; set; } + + [Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")] + public DateTime DurationStart { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")] + public DateTime DurationEnd { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 6), Comment("เหตุผลที่ออก")] + public string Reason { get; set; } = string.Empty; + } +} diff --git a/Models/Exam/Disable/Disable.cs b/Models/Exam/Disable/Disable.cs new file mode 100644 index 0000000..4d789ae --- /dev/null +++ b/Models/Exam/Disable/Disable.cs @@ -0,0 +1,82 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class Disable : EntityBase + { + + [Required, MaxLength(13), Comment("เลขประจำตัวประชาชน")] + public string CitizenId { get; set; } = string.Empty; + + [Required, MaxLength(50)] + public string ExamId { get; set; } = string.Empty; + + [Required, MaxLength(50)] + public string Prefix { get; set; } = string.Empty; + + [Required, MaxLength(150)] + public string FirstName { get; set; } = string.Empty; + + [Required, MaxLength(150)] + public string LastName { get; set; } = string.Empty; + + [MaxLength(20)] + public string Gendor { get; set; } = string.Empty; + + [MaxLength(200)] + public string National { get; set; } = string.Empty; + + [MaxLength(200)] + public string Race { get; set; } = string.Empty; + + [MaxLength(200)] + public string Religion { get; set; } = string.Empty; + + [Required] + public DateTime DateOfBirth { get; set; } + + [MaxLength(20)] + public string Marry { get; set; } = string.Empty; + + [MaxLength(1)] + public string Isspecial { get; set; } = "N"; + + [MaxLength(20)] + public string RefNo { get; set; } = string.Empty; + + [MaxLength(200)] + public string CitizenCardIssuer { get; set; } = string.Empty; + + public DateTime CitizenCardExpireDate { get; set; } + + [MaxLength(200)] + public string Remark { get; set; } = string.Empty; + + [MaxLength(1)] + public string Qualified { get; set; } = "Y"; + + public PeriodExam? PeriodExam { get; set; } + + public virtual List Addresses { get; set; } = new List(); + + public virtual List Occupations { get; set; } = new List(); + + public virtual List Certificates { get; set; } = new List(); + + public virtual List Educations { get; set; } = new List(); + + public virtual List Payments { get; set; } = new List(); + + public virtual List Documents { get; set; } = new List(); + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public DateTime ModifiedDate { get; set; } + + public DateTime ApplyDate { get; set; } + + public string? PositionName { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableAddress.cs b/Models/Exam/Disable/DisableAddress.cs new file mode 100644 index 0000000..2d746ec --- /dev/null +++ b/Models/Exam/Disable/DisableAddress.cs @@ -0,0 +1,63 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableAddress : EntityBase + { + [MaxLength(200)] + public string Address { get; set; } + + [MaxLength(200)] + public string Moo { get; set; } + + [MaxLength(200)] + public string Soi { get; set; } + + [MaxLength(200)] + public string Road { get; set; } + + [MaxLength(200)] + public string District { get; set; } + + [MaxLength(200)] + public string Amphur { get; set; } + + [MaxLength(200)] + public string Province { get; set; } + + [MaxLength(5)] + public string ZipCode { get; set; } + + [MaxLength(200)] + public string Telephone { get; set; } + + [MaxLength(200)] + public string Mobile { get; set; } + + [MaxLength(200)] + public string Address1 { get; set; } + + [MaxLength(200)] + public string Moo1 { get; set; } + + [MaxLength(200)] + public string Soi1 { get; set; } + + [MaxLength(200)] + public string Road1 { get; set; } + + [MaxLength(200)] + public string District1 { get; set; } + + [MaxLength(200)] + public string Amphur1 { get; set; } + + [MaxLength(200)] + public string Province1 { get; set; } + + [MaxLength(5)] + public string ZipCode1 { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableCertificate.cs b/Models/Exam/Disable/DisableCertificate.cs new file mode 100644 index 0000000..b1108ac --- /dev/null +++ b/Models/Exam/Disable/DisableCertificate.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableCertificate : EntityBase + { + [MaxLength(50)] + public string CertificateNo { get; set; } + + [MaxLength(200)] + public string Description { get; set; } + + public DateTime IssueDate { get; set; } + + public DateTime ExpiredDate { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableDocument.cs b/Models/Exam/Disable/DisableDocument.cs new file mode 100644 index 0000000..a3dfa82 --- /dev/null +++ b/Models/Exam/Disable/DisableDocument.cs @@ -0,0 +1,13 @@ +using BMA.EHR.Recruit.Service.Models.Documents; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableDocument : EntityBase + { + public DateTime CreatedDate { get; set; } + + public Document DocumentFile { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableEducation.cs b/Models/Exam/Disable/DisableEducation.cs new file mode 100644 index 0000000..cb2cbb3 --- /dev/null +++ b/Models/Exam/Disable/DisableEducation.cs @@ -0,0 +1,33 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableEducation : EntityBase + { + [MaxLength(200)] + public string Degree { get; set; } + + [MaxLength(200)] + public string Major { get; set; } + + [MaxLength(20)] + public string MajorGroupId { get; set; } + + [MaxLength(200)] + public string MajorGroupName { get; set; } + + [MaxLength(200)] + public string University { get; set; } + public double GPA { get; set; } = 0.0; + + [MaxLength(1000)] + public string Specialist { get; set; } + + [MaxLength(200)] + public string HighDegree { get; set; } + + public DateTime BachelorDate { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableImportHistory.cs b/Models/Exam/Disable/DisableImportHistory.cs new file mode 100644 index 0000000..bddb2d4 --- /dev/null +++ b/Models/Exam/Disable/DisableImportHistory.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableImportHistory : EntityBase + { + [Required, Comment("รายละเอียดการนำเข้า"), Column(Order = 1)] + public string Description { get; set; } = string.Empty; + + public PeriodExam PeriodExam { get; set; } + } +} \ No newline at end of file diff --git a/Models/Exam/Disable/DisableOccupation.cs b/Models/Exam/Disable/DisableOccupation.cs new file mode 100644 index 0000000..23f59c6 --- /dev/null +++ b/Models/Exam/Disable/DisableOccupation.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableOccupation : EntityBase + { + [MaxLength(200)] + public string Occupation { get; set; } + + [MaxLength(200)] + public string WorkAge { get; set; } + + [MaxLength(200)] + public string Position { get; set; } + + [MaxLength(200)] + public string Workplace { get; set; } + + [MaxLength(200)] + public string Telephone { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisablePayment.cs b/Models/Exam/Disable/DisablePayment.cs new file mode 100644 index 0000000..437e963 --- /dev/null +++ b/Models/Exam/Disable/DisablePayment.cs @@ -0,0 +1,56 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisablePayment : EntityBase + { + [MaxLength(50)] + public string PaymentId { get; set; } + + [MaxLength(50)] + public string CompanyCode { get; set; } + + [MaxLength(50)] + public string TextFile { get; set; } + + [MaxLength(50)] + public string BankCode { get; set; } + + [MaxLength(50)] + public string AccountNumber { get; set; } + + [MaxLength(50)] + public string TransDate { get; set; } + + [MaxLength(50)] + public string TransTime { get; set; } + + [MaxLength(200)] + public string CustomerName { get; set; } + + [MaxLength(50)] + public string RefNo1 { get; set; } + + [MaxLength(50)] + public string TermBranch { get; set; } + + [MaxLength(50)] + public string TellerId { get; set; } + + [MaxLength(50)] + public string CreditDebit { get; set; } + + [MaxLength(50)] + public string PaymentType { get; set; } + + [MaxLength(50)] + public string ChequeNo { get; set; } + + public decimal Amount { get; set; } + + [MaxLength(50)] + public string ChqueBankCode { get; set; } + + public Disable Disable { get; set; } + } +} diff --git a/Models/Exam/Disable/DisableScore.cs b/Models/Exam/Disable/DisableScore.cs new file mode 100644 index 0000000..1e081fc --- /dev/null +++ b/Models/Exam/Disable/DisableScore.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class DisableScore : EntityBase + { + [Required, MaxLength(50)] + public string ExamId { get; set; } + + public int SumA { get; set; } + + public int FullA { get; set; } + + public double PercentageA { get; set; } + + [MaxLength(50)] + public string AStatus { get; set; } + + public int SumB { get; set; } + + public int FullB { get; set; } + + public double PercentageB { get; set; } + + [MaxLength(50)] + public string BStatus { get; set; } + + public int SumAB { get; set; } + + [Required, MaxLength(50)] + public string ABStatus { get; set; } + + public int SumC { get; set; } + + public int FullC { get; set; } + + public double PercentageC { get; set; } + + [MaxLength(50)] + public string CStatus { get; set; } + + [Required, MaxLength(50)] + public string ExamStatus { get; set; } + + [MaxLength(200)] + public string Major { get; set; } + + [MaxLength(200), Comment("ลำดับที่สอบได้")] + public string Number { get; set; } = string.Empty; + + public ScoreImport ScoreImport { get; set; } + } +} diff --git a/Models/Exam/Disable/ScoreImport.cs b/Models/Exam/Disable/ScoreImport.cs new file mode 100644 index 0000000..90c32ee --- /dev/null +++ b/Models/Exam/Disable/ScoreImport.cs @@ -0,0 +1,19 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models.Disables +{ + public class ScoreImport : EntityBase + { + public int? Year { get; set; } + + public Document ImportFile { get; set; } = new Document(); + + public virtual List Scores { get; set; } = new List(); + + [ForeignKey("FK_Score_Import_ID")] + public Guid PeriodExamId { get; set; } + + public PeriodExam PeriodExam { get; set; } + } +} diff --git a/Models/Exam/District.cs b/Models/Exam/District.cs new file mode 100644 index 0000000..0d6c13d --- /dev/null +++ b/Models/Exam/District.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class District : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual List SubDistricts { get; set; } = new(); + + public virtual Province? Province { get; set; } + } +} diff --git a/Models/Exam/Education.cs b/Models/Exam/Education.cs new file mode 100644 index 0000000..2954925 --- /dev/null +++ b/Models/Exam/Education.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Education : EntityBase + { + [Required, Column(Order = 7), Comment("Id ผู้สมัคร")] + public virtual Candidate? Candidate { get; set; } + + [Comment("Idวุฒิที่ได้รับ")] + public Guid? EducationLevelId { get; set; } + + [Comment("วุฒิที่ได้รับ")] + public string? EducationLevelName { get; set; } + + [Required, Column(Order = 4), Comment("สาขาวิชา/วิชาเอก")] + public string Major { get; set; } = string.Empty; + + [Required, MaxLength(10), Column(Order = 6), Comment("คะแนนเฉลี่ยตลอดหลักสูตร")] + public float Scores { get; set; } + + [Required, Column(Order = 3), Comment("ชื่อสถานศึกษา")] + public string Name { get; set; } = string.Empty; + + [Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")] + public DateTime DurationStart { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")] + public DateTime DurationEnd { get; set; } = DateTime.Now.Date; + } +} diff --git a/Models/Exam/EducationLevel.cs b/Models/Exam/EducationLevel.cs new file mode 100644 index 0000000..314bd8c --- /dev/null +++ b/Models/Exam/EducationLevel.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class EducationLevel : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ระดับการศึกษา")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/Exam/EntityBase.cs b/Models/Exam/EntityBase.cs new file mode 100644 index 0000000..e83053c --- /dev/null +++ b/Models/Exam/EntityBase.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class EntityBase + { + [Key, Column(Order = 0), Comment("PrimaryKey")] + [JsonPropertyName("id")] + public Guid Id { get; set; } + + [Required, Column(Order = 100), Comment("สร้างข้อมูลเมื่อ")] + public DateTime CreatedAt { get; set; } = DateTime.Now; + + [Column(Order = 101), Comment("User Id ที่สร้างข้อมูล"), MaxLength(40)] + public string CreatedUserId { get; set; } = string.Empty; + + [Column(Order = 102), Comment("แก้ไขข้อมูลล่าสุดเมื่อ")] + public DateTime? LastUpdatedAt { get; set; } + + [Column(Order = 103), Comment("User Id ที่แก้ไขข้อมูลล่าสุด"), MaxLength(40)] + public string LastUpdateUserId { get; set; } = string.Empty; + + [Column(Order = 104), Comment("ชื่อ User ที่สร้างข้อมูล"), MaxLength(200)] + public string CreatedFullName { get; set; } = string.Empty; + + [Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)] + public string LastUpdateFullName { get; set; } = string.Empty; + } +} diff --git a/Models/Exam/OrganizationOrganization.cs b/Models/Exam/OrganizationOrganization.cs new file mode 100644 index 0000000..06c6532 --- /dev/null +++ b/Models/Exam/OrganizationOrganization.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class OrganizationOrganization : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/Exam/OrganizationShortName.cs b/Models/Exam/OrganizationShortName.cs new file mode 100644 index 0000000..8dfcac3 --- /dev/null +++ b/Models/Exam/OrganizationShortName.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class OrganizationShortName : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน")] + public string AgencyCode { get; set; } = string.Empty; + [Required, MaxLength(100), Column(Order = 2), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ")] + public string GovernmentCode { get; set; } = string.Empty; + [Required, MaxLength(100), Column(Order = 3), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 4), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/Exam/PeriodExam.cs b/Models/Exam/PeriodExam.cs new file mode 100644 index 0000000..6565920 --- /dev/null +++ b/Models/Exam/PeriodExam.cs @@ -0,0 +1,105 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.Recurit.Exam.Service.Models.Disables; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class PeriodExam : EntityBase + { + [Required, MaxLength(150), Column(Order = 8), Comment("ชื่อการสอบ")] + public string Name { get; set; } = string.Empty; + + [Required, Comment("ตรวจสอบเอกสารหลังประกาศผลสอบ")] + public bool CheckDocument { get; set; } = false; + + [Required, Comment("คนพิการ")] + public bool CheckDisability { get; set; } = false; + + [Column(Order = 9), Comment("รอบการสอบ")] + public int? Round { get; set; } + + [Comment("ปีงบประมาณ")] + public int? Year { get; set; } + + [Comment("ค่าธรรมเนียม")] + public float? Fee { get; set; } = 0; + + [Required, Column(Order = 1), Comment("วันเริ่มสมัครสอบ")] + public DateTime RegisterStartDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 2), Comment("วันสิ้นสุดสมัครสอบ")] + public DateTime RegisterEndDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 3), Comment("วันเริ่มชำระเงิน")] + public DateTime PaymentStartDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 4), Comment("วันสิ้นสุดชำระเงิน")] + public DateTime PaymentEndDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 5), Comment("วันประกาศผลสอบ")] + public DateTime AnnouncementDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 6), Comment("วันเริ่มประกาศ")] + public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 7), Comment("วันสิ้นสุดประกาศ")] + public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date; + + [Required, Comment("วันที่สอบ")] + public DateTime ExamDate { get; set; } = DateTime.Now.Date; + + [Comment("Id รหัสส่วนราชการ")] + public Guid? OrganizationCodeId { get; set; } + + [Comment("ชื่อรหัสส่วนราชการ")] + public string? OrganizationCodeName { get; set; } + + [Comment("Id หน่วยงาน")] + public Guid? OrganizationId { get; set; } + + [Comment("ชื่อหน่วยงาน")] + public string? OrganizationName { get; set; } + + [Comment("ชำระเงินผ่านกรุงไทย")] + public string? PaymentKrungThai { get; set; } + + [Comment("รายละเอียดสมัครสอบ")] + public string? Detail { get; set; } + + [Comment("หมายเหตุ")] + public string? Note { get; set; } + + [Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + [Comment("เช็คอัพคะแนน")] + public bool SetSeat { get; set; } = false; + + [Comment("ประกาศนี้มีสมัครสอบคัดเลือก")] + public bool AnnouncementExam { get; set; } = false; + + [Comment("สำนัก")] + public string? Category { get; set; } + + [Comment("รายชื่อคนสม้ครในรอบ")] + public List Candidate { get; set; } = new List(); + + [Comment("ตำแหน่งสมัคร")] + public List PositionExam { get; set; } = new List(); + + [Comment("ช่องทางชำระเงิน")] + public List BankExam { get; set; } = new List(); + + [Comment("เอกสารอื่นๆ")] + public virtual List PeriodExamDocuments { get; set; } = new(); + + [Comment("รูป")] + public virtual List PeriodExamImages { get; set; } = new(); + public Document? ImportFile { get; set; } = new Document(); + public List Disables { get; set; } = new List(); + public ScoreImport? ScoreImport { get; set; } + public List ImportHostories { get; set; } = new List(); + } +} diff --git a/Models/Exam/PeriodExamDocument.cs b/Models/Exam/PeriodExamDocument.cs new file mode 100644 index 0000000..c3e817d --- /dev/null +++ b/Models/Exam/PeriodExamDocument.cs @@ -0,0 +1,14 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class PeriodExamDocument : EntityBase + { + [Required, Comment("Id รอบสมัครสอบ")] + public virtual PeriodExam? PeriodExam { get; set; } + [Required, Comment("Id ไฟล์เอกสาร")] + public virtual Document? Document { get; set; } + } +} diff --git a/Models/Exam/PeriodExamImage.cs b/Models/Exam/PeriodExamImage.cs new file mode 100644 index 0000000..4403ec8 --- /dev/null +++ b/Models/Exam/PeriodExamImage.cs @@ -0,0 +1,14 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class PeriodExamImage : EntityBase + { + [Required, Comment("Id รอบสมัครสอบ")] + public virtual PeriodExam? PeriodExam { get; set; } + [Required, Comment("Id ไฟล์รูป")] + public virtual Document? Document { get; set; } + } +} diff --git a/Models/Exam/PositionExam.cs b/Models/Exam/PositionExam.cs new file mode 100644 index 0000000..486dad8 --- /dev/null +++ b/Models/Exam/PositionExam.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class PositionExam : EntityBase + { + [Required, Comment("Id การสอบ")] + public virtual PeriodExam? PeriodExam { get; set; } + + [Comment("Id ตำแหน่ง")] + public Guid? PositionId { get; set; } + + [Comment("ชื่อตำแหน่ง")] + public string? PositionName { get; set; } + + [Comment("Id ประเภทแบบฟอร์ม")] + public string? TypeId { get; set; } + + [Comment("ชื่อประเภทแบบฟอร์ม")] + public string? TypeName { get; set; } + } +} diff --git a/Models/Exam/Prefix.cs b/Models/Exam/Prefix.cs new file mode 100644 index 0000000..91cf8ce --- /dev/null +++ b/Models/Exam/Prefix.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Prefix : EntityBase + { + [Required, MaxLength(50), Column(Order = 2), Comment("รายละเอียดคำนำหน้า")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/Exam/Province.cs b/Models/Exam/Province.cs new file mode 100644 index 0000000..aea5c64 --- /dev/null +++ b/Models/Exam/Province.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Province : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("จังหวัด")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual List Districts { get; set; } = new(); + } +} diff --git a/Models/Exam/Relationship.cs b/Models/Exam/Relationship.cs new file mode 100644 index 0000000..dae82d2 --- /dev/null +++ b/Models/Exam/Relationship.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models; + +public class Relationship : EntityBase +{ + [Required, MaxLength(50), Column(Order = 1), Comment("ชื่อความสัมพันธ์")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; +} \ No newline at end of file diff --git a/Models/Exam/Religion.cs b/Models/Exam/Religion.cs new file mode 100644 index 0000000..ae493ec --- /dev/null +++ b/Models/Exam/Religion.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class Religion : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ศาสนา")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/Exam/SubDistrict.cs b/Models/Exam/SubDistrict.cs new file mode 100644 index 0000000..d01c634 --- /dev/null +++ b/Models/Exam/SubDistrict.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Recurit.Exam.Service.Models +{ + public class SubDistrict : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] + public string Name { get; set; } = string.Empty; + + [Required, MaxLength(10), Column(Order = 2), Comment("รหัสไปรษณีย์")] + public string ZipCode { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual District? District { get; set; } + } +} diff --git a/Models/HR/Profile.cs b/Models/HR/Profile.cs new file mode 100644 index 0000000..8447557 --- /dev/null +++ b/Models/HR/Profile.cs @@ -0,0 +1,264 @@ +using BMA.EHR.MetaData.Service.Models; +using BMA.EHR.Recruit.Service.Models.Documents; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class Profile : EntityBase + { + [Key] + public Guid Id { get; set; } + + [MaxLength(13)] + public string? CitizenId { get; set; } + + [MaxLength(50)] + public string? ProfileType { get; set; } + + [MaxLength(20)] + public string? EmployeeType { get; set; } + + [MaxLength(20)] + public string? EmployeeClass { get; set; } + + public Guid? PrefixId { get; set; } + + [MaxLength(100)] + [Required] + public string? FirstName { get; set; } + + [MaxLength(100)] + [Required] + public string? LastName { get; set; } + + [MaxLength(100)] + public string AvatarRef { get; set; } + + public Guid? GenderId { get; set; } + + [MaxLength(100)] + public string? Nationality { get; set; } + + [MaxLength(100)] + public string? Race { get; set; } + + public Guid? ReligionId { get; set; } + + [Required] + public DateTime BirthDate { get; set; } + + public Guid? BloodGroupId { get; set; } + + public Guid? RelationshipId { get; set; } + + [MaxLength(50)] + public string? TelephoneNumber { get; set; } + + public bool? Couple { get; set; } + + public Guid? CouplePrefixId { get; set; } + + [MaxLength(100)] + public string? CoupleFirstName { get; set; } + + [MaxLength(100)] + public string? CoupleLastName { get; set; } + + [MaxLength(100)] + public string? CoupleCareer { get; set; } + + public Guid? FatherPrefixId { get; set; } + + [MaxLength(100)] + public string? FatherFirstName { get; set; } + + [MaxLength(100)] + public string? FatherLastName { get; set; } + + [MaxLength(100)] + public string? FatherCareer { get; set; } + + public Guid? MotherPrefixId { get; set; } + + [MaxLength(100)] + public string? MotherFirstName { get; set; } + + [MaxLength(100)] + public string? MotherLastName { get; set; } + + [MaxLength(100)] + public string? MotherCareer { get; set; } + + [MaxLength(200)] + public string? CurrentAddress { get; set; } + + public Guid? CurrentSubDistrictId { get; set; } + + public Guid? CurrentDistrictId { get; set; } + + public Guid? CurrentProvinceId { get; set; } + + [MaxLength(5)] + public string? CurrentZipCode { get; set; } + + public bool? RegistrationSame { get; set; } = false; + + [MaxLength(200)] + public string? RegistrationAddress { get; set; } + + public Guid? RegistrationSubDistrictId { get; set; } + + public Guid? RegistrationDistrictId { get; set; } + + public Guid? RegistrationProvinceId { get; set; } + + [MaxLength(5)] + public string? RegistrationZipCode { get; set; } + + public DateTime? DateAppoint { get; set; } + + public DateTime? DateStart { get; set; } + + public DateTime? DateRetire { get; set; } + + public string? ReasonSameDate { get; set; } + // public Guid? AffiliationId { get; set; } + // public Guid? PositionId { get; set; } + // public Guid? WorkId { get; set; } + // public Guid? TypeId { get; set; } + // public Guid? LevelId { get; set; } + // public Guid? NumberId { get; set; } + // public Guid? BusinessId { get; set; } + public Guid? OcId { get; set; } + public string? Oc { get; set; } + public Guid? OrganizationShortNameId { get; set; } + public string? OrganizationShortName { get; set; } + public string? GovernmentCode { get; set; } + public Guid? OrganizationOrganizationId { get; set; } + public string? OrganizationOrganization { get; set; } + public Guid? PositionId { get; set; } + public string? Position { get; set; } + public Guid? PosNoId { get; set; } + public string? PosNo { get; set; } + public Guid? PositionLineId { get; set; } + public string? PositionLine { get; set; } + public Guid? PositionPathSideId { get; set; } + public string? PositionPathSide { get; set; } + public Guid? PositionTypeId { get; set; } + public string? PositionType { get; set; } + public Guid? PositionLevelId { get; set; } + public string? PositionLevel { get; set; } + public Guid? PositionExecutiveId { get; set; } + public string? PositionExecutive { get; set; } + public Guid? PositionExecutiveSideId { get; set; } + public string? PositionExecutiveSide { get; set; } + + + [MaxLength(100)] + public string Physical { get; set; } + + [MaxLength(100)] + public string Ability { get; set; } + + public bool IsActive { get; set; } = true; + + public bool IsLeave { get; set; } = false; + + public DateTime? LeaveDate { get; set; } + + [MaxLength(1000)] + public string? LeaveReason { get; set; } + + public DateTime? CreatedDate { get; set; } + + public DateTime? ModifiedDate { get; set; } + + [MaxLength(250)] + public string CreatedUser { get; set; } = string.Empty; + + [MaxLength(5)] + public string EntryStatus { get; set; } = "st1"; // สถานะการตรวจสอบ st1 = create; st2 = pending + + public bool IsTransfer { get; set; } = false; + + public DateTime? TransferDate { get; set; } + + public int GovAgeAbsent { get; set; } = 0; + + public int GovAgePlus { get; set; } = 0; + + // public OrganizationEntity? Organization { get; set; } + + // public PositionNumberEntity PositionNumber { get; set; } + + // public Position Position { get; set; } + + // public PositionExecutive PositionExecutive { get; set; } + + public bool IsVerified { get; set; } = false; + + [MaxLength(100)] + public string VerifiedUser { get; set; } = string.Empty; + + public DateTime? VerifiedDate { get; set; } + + public Document? Avatar { get; set; } + + public bool IsProbation { get; set; } = true; + + // public PositionType PositionType { get; set; } // ประเภทตำแหน่ง + + // public PositionLevel PositionLevel { get; set; } // ระดับ + + // public OrganizationPositionEntity? OrganizationPosition { get; set; } + + public virtual List Educations { get; set; } = new List(); + + public virtual List Honors { get; set; } = new List(); + public virtual List Assessments { get; set; } = new List(); + + public virtual List Disciplines { get; set; } = new List(); + + public virtual List Certificates { get; set; } = new List(); + + public virtual List Trainings { get; set; } = new List(); + + public virtual List Insignias { get; set; } = new List(); + + public virtual List Salaries { get; set; } = new List(); + + public virtual List ProfileHistory { get; set; } = new List(); + + public virtual List CoupleHistory { get; set; } = new List(); + + public virtual List FatherHistory { get; set; } = new List(); + + public virtual List MotherHistory { get; set; } = new List(); + + public virtual List FamilyHistory { get; set; } = new List(); + + public virtual List GovernmentHistory { get; set; } = new List(); + + public virtual List Leaves { get; set; } = new List(); + + public virtual List CurrentAddressHistory { get; set; } = new List(); + + public virtual List RegistrationAddressHistory { get; set; } = new List(); + + public virtual List AddressHistory { get; set; } = new List(); + + public virtual List Others { get; set; } = new List(); + + public virtual List Abilitys { get; set; } = new List(); + + public virtual List Dutys { get; set; } = new List(); + + public virtual List Nopaids { get; set; } = new List(); + + public virtual List AvatarHistory { get; set; } = new List(); + + public virtual List Papers { get; set; } = new List(); + + public virtual List Childrens { get; set; } = new List(); + } +} diff --git a/Models/HR/ProfileAbility.cs b/Models/HR/ProfileAbility.cs new file mode 100644 index 0000000..30fae62 --- /dev/null +++ b/Models/HR/ProfileAbility.cs @@ -0,0 +1,44 @@ +using BMA.EHR.Report.Service.Models; +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAbility : EntityBase + { + /// + /// ด้าน (ใช้เฉพาะ ความสามารถพิเศษ) + /// + public string? Field { get; set; } + + /// + /// รายละเอียด + /// + public string? Detail { get; set; } + + /// + /// หมายเหตุ + /// + public string? Remark { get; set; } + + /// + /// วันที่เริ่มต้น + /// + public DateTime? DateStart { get; set; } + + /// + /// วันที่สิ้นสุด + /// + public DateTime? DateEnd { get; set; } + + /// + /// เอกสารอ้างอิง + /// + public string? Reference { get; set; } + // public string? Side { get; set; } + // public string? Detail { get; set; } + // public string? Note { get; set; } + public virtual List ProfileAbilityHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} \ No newline at end of file diff --git a/Models/HR/ProfileAbilityHistory.cs b/Models/HR/ProfileAbilityHistory.cs new file mode 100644 index 0000000..7897dea --- /dev/null +++ b/Models/HR/ProfileAbilityHistory.cs @@ -0,0 +1,43 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAbilityHistory : EntityBase + { + /// + /// ด้าน (ใช้เฉพาะ ความสามารถพิเศษ) + /// + public string? Field { get; set; } + + /// + /// รายละเอียด + /// + public string? Detail { get; set; } + + /// + /// หมายเหตุ + /// + public string? Remark { get; set; } + + /// + /// วันที่เริ่มต้น + /// + public DateTime? DateStart { get; set; } + + /// + /// วันที่สิ้นสุด + /// + public DateTime? DateEnd { get; set; } + + /// + /// เอกสารอ้างอิง + /// + public string? Reference { get; set; } + // public string? Side { get; set; } + // public string? Detail { get; set; } + // public string? Note { get; set; } + public virtual ProfileAbility? ProfileAbility { get; set; } + } +} \ No newline at end of file diff --git a/Models/HR/ProfileAddressHistory.cs b/Models/HR/ProfileAddressHistory.cs new file mode 100644 index 0000000..a833e76 --- /dev/null +++ b/Models/HR/ProfileAddressHistory.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAddressHistory : EntityBase + { + public bool? RegistrationSame { get; set; } + [MaxLength(200)] + public string? RegistrationAddress { get; set; } + public Guid? RegistrationSubDistrictId { get; set; } + public string? RegistrationSubDistrict { get; set; } + public Guid? RegistrationDistrictId { get; set; } + public string? RegistrationDistrict { get; set; } + public Guid? RegistrationProvinceId { get; set; } + public string? RegistrationProvince { get; set; } + [MaxLength(5)] + public string? RegistrationZipCode { get; set; } + [MaxLength(200)] + public string? CurrentAddress { get; set; } + public Guid? CurrentSubDistrictId { get; set; } + public string? CurrentSubDistrict { get; set; } + public Guid? CurrentDistrictId { get; set; } + public string? CurrentDistrict { get; set; } + public Guid? CurrentProvinceId { get; set; } + public string? CurrentProvince { get; set; } + [MaxLength(5)] + public string? CurrentZipCode { get; set; } + public virtual Profile? Profile { get; set; } + } +} + diff --git a/Models/HR/ProfileAssessment.cs b/Models/HR/ProfileAssessment.cs new file mode 100644 index 0000000..0674b80 --- /dev/null +++ b/Models/HR/ProfileAssessment.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAssessment : EntityBase + { + public string? Name { get; set; } + public DateTime? Date { get; set; } + public double? Point { get; set; } + public virtual List ProfileAssessmentHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileAssessmentHistory.cs b/Models/HR/ProfileAssessmentHistory.cs new file mode 100644 index 0000000..177f9ca --- /dev/null +++ b/Models/HR/ProfileAssessmentHistory.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAssessmentHistory : EntityBase + { + public string? Name { get; set; } + public DateTime? Date { get; set; } + public double? Point { get; set; } + public virtual ProfileAssessment? ProfileAssessment { get; set; } + } +} diff --git a/Models/HR/ProfileAvatarHistory.cs b/Models/HR/ProfileAvatarHistory.cs new file mode 100644 index 0000000..67f665c --- /dev/null +++ b/Models/HR/ProfileAvatarHistory.cs @@ -0,0 +1,18 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.Report.Service.Models; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileAvatarHistory : EntityBase + { + // [Key] + // public int Id { get; set; } + + // public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Document AvatarFile { get; set; } + + public Profile Profile { get; set; } + } +} diff --git a/Models/HR/ProfileCertificate.cs b/Models/HR/ProfileCertificate.cs new file mode 100644 index 0000000..70ae3b4 --- /dev/null +++ b/Models/HR/ProfileCertificate.cs @@ -0,0 +1,28 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileCertificate : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + [MaxLength(20)] + public string? CertificateNo { get; set; } + [MaxLength(200)] + public string? Issuer { get; set; } + public DateTime? IssueDate { get; set; } + public DateTime? ExpireDate { get; set; } + [MaxLength(100)] + public string? CertificateType { get; set; } + // public string? Name { get; set; } + // public string? CertiNumber { get; set; } + // public DateTime? Start { get; set; } + // public DateTime? End { get; set; } + public virtual List ProfileCertificateHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileCertificateHistory.cs b/Models/HR/ProfileCertificateHistory.cs new file mode 100644 index 0000000..c7bccff --- /dev/null +++ b/Models/HR/ProfileCertificateHistory.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileCertificateHistory : EntityBase + { + [MaxLength(20)] + public string? CertificateNo { get; set; } + [MaxLength(200)] + public string? Issuer { get; set; } + public DateTime? IssueDate { get; set; } + public DateTime? ExpireDate { get; set; } + [MaxLength(100)] + public string? CertificateType { get; set; } + // public string? Name { get; set; } + // public string? CertiNumber { get; set; } + // public DateTime? Start { get; set; } + // public DateTime? End { get; set; } + public virtual ProfileCertificate? ProfileCertificate { get; set; } + } +} diff --git a/Models/HR/ProfileChildren.cs b/Models/HR/ProfileChildren.cs new file mode 100644 index 0000000..427d033 --- /dev/null +++ b/Models/HR/ProfileChildren.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileChildren : EntityBase + { + public Guid? ChildrenPrefixId { get; set; } + public string? ChildrenPrefix { get; set; } + public string? ChildrenFirstName { get; set; } + public string? ChildrenLastName { get; set; } + public string? ChildrenCareer { get; set; } + public virtual List ProfileChildrenHistorys { get; set; } = new List(); + public Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileChildrenHistory.cs b/Models/HR/ProfileChildrenHistory.cs new file mode 100644 index 0000000..618bdcf --- /dev/null +++ b/Models/HR/ProfileChildrenHistory.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileChildrenHistory : EntityBase + { + public Guid? ChildrenPrefixId { get; set; } + public string? ChildrenPrefix { get; set; } + public string? ChildrenFirstName { get; set; } + public string? ChildrenLastName { get; set; } + public string? ChildrenCareer { get; set; } + } +} diff --git a/Models/HR/ProfileCoupleHistory.cs b/Models/HR/ProfileCoupleHistory.cs new file mode 100644 index 0000000..01b8a8a --- /dev/null +++ b/Models/HR/ProfileCoupleHistory.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileCoupleHistory + { + [Key] + public int Id { get; set; } + + [Required] + [MaxLength(50)] + public string Prefix { get; set; } + + [Required] + [MaxLength(100)] + public string FirstName { get; set; } + + [Required] + [MaxLength(100)] + public string LastName { get; set; } + + [MaxLength(100)] + public string Career { get; set; } + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Profile Profile { get; set; } + } +} diff --git a/Models/HR/ProfileCurrentAddressHistory.cs b/Models/HR/ProfileCurrentAddressHistory.cs new file mode 100644 index 0000000..0effa46 --- /dev/null +++ b/Models/HR/ProfileCurrentAddressHistory.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileCurrentAddressHistory + { + [Key] + public int Id { get; set; } + + [MaxLength(200)] + [Required] + public string Address { get; set; } + + [Required] + public Guid SubDistrictId { get; set; } + + [Required] + public Guid DistrictId { get; set; } + + [Required] + public Guid ProvinceId { get; set; } + + [MaxLength(5)] + [Required] + public string ZipCode { get; set; } + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Profile Profile { get; set; } + } +} + diff --git a/Models/HR/ProfileDiscipline.cs b/Models/HR/ProfileDiscipline.cs new file mode 100644 index 0000000..ac1baff --- /dev/null +++ b/Models/HR/ProfileDiscipline.cs @@ -0,0 +1,28 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileDiscipline : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + public string? Level { get; set; } + [Column(TypeName = "text")] + public string? Detail { get; set; } + public string? RefCommandNo { get; set; } + public DateTime? RefCommandDate { get; set; } + public DateTime? Date { get; set; } + // public DateTime? Date { get; set; } + // public string? Status { get; set; } + // public string? Level { get; set; } + // public string? RefNo { get; set; } + // public DateTime? RefDate { get; set; } + public virtual List ProfileDisciplineHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileDisciplineHistory.cs b/Models/HR/ProfileDisciplineHistory.cs new file mode 100644 index 0000000..cd4f965 --- /dev/null +++ b/Models/HR/ProfileDisciplineHistory.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileDisciplineHistory : EntityBase + { + public string? Level { get; set; } + [Column(TypeName = "text")] + public string? Detail { get; set; } + public string? RefCommandNo { get; set; } + public DateTime? RefCommandDate { get; set; } + public DateTime? Date { get; set; } + // public DateTime? Date { get; set; } + // public string? Status { get; set; } + // public string? Level { get; set; } + // public string? RefNo { get; set; } + // public DateTime? RefDate { get; set; } + public virtual ProfileDiscipline? ProfileDiscipline { get; set; } + } +} diff --git a/Models/HR/ProfileDuty.cs b/Models/HR/ProfileDuty.cs new file mode 100644 index 0000000..f8f518d --- /dev/null +++ b/Models/HR/ProfileDuty.cs @@ -0,0 +1,16 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileDuty : EntityBase + { + public DateTime? DateStart { get; set; } + public DateTime? DateEnd { get; set; } + public string? Detail { get; set; } + public string? Reference { get; set; } + public virtual List ProfileDutyHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} \ No newline at end of file diff --git a/Models/HR/ProfileDutyHistory.cs b/Models/HR/ProfileDutyHistory.cs new file mode 100644 index 0000000..6020a87 --- /dev/null +++ b/Models/HR/ProfileDutyHistory.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileDutyHistory : EntityBase + { + public DateTime? DateStart { get; set; } + public DateTime? DateEnd { get; set; } + public string? Detail { get; set; } + public string? Reference { get; set; } + public virtual ProfileDuty? ProfileDuty { get; set; } + } +} \ No newline at end of file diff --git a/Models/HR/ProfileEducation.cs b/Models/HR/ProfileEducation.cs new file mode 100644 index 0000000..cc93425 --- /dev/null +++ b/Models/HR/ProfileEducation.cs @@ -0,0 +1,44 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.MetaData.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileEducation : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + [MaxLength(1000)] + public string? Institute { get; set; } + [MaxLength(200)] + public string? Degree { get; set; } + [MaxLength(200)] + public string? Field { get; set; } + [MaxLength(20)] + public string? Gpa { get; set; } + [MaxLength(1000)] + public string? Country { get; set; } + [MaxLength(1000)] + public string? Duration { get; set; } + [MaxLength(1000)] + public string? Other { get; set; } + [MaxLength(1000)] + public string? FundName { get; set; } + public int DurationYear { get; set; } + public DateTime? FinishDate { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + // public EducationLevel? EducationLevel { get; set; } + public string? EducationLevel { get; set; } + public Guid? EducationLevelId { get; set; } + // public string? Name { get; set; } + // public int? Start { get; set; } + // public int? End { get; set; } + // public string? Education { get; set; } + // public string? Major { get; set; } + public virtual List ProfileEducationHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + + } +} diff --git a/Models/HR/ProfileEducationHistory.cs b/Models/HR/ProfileEducationHistory.cs new file mode 100644 index 0000000..cf6101b --- /dev/null +++ b/Models/HR/ProfileEducationHistory.cs @@ -0,0 +1,32 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.MetaData.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileEducationHistory : EntityBase + { + [MaxLength(1000)] + public string? Institute { get; set; }// + [MaxLength(200)] + public string? Degree { get; set; }// + [MaxLength(200)] + public string? Field { get; set; }// + [MaxLength(20)] + public string? Gpa { get; set; }// + [MaxLength(1000)] + public string? Country { get; set; }// + [MaxLength(1000)] + public string? Duration { get; set; }// + [MaxLength(1000)] + public string? Other { get; set; }// + [MaxLength(1000)] + public string? FundName { get; set; }// + public int DurationYear { get; set; }// + public DateTime? FinishDate { get; set; }// + public DateTime? StartDate { get; set; }// + public DateTime? EndDate { get; set; }// + public string? EducationLevel { get; set; } + public Guid? EducationLevelId { get; set; } + public virtual ProfileEducation? ProfileEducation { get; set; } + } +} diff --git a/Models/HR/ProfileFamilyHistory.cs b/Models/HR/ProfileFamilyHistory.cs new file mode 100644 index 0000000..43e8863 --- /dev/null +++ b/Models/HR/ProfileFamilyHistory.cs @@ -0,0 +1,32 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileFamilyHistory : EntityBase + { + public bool? Couple { get; set; } + + public Guid? CouplePrefixId { get; set; } + public string? CouplePrefix { get; set; } + public string? CoupleFirstName { get; set; } + public string? CoupleLastName { get; set; } + public string? CoupleCareer { get; set; } + + public Guid? FatherPrefixId { get; set; } + public string? FatherPrefix { get; set; } + public string? FatherFirstName { get; set; } + public string? FatherLastName { get; set; } + public string? FatherCareer { get; set; } + + public Guid? MotherPrefixId { get; set; } + public string? MotherPrefix { get; set; } + public string? MotherFirstName { get; set; } + public string? MotherLastName { get; set; } + public string? MotherCareer { get; set; } + public virtual Profile? Profile { get; set; } + + public virtual List Childrens { get; set; } = new List(); + } +} diff --git a/Models/HR/ProfileFatherHistory.cs b/Models/HR/ProfileFatherHistory.cs new file mode 100644 index 0000000..d29ea92 --- /dev/null +++ b/Models/HR/ProfileFatherHistory.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileFatherHistory + { + [Key] + public int Id { get; set; } + + [Required] + [MaxLength(50)] + public string Prefix { get; set; } + + [Required] + [MaxLength(100)] + public string FirstName { get; set; } + + [Required] + [MaxLength(100)] + public string LastName { get; set; } + + [MaxLength(100)] + public string Career { get; set; } + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Profile Profile { get; set; } + } +} diff --git a/Models/HR/ProfileGovernmentHistory.cs b/Models/HR/ProfileGovernmentHistory.cs new file mode 100644 index 0000000..d5e8472 --- /dev/null +++ b/Models/HR/ProfileGovernmentHistory.cs @@ -0,0 +1,37 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileGovernmentHistory : EntityBase + { + // public Guid? AffiliationId { get; set; } + // public Guid? PositionId { get; set; } + // public Guid? WorkId { get; set; } + // public Guid? TypeId { get; set; } + // public Guid? LevelId { get; set; } + // public Guid? NumberId { get; set; } + // public Guid? BusinessId { get; set; } + public string? ReasonSameDate { get; set; } + public Guid? OcId { get; set; } + public string? Oc { get; set; } + public Guid? PositionId { get; set; } + public string? Position { get; set; } + public Guid? PosNoId { get; set; } + public string? PosNo { get; set; } + public string? PositionLine { get; set; } + // public string? PositionPathSide { get; set; } + public string? PositionType { get; set; } + public string? PositionLevel { get; set; } + public string? PositionExecutive { get; set; } + // public string? PositionExecutiveSide { get; set; } + public DateTime? DateAppoint { get; set; } + public DateTime? DateStart { get; set; } + public string? RetireDate { get; set; } + public string? GovAge { get; set; } + public int? GovAgeAbsent { get; set; } = 0; + public int? GovAgePlus { get; set; } = 0; + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileHistory.cs b/Models/HR/ProfileHistory.cs new file mode 100644 index 0000000..2f2473c --- /dev/null +++ b/Models/HR/ProfileHistory.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileHistory : EntityBase + { + [MaxLength(13)] + public string? CitizenId { get; set; } + public Guid? PrefixId { get; set; } + public string? Prefix { get; set; } + [MaxLength(100)] + [Required] + public string? FirstName { get; set; } + [MaxLength(100)] + [Required] + public string? LastName { get; set; } + public Guid? GenderId { get; set; } + public string? Gender { get; set; } + [MaxLength(100)] + public string? Nationality { get; set; } + [MaxLength(100)] + public string? Race { get; set; } + public Guid? ReligionId { get; set; } + public string? Religion { get; set; } + [Required] + public DateTime BirthDate { get; set; } + public Guid? BloodGroupId { get; set; } + public string? BloodGroup { get; set; } + public Guid? RelationshipId { get; set; } + public string? Relationship { get; set; } + [MaxLength(50)] + public string? TelephoneNumber { get; set; } + [MaxLength(20)] + public string? EmployeeType { get; set; } + [MaxLength(20)] + public string? EmployeeClass { get; set; } + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileHonor.cs b/Models/HR/ProfileHonor.cs new file mode 100644 index 0000000..7bf556a --- /dev/null +++ b/Models/HR/ProfileHonor.cs @@ -0,0 +1,28 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileHonor : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + // [MaxLength(20)] + // public string? No { get; set; } + [MaxLength(200)] + public string? Issuer { get; set; } + [MaxLength(2000)] + public string? Detail { get; set; } + public DateTime? IssueDate { get; set; } + + // public DateTime? ReceiveDate { get; set; } + // public string? Detail { get; set; } + // public Guid? OrganizationOrganizationId { get; set; } + // public string? OrganizationOrganization { get; set; } + public virtual List ProfileHonorHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileHonorHistory.cs b/Models/HR/ProfileHonorHistory.cs new file mode 100644 index 0000000..ab6f92b --- /dev/null +++ b/Models/HR/ProfileHonorHistory.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileHonorHistory : EntityBase + { + [MaxLength(200)] + public string? Issuer { get; set; } + [MaxLength(2000)] + public string? Detail { get; set; } + public DateTime? IssueDate { get; set; } + + // public DateTime? ReceiveDate { get; set; } + // public string? Detail { get; set; } + // public Guid? OrganizationOrganizationId { get; set; } + // public string? OrganizationOrganization { get; set; } + public virtual ProfileHonor? ProfileHonor { get; set; } + } +} diff --git a/Models/HR/ProfileInsignia.cs b/Models/HR/ProfileInsignia.cs new file mode 100644 index 0000000..47aa18a --- /dev/null +++ b/Models/HR/ProfileInsignia.cs @@ -0,0 +1,50 @@ +using BMA.EHR.MetaData.Service.Models; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileInsignia : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + // public Insignia Insignia { get; set; } + // public DateTime DateReceive { get; set; } + public int Year { get; set; } + // [MaxLength(300)] + // public string? Level { get; set; } + [MaxLength(20)] + public string? No { get; set; } + [MaxLength(300)] + public string? Issue { get; set; } + [MaxLength(30)] + public string? VolumeNo { get; set; } + [MaxLength(30)] + public string? Volume { get; set; } + [MaxLength(30)] + public string? Section { get; set; } + [MaxLength(30)] + public string? Page { get; set; } + // public DateTime? DateStamp { get; set; } + public DateTime? DateAnnounce { get; set; } + // public DateTime? EndDate { get; set; } + + + // public int? Year { get; set; } + public DateTime? ReceiveDate { get; set; } + public string? InsigniaType { get; set; } + // public InsigniaType? InsigniaType { get; set; } + public string? Insignia { get; set; } + public Guid? InsigniaId { get; set; } + // public Insignia? Insignia { get; set; } + // public string? No { get; set; } + // public string? GazetteNo { get; set; } + // public string? Volume { get; set; } + // public string? Book { get; set; } + // public string? Section { get; set; } + // public string? Page { get; set; } + public virtual List ProfileInsigniaHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileInsigniaHistory.cs b/Models/HR/ProfileInsigniaHistory.cs new file mode 100644 index 0000000..6d94f6e --- /dev/null +++ b/Models/HR/ProfileInsigniaHistory.cs @@ -0,0 +1,40 @@ +using BMA.EHR.MetaData.Service.Models; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileInsigniaHistory : EntityBase + { + public int Year { get; set; } + // [MaxLength(300)] + // public string? Level { get; set; } + [MaxLength(20)] + public string? No { get; set; } + [MaxLength(300)] + public string? Issue { get; set; } + [MaxLength(30)] + public string? VolumeNo { get; set; } + [MaxLength(30)] + public string? Volume { get; set; } + [MaxLength(30)] + public string? Section { get; set; } + [MaxLength(30)] + public string? Page { get; set; } + // public DateTime? DateStamp { get; set; } + public DateTime? DateAnnounce { get; set; } + // public DateTime? EndDate { get; set; } + + // public int? Year { get; set; } + public DateTime? ReceiveDate { get; set; } + public string? InsigniaType { get; set; } + public string? Insignia { get; set; } + public Guid? InsigniaId { get; set; } + // public string? No { get; set; } + // public string? GazetteNo { get; set; } + // public string? Volume { get; set; } + // public string? Book { get; set; } + // public string? Section { get; set; } + // public string? Page { get; set; } + public virtual ProfileInsignia? ProfileInsignia { get; set; } + } +} diff --git a/Models/HR/ProfileLeave.cs b/Models/HR/ProfileLeave.cs new file mode 100644 index 0000000..64dd91d --- /dev/null +++ b/Models/HR/ProfileLeave.cs @@ -0,0 +1,58 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileLeave : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + public int Year { get; set; } + public double? RestCount { get; set; } + public double? RestDay { get; set; } + public double? SickCount { get; set; } + public double? SickDay { get; set; } + public double? AbsentCount { get; set; } + public double? AbsentDay { get; set; } + public double? LateCount { get; set; } + public double? LateDay { get; set; } + public double? OtherCount { get; set; } + public double? OtherDay { get; set; } + public double? PersonalCount { get; set; } + public double? PersonalDay { get; set; } + public double? MaternityCount { get; set; } + public double? MaternityDay { get; set; } + public double? WifeCount { get; set; } + public double? WifeDay { get; set; } + public double? OrdainCount { get; set; } + public double? OrdainDay { get; set; } + public double? MilitaryCount { get; set; } + public double? MilitaryDay { get; set; } + public double? StudyCount { get; set; } + public double? StudyDay { get; set; } + public double? AgencyCount { get; set; } + public double? AgencyDay { get; set; } + public double? CoupleCount { get; set; } + public double? CoupleDay { get; set; } + public double? TherapyCount { get; set; } + public double? TherapyDay { get; set; } + // public int? Year { get; set; } + // public double? Holiday { get; set; } + // public double? Sick { get; set; } + // public double? Government { get; set; } + // public double? Late { get; set; } + // public double? Other { get; set; } + // public double? Business { get; set; } + // public double? Maternity { get; set; } + // public double? HelpMaternity { get; set; } + // public double? Ordination { get; set; } + // public double? Study { get; set; } + // public double? International { get; set; } + // public double? Spouse { get; set; } + // public double? Rehabilitation { get; set; } + public virtual List ProfileLeaveHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileLeaveHistory.cs b/Models/HR/ProfileLeaveHistory.cs new file mode 100644 index 0000000..018ce42 --- /dev/null +++ b/Models/HR/ProfileLeaveHistory.cs @@ -0,0 +1,53 @@ +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileLeaveHistory : EntityBase + { + public int Year { get; set; } + public double? RestCount { get; set; } + public double? RestDay { get; set; } + public double? SickCount { get; set; } + public double? SickDay { get; set; } + public double? AbsentCount { get; set; } + public double? AbsentDay { get; set; } + public double? LateCount { get; set; } + public double? LateDay { get; set; } + public double? OtherCount { get; set; } + public double? OtherDay { get; set; } + public double? PersonalCount { get; set; } + public double? PersonalDay { get; set; } + public double? MaternityCount { get; set; } + public double? MaternityDay { get; set; } + public double? WifeCount { get; set; } + public double? WifeDay { get; set; } + public double? OrdainCount { get; set; } + public double? OrdainDay { get; set; } + public double? MilitaryCount { get; set; } + public double? MilitaryDay { get; set; } + public double? StudyCount { get; set; } + public double? StudyDay { get; set; } + public double? AgencyCount { get; set; } + public double? AgencyDay { get; set; } + public double? CoupleCount { get; set; } + public double? CoupleDay { get; set; } + public double? TherapyCount { get; set; } + public double? TherapyDay { get; set; } + // public int? Year { get; set; } + // public double? Holiday { get; set; } + // public double? Sick { get; set; } + // public double? Government { get; set; } + // public double? Late { get; set; } + // public double? Other { get; set; } + // public double? Business { get; set; } + // public double? Maternity { get; set; } + // public double? HelpMaternity { get; set; } + // public double? Ordination { get; set; } + // public double? Study { get; set; } + // public double? International { get; set; } + // public double? Spouse { get; set; } + // public double? Rehabilitation { get; set; } + public virtual ProfileLeave? ProfileLeave { get; set; } + } +} diff --git a/Models/HR/ProfileMotherHistory.cs b/Models/HR/ProfileMotherHistory.cs new file mode 100644 index 0000000..fedac87 --- /dev/null +++ b/Models/HR/ProfileMotherHistory.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileMotherHistory + { + [Key] + public int Id { get; set; } + + [Required] + [MaxLength(50)] + public string Prefix { get; set; } + + [Required] + [MaxLength(100)] + public string FirstName { get; set; } + + [Required] + [MaxLength(100)] + public string LastName { get; set; } + + [MaxLength(100)] + public string Career { get; set; } + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Profile Profile { get; set; } + } +} diff --git a/Models/HR/ProfileNopaid.cs b/Models/HR/ProfileNopaid.cs new file mode 100644 index 0000000..3818024 --- /dev/null +++ b/Models/HR/ProfileNopaid.cs @@ -0,0 +1,26 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileNopaid : EntityBase + { + // [Key] + // public int Id { get; set; } + // [Required] + // public int Order { get; set; } + // [MaxLength(20)] + // public string No { get; set; } + // [MaxLength(200)] + // public string Issuer { get; set; } + // [MaxLength(2000)] + // public string Detail { get; set; } + // public DateTime IssueDate { get; set; } + public DateTime? Date { get; set; } + public string? Detail { get; set; } + public string? Reference { get; set; } + public virtual List ProfileNopaidHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileNopaidHistory.cs b/Models/HR/ProfileNopaidHistory.cs new file mode 100644 index 0000000..0327c1d --- /dev/null +++ b/Models/HR/ProfileNopaidHistory.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileNopaidHistory : EntityBase + { + public DateTime? Date { get; set; } + public string? Detail { get; set; } + public string? Reference { get; set; } + public virtual ProfileNopaid? ProfileNopaid { get; set; } + } +} diff --git a/Models/HR/ProfileOther.cs b/Models/HR/ProfileOther.cs new file mode 100644 index 0000000..3842cfa --- /dev/null +++ b/Models/HR/ProfileOther.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileOther : EntityBase + { + public DateTime? Date { get; set; } + public string? Detail { get; set; } + public virtual List ProfileOtherHistorys { get; set; } = new List(); + public Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileOtherHistory.cs b/Models/HR/ProfileOtherHistory.cs new file mode 100644 index 0000000..433135c --- /dev/null +++ b/Models/HR/ProfileOtherHistory.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileOtherHistory : EntityBase + { + public DateTime? Date { get; set; } + public string? Detail { get; set; } + public ProfileOther? ProfileOther { get; set; } + } +} diff --git a/Models/HR/ProfilePaper.cs b/Models/HR/ProfilePaper.cs new file mode 100644 index 0000000..fc17eb0 --- /dev/null +++ b/Models/HR/ProfilePaper.cs @@ -0,0 +1,18 @@ +using BMA.EHR.Recruit.Service.Models.Documents; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfilePaper : EntityBase + { + // [Key] + // public int Id { get; set; } + [Required, MaxLength(255)] + public string? Detail { get; set; } + [Required, MaxLength(255)] + public string? CategoryName { get; set; } + public Document Document { get; set; } + public virtual Profile Profile { get; set; } + } +} diff --git a/Models/HR/ProfileRegistrationAddressHistory.cs b/Models/HR/ProfileRegistrationAddressHistory.cs new file mode 100644 index 0000000..eaf81cc --- /dev/null +++ b/Models/HR/ProfileRegistrationAddressHistory.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileRegistrationAddressHistory + { + [Key] + public int Id { get; set; } + + [MaxLength(200)] + [Required] + public string Address { get; set; } + + [Required] + public Guid SubDistrictId { get; set; } + + [Required] + public Guid DistrictId { get; set; } + + [Required] + public Guid ProvinceId { get; set; } + + [MaxLength(5)] + [Required] + public string ZipCode { get; set; } + + public DateTime CreatedDate { get; set; } = DateTime.Now; + + public Profile Profile { get; set; } + } +} + diff --git a/Models/HR/ProfileSalary.cs b/Models/HR/ProfileSalary.cs new file mode 100644 index 0000000..253bb8b --- /dev/null +++ b/Models/HR/ProfileSalary.cs @@ -0,0 +1,25 @@ +using BMA.EHR.MetaData.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalary : EntityBase + { + public DateTime? Date { get; set; } + public double? Amount { get; set; } + public double? PositionSalaryAmount { get; set; } + public Guid? OcId { get; set; } + public Guid? OrganizationShortNameId { get; set; } + public Guid? PositionId { get; set; } + public Guid? PosNoId { get; set; } + public Guid? PositionLineId { get; set; } + public Guid? PositionPathSideId { get; set; } + public Guid? PositionTypeId { get; set; } + public Guid? PositionLevelId { get; set; } + public Guid? PositionExecutiveId { get; set; } + public Guid? PositionExecutiveSideId { get; set; } + public string? SalaryClass { get; set; } + public string? SalaryRef { get; set; } + public virtual List ProfileSalaryHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileSalaryHistory.cs b/Models/HR/ProfileSalaryHistory.cs new file mode 100644 index 0000000..796af6d --- /dev/null +++ b/Models/HR/ProfileSalaryHistory.cs @@ -0,0 +1,34 @@ +using BMA.EHR.MetaData.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryHistory : EntityBase + { + public DateTime? Date { get; set; } + public double? Amount { get; set; } + public double? PositionSalaryAmount { get; set; } + public Guid? OcId { get; set; } + public string? Oc { get; set; } + public Guid? OrganizationShortNameId { get; set; } + public string? OrganizationShortName { get; set; } + public Guid? PositionId { get; set; } + public string? Position { get; set; } + public Guid? PosNoId { get; set; } + public string? PosNo { get; set; } + public Guid? PositionLineId { get; set; } + public string? PositionLine { get; set; } + public Guid? PositionPathSideId { get; set; } + public string? PositionPathSide { get; set; } + public Guid? PositionTypeId { get; set; } + public string? PositionType { get; set; } + public Guid? PositionLevelId { get; set; } + public string? PositionLevel { get; set; } + public Guid? PositionExecutiveId { get; set; } + public string? PositionExecutive { get; set; } + public Guid? PositionExecutiveSideId { get; set; } + public string? PositionExecutiveSide { get; set; } + public string? SalaryClass { get; set; } + public string? SalaryRef { get; set; } + public virtual ProfileSalary? ProfileSalary { get; set; } + } +} diff --git a/Models/HR/ProfileSalaryOrganization.cs b/Models/HR/ProfileSalaryOrganization.cs new file mode 100644 index 0000000..5b02328 --- /dev/null +++ b/Models/HR/ProfileSalaryOrganization.cs @@ -0,0 +1,19 @@ +using BMA.EHR.Profile.Service.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryOrganization + { + [ForeignKey("ProfileSalary")] + public int Id { get; set; } + + [MaxLength(200)] + public string Comment { get; set; } + + // public OrganizationEntity Organization { get; set; } + + // public ProfileSalary ProfileSalary { get; set; } + } +} diff --git a/Models/HR/ProfileSalaryPosition.cs b/Models/HR/ProfileSalaryPosition.cs new file mode 100644 index 0000000..0312204 --- /dev/null +++ b/Models/HR/ProfileSalaryPosition.cs @@ -0,0 +1,19 @@ +using BMA.EHR.MetaData.Service.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryPosition + { + [ForeignKey("ProfileSalary")] + public int Id { get; set; } + + [MaxLength(200)] + public string Comment { get; set; } + + public Position Position { get; set; } + + // public ProfileSalary ProfileSalary { get; set; } + } +} diff --git a/Models/HR/ProfileSalaryPositionLevel.cs b/Models/HR/ProfileSalaryPositionLevel.cs new file mode 100644 index 0000000..2fae436 --- /dev/null +++ b/Models/HR/ProfileSalaryPositionLevel.cs @@ -0,0 +1,20 @@ +using BMA.EHR.MetaData.Service.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryPositionLevel + { + [ForeignKey("ProfileSalary")] + public int Id { get; set; } + + [MaxLength(200)] + public string Comment { get; set; } + + // public PositionLevel PositionLevel { get; set; } + + // public ProfileSalary ProfileSalary { get; set; } + } +} + diff --git a/Models/HR/ProfileSalaryPositionNumber.cs b/Models/HR/ProfileSalaryPositionNumber.cs new file mode 100644 index 0000000..6e93f54 --- /dev/null +++ b/Models/HR/ProfileSalaryPositionNumber.cs @@ -0,0 +1,19 @@ +using BMA.EHR.Profile.Service.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryPositionNumber + { + [ForeignKey("ProfileSalary")] + public int Id { get; set; } + + [MaxLength(200)] + public string Comment { get; set; } + + // public PositionNumberEntity PositionNumber { get; set; } + + // public ProfileSalary ProfileSalary { get; set; } + } +} diff --git a/Models/HR/ProfileSalaryPositionType.cs b/Models/HR/ProfileSalaryPositionType.cs new file mode 100644 index 0000000..d7b0daa --- /dev/null +++ b/Models/HR/ProfileSalaryPositionType.cs @@ -0,0 +1,22 @@ +using BMA.EHR.MetaData.Service.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileSalaryPositionType + { + + [ForeignKey("ProfileSalary")] + public int Id { get; set; } + + [MaxLength(200)] + public string Comment { get; set; } + + // public PositionType PositionType { get; set; } + + // public ProfileSalary ProfileSalary { get; set; } + + } +} + diff --git a/Models/HR/ProfileTraining.cs b/Models/HR/ProfileTraining.cs new file mode 100644 index 0000000..adbcad2 --- /dev/null +++ b/Models/HR/ProfileTraining.cs @@ -0,0 +1,34 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileTraining : EntityBase + { + [MaxLength(100)] + public string? Subject { get; set; } + [Column(TypeName = "text")] + public string? Detail { get; set; } + [MaxLength(200)] + public string? Host { get; set; } + [MaxLength(200)] + public string? ClassName { get; set; } + [MaxLength(200)] + public string? Place { get; set; } + [MaxLength(50)] + public string? Reference { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + // public string? Course { get; set; } + // public DateTime? Start { get; set; } + // public DateTime? End { get; set; } + // public string? Location { get; set; } + // public string? Detail { get; set; } + // public string? Organize { get; set; } + // public string? Gen { get; set; } + public virtual List ProfileTrainingHistorys { get; set; } = new List(); + public virtual Profile? Profile { get; set; } + } +} diff --git a/Models/HR/ProfileTrainingHistory.cs b/Models/HR/ProfileTrainingHistory.cs new file mode 100644 index 0000000..171428d --- /dev/null +++ b/Models/HR/ProfileTrainingHistory.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models.HR +{ + public class ProfileTrainingHistory : EntityBase + { + [MaxLength(100)] + public string? Subject { get; set; } + [Column(TypeName = "text")] + public string? Detail { get; set; } + [MaxLength(200)] + public string? Host { get; set; } + [MaxLength(200)] + public string? ClassName { get; set; } + [MaxLength(200)] + public string? Place { get; set; } + [MaxLength(50)] + public string? Reference { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + // public string? Course { get; set; } + // public DateTime? Start { get; set; } + // public DateTime? End { get; set; } + // public string? Location { get; set; } + // public string? Detail { get; set; } + // public string? Organize { get; set; } + // public string? Gen { get; set; } + public virtual ProfileTraining? ProfileTraining { get; set; } + } +} diff --git a/Models/MetaData/BloodGroup.cs b/Models/MetaData/BloodGroup.cs new file mode 100644 index 0000000..29ad2d1 --- /dev/null +++ b/Models/MetaData/BloodGroup.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class BloodGroup : EntityBase + { + [Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/District.cs b/Models/MetaData/District.cs new file mode 100644 index 0000000..a99b70b --- /dev/null +++ b/Models/MetaData/District.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class District : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual List SubDistricts { get; set; } = new(); + + public virtual Province? Province { get; set; } + } +} diff --git a/Models/MetaData/EducationLevel.cs b/Models/MetaData/EducationLevel.cs new file mode 100644 index 0000000..5f45f77 --- /dev/null +++ b/Models/MetaData/EducationLevel.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class EducationLevel : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ระดับการศึกษา")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/EntityBase.cs b/Models/MetaData/EntityBase.cs new file mode 100644 index 0000000..90a39ee --- /dev/null +++ b/Models/MetaData/EntityBase.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class EntityBase + { + [Key, Column(Order = 0), Comment("PrimaryKey")] + [JsonPropertyName("id")] + public Guid Id { get; set; } + + [Required, Column(Order = 100), Comment("สร้างข้อมูลเมื่อ")] + public DateTime CreatedAt { get; set; } = DateTime.Now; + + [Column(Order = 101), Comment("User Id ที่สร้างข้อมูล"), MaxLength(40)] + public string CreatedUserId { get; set; } = string.Empty; + + [Column(Order = 102), Comment("แก้ไขข้อมูลล่าสุดเมื่อ")] + public DateTime? LastUpdatedAt { get; set; } + + [Column(Order = 103), Comment("User Id ที่แก้ไขข้อมูลล่าสุด"), MaxLength(40)] + public string LastUpdateUserId { get; set; } = string.Empty; + + [Column(Order = 104), Comment("ชื่อ User ที่สร้างข้อมูล"), MaxLength(200)] + public string CreatedFullName { get; set; } = string.Empty; + + [Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)] + public string LastUpdateFullName { get; set; } = string.Empty; + } +} diff --git a/Models/MetaData/Gendor.cs b/Models/MetaData/Gendor.cs new file mode 100644 index 0000000..31042f0 --- /dev/null +++ b/Models/MetaData/Gendor.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Gender : EntityBase + { + [Required, MaxLength(20), Column(Order = 1), Comment("เพศ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/Holiday.cs b/Models/MetaData/Holiday.cs new file mode 100644 index 0000000..369c359 --- /dev/null +++ b/Models/MetaData/Holiday.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Holiday : EntityBase + { + [Required, Column(Order = 1), Comment("ประจำปี")] + public int Year { get; set; } = 0; + + [Required, Column(Order = 2), Comment("วันหยุด")] + public DateTime HolidayDate { get; set; } = DateTime.Now.Date; + + [Required, Column(Order = 3), Comment("วันหยุด(Original)")] + public DateTime OriginalDate { get; set; } = DateTime.Now.Date; + + [Required, MaxLength(250), Column(Order = 4), Comment("ชื่อวันหยุด")] + public string Name { get; set; } = string.Empty; + + [Required, Column(Order = 5), Comment("เป็นวันหยุดพิเศษหรือไม่")] + public bool IsSpecial { get; set; } = true; + + [Required, Column(Order = 6), Comment("ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`")] + public string Category { get; set; } = "NORMAL"; + } +} diff --git a/Models/MetaData/Insignia.cs b/Models/MetaData/Insignia.cs new file mode 100644 index 0000000..b0b905a --- /dev/null +++ b/Models/MetaData/Insignia.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Insignia: EntityBase + { + [Required, MaxLength(50), Column(Order = 1), Comment("ชื่อเครื่องราชย์")] + public string Name { get; set; } = string.Empty; + + [Required, MaxLength(10), Column(Order = 2), Comment("ชื่อย่อเครื่องราชย์")] + public string ShortName { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + [Column(Order = 4), Comment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น")] + public int Level { get; set; } = 0; + + public virtual InsigniaType? InsigniaType { get; set; } + } +} diff --git a/Models/MetaData/InsigniaType.cs b/Models/MetaData/InsigniaType.cs new file mode 100644 index 0000000..ceba1f1 --- /dev/null +++ b/Models/MetaData/InsigniaType.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class InsigniaType : EntityBase + { + [Required, MaxLength(50), Column(Order = 1), Comment("ชื่อประเภทเครื่องราชย์")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationAgency.cs b/Models/MetaData/OrganizationAgency.cs new file mode 100644 index 0000000..990a5d3 --- /dev/null +++ b/Models/MetaData/OrganizationAgency.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationAgency : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationFax.cs b/Models/MetaData/OrganizationFax.cs new file mode 100644 index 0000000..684dcc6 --- /dev/null +++ b/Models/MetaData/OrganizationFax.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationFax : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationGovernmentAgency.cs b/Models/MetaData/OrganizationGovernmentAgency.cs new file mode 100644 index 0000000..796b4fe --- /dev/null +++ b/Models/MetaData/OrganizationGovernmentAgency.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationGovernmentAgency : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationLevel.cs b/Models/MetaData/OrganizationLevel.cs new file mode 100644 index 0000000..b6c366c --- /dev/null +++ b/Models/MetaData/OrganizationLevel.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationLevel : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationOrganization.cs b/Models/MetaData/OrganizationOrganization.cs new file mode 100644 index 0000000..b82a2aa --- /dev/null +++ b/Models/MetaData/OrganizationOrganization.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationOrganization : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationShortName.cs b/Models/MetaData/OrganizationShortName.cs new file mode 100644 index 0000000..59955ac --- /dev/null +++ b/Models/MetaData/OrganizationShortName.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationShortName : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน")] + public string AgencyCode { get; set; } = string.Empty; + [Required, MaxLength(100), Column(Order = 2), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ")] + public string GovernmentCode { get; set; } = string.Empty; + [Required, MaxLength(100), Column(Order = 3), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 4), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationStatus.cs b/Models/MetaData/OrganizationStatus.cs new file mode 100644 index 0000000..91a8b0d --- /dev/null +++ b/Models/MetaData/OrganizationStatus.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationStatus : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationTelExternal.cs b/Models/MetaData/OrganizationTelExternal.cs new file mode 100644 index 0000000..237cfb4 --- /dev/null +++ b/Models/MetaData/OrganizationTelExternal.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationTelExternal : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationTelInternal.cs b/Models/MetaData/OrganizationTelInternal.cs new file mode 100644 index 0000000..6db4aa2 --- /dev/null +++ b/Models/MetaData/OrganizationTelInternal.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationTelInternal : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/OrganizationType.cs b/Models/MetaData/OrganizationType.cs new file mode 100644 index 0000000..20f0eac --- /dev/null +++ b/Models/MetaData/OrganizationType.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class OrganizationType : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PhysicalStatus.cs b/Models/MetaData/PhysicalStatus.cs new file mode 100644 index 0000000..673206a --- /dev/null +++ b/Models/MetaData/PhysicalStatus.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PhysicalStatus : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("สถานภาพทางกาย")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/Position.cs b/Models/MetaData/Position.cs new file mode 100644 index 0000000..f5bc03d --- /dev/null +++ b/Models/MetaData/Position.cs @@ -0,0 +1,36 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Position : EntityBase + { + [Required, MaxLength(300), Column(Order = 1), Comment("ชื่อตำแหน่งในสายงาน")] + public string Name { get; set; } = string.Empty; + + [MaxLength(300), Column(Order = 2), Comment("ด้านของสายงาน")] + public virtual PositionPathSide? PathSide { get; set; } + + [MaxLength(300), Column(Order = 3), Comment("ชื่อตำแหน่งทางการบริหาร")] + public string ExecutiveName { get; set; } = string.Empty; + + [MaxLength(300), Column(Order = 4), Comment("ด้านทางการบริหาร")] + public virtual PositionExecutiveSide? ExecutiveSide { get; set; } + + [Column(Order = 5), Comment("สายงาน")] + public virtual PositionPath? PositionPath { get; set; } + + [Column(Order = 6), Comment("ตำแหน่งประเภท")] + public virtual PositionType? PositionType { get; set; } + + [Column(Order = 7), Comment("ระดับ")] + public virtual PositionLevel? PositionLevel { get; set; } + + [Column(Order = 8),Comment("ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee")] + public string PositionCategory { get; set; } = string.Empty; + + [Column(Order = 9), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeeGroup.cs b/Models/MetaData/PositionEmployeeGroup.cs new file mode 100644 index 0000000..0f50f06 --- /dev/null +++ b/Models/MetaData/PositionEmployeeGroup.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeeGroup : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeeLevel.cs b/Models/MetaData/PositionEmployeeLevel.cs new file mode 100644 index 0000000..518bf27 --- /dev/null +++ b/Models/MetaData/PositionEmployeeLevel.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeeLevel : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeeLine.cs b/Models/MetaData/PositionEmployeeLine.cs new file mode 100644 index 0000000..df9e97e --- /dev/null +++ b/Models/MetaData/PositionEmployeeLine.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeeLine : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeePosition.cs b/Models/MetaData/PositionEmployeePosition.cs new file mode 100644 index 0000000..02a4f6a --- /dev/null +++ b/Models/MetaData/PositionEmployeePosition.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeePosition : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeePositionSide.cs b/Models/MetaData/PositionEmployeePositionSide.cs new file mode 100644 index 0000000..dc3ca79 --- /dev/null +++ b/Models/MetaData/PositionEmployeePositionSide.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeePositionSide : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionEmployeeStatus.cs b/Models/MetaData/PositionEmployeeStatus.cs new file mode 100644 index 0000000..4a6fcce --- /dev/null +++ b/Models/MetaData/PositionEmployeeStatus.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionEmployeeStatus : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionExecutive.cs b/Models/MetaData/PositionExecutive.cs new file mode 100644 index 0000000..4dd5fd7 --- /dev/null +++ b/Models/MetaData/PositionExecutive.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionExecutive : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionExecutiveSide.cs b/Models/MetaData/PositionExecutiveSide.cs new file mode 100644 index 0000000..98db7f2 --- /dev/null +++ b/Models/MetaData/PositionExecutiveSide.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionExecutiveSide : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อด้านทางการบริหาร")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionLevel.cs b/Models/MetaData/PositionLevel.cs new file mode 100644 index 0000000..54ca1a5 --- /dev/null +++ b/Models/MetaData/PositionLevel.cs @@ -0,0 +1,18 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionLevel : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับตำแหน่ง")] + public string Name { get; set; } = string.Empty; + + [Required, MaxLength(100), Column(Order = 2), Comment("ชื่อย่อระดับตำแหน่ง")] + public string ShortName { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionLine.cs b/Models/MetaData/PositionLine.cs new file mode 100644 index 0000000..c3c6e2b --- /dev/null +++ b/Models/MetaData/PositionLine.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionLine : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionPath.cs b/Models/MetaData/PositionPath.cs new file mode 100644 index 0000000..d48cc09 --- /dev/null +++ b/Models/MetaData/PositionPath.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionPath : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสายงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionPathSide.cs b/Models/MetaData/PositionPathSide.cs new file mode 100644 index 0000000..890f8a3 --- /dev/null +++ b/Models/MetaData/PositionPathSide.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionPathSide : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อด้านของสายงาน")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionStatus.cs b/Models/MetaData/PositionStatus.cs new file mode 100644 index 0000000..aed9c60 --- /dev/null +++ b/Models/MetaData/PositionStatus.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionStatus : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/PositionType.cs b/Models/MetaData/PositionType.cs new file mode 100644 index 0000000..3661f81 --- /dev/null +++ b/Models/MetaData/PositionType.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class PositionType : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อประเภทตำแหน่ง")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/Prefix.cs b/Models/MetaData/Prefix.cs new file mode 100644 index 0000000..56b2cd0 --- /dev/null +++ b/Models/MetaData/Prefix.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Prefix : EntityBase + { + [Required, MaxLength(50), Column(Order = 2), Comment("รายละเอียดคำนำหน้า")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/Province.cs b/Models/MetaData/Province.cs new file mode 100644 index 0000000..4f55dcc --- /dev/null +++ b/Models/MetaData/Province.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Province : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("จังหวัด")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual List Districts { get; set; } = new(); + } +} diff --git a/Models/MetaData/Relationship.cs b/Models/MetaData/Relationship.cs new file mode 100644 index 0000000..3b8b6a5 --- /dev/null +++ b/Models/MetaData/Relationship.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models; + +public class Relationship: EntityBase +{ + [Required, MaxLength(50), Column(Order = 1), Comment("ชื่อความสัมพันธ์")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; +} \ No newline at end of file diff --git a/Models/MetaData/Religion.cs b/Models/MetaData/Religion.cs new file mode 100644 index 0000000..65bb8af --- /dev/null +++ b/Models/MetaData/Religion.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Religion : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ศาสนา")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/Royal.cs b/Models/MetaData/Royal.cs new file mode 100644 index 0000000..faa8dfb --- /dev/null +++ b/Models/MetaData/Royal.cs @@ -0,0 +1,18 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class Royal : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อประเภทข้อมูลเหรียญตรา")] + public string Name { get; set; } = string.Empty; + + [Required, MaxLength(10), Column(Order = 2), Comment("ชื่อย่อเหรียญตรา")] + public string ShortName { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/RoyalHierarchy.cs b/Models/MetaData/RoyalHierarchy.cs new file mode 100644 index 0000000..5fa848d --- /dev/null +++ b/Models/MetaData/RoyalHierarchy.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class RoyalHierarchy : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อลำดับชั้นข้อมูลเครื่องราชฯ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/RoyalType.cs b/Models/MetaData/RoyalType.cs new file mode 100644 index 0000000..391e7cc --- /dev/null +++ b/Models/MetaData/RoyalType.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class RoyalType : EntityBase + { + [Required, MaxLength(100), Column(Order = 1), Comment("ชื่อประเภทข้อมูลเครื่องราชฯ")] + public string Name { get; set; } = string.Empty; + + [Column(Order = 2), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/Models/MetaData/SubDistrict.cs b/Models/MetaData/SubDistrict.cs new file mode 100644 index 0000000..d08c542 --- /dev/null +++ b/Models/MetaData/SubDistrict.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.X509; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.MetaData.Service.Models +{ + public class SubDistrict : EntityBase + { + [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] + public string Name { get; set; } = string.Empty; + + [Required, MaxLength(10), Column(Order = 2), Comment("รหัสไปรษณีย์")] + public string ZipCode { get; set; } = string.Empty; + + [Column(Order = 3), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + public virtual District? District { get; set; } + } +} diff --git a/Models/OrganizationEntity.cs b/Models/OrganizationEntity.cs new file mode 100644 index 0000000..723a102 --- /dev/null +++ b/Models/OrganizationEntity.cs @@ -0,0 +1,73 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models +{ + public class OrganizationEntity : EntityBase + { + + //[ForeignKey("OrganizationOrganizationId")] + //public OrganizationOrganization? OrganizationOrganization_OrganizationOrganizationId { get; set; } + + [Column(Order = 2), Comment("OrganizationOrganizationId")] + public Guid? OrganizationOrganizationId { get; set; } + + //[ForeignKey("OrganizationShortNameId")] + //public OrganizationShortName? OrganizationShortName_OrganizationShortNameId { get; set; } + + [Column(Order = 3), Comment("OrganizationShortNameId")] + public Guid? OrganizationShortNameId { get; set; } + + //[ForeignKey("OrganizationTypeId")] + //public OrganizationType? OrganizationType_OrganizationTypeId { get; set; } + + [Column(Order = 4), Comment("OrganizationTypeId")] + public Guid? OrganizationTypeId { get; set; } + + //[ForeignKey("OrganizationLevelId")] + //public OrganizationLevel? OrganizationLevel_OrganizationLevelId { get; set; } + + [Column(Order = 5), Comment("OrganizationLevelId")] + public Guid? OrganizationLevelId { get; set; } + + //[ForeignKey("OrganizationTelExternalId")] + //public OrganizationTelExternal? OrganizationTelExternal_OrganizationTelExternalId { get; set; } + + [Column(Order = 6), Comment("OrganizationTelExternalId")] + public Guid? OrganizationTelExternalId { get; set; } + + //[ForeignKey("OrganizationTelInternalId")] + //public OrganizationTelInternal? OrganizationTelInternal_OrganizationTelInternalId { get; set; } + + [Column(Order = 7), Comment("OrganizationTelInternalId")] + public Guid? OrganizationTelInternalId { get; set; } + + //[ForeignKey("OrganizationFaxId")] + //public OrganizationFax? OrganizationFax_OrganizationFaxId { get; set; } + + [Column(Order = 8), Comment("OrganizationFaxId")] + public Guid? OrganizationFaxId { get; set; } + + [ForeignKey("ParentId")] + public OrganizationEntity? Organization_ParentId { get; set; } + + [Column(Order = 9), Comment("ParentId")] + public Guid? ParentId { get; set; } + + [Column(Order = 10), Comment("OrganizationAgencyId")] + public Guid? OrganizationAgencyId { get; set; } + + [Column(Order = 11), Comment("OrganizationGovernmentAgencyId")] + public Guid? OrganizationGovernmentAgencyId { get; set; } + + [Column(Order = 12), Comment("OrganizationOrder")] + public int? OrganizationOrder { get; set; } + + [Column(Order = 13), Comment("OrganizationUserNote")] + public string? OrganizationUserNote { get; set; } + public List Organizations { get; } = new(); + + } +} diff --git a/Models/OrganizationPositionEntity.cs b/Models/OrganizationPositionEntity.cs new file mode 100644 index 0000000..be30531 --- /dev/null +++ b/Models/OrganizationPositionEntity.cs @@ -0,0 +1,31 @@ +using BMA.EHR.Report.Service.Models; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Profile.Service.Models +{ + public class OrganizationPositionEntity : EntityBase + { + [ForeignKey("PositionMasterId")] + public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; } + + [Column(Order = 2), Comment("Position Master")] + public Guid? PositionMasterId { get; set; } + + [Column(Order = 3), Comment("Is Director")] + public bool? IsDirector { get; set; } + + [Column(Order = 4), Comment("positionUserNote")] + public string? PositionUserNote { get; set; } + + [ForeignKey("OrganizationId")] + public OrganizationEntity? Organization_OrganizationId { get; set; } + + [Column(Order = 5), Comment("OrganizationId")] + public Guid? OrganizationId { get; set; } + + [Column(Order = 6), Comment("PositionNumberId")] + public Guid? PositionNumberId { get; set; } + } +} diff --git a/Models/PositionMasterEntity.cs b/Models/PositionMasterEntity.cs new file mode 100644 index 0000000..219ab6d --- /dev/null +++ b/Models/PositionMasterEntity.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models +{ + public class PositionMasterEntity : EntityBase + { + + //[ForeignKey("PositionId")] + //public Position? Position_PositionId { get; set; } + + [Column(Order = 2), Comment("PositionId")] + public Guid? PositionId { get; set; } + + //[ForeignKey("PositionPathId")] + //public PositionPath? PositionPath_PositionPathId { get; set; } + + [Column(Order = 3), Comment("PositionPathId")] + public Guid? PositionPathId { get; set; } + + //[ForeignKey("PositionTypeId")] + //public PositionType? PositionType_PositionTypeId { get; set; } + + [Column(Order = 4), Comment("PositionTypeId")] + public Guid? PositionTypeId { get; set; } + + //[ForeignKey("PositionExecutiveId")] + //public PositionExecutive? PositionExecutive_PositionExecutiveId { get; set; } + + [Column(Order = 5), Comment("PositionExecutiveId")] + public Guid? PositionExecutiveId { get; set; } + + //[ForeignKey("ExcutiveSideId")] + //public PositionExecutiveSide? PositionExecutiveSide_ExcutiveSideId { get; set; } + + [Column(Order = 6), Comment("PositionExecutiveSideId")] + public Guid? PositionExecutiveSideId { get; set; } + + //[ForeignKey("PathSideId")] + //public PositionPathSide? PositionPathSide_PathSideId { get; set; } + + [Column(Order = 7), Comment("PositionPathSideId")] + public Guid? PositionPathSideId { get; set; } + + [Column(Order = 8), Comment("PositionLineId")] + public Guid? PositionLineId { get; set; } + + //[Column(Order = 9), Comment("PositionLevelId")] + //public Guid? PositionLevelId { get; set; } + + [Column(Order = 10), Comment("PositionStatusId")] + public Guid? PositionStatusId { get; set; } + + [Column(Order = 11), Comment("PositionCondition")] + public string? PositionCondition { get; set; } + + [Column(Order = 12), Comment("PositionStatus")] + public Guid? PositionStatus { get; set; } + + [Column(Order = 13), Comment("PositionMasterUserNote")] + public string? PositionMasterUserNote { get; set; } + + [Column(Order = 14), Comment("IsDirector")] + public bool? IsDirector { get; set; } + + //public List AvailablePositionLevels { get; } = new(); + + + } +} diff --git a/Models/PositionNumberEntity.cs b/Models/PositionNumberEntity.cs new file mode 100644 index 0000000..6382108 --- /dev/null +++ b/Models/PositionNumberEntity.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models +{ + public class PositionNumberEntity : EntityBase + { + + [MaxLength(300), Column(Order = 2), Comment("ชื่อ")] + public string? Name { get; set; } + + //[ForeignKey("OrganizationShortNameId")] + //public OrganizationShortName? OrganizationShortName_OrganizationShortNameId { get; set; } + + [Column(Order = 3), Comment("Shortname")] + public Guid? OrganizationShortNameId { get; set; } + } +} diff --git a/Models/ProfilePosition.cs b/Models/ProfilePosition.cs new file mode 100644 index 0000000..b77a6e1 --- /dev/null +++ b/Models/ProfilePosition.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Report.Service.Models; + +namespace BMA.EHR.Profile.Service.Models +{ + /// + /// Link Profile กับ OrganizationPosition + /// + public class ProfilePosition : EntityBase + { + public OrganizationPositionEntity OrganizationPosition { get; set; } + + public Guid OrganizationPositionId { get; set; } + + public Guid? ProfileId { get; set; } + } +} diff --git a/Program.cs b/Program.cs index 42c66c6..a205bfa 100644 --- a/Program.cs +++ b/Program.cs @@ -16,6 +16,7 @@ using MongoDB.Bson.Serialization; using BMA.EHR.Report.Service; using Microsoft.AspNetCore.Mvc.ApiExplorer; using BMA.EHR.Recruit.Service.Services; +using BMA.EHR.Profile.Service.Services; var builder = WebApplication.CreateBuilder(args); var issuer = builder.Configuration["Jwt:Issuer"]; @@ -27,18 +28,18 @@ builder.Services.AddHttpContextAccessor(); builder.Services.AddApiVersioning(opt => { - opt.DefaultApiVersion = new ApiVersion(1, 0); - opt.AssumeDefaultVersionWhenUnspecified = true; - opt.ReportApiVersions = true; - opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(), - new HeaderApiVersionReader("x-api-version"), - new MediaTypeApiVersionReader("x-api-version")); + opt.DefaultApiVersion = new ApiVersion(1, 0); + opt.AssumeDefaultVersionWhenUnspecified = true; + opt.ReportApiVersions = true; + opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(), + new HeaderApiVersionReader("x-api-version"), + new MediaTypeApiVersionReader("x-api-version")); }); builder.Services.AddVersionedApiExplorer(setup => { - setup.GroupNameFormat = "'v'VVV"; - setup.SubstituteApiVersionInUrl = true; + setup.GroupNameFormat = "'v'VVV"; + setup.SubstituteApiVersionInUrl = true; }); builder.Services.AddEndpointsApiExplorer(); @@ -46,17 +47,17 @@ builder.Services.AddEndpointsApiExplorer(); // Authorization builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt => { - opt.RequireHttpsMetadata = false; //false for dev - opt.Authority = issuer; - opt.TokenValidationParameters = new() - { - ValidateIssuer = true, - ValidateAudience = false, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - ValidIssuer = issuer, - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key)) - }; + opt.RequireHttpsMetadata = false; //false for dev + opt.Authority = issuer; + opt.TokenValidationParameters = new() + { + ValidateIssuer = true, + ValidateAudience = false, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + ValidIssuer = issuer, + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key)) + }; }); builder.Services.AddAuthorization(); @@ -70,26 +71,36 @@ BsonSerializer.RegisterSerializer(new DateTimeSerializer(BsonType.String)); // Register DbContext var recruitConnection = builder.Configuration.GetConnectionString("RecruitConnection"); builder.Services.AddDbContext(options => - options.UseMySql(recruitConnection, ServerVersion.AutoDetect(recruitConnection), o => o.MigrationsHistoryTable("__ReportMigrationsHistory")), ServiceLifetime.Transient); + options.UseMySql(recruitConnection, ServerVersion.AutoDetect(recruitConnection), o => o.MigrationsHistoryTable("__ReportMigrationsHistory")), ServiceLifetime.Transient); + +var ehrConnection = builder.Configuration.GetConnectionString("EHRConnection"); +builder.Services.AddDbContext(options => + options.UseMySql(ehrConnection, ServerVersion.AutoDetect(ehrConnection), o => o.MigrationsHistoryTable("__ReportMigrationsHistory")), ServiceLifetime.Transient); + +var examConnection = builder.Configuration.GetConnectionString("ExamConnection"); +builder.Services.AddDbContext(options => + options.UseMySql(examConnection, ServerVersion.AutoDetect(examConnection), o => o.MigrationsHistoryTable("__ReportMigrationsHistory")), ServiceLifetime.Transient); // Add config CORS builder.Services.AddCors(options => options.AddDefaultPolicy(builder => { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .SetIsOriginAllowedToAllowWildcardSubdomains(); + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .SetIsOriginAllowedToAllowWildcardSubdomains(); })); // Register Service builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); // Add services to the container. builder.Services.AddControllers(options => { - options.SuppressAsyncSuffixInActionNames = false; + options.SuppressAsyncSuffixInActionNames = false; }) .AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); @@ -97,21 +108,22 @@ builder.Services.AddSwaggerGen(); builder.Services.ConfigureOptions(); builder.Services.AddHealthChecks(); + var app = builder.Build(); var apiVersionDescriptionProvider = app.Services.GetRequiredService(); if (app.Environment.IsDevelopment()) { - app.UseSwagger(); - app.UseSwaggerUI(options => - { - foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions) - { - options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", - description.GroupName.ToUpperInvariant()); - } - }); + app.UseSwagger(); + app.UseSwaggerUI(options => + { + foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions) + { + options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", + description.GroupName.ToUpperInvariant()); + } + }); } app.MapHealthChecks("/health"); @@ -132,32 +144,32 @@ await db.Database.MigrateAsync(); app.Run(); void ConfigureLogs() { - var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - var configuration = new ConfigurationBuilder() - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile( - $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", - optional: true) - .Build(); + var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + var configuration = new ConfigurationBuilder() + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile( + $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", + optional: true) + .Build(); - Log.Logger = new LoggerConfiguration() - .Enrich.FromLogContext() - // .WriteTo.Debug() - .MinimumLevel.Error() - .WriteTo.Console() - .Enrich.WithExceptionDetails() - // .Enrich.WithEnvironmentUserName() - .WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? "")) - .Enrich.WithProperty("Environment", environment) - .ReadFrom.Configuration(configuration) - .CreateLogger(); + Log.Logger = new LoggerConfiguration() + .Enrich.FromLogContext() + // .WriteTo.Debug() + .MinimumLevel.Error() + .WriteTo.Console() + .Enrich.WithExceptionDetails() + // .Enrich.WithEnvironmentUserName() + .WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? "")) + .Enrich.WithProperty("Environment", environment) + .ReadFrom.Configuration(configuration) + .CreateLogger(); } ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment) { - return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? "")) - { - AutoRegisterTemplate = true, - IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}" - }; + return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? "")) + { + AutoRegisterTemplate = true, + IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}" + }; } diff --git a/Report/Organization/rptAccount1.trdp b/Report/Organization/rptAccount1.trdp new file mode 100644 index 0000000..a18371c Binary files /dev/null and b/Report/Organization/rptAccount1.trdp differ diff --git a/Report/Profile/rptKK1Summary.trbp b/Report/Profile/rptKK1Summary.trbp new file mode 100644 index 0000000..d4350b5 Binary files /dev/null and b/Report/Profile/rptKK1Summary.trbp differ diff --git a/Report/Profile/rptKK1_Page1.trdp b/Report/Profile/rptKK1_Page1.trdp new file mode 100644 index 0000000..28ffe18 Binary files /dev/null and b/Report/Profile/rptKK1_Page1.trdp differ diff --git a/Report/Profile/rptKK1_Page2.trdp b/Report/Profile/rptKK1_Page2.trdp new file mode 100644 index 0000000..c27bee0 Binary files /dev/null and b/Report/Profile/rptKK1_Page2.trdp differ diff --git a/Report/Profile/rptShortKp7.trdp b/Report/Profile/rptShortKp7.trdp new file mode 100644 index 0000000..78dce00 Binary files /dev/null and b/Report/Profile/rptShortKp7.trdp differ diff --git a/Responses/Document/FileDownloadResponse.cs b/Responses/Document/FileDownloadResponse.cs new file mode 100644 index 0000000..2b58c89 --- /dev/null +++ b/Responses/Document/FileDownloadResponse.cs @@ -0,0 +1,11 @@ +namespace BMA.EHR.Recruit.Service.Responses.Document +{ + public class FileDownloadResponse + { + public string FileName { get; set; } = string.Empty; + + public string FileType { get; set; } = string.Empty; + + public byte[] FileContent { get; set; } + } +} diff --git a/Services/MinIOService.cs b/Services/MinIOService.cs new file mode 100644 index 0000000..2c70db0 --- /dev/null +++ b/Services/MinIOService.cs @@ -0,0 +1,222 @@ +using Amazon.S3; +using Amazon.S3.Model; +using BMA.EHR.Recruit.Service.Core; +using BMA.EHR.Recruit.Service.Models.Documents; +using BMA.EHR.Recruit.Service.Responses.Document; +using BMA.EHR.Report.Service.Data; +using Microsoft.EntityFrameworkCore; +using System.Drawing; +using System.Net.Http.Headers; + +namespace BMA.EHR.Recruit.Service.Services +{ + public class MinIOService + { + #region " Fields " + + private readonly EHRDbContext _context; + private readonly IConfiguration _configuration; + private readonly IWebHostEnvironment _webHostEnvironment; + private readonly AmazonS3Client _s3Client; + private string _bucketName = string.Empty; + + #endregion + + #region " Constructors " + + public MinIOService(EHRDbContext context, + IConfiguration configuration, + IWebHostEnvironment webHostEnvironment) + { + _context = context; + _configuration = configuration; + _webHostEnvironment = webHostEnvironment; + + var config = new AmazonS3Config + { + ServiceURL = _configuration["MinIO:Endpoint"], + ForcePathStyle = true + }; + + _s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config); + this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit"; + } + + #endregion + + #region " Methods " + + public async Task UploadFileAsync(IFormFile file, string newFileName = "") + { + var fileName = ""; + var fileExt = Path.GetExtension(file.FileName); + if (newFileName != "") + fileName = $"{newFileName}"; + else + fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); + + + var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp"); + if (!Directory.Exists(tmpDir)) + Directory.CreateDirectory(tmpDir); + + var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}"); + + try + { + using (var ms = new MemoryStream()) + { + var id = Guid.NewGuid(); + file.CopyTo(ms); + var fileBytes = ms.ToArray(); + System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes); + + var request = new PutObjectRequest + { + BucketName = _bucketName, + Key = id.ToString("D"), + InputStream = filestream, + ContentType = file.ContentType, + CannedACL = S3CannedACL.PublicRead + }; + + await _s3Client.PutObjectAsync(request); + + // create document object + var doc = new Document() + { + FileName = fileName, + FileType = file.ContentType, + FileSize = Convert.ToInt32(file.Length), + ObjectRefId = id, + CreatedDate = DateTime.Now + }; + + await _context.Documents.AddAsync(doc); + await _context.SaveChangesAsync(); + + return doc; + } + } + catch + { + throw; + } + finally + { + File.Delete(tmpFile); + } + } + + public async Task DownloadFileAsync(Guid fileId) + { + try + { + var doc = await _context.Documents.AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + + using (var memoryStream = new MemoryStream()) + { + GetObjectRequest request = new GetObjectRequest + { + BucketName = _bucketName, + Key = doc.ObjectRefId.ToString("D") + }; + + using (GetObjectResponse response = await _s3Client.GetObjectAsync(request)) + { + using (Stream responseStream = response.ResponseStream) + { + responseStream.CopyTo(memoryStream); + } + } + + var fileContent = memoryStream.ToArray(); + + return new FileDownloadResponse + { + FileName = doc.FileName, + FileType = doc.FileType, + FileContent = fileContent + }; + }; + } + catch + { + throw; + } + } + + public async Task DeleteFileAsync(Guid fileId) + { + try + { + var doc = await _context.Documents.AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + else + { + DeleteObjectRequest request = new DeleteObjectRequest + { + BucketName = _bucketName, + Key = doc?.ObjectRefId.ToString("D") + }; + + // delete from minio + await _s3Client.DeleteObjectAsync(request); + + + _context.Documents.Remove(doc); + await _context.SaveChangesAsync(); + } + } + catch + { + throw; + } + } + + public async Task GetFilePath(Guid fileId) + { + + var doc = await _context.Documents.AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + + //var config = new AmazonS3Config + //{ + // ServiceURL = Configuration.GetValue("MinIO:Endpoint"), + // ForcePathStyle = true + //}; + + DateTime expires = DateTime.UtcNow.AddHours(6); + GetPreSignedUrlRequest request = new GetPreSignedUrlRequest + { + BucketName = _bucketName, + Key = doc?.ObjectRefId.ToString("D"), + Expires = expires, + }; + string path = _s3Client.GetPreSignedURL(request); + + return path; + } + + public Image ByteArrayToImage(byte[] bytesArr) + { + using (MemoryStream memstr = new MemoryStream(bytesArr)) + { + Image img = Image.FromStream(memstr); + return img; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Services/ProfileService.cs b/Services/ProfileService.cs new file mode 100644 index 0000000..cbbbce1 --- /dev/null +++ b/Services/ProfileService.cs @@ -0,0 +1,485 @@ +using BMA.EHR.Profile.Service.Models; +using BMA.EHR.Report.Service.Data; +using Microsoft.EntityFrameworkCore; +using System.Text.RegularExpressions; + +namespace BMA.EHR.Profile.Service.Services +{ + public class OrganizationItem + { + public Guid Id { get; set; } + + public string Name { get; set; } = string.Empty; + + public int Order { get; set; } = 0; + } + + public class ProfileService + { + private readonly EHRDbContext _context; + + public ProfileService(EHRDbContext context) + { + _context = context; + } + + public string ConvertRelationshipToEng(string thai_text) + { + switch (thai_text) + { + case "หย่า": + case "หย่าร้าง": return "divorced"; + case "โสด": return "single"; + case "สมรส": return "married"; + case "แยกกันอยู่": return "seperated"; + default: return "na"; + } + } + + public string ConvertGenderToEng(string thai_text) + { + switch (thai_text) + { + case "ชาย": return "male"; + case "หญิง": return "female"; + default: return "na"; + } + } + + #region " Organizations " + + public string FindOCFullPath(Guid id, bool showRoot = false) + { + try + { + var ocList = GetOcNameFullPath(id, showRoot); + var ret = String.Empty; + foreach (var oc in ocList) + { + ret = oc + " " + ret; + } + + ret = ret.Substring(0, ret.Length - 1); + + return ret; + } + catch + { + throw; + } + } + + public string FindOCFullPathWithNewLine(Guid id, bool showRoot = false, string suppress = "") + { + try + { + var ocList = GetOcNameFullPath(id, showRoot); + var ret = String.Empty; + foreach (var oc in ocList) + { + if ((oc == suppress) && ocList.Count > 1) continue; + ret = $"{oc}\r\n{ret}"; + } + + ret = ret.Substring(0, ret.Length - 2); + + return ret; + } + catch + { + throw; + } + } + + public string GetOrganizationNameFullPathNewLine(Guid id, bool showRoot = false, bool descending = false) + { + try + { + var ocList = GetOCWithFullPath(id, showRoot); + if (descending) + ocList = ocList.OrderBy(x => x.Order).ToList(); + + var ret = String.Empty; + foreach (var oc in ocList) + { + ret = $"{oc.Name}\r\n{ret}"; + } + + ret = ret.Substring(0, ret.Length - 1); + + return ret; + } + catch + { + throw; + } + } + + public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false) + { + try + { + var ocList = GetOCWithFullPath(id, showRoot); + if (descending) + ocList = ocList.OrderBy(x => x.Order).ToList(); + + var ret = String.Empty; + foreach (var oc in ocList) + { + ret = oc.Name + " " + ret; + } + + ret = ret.Substring(0, ret.Length - 1); + + return ret; + } + catch + { + throw; + } + } + + public List GetOCWithFullPath(Guid id, bool showRoot = false) + { + try + { + var ocList = new List(); + + var organizations = _context.Organizations.ToList(); + var organizationOrganizations = _context.OrganizationOrganizations.ToList(); + + + var oc = (from o in organizations + join oc_name in organizationOrganizations on o.OrganizationOrganizationId equals oc_name.Id + select new + { + Id = o.Id, + Name = oc_name.Name, + //o.IsActive, + o.ParentId, + IsRoot = o.ParentId == null + }).FirstOrDefault(x => x.Id == id); + + + //ocList.Add(new OrganizationItem { Id = oc.Id, Name = oc.Name }); + + if (!showRoot) + { + if (!oc.IsRoot) + ocList.Add(new OrganizationItem { Id = oc.Id, Name = oc.Name }); + } + else + ocList.Add(new OrganizationItem { Id = oc.Id, Name = oc.Name }); + + if (oc.ParentId != null) + { + ocList.AddRange(GetOCWithFullPath(oc.ParentId.Value, showRoot)); + } + + return ocList; + } + catch + { + throw; + } + } + + public List GetOcNameFullPath(Guid id, bool showRoot = false) + { + try + { + var ocList = new List(); + + var organizations = _context.Organizations.ToList(); + var organizationOrganizations = _context.OrganizationOrganizations.ToList(); + + var oc = (from o in organizations + join oc_name in organizationOrganizations on o.OrganizationOrganizationId equals oc_name.Id + select new + { + Id = o.Id, + Name = oc_name.Name, + //o.IsActive, + o.ParentId, + IsRoot = o.ParentId == null + }).FirstOrDefault(x => x.Id == id); + + if (!showRoot) + { + if (!oc.IsRoot) + ocList.Add(oc.Name); + } + else + ocList.Add(oc.Name); + + //ocList.Add(oc.Name); + + if (oc.ParentId != null) + { + ocList.AddRange(GetOcNameFullPath(oc.ParentId.Value, showRoot)); + } + + return ocList; + } + catch + { + throw; + } + } + + public List GetAllIdByRoot(Guid id) + { + try + { + var ret = new List(); + + var oc = _context.Organizations.FirstOrDefault(x => x.Id == id); + if (oc != null) + ret.Add(oc.Id); + + var child = _context.Organizations.AsQueryable().Where(x => x.ParentId == id).ToList(); + if (child.Any()) + { + foreach (var item in child) + { + ret.AddRange(GetAllIdByRoot(item.Id)); + } + } + + return ret; + } + catch + { + throw; + } + } + + public List GetOCWithChildrenByRoot(Guid id) + { + try + { + var ret = new List(); + + var organizations = _context.Organizations.ToList(); + var organizationOrganizations = _context.OrganizationOrganizations.ToList(); + + // var oc = _context.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive); + var oc = (from o in organizations + join oc_name in organizationOrganizations on o.OrganizationOrganizationId equals oc_name.Id + select new + { + Id = o.Id, + Name = oc_name.Name, + //o.IsActive, + o.ParentId, + IsRoot = o.ParentId == null + }).FirstOrDefault(x => x.Id == id); + + var child = (from o in organizations + join oc_name in organizationOrganizations on o.OrganizationOrganizationId equals oc_name.Id + select new + { + Id = o.Id, + Name = oc_name.Name, + //o.IsActive, + o.ParentId, + IsRoot = o.ParentId == null + }) + .Where(x => x.ParentId == id) + .ToList(); + + // var child = _context.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList(); + + + if (child.Any()) + { + var node = new + { + id = oc.Id, + label = oc.Name, + children = new List() + }; + foreach (var item in child) + { + node.children.AddRange(GetOCWithChildrenByRoot(item.Id)); + } + + ret.Add(node); + } + else + { + var node = new + { + id = oc.Id, + label = oc.Name, + }; + ret.Add(node); + } + + return ret; + } + catch + { + throw; + } + } + + public List GetOcByRoot(Guid id) + { + try + { + var ret = new List(); + var oc = _context.Organizations.FirstOrDefault(x => x.Id == id); + ret.Add(oc); + var child = _context.Organizations.AsQueryable().Where(x => x.ParentId == id).ToList(); + if (child.Any()) + { + foreach (var item in child) + { + //ret.Add(item); + var c = _context.Organizations.AsQueryable().Where(x => x.ParentId == item.Id).ToList(); + if (c.Any()) + ret.AddRange(GetOcByRoot(item.Id)); + else + ret.Add(item); + } + } + return ret; + } + catch + { + throw; + } + } + + public string GetPositionLevel(Guid id) + { + try + { + var level = (from alv in _context.AvailablePositionLevels + join lv in _context.PositionLevels on alv.PositionLevelId equals lv.Id + where alv.PositionMasterId == id + select lv.Name).ToList(); + + + var count = 0; + var ret = String.Empty; + foreach (var lv in level) + { + if (count != 0) + ret = $"{ret}หรือ\r\n{lv}"; + else + ret += lv; + + count++; + } + + return ret; + } + catch + { + throw; + } + } + + #endregion + + #region " Profiles " + + public async Task GetProfileById(Guid profileId) + { + try + { + var profile = await _context.Profiles.AsQueryable() + // .Include(p => p.Organization) + .Include(p => p.Position) + // .ThenInclude(p => p.PositionPath) + // .Include(p => p.PositionNumber) + + .Include(p => p.Certificates) + .Include(p => p.Disciplines) + .Include(p => p.Educations) + .Include(p => p.Honors) + .Include(p => p.Insignias) + .Include(p => p.Trainings) + + // .Include(p => p.Salaries) + // .ThenInclude(s => s.SalaryPosition) + // .Include(s => s.Salaries) + // .ThenInclude(s => s.SalaryOrganization) + // .Include(p => p.Salaries) + // .ThenInclude(s => s.SalaryPositionNumber) + // .Include(p => p.Salaries) + // .ThenInclude(s => s.SalaryPositionLevel) + // .Include(p => p.Salaries) + // .ThenInclude(s => s.SalaryPositionType) + .Include(x => x.Avatar) + + // .Include(x => x.PositionType) + // .Include(x => x.PositionLevel) + .Include(x => x.Childrens) + .FirstOrDefaultAsync(p => p.Id == profileId); + + return profile; + } + catch + { + throw; + } + } + + public bool ValidateProfileById(string profileId) + { + var idcardno = profileId; + + if (string.IsNullOrEmpty(idcardno)) + { + return false; + } + + if (idcardno.Length != 13) + { + return false; + } + + bool isDigit = Regex.IsMatch(idcardno, @"^[0-9]*$"); + if (!isDigit) + { + return false; + } + + + int sum = 0; + for (int i = 0; i < 12; i++) + { + sum += Convert.ToInt32(idcardno.Substring(i, 1)) * (13 - i); + } + + int checksum = (11 - (sum % 11)) % 10; + if (checksum != Convert.ToInt32(idcardno.Substring(12))) + { + return false; + } + + return true; + + } + + public async Task CheckExistCitizenId(string profileId) + { + try + { + var profile = await _context.Profiles.AsQueryable().Where(p => p.CitizenId == profileId).FirstOrDefaultAsync(); + + return profile != null; + } + catch + { + throw; + } + } + + + #endregion + } +} diff --git a/appsettings.Development.json b/appsettings.Development.json index a54f5fa..686aa8e 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -14,7 +14,9 @@ "AllowedHosts": "*", "ConnectionStrings": { "MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017", - "RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + "RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "EHRConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "ExamConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" }, "Jwt": { "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", diff --git a/appsettings.json b/appsettings.json index a54f5fa..84a786b 100644 --- a/appsettings.json +++ b/appsettings.json @@ -14,7 +14,10 @@ "AllowedHosts": "*", "ConnectionStrings": { "MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017", - "RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + "RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "EHRConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "ExamConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + }, "Jwt": { "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",